diff --git a/extensions/cornerstone/src/Viewport/OHIFCornerstoneViewport.tsx b/extensions/cornerstone/src/Viewport/OHIFCornerstoneViewport.tsx index cd0734ecc81..a3477fbc3bf 100644 --- a/extensions/cornerstone/src/Viewport/OHIFCornerstoneViewport.tsx +++ b/extensions/cornerstone/src/Viewport/OHIFCornerstoneViewport.tsx @@ -485,7 +485,10 @@ function _subscribeToJumpToMeasurementEvents( cornerstoneViewportService.getViewportIdToJump( jumpId, measurement.displaySetInstanceUID, - { referencedImageId: measurement.referencedImageId } + { + referencedImageId: + measurement.referencedImageId || measurement.metadata?.referencedImageId, + } ); } if (cacheJumpToMeasurementEvent.cornerstoneViewport !== viewportId) { diff --git a/extensions/cornerstone/src/services/ViewportService/CornerstoneViewportService.ts b/extensions/cornerstone/src/services/ViewportService/CornerstoneViewportService.ts index ae58d69f737..9fd4f3ce5f2 100644 --- a/extensions/cornerstone/src/services/ViewportService/CornerstoneViewportService.ts +++ b/extensions/cornerstone/src/services/ViewportService/CornerstoneViewportService.ts @@ -532,6 +532,11 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi cameraProps: unknown ): string { const viewportInfo = this.getViewportInfo(activeViewportId); + + if (viewportInfo.getViewportType() === csEnums.ViewportType.VOLUME_3D) { + return null; + } + const { referencedImageId } = cameraProps; if (viewportInfo?.contains(displaySetInstanceUID, referencedImageId)) { return activeViewportId; diff --git a/extensions/cornerstone/src/services/ViewportService/Viewport.ts b/extensions/cornerstone/src/services/ViewportService/Viewport.ts index 2ec852492aa..247b4d3bd83 100644 --- a/extensions/cornerstone/src/services/ViewportService/Viewport.ts +++ b/extensions/cornerstone/src/services/ViewportService/Viewport.ts @@ -1,4 +1,10 @@ -import { Types, Enums } from '@cornerstonejs/core'; +import { + Types, + Enums, + getEnabledElementByViewportId, + VolumeViewport, + utilities, +} from '@cornerstonejs/core'; import { Types as CoreTypes } from '@ohif/core'; import { StackViewportData, VolumeViewportData } from '../../types/CornerstoneCacheService'; import getCornerstoneBlendMode from '../../utils/getCornerstoneBlendMode'; @@ -89,13 +95,30 @@ const DEFAULT_TOOLGROUP_ID = 'default'; // Return true if the data contains the given display set UID OR the imageId // if it is a composite object. -const dataContains = (data, displaySetUID: string, imageId?: string): boolean => { - if (data.displaySetInstanceUID === displaySetUID) { - return true; - } +const dataContains = ({ data, displaySetUID, imageId, viewport }): boolean => { if (imageId && data.isCompositeStack && data.imageIds) { return !!data.imageIds.find(dataId => dataId === imageId); } + + if (imageId && (data.volumeId || viewport instanceof VolumeViewport)) { + const isAcquisition = !!viewport.getCurrentImageId(); + + if (!isAcquisition) { + return false; + } + + const imageURI = utilities.imageIdToURI(imageId); + const hasImageId = viewport.hasImageURI(imageURI); + + if (hasImageId) { + return true; + } + } + + if (data.displaySetInstanceUID === displaySetUID) { + return true; + } + return false; }; @@ -122,10 +145,20 @@ class ViewportInfo { return false; } + const { viewport } = getEnabledElementByViewportId(this.viewportId) || {}; + if (this.viewportData.data.length) { - return !!this.viewportData.data.find(data => dataContains(data, displaySetUID, imageId)); + return !!this.viewportData.data.find(data => + dataContains({ data, displaySetUID, imageId, viewport }) + ); } - return dataContains(this.viewportData.data, displaySetUID, imageId); + + return dataContains({ + data: this.viewportData.data, + displaySetUID, + imageId, + viewport, + }); } public destroy = (): void => { diff --git a/extensions/cornerstone/src/utils/measurementServiceMappings/RectangleROI.ts b/extensions/cornerstone/src/utils/measurementServiceMappings/RectangleROI.ts index 4718e617af3..fe94bfa27f8 100644 --- a/extensions/cornerstone/src/utils/measurementServiceMappings/RectangleROI.ts +++ b/extensions/cornerstone/src/utils/measurementServiceMappings/RectangleROI.ts @@ -114,6 +114,7 @@ function getMappedAnnotations(annotation, DisplaySetService) { unit: modalityUnit, mean, stdDev, + metadata, max, area, areaUnit,