* feat(DICOM Upload) OHIF #3297 - DicomWebDataSource.store.dicom now accepts an ArrayBuffer of data sets to store - DicomWebDataSource.store.dicom now also accepts optional callbacks to track upload and an AbortSignal object to cancel upload - Added DicomFileUploader class that performs and tracks the upload of a DICOM file - Added various UI pieces for the upload: DicomUpload, DicomUploadProgress, DicomUploadProgressItem - ProgressLoadingBar was extracted from LoadingIndicatorProgress so it can be reused - Modal dialogues can now optionally prevent an outside click from closing the Modal * Passing an XMLHttpRequest to the dataSource.store.dicom method instead of callbacks and AbortSignal. Cleanup of various UI pieces to minimize code and increase readability. * Made the DicomUpload component a customization module exported by the cornerstone extension. * Exposed a copy of the data source configuration via the IWebApiDataSource interface. Added dicomUploadEnabled to a data source's configuration. * Code clean up. * Upgraded the dicomweb-client version to one that provides the ability to pass a custom HTTP request. DICOM upload uses that custom HTTP request to track progress and cancel requests. * Distinguished between failed and cancelled uploads. * Allow no selection in the upload dialogue. Fixed the styling of various progress information so that everything aligns. * Switched from cornerstone wado image loader to cornerstone dicom image loader for DICOM upload. * Added special cancelled icon to differentiate from failed. * Added a bit of spacing between the upload progress bar and percentage. * Fixed minor issue with upload rejection. * Performance improvement for cancel all uploads: - use React memo for each upload item progress (row) - do not await each request of a cancel all * Fixed various padding/spacing for the DICOM upload drop zone component. Changed the border dashing for the DICOM upload drop zone to be a background image gradient. Added hover and active effects to the 'Cancel All Uploads' text.
84 lines
2.1 KiB
JavaScript
84 lines
2.1 KiB
JavaScript
import { DicomMetadataStore } from '../services/DicomMetadataStore';
|
|
// TODO: Use above to inject so dependent datasources don't need to import or
|
|
// depend on @ohif/core?
|
|
|
|
/**
|
|
* Factory function that creates a new "Web API" data source.
|
|
* A "Web API" data source is any source that fetches data over
|
|
* HTTP. This function serves as an "adapter" to wrap those calls
|
|
* so that all "Web API" data sources have the same interface and can
|
|
* be used interchangeably.
|
|
*
|
|
* It's worth noting that a single implementation of this interface
|
|
* can define different underlying sources for "read" and "write" operations.
|
|
*/
|
|
function create({
|
|
query,
|
|
retrieve,
|
|
store,
|
|
reject,
|
|
initialize,
|
|
deleteStudyMetadataPromise,
|
|
getImageIdsForDisplaySet,
|
|
getImageIdsForInstance,
|
|
getConfig,
|
|
}) {
|
|
const defaultQuery = {
|
|
studies: {
|
|
/**
|
|
* @param {string} params.patientName
|
|
* @param {string} params.mrn
|
|
* @param {object} params.studyDate
|
|
* @param {string} params.description
|
|
* @param {string} params.modality
|
|
* @param {string} params.accession
|
|
* @param {string} params.sortBy
|
|
* @param {string} params.sortDirection -
|
|
* @param {number} params.page
|
|
* @param {number} params.resultsPerPage
|
|
*/
|
|
mapParams: params => params,
|
|
requestResults: () => {},
|
|
processResults: results => results,
|
|
},
|
|
series: {},
|
|
instances: {},
|
|
};
|
|
|
|
const defaultRetrieve = {
|
|
series: {},
|
|
};
|
|
|
|
const defaultStore = {
|
|
dicom: async naturalizedDataset => {
|
|
throw new Error(
|
|
'store.dicom(naturalizedDicom, StudyInstanceUID) not implemented for dataSource.'
|
|
);
|
|
},
|
|
};
|
|
|
|
const defaultReject = {};
|
|
|
|
const defaultGetConfig = () => {
|
|
return { dicomUploadEnabled: false };
|
|
};
|
|
|
|
return {
|
|
query: query || defaultQuery,
|
|
retrieve: retrieve || defaultRetrieve,
|
|
reject: reject || defaultReject,
|
|
store: store || defaultStore,
|
|
initialize,
|
|
deleteStudyMetadataPromise,
|
|
getImageIdsForDisplaySet,
|
|
getImageIdsForInstance,
|
|
getConfig: getConfig || defaultGetConfig,
|
|
};
|
|
}
|
|
|
|
const IWebApiDataSource = {
|
|
create,
|
|
};
|
|
|
|
export default IWebApiDataSource;
|