diff --git a/extensions/cornerstone-dicom-sr/package.json b/extensions/cornerstone-dicom-sr/package.json index 3bae4e3c1..af5d3c57a 100644 --- a/extensions/cornerstone-dicom-sr/package.json +++ b/extensions/cornerstone-dicom-sr/package.json @@ -46,7 +46,7 @@ "@babel/runtime": "^7.20.13", "classnames": "^2.3.2", "@cornerstonejs/adapters": "^0.4.1", - "@cornerstonejs/core": "^0.36.0", - "@cornerstonejs/tools": "^0.50.2" + "@cornerstonejs/core": "^0.36.2", + "@cornerstonejs/tools": "^0.55.1" } } diff --git a/extensions/cornerstone/package.json b/extensions/cornerstone/package.json index cf4b42d94..0a6802edf 100644 --- a/extensions/cornerstone/package.json +++ b/extensions/cornerstone/package.json @@ -44,9 +44,9 @@ "dependencies": { "@babel/runtime": "^7.20.13", "@cornerstonejs/adapters": "^0.4.1", - "@cornerstonejs/core": "^0.36.0", - "@cornerstonejs/streaming-image-volume-loader": "^0.14.1", - "@cornerstonejs/tools": "^0.50.2", + "@cornerstonejs/core": "^0.36.2", + "@cornerstonejs/streaming-image-volume-loader": "^0.15.1", + "@cornerstonejs/tools": "^0.55.1", "@kitware/vtk.js": "26.5.6", "html2canvas": "^1.4.1", "lodash.debounce": "4.0.8", diff --git a/extensions/cornerstone/src/index.tsx b/extensions/cornerstone/src/index.tsx index 20b8695c6..f4cf97070 100644 --- a/extensions/cornerstone/src/index.tsx +++ b/extensions/cornerstone/src/index.tsx @@ -151,5 +151,6 @@ const cornerstoneExtension: Types.Extensions.Extension = { }, }; +export type { PublicViewportOptions }; +export { measurementMappingUtils }; export default cornerstoneExtension; -export { measurementMappingUtils, PublicViewportOptions }; diff --git a/extensions/cornerstone/src/services/SegmentationService/SegmentationService.ts b/extensions/cornerstone/src/services/SegmentationService/SegmentationService.ts index 949d54c90..658ee816f 100644 --- a/extensions/cornerstone/src/services/SegmentationService/SegmentationService.ts +++ b/extensions/cornerstone/src/services/SegmentationService/SegmentationService.ts @@ -1,22 +1,22 @@ import cloneDeep from 'lodash.clonedeep'; -import { pubSubServiceInterface } from '@ohif/core'; import { - utilities as cstUtils, - segmentation as cstSegmentation, - CONSTANTS as cstConstants, - Enums as csToolsEnums, - Types as cstTypes, -} from '@cornerstonejs/tools'; -import { - eventTarget, cache, + eventTarget, + getEnabledElementByIds, + metaData, + Types, utilities as csUtils, volumeLoader, - Types, - metaData, - getEnabledElementByIds, } from '@cornerstonejs/core'; +import { + CONSTANTS as cstConstants, + Enums as csToolsEnums, + segmentation as cstSegmentation, + Types as cstTypes, + utilities as cstUtils, +} from '@cornerstonejs/tools'; +import { pubSubServiceInterface } from '@ohif/core'; import isEqual from 'lodash.isequal'; import { easeInOutBell } from '../../utils/transitions'; import { @@ -202,7 +202,7 @@ class SegmentationService { this._setActiveSegment(segmentationId, segmentIndex, suppressEvents); } - // Todo: this includes nonhydrated segmentations which might not be + // Todo: this includes non-hydrated segmentations which might not be // persisted in the store this._broadcastEvent(this.EVENTS.SEGMENTATION_UPDATED, { segmentation, @@ -1598,6 +1598,13 @@ class SegmentationService { isVisible ); + // make sure to update the isVisible flag on the segmentation + // if a segment becomes invisible then the segmentation should be invisible + // in the status as well, and show correct icon + segmentation.isVisible = segmentation.segments + .filter(Boolean) + .every(segment => segment.isVisible); + if (suppressEvents === false) { this._broadcastEvent(this.EVENTS.SEGMENTATION_UPDATED, { segmentation, @@ -1917,28 +1924,27 @@ class SegmentationService { representation => representation.segmentationId === segmentationId ); - const visibility = cstSegmentation.config.visibility.getSegmentationVisibility( - toolGroupId, - representation.segmentationRepresentationUID - ); + const { segmentsHidden } = representation; + + const currentVisibility = segmentsHidden.size === 0 ? true : false; + const newVisibility = !currentVisibility; cstSegmentation.config.visibility.setSegmentationVisibility( toolGroupId, representation.segmentationRepresentationUID, - !visibility + newVisibility ); - // set all segments to visible as well - const segments = this.getSegmentation(segmentationId).segments; - Object.keys(segments).forEach(segmentIndex => { - if (segmentIndex !== '0') { - this._setSegmentVisibility( - segmentationId, - Number(segmentIndex), - !visibility, - toolGroupId - ); - } + // update segments visibility + const { segmentation } = this._getSegmentationInfo( + segmentationId, + toolGroupId + ); + + const segments = segmentation.segments.filter(Boolean); + + segments.forEach(segment => { + segment.isVisible = newVisibility; }); }); }; diff --git a/extensions/cornerstone/src/services/ViewportService/Viewport.ts b/extensions/cornerstone/src/services/ViewportService/Viewport.ts index 5221827ce..4f43aff23 100644 --- a/extensions/cornerstone/src/services/ViewportService/Viewport.ts +++ b/extensions/cornerstone/src/services/ViewportService/Viewport.ts @@ -1,14 +1,14 @@ import { Types, Enums } from '@cornerstonejs/core'; import { Types as UITypes } from '@ohif/ui'; +import { + StackViewportData, + VolumeViewportData, +} from '../../types/CornerstoneCacheService'; import getCornerstoneBlendMode from '../../utils/getCornerstoneBlendMode'; import getCornerstoneOrientation from '../../utils/getCornerstoneOrientation'; import getCornerstoneViewportType from '../../utils/getCornerstoneViewportType'; import JumpPresets from '../../utils/JumpPresets'; import { SyncGroup } from '../SyncGroupService/SyncGroupService'; -import { - StackViewportData, - VolumeViewportData, -} from '../../types/CornerstoneCacheService'; export type InitialImageOptions = { index?: number; @@ -247,7 +247,7 @@ class ViewportInfo { return this.viewportOptions.background || [0, 0, 0]; } - public getOrientation(): Types.Orientation { + public getOrientation(): Enums.OrientationAxis { return this.viewportOptions.orientation; } diff --git a/extensions/cornerstone/src/utils/getCornerstoneOrientation.ts b/extensions/cornerstone/src/utils/getCornerstoneOrientation.ts index e37177d55..8ac7b2cb5 100644 --- a/extensions/cornerstone/src/utils/getCornerstoneOrientation.ts +++ b/extensions/cornerstone/src/utils/getCornerstoneOrientation.ts @@ -1,5 +1,4 @@ import { Enums } from '@cornerstonejs/core'; -import { log } from '@ohif/core'; const AXIAL = 'axial'; const SAGITTAL = 'sagittal'; diff --git a/extensions/measurement-tracking/package.json b/extensions/measurement-tracking/package.json index 4f57ab622..cf6ddae2a 100644 --- a/extensions/measurement-tracking/package.json +++ b/extensions/measurement-tracking/package.json @@ -32,8 +32,8 @@ "peerDependencies": { "@ohif/core": "^3.0.0", "classnames": "^2.3.2", - "@cornerstonejs/core": "^0.36.0", - "@cornerstonejs/tools": "^0.50.2", + "@cornerstonejs/core": "^0.36.2", + "@cornerstonejs/tools": "^0.55.1", "@ohif/extension-cornerstone-dicom-sr": "^3.0.0", "dcmjs": "^0.29.4", "lodash.debounce": "^4.17.21", diff --git a/platform/ui/src/components/SegmentationGroupTable/SegmentationGroup.tsx b/platform/ui/src/components/SegmentationGroupTable/SegmentationGroup.tsx index bbff6bffb..34cb510ec 100644 --- a/platform/ui/src/components/SegmentationGroupTable/SegmentationGroup.tsx +++ b/platform/ui/src/components/SegmentationGroupTable/SegmentationGroup.tsx @@ -171,9 +171,7 @@ const SegmentationGroup = ({ id={id} showAddSegment={showAddSegment} /> -