@@ -1707,6 +1707,25 @@ class DICOMwebClient {
1707
1707
) ;
1708
1708
}
1709
1709
1710
+ /**
1711
+ * Generate an absolute URI from a relative URI.
1712
+ * If the URI contains : then it is already absolute, return it.
1713
+ * If the URI starts with /, then just add it after the wadoURL
1714
+ * Otherwise, assume the URL is relative to the wadoURL, and add studies/STUDYUID to it.
1715
+ * @param {string } studyUid to use in the full URL
1716
+ * @param {string } uri to convert to full URL
1717
+ * @returns a URL to the requested resource.
1718
+ */
1719
+ _handleRelativeURI ( studyUid , uri ) {
1720
+ if ( ! uri || uri . indexOf ( ':' ) !== - 1 ) {
1721
+ return uri ;
1722
+ }
1723
+ if ( uri [ 0 ] === '/' ) {
1724
+ return this . wadoURL + uri ;
1725
+ }
1726
+ return `${ this . wadoURL } /studies/${ studyUid } /${ uri } ` ;
1727
+ }
1728
+
1710
1729
/**
1711
1730
* Retrieves and parses BulkData from a BulkDataURI location.
1712
1731
* Decodes the multipart encoded data and returns the resulting data
@@ -1715,15 +1734,17 @@ class DICOMwebClient {
1715
1734
* See http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_6.5.5.html
1716
1735
*
1717
1736
* @param {Object } options
1718
- * @param {String } BulkDataURI - URI for retrieval of bulkdata
1737
+ * @param {string } options. BulkDataURI to retrieve
1719
1738
* @returns {Promise<Array> } Bulkdata parts
1720
1739
*/
1721
1740
retrieveBulkData ( options ) {
1722
1741
if ( ! ( 'BulkDataURI' in options ) ) {
1723
1742
throw new Error ( 'BulkDataURI is required.' ) ;
1724
1743
}
1744
+ const { StudyInstanceUID, BulkDataURI } = options ;
1725
1745
1726
- const url = options . BulkDataURI ;
1746
+ // Allow relative URI's, assume it is relative to the studyUID directory
1747
+ const url = this . _handleRelativeURI ( StudyInstanceUID , BulkDataURI ) ;
1727
1748
const { mediaTypes, byteRange } = options ;
1728
1749
const { withCredentials = false } = options ;
1729
1750
const { progressCallback = false } = options ;
0 commit comments