feat(pmap): added support for parametric map (#4284)

This commit is contained in:
Leonardo Campos authored and GitHub committed 2024-07-24 16:40:28 -04:00
1 parent 9f3fc382c3
commit fc0064fd9d
22 files changed
+703 -18

No files matched your search

@@ -131,6 +131,11 @@ const OHIFCornerstoneViewport = React.memo((props: withAppTypes) => {
throw new Error('Viewport ID is required');
}
// Make sure displaySetOptions has one object per displaySet
while (displaySetOptions.length < displaySets.length) {
displaySetOptions.push({});
}
// Since we only have support for dynamic data in volume viewports, we should
// handle this case here and set the viewportType to volume if any of the
// displaySets are dynamic volumes
+1
View File
@@ -231,5 +231,6 @@ export {
getEnabledElement,
ImageOverlayViewerTool,
getSOPInstanceAttributes,
dicomLoaderService,
};
export default cornerstoneExtension;
@@ -200,6 +200,9 @@ class CornerstoneCacheService {
const volumeData = [];
for (const displaySet of displaySets) {
const { Modality } = displaySet;
const isParametricMap = Modality === 'PMAP';
// Don't create volumes for the displaySets that have custom load
// function (e.g., SEG, RT, since they rely on the reference volumes
// and they take care of their own loading after they are created in their
@@ -210,24 +213,27 @@ class CornerstoneCacheService {
const headers = userAuthenticationService.getAuthorizationHeader();
await displaySet.load({ headers });
volumeData.push({
studyInstanceUID: displaySet.StudyInstanceUID,
displaySetInstanceUID: displaySet.displaySetInstanceUID,
});
// Parametric maps have a `load` method but it should not be loaded in the
// same way as SEG and RTSTRUCT but like a normal volume
if (!isParametricMap) {
volumeData.push({
studyInstanceUID: displaySet.StudyInstanceUID,
displaySetInstanceUID: displaySet.displaySetInstanceUID,
});
// Todo: do some cache check and empty the cache if needed
continue;
// Todo: do some cache check and empty the cache if needed
continue;
}
}
const volumeLoaderSchema = displaySet.volumeLoaderSchema ?? VOLUME_LOADER_SCHEME;
const volumeId = `${volumeLoaderSchema}:${displaySet.displaySetInstanceUID}`;
let volumeImageIds = this.volumeImageIds.get(displaySet.displaySetInstanceUID);
let volume = cs3DCache.getVolume(volumeId);
if (!volumeImageIds || !volume) {
// Parametric maps do not have image ids but they already have volume data
// therefore a new volume should not be created.
if (!isParametricMap && (!volumeImageIds || !volume)) {
volumeImageIds = this._getCornerstoneVolumeImageIds(displaySet, dataSource);
volume = await volumeLoader.createAndCacheVolume(volumeId, {
@@ -814,12 +814,16 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
// load any secondary displaySets
const displaySetInstanceUIDs = this.viewportsDisplaySets.get(viewport.id);
// can be SEG or RTSTRUCT for now
const overlayDisplaySet = displaySetInstanceUIDs
// Can be SEG or RTSTRUCT for now but not PMAP
const segOrRTSOverlayDisplaySet = displaySetInstanceUIDs
.map(displaySetService.getDisplaySetByUID)
.find(displaySet => displaySet?.isOverlayDisplaySet);
if (overlayDisplaySet) {
this.addOverlayRepresentationForDisplaySet(overlayDisplaySet, viewport);
.find(
displaySet =>
displaySet?.isOverlayDisplaySet && ['SEG', 'RTSTRUCT'].includes(displaySet.Modality)
);
if (segOrRTSOverlayDisplaySet) {
this.addOverlayRepresentationForDisplaySet(segOrRTSOverlayDisplaySet, viewport);
} else {
// If the displaySet is not a SEG displaySet we assume it is a primary displaySet
// and we can look into hydrated segmentations to check if any of them are