feat(microscopy): add dicom microscopy extension and mode (#3247)
* skeleton for dicom-microscopy extension * skeleton for microscopy mode * [feat] ported @radicalimaging/microscopy-dicom to OHIF's default extension * [feat] ported microscopy mode from private repo * added new definitions to the package.json * webpack configuration update for microscopy extension * register new icons for microscopy tools * fixes to the microscopy extension and mode * trivial error fix - typescript type import error * link microscopy extension with default OHIF app plugin config * demo config fix * fix logs * remove unsed imports * [fix] loading of microscopy * [fix] webworker script loading, normalizing denaturalized dataset * found the latest version of dicom-microscopy-viewer that works with current OHIF extension : 0.35.2 * hide thumbnail pane by default, as we have issues with * comments * remove unused code * [feat] microscopy - annotation selection * [feat] microscopy - edit annotation label * wip * [bugfix] dicom-microscopy tool * [bugfix] dicom microscopy annotations * [fix] mixed-content blocking caused by BulkDataURI * [fix] microscopy measurements panel - center button * [fix] microscopy measurements panel - styling * [fix] microscopy - controls * fix local loading of microscopy * fix local loading of dicom microscopy * fix typo - indexof to indexOf * [fix] remove unused icons * remove commented out lines from webpack configuration * platform/viewer/public/config/default.js - revert accidental changes * [refactor] redirecting to microscopy mode on Local mode * attribution to DMV and SLIM viewer * [fix] code review feedbacks * fix thumbnails * [fix] microscopy - fix old publisher.publish() to PubSubService._broadcastEvent() * [fix] interactions, webpack config, roi selection * [feat] microscopy - remove select tool from UI * microscopy author * [fix] saving and loading SR * [bugfix] - missing publish() function in MicroscopyService, replace with _broadcastEvent * remove author section from readme * refactor SR saving feature * fix webpack config after merge * [bugfix] repeated import * fix e2e * webpack configuration * hide "Create report" button for microscopy
This commit is contained in:
76 files changed
+5868
-31
No files matched your search
@@ -0,0 +1,96 @@
|
||||
import { api } from 'dicomweb-client';
|
||||
import { errorHandler, DicomMetadataStore } from '@ohif/core';
|
||||
|
||||
/**
|
||||
* create a DICOMwebClient object to be used by Dicom Microscopy Viewer
|
||||
*
|
||||
* Referenced the code from `/extensions/default/src/DicomWebDataSource/index.js`
|
||||
*
|
||||
* @param param0
|
||||
* @returns
|
||||
*/
|
||||
export default function getDicomWebClient({
|
||||
extensionManager,
|
||||
servicesManager,
|
||||
}) {
|
||||
const dataSourceConfig = window.config.dataSources.find(
|
||||
ds => ds.sourceName === extensionManager.activeDataSource
|
||||
);
|
||||
const { userAuthenticationService } = servicesManager.services;
|
||||
|
||||
const { wadoRoot, staticWado, singlepart } = dataSourceConfig.configuration;
|
||||
|
||||
const wadoConfig = {
|
||||
url: wadoRoot || '/dicomlocal',
|
||||
staticWado,
|
||||
singlepart,
|
||||
headers: userAuthenticationService.getAuthorizationHeader(),
|
||||
errorInterceptor: errorHandler.getHTTPErrorHandler(),
|
||||
};
|
||||
|
||||
const client = new api.DICOMwebClient(wadoConfig);
|
||||
client.wadoURL = wadoConfig.url;
|
||||
|
||||
if (extensionManager.activeDataSource === 'dicomlocal') {
|
||||
/**
|
||||
* For local data source, override the retrieveInstanceFrames() method of the
|
||||
* dicomweb-client to retrieve image data from memory cached metadata.
|
||||
* Other methods of the client doesn't matter, as we are feeding the DMV
|
||||
* with the series metadata already.
|
||||
*
|
||||
* @param {Object} options
|
||||
* @param {String} options.studyInstanceUID - Study Instance UID
|
||||
* @param {String} options.seriesInstanceUID - Series Instance UID
|
||||
* @param {String} options.sopInstanceUID - SOP Instance UID
|
||||
* @param {String} options.frameNumbers - One-based indices of Frame Items
|
||||
* @param {Object} [options.queryParams] - HTTP query parameters
|
||||
* @returns {ArrayBuffer[]} Rendered Frame Items as byte arrays
|
||||
*/
|
||||
//
|
||||
client.retrieveInstanceFrames = async options => {
|
||||
if (!('studyInstanceUID' in options)) {
|
||||
throw new Error(
|
||||
'Study Instance UID is required for retrieval of instance frames'
|
||||
);
|
||||
}
|
||||
if (!('seriesInstanceUID' in options)) {
|
||||
throw new Error(
|
||||
'Series Instance UID is required for retrieval of instance frames'
|
||||
);
|
||||
}
|
||||
if (!('sopInstanceUID' in options)) {
|
||||
throw new Error(
|
||||
'SOP Instance UID is required for retrieval of instance frames'
|
||||
);
|
||||
}
|
||||
if (!('frameNumbers' in options)) {
|
||||
throw new Error(
|
||||
'frame numbers are required for retrieval of instance frames'
|
||||
);
|
||||
}
|
||||
console.log(
|
||||
`retrieve frames ${options.frameNumbers.toString()} of instance ${
|
||||
options.sopInstanceUID
|
||||
}`
|
||||
);
|
||||
|
||||
const instance = DicomMetadataStore.getInstance(
|
||||
options.studyInstanceUID,
|
||||
options.seriesInstanceUID,
|
||||
options.sopInstanceUID
|
||||
);
|
||||
|
||||
const frameNumbers = Array.isArray(options.frameNumbers)
|
||||
? options.frameNumbers
|
||||
: options.frameNumbers.split(',');
|
||||
|
||||
return frameNumbers.map(fr =>
|
||||
Array.isArray(instance.PixelData)
|
||||
? instance.PixelData[+fr - 1]
|
||||
: instance.PixelData
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
return client;
|
||||
}
|
||||
Reference in new issue
Block a user