2022-07-27 16:39:04 +00:00
|
|
|
import RetrieveMetadataLoaderSync from './retrieveMetadataLoaderSync';
|
2020-05-11 18:56:46 +02:00
|
|
|
import RetrieveMetadataLoaderAsync from './retrieveMetadataLoaderAsync';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Retrieve Study metadata from a DICOM server. If the server is configured to use lazy load, only the first series
|
|
|
|
|
* will be loaded and the property "studyLoader" will be set to let consumer load remaining series as needed.
|
|
|
|
|
*
|
2023-11-15 11:37:09 -03:00
|
|
|
* @param {*} dicomWebClient The DICOMWebClient instance to be used for series load
|
|
|
|
|
* @param {*} StudyInstanceUID The UID of the Study to be retrieved
|
|
|
|
|
* @param {*} enableStudyLazyLoad Whether the study metadata should be loaded asynchronously
|
|
|
|
|
* @param {object} filters Object containing filters to be applied on retrieve metadata process
|
|
|
|
|
* @param {string} [filters.seriesInstanceUID] Series instance uid to filter results against
|
|
|
|
|
* @param {array} [filters.SeriesInstanceUIDs] Series instance uids to filter results against
|
|
|
|
|
* @param {function} [sortCriteria] Sort criteria function
|
|
|
|
|
* @param {function} [sortFunction] Sort function
|
|
|
|
|
*
|
|
|
|
|
* @returns {Promise} A promises that resolves the study descriptor object
|
2020-05-11 18:56:46 +02:00
|
|
|
*/
|
|
|
|
|
async function RetrieveMetadata(
|
|
|
|
|
dicomWebClient,
|
2023-11-15 11:37:09 -03:00
|
|
|
StudyInstanceUID,
|
2020-05-11 18:56:46 +02:00
|
|
|
enableStudyLazyLoad,
|
2021-05-28 14:32:48 -04:00
|
|
|
filters = {},
|
|
|
|
|
sortCriteria,
|
|
|
|
|
sortFunction
|
2020-05-11 18:56:46 +02:00
|
|
|
) {
|
2022-07-27 16:39:04 +00:00
|
|
|
const RetrieveMetadataLoader =
|
2023-09-01 16:19:39 -04:00
|
|
|
enableStudyLazyLoad !== false ? RetrieveMetadataLoaderAsync : RetrieveMetadataLoaderSync;
|
2020-05-11 18:56:46 +02:00
|
|
|
|
|
|
|
|
const retrieveMetadataLoader = new RetrieveMetadataLoader(
|
|
|
|
|
dicomWebClient,
|
2023-11-15 11:37:09 -03:00
|
|
|
StudyInstanceUID,
|
2021-05-28 14:32:48 -04:00
|
|
|
filters,
|
|
|
|
|
sortCriteria,
|
|
|
|
|
sortFunction
|
2020-05-11 18:56:46 +02:00
|
|
|
);
|
2022-07-27 16:39:04 +00:00
|
|
|
const data = await retrieveMetadataLoader.execLoad();
|
2020-05-11 18:56:46 +02:00
|
|
|
|
2022-07-27 16:39:04 +00:00
|
|
|
return data;
|
2020-05-11 18:56:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default RetrieveMetadata;
|