Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | import { errorHandler, DicomMetadataStore } from '@ohif/core'; import { StaticWadoClient } from '@ohif/extension-default'; /** * 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 }: withAppTypes) { 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 StaticWadoClient(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; } |