@cornerstonejs/tools 2.0.0-beta.22 → 2.0.0-beta.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +27 -23
  2. package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js +2 -2
  3. package/dist/esm/index.d.ts +2 -2
  4. package/dist/esm/index.js +2 -2
  5. package/dist/esm/stateManagement/index.d.ts +2 -0
  6. package/dist/esm/stateManagement/index.js +2 -2
  7. package/dist/esm/stateManagement/segmentation/SegmentationRenderingEngine.d.ts +1 -2
  8. package/dist/esm/stateManagement/segmentation/SegmentationStateManager.d.ts +3 -0
  9. package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +59 -11
  10. package/dist/esm/stateManagement/segmentation/getStackSegmentationImageIdsForViewport.d.ts +1 -0
  11. package/dist/esm/stateManagement/segmentation/getStackSegmentationImageIdsForViewport.js +5 -0
  12. package/dist/esm/stateManagement/segmentation/segmentationState.d.ts +2 -1
  13. package/dist/esm/stateManagement/segmentation/segmentationState.js +2 -1
  14. package/dist/esm/tools/annotation/BidirectionalTool.js +6 -6
  15. package/dist/esm/tools/annotation/CircleROITool.js +12 -12
  16. package/dist/esm/tools/annotation/DragProbeTool.js +2 -2
  17. package/dist/esm/tools/annotation/EllipticalROITool.js +11 -11
  18. package/dist/esm/tools/annotation/HeightTool.js +4 -4
  19. package/dist/esm/tools/annotation/LengthTool.js +4 -4
  20. package/dist/esm/tools/annotation/PlanarFreehandROITool.d.ts +4 -4
  21. package/dist/esm/tools/annotation/PlanarFreehandROITool.js +19 -19
  22. package/dist/esm/tools/annotation/ProbeTool.js +8 -8
  23. package/dist/esm/tools/annotation/RectangleROITool.js +11 -11
  24. package/dist/esm/tools/annotation/SplineROITool.js +6 -6
  25. package/dist/esm/tools/index.d.ts +1 -3
  26. package/dist/esm/tools/index.js +1 -3
  27. package/dist/esm/tools/segmentation/BrushTool.d.ts +38 -0
  28. package/dist/esm/tools/segmentation/BrushTool.js +40 -7
  29. package/dist/esm/tools/segmentation/CircleROIStartEndThresholdTool.js +8 -8
  30. package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +8 -8
  31. package/dist/esm/tools/segmentation/strategies/BrushStrategy.js +10 -5
  32. package/dist/esm/tools/segmentation/strategies/compositions/islandRemoval.js +1 -1
  33. package/dist/esm/tools/segmentation/strategies/compositions/preview.js +2 -2
  34. package/dist/esm/tools/segmentation/strategies/compositions/setValue.js +6 -4
  35. package/dist/esm/tools/segmentation/strategies/fillSphere.js +5 -14
  36. package/dist/esm/types/LabelmapToolOperationData.d.ts +5 -0
  37. package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +2 -2
  38. package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js +7 -7
  39. package/dist/esm/utilities/getCalibratedUnits.d.ts +2 -2
  40. package/dist/esm/utilities/getCalibratedUnits.js +13 -13
  41. package/dist/esm/utilities/segmentation/getSegmentIndexAtLabelmapBorder.js +7 -3
  42. package/dist/esm/utilities/segmentation/isLineInSegment.js +3 -3
  43. package/dist/umd/index.js +1 -1
  44. package/dist/umd/index.js.map +1 -1
  45. package/package.json +3 -3
  46. package/dist/esm/tools/StackScrollToolMouseWheelTool.d.ts +0 -16
  47. package/dist/esm/tools/StackScrollToolMouseWheelTool.js +0 -33
@@ -1,30 +1,34 @@
1
- import { cache, utilities as csUtils, VolumeViewport, getEnabledElementByViewportId, } from '@cornerstonejs/core';
1
+ import { cache, utilities as csUtils, VolumeViewport, getEnabledElementByViewportId, StackViewport, } from '@cornerstonejs/core';
2
2
  import * as SegmentationState from '../../../stateManagement/segmentation/segmentationState';
3
3
  const onLabelmapSegmentationDataModified = function (evt) {
4
4
  const { segmentationId, modifiedSlicesToUse } = evt.detail;
5
- let modifiedSlices = modifiedSlicesToUse;
6
5
  const { representationData, type } = SegmentationState.getSegmentation(segmentationId);
7
- const labelmapRepresentationData = representationData[type];
8
- if ('stack' in labelmapRepresentationData &&
9
- 'volumeId' in labelmapRepresentationData) {
10
- modifiedSlices = [];
11
- }
12
- if ('volumeId' in labelmapRepresentationData) {
13
- performVolumeLabelmapUpdate({
14
- modifiedSlicesToUse: modifiedSlices,
15
- representationData,
16
- type,
17
- });
18
- }
19
6
  const viewportIds = SegmentationState.getViewportIdsWithSegmentation(segmentationId);
20
- if ('imageIds' in labelmapRepresentationData) {
21
- performStackLabelmapUpdate({
22
- viewportIds,
23
- segmentationId,
24
- representationData,
25
- type,
26
- });
27
- }
7
+ const hasVolumeViewport = viewportIds.some((viewportId) => {
8
+ const { viewport } = getEnabledElementByViewportId(viewportId);
9
+ return viewport instanceof VolumeViewport;
10
+ });
11
+ const hasStackViewport = viewportIds.some((viewportId) => {
12
+ const { viewport } = getEnabledElementByViewportId(viewportId);
13
+ return viewport instanceof StackViewport;
14
+ });
15
+ const hasBothStackAndVolume = hasVolumeViewport && hasStackViewport;
16
+ viewportIds.forEach((viewportId) => {
17
+ const { viewport } = getEnabledElementByViewportId(viewportId);
18
+ if (viewport instanceof VolumeViewport) {
19
+ performVolumeLabelmapUpdate({
20
+ modifiedSlicesToUse: hasBothStackAndVolume ? [] : modifiedSlicesToUse,
21
+ representationData,
22
+ type,
23
+ });
24
+ }
25
+ if (viewport instanceof StackViewport) {
26
+ performStackLabelmapUpdate({
27
+ viewportIds,
28
+ segmentationId,
29
+ });
30
+ }
31
+ });
28
32
  };
29
33
  function performVolumeLabelmapUpdate({ modifiedSlicesToUse, representationData, type, }) {
30
34
  const segmentationVolume = cache.getVolume(representationData[type].volumeId);
@@ -46,7 +50,7 @@ function performVolumeLabelmapUpdate({ modifiedSlicesToUse, representationData,
46
50
  });
47
51
  imageData.modified();
48
52
  }
49
- function performStackLabelmapUpdate({ viewportIds, segmentationId, representationData, type, }) {
53
+ function performStackLabelmapUpdate({ viewportIds, segmentationId }) {
50
54
  viewportIds.forEach((viewportId) => {
51
55
  const viewportSegReps = SegmentationState.getSegmentationRepresentations(viewportId);
52
56
  viewportSegReps.forEach((representation) => {
@@ -1,10 +1,10 @@
1
1
  import SegmentationRepresentations from '../../enums/SegmentationRepresentations';
2
- import * as SegmentationState from '../../stateManagement/segmentation/segmentationState';
3
2
  import { triggerSegmentationRenderBySegmentationId } from '../../stateManagement/segmentation/SegmentationRenderingEngine';
4
3
  import onLabelmapSegmentationDataModified from './labelmap/onLabelmapSegmentationDataModified';
4
+ import { getSegmentation } from '../../stateManagement/segmentation/getSegmentation';
5
5
  const onSegmentationDataModified = function (evt) {
6
6
  const { segmentationId } = evt.detail;
7
- const { type } = SegmentationState.getSegmentation(segmentationId);
7
+ const { type } = getSegmentation(segmentationId);
8
8
  if (type === SegmentationRepresentations.Labelmap) {
9
9
  onLabelmapSegmentationDataModified(evt);
10
10
  }
@@ -9,7 +9,7 @@ import * as cursors from './cursors';
9
9
  import * as Types from './types';
10
10
  import * as annotation from './stateManagement/annotation';
11
11
  import * as segmentation from './stateManagement/segmentation';
12
- import { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, PlanarRotateTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, KeyImageTool, CrosshairsTool, ReferenceLinesTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, ReferenceLines, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, OverlayGridTool, SegmentationIntersectionTool, EraserTool, SculptorTool, SegmentSelectTool, WindowLevelRegionTool } from './tools';
12
+ import { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, PlanarRotateTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, KeyImageTool, CrosshairsTool, ReferenceLinesTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, OverlayGridTool, SegmentationIntersectionTool, EraserTool, SculptorTool, SegmentSelectTool, WindowLevelRegionTool } from './tools';
13
13
  import VideoRedactionTool from './tools/annotation/VideoRedactionTool';
14
14
  import * as Enums from './enums';
15
- export { VideoRedactionTool, init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, ZoomTool, StackScrollTool, PlanarRotateTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, HeightTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, KeyImageTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, ReferenceLines, ScaleOverlayTool, SculptorTool, EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, OrientationMarkerTool, SegmentSelectTool, synchronizers, Synchronizer, SynchronizerManager, PaintFillTool, Types, state, ToolGroupManager, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, };
15
+ export { VideoRedactionTool, init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, ZoomTool, StackScrollTool, PlanarRotateTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, HeightTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, KeyImageTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, ScaleOverlayTool, SculptorTool, EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, OrientationMarkerTool, SegmentSelectTool, synchronizers, Synchronizer, SynchronizerManager, PaintFillTool, Types, state, ToolGroupManager, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, };
package/dist/esm/index.js CHANGED
@@ -9,7 +9,7 @@ import * as cursors from './cursors';
9
9
  import * as Types from './types';
10
10
  import * as annotation from './stateManagement/annotation';
11
11
  import * as segmentation from './stateManagement/segmentation';
12
- import { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, PlanarRotateTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, KeyImageTool, CrosshairsTool, ReferenceLinesTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, ReferenceLines, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, OverlayGridTool, SegmentationIntersectionTool, EraserTool, SculptorTool, SegmentSelectTool, WindowLevelRegionTool, } from './tools';
12
+ import { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, PlanarRotateTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, KeyImageTool, CrosshairsTool, ReferenceLinesTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, OverlayGridTool, SegmentationIntersectionTool, EraserTool, SculptorTool, SegmentSelectTool, WindowLevelRegionTool, } from './tools';
13
13
  import VideoRedactionTool from './tools/annotation/VideoRedactionTool';
14
14
  import * as Enums from './enums';
15
- export { VideoRedactionTool, init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, ZoomTool, StackScrollTool, PlanarRotateTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, HeightTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, KeyImageTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, ReferenceLines, ScaleOverlayTool, SculptorTool, EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, OrientationMarkerTool, SegmentSelectTool, synchronizers, Synchronizer, SynchronizerManager, PaintFillTool, Types, state, ToolGroupManager, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, };
15
+ export { VideoRedactionTool, init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, ZoomTool, StackScrollTool, PlanarRotateTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, HeightTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, KeyImageTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, ScaleOverlayTool, SculptorTool, EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, OrientationMarkerTool, SegmentSelectTool, synchronizers, Synchronizer, SynchronizerManager, PaintFillTool, Types, state, ToolGroupManager, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, };
@@ -15,4 +15,6 @@ import { setAnnotationManager } from './annotation/annotationState';
15
15
  import { getAnnotationManager } from './annotation/annotationState';
16
16
  import { resetAnnotationManager } from './annotation/annotationState';
17
17
  import { invalidateAnnotation } from './annotation/annotationState';
18
+ import addSegmentationRepresentations from './segmentation/addSegmentationRepresentations';
19
+ import removeSegmentationRepresentations from './segmentation/removeSegmentationRepresentations';
18
20
  export { FrameOfReferenceSpecificAnnotationManager, defaultFrameOfReferenceSpecificAnnotationManager, annotationLocking, annotationSelection, getAnnotations, addAnnotation, getNumberOfAnnotations, removeAnnotation, getAnnotation, getParentAnnotation, getChildAnnotations, clearParentAnnotation, addChildAnnotation, setAnnotationManager, getAnnotationManager, resetAnnotationManager, invalidateAnnotation, addSegmentationRepresentations, removeSegmentationRepresentations };
@@ -2,6 +2,6 @@ import FrameOfReferenceSpecificAnnotationManager, { defaultFrameOfReferenceSpeci
2
2
  import * as annotationLocking from './annotation/annotationLocking';
3
3
  import * as annotationSelection from './annotation/annotationSelection';
4
4
  import { getAnnotations, addAnnotation, removeAnnotation, getAnnotation, getParentAnnotation, getChildAnnotations, clearParentAnnotation, addChildAnnotation, getNumberOfAnnotations, setAnnotationManager, getAnnotationManager, resetAnnotationManager, invalidateAnnotation, } from './annotation/annotationState';
5
- import { addSegmentationRepresentations } from './segmentation/addSegmentationRepresentations';
6
- import { removeSegmentationRepresentations } from './segmentation/removeSegmentationRepresentations';
5
+ import addSegmentationRepresentations from './segmentation/addSegmentationRepresentations';
6
+ import removeSegmentationRepresentations from './segmentation/removeSegmentationRepresentations';
7
7
  export { FrameOfReferenceSpecificAnnotationManager, defaultFrameOfReferenceSpecificAnnotationManager, annotationLocking, annotationSelection, getAnnotations, addAnnotation, getNumberOfAnnotations, removeAnnotation, getAnnotation, getParentAnnotation, getChildAnnotations, clearParentAnnotation, addChildAnnotation, setAnnotationManager, getAnnotationManager, resetAnnotationManager, invalidateAnnotation, addSegmentationRepresentations, removeSegmentationRepresentations, };
@@ -1,4 +1,3 @@
1
- import type { Types } from '@cornerstonejs/core';
2
1
  declare class SegmentationRenderingEngine {
3
2
  private _needsRender;
4
3
  private _animationFrameSet;
@@ -6,7 +5,7 @@ declare class SegmentationRenderingEngine {
6
5
  hasBeenDestroyed: boolean;
7
6
  renderSegmentationsForViewport(viewportId?: string): void;
8
7
  renderSegmentation(segmentationId: string): void;
9
- _getAllViewports: () => Types.IViewport[];
8
+ _getAllViewports: () => import("@cornerstonejs/core").Viewport[];
10
9
  _getViewportIdsForSegmentation(segmentationId?: string): string[];
11
10
  private _throwIfDestroyed;
12
11
  private _setViewportsToBeRenderedNextFrame;
@@ -15,9 +15,12 @@ export default class SegmentationStateManager {
15
15
  getSegmentationRepresentation(segmentationRepresentationUID: string): SegmentationRepresentation | undefined;
16
16
  addSegmentationRepresentationState(segmentationRepresentation: SegmentationRepresentation): void;
17
17
  addSegmentationRepresentationToViewport(viewportId: string, segmentationRepresentationUID: string): void;
18
+ _updateLabelmapSegmentationReferences(segmentationId: any, stackViewport: any, labelmapImageIds: any, updateCallback: any): string;
18
19
  updateLabelmapSegmentationImageReferences(viewportId: any, segmentationId: any): string;
20
+ _updateAllLabelmapSegmentationImageReferences(viewportId: any, segmentationId: any): void;
19
21
  private getLabelmapImageIds;
20
22
  getCurrentLabelmapImageIdForViewport(viewportId: string, segmentationId: string): string | undefined;
23
+ getStackSegmentationImageIdsForViewport(viewportId: string, segmentationId: string): string[];
21
24
  getSegmentationRepresentations(viewportId: string): SegmentationRepresentation[];
22
25
  removeRepresentation(segmentationRepresentationUID: string): void;
23
26
  setActiveSegmentationRepresentation(viewportId: string, segmentationRepresentationUID: string): void;
@@ -111,6 +111,23 @@ export default class SegmentationStateManager {
111
111
  }
112
112
  this.setActiveSegmentationRepresentation(viewportId, segmentationRepresentationUID);
113
113
  }
114
+ _updateLabelmapSegmentationReferences(segmentationId, stackViewport, labelmapImageIds, updateCallback) {
115
+ const currentImageId = stackViewport.getCurrentImageId();
116
+ for (const labelmapImageId of labelmapImageIds) {
117
+ const viewableImageId = stackViewport.isReferenceViewable({ referencedImageId: labelmapImageId }, { asOverlay: true });
118
+ if (viewableImageId) {
119
+ this._stackLabelmapImageIdReferenceMap
120
+ .get(segmentationId)
121
+ .set(currentImageId, labelmapImageId);
122
+ }
123
+ }
124
+ if (updateCallback) {
125
+ updateCallback(stackViewport, segmentationId, labelmapImageIds);
126
+ }
127
+ return this._stackLabelmapImageIdReferenceMap
128
+ .get(segmentationId)
129
+ .get(currentImageId);
130
+ }
114
131
  updateLabelmapSegmentationImageReferences(viewportId, segmentationId) {
115
132
  const segmentation = this.getSegmentation(segmentationId);
116
133
  if (!segmentation) {
@@ -126,18 +143,36 @@ export default class SegmentationStateManager {
126
143
  const labelmapImageIds = this.getLabelmapImageIds(representationData);
127
144
  const enabledElement = getEnabledElementByViewportId(viewportId);
128
145
  const stackViewport = enabledElement.viewport;
129
- const currentImageId = stackViewport.getCurrentImageId();
130
- for (const labelmapImageId of labelmapImageIds) {
131
- const viewableImageId = stackViewport.isReferenceViewable({ referencedImageId: labelmapImageId }, { asOverlay: true });
132
- if (viewableImageId) {
133
- this._stackLabelmapImageIdReferenceMap
134
- .get(segmentationId)
135
- .set(currentImageId, labelmapImageId);
136
- }
146
+ return this._updateLabelmapSegmentationReferences(segmentationId, stackViewport, labelmapImageIds, null);
147
+ }
148
+ _updateAllLabelmapSegmentationImageReferences(viewportId, segmentationId) {
149
+ const segmentation = this.getSegmentation(segmentationId);
150
+ if (!segmentation) {
151
+ return;
137
152
  }
138
- return this._stackLabelmapImageIdReferenceMap
139
- .get(segmentationId)
140
- .get(currentImageId);
153
+ if (!this._stackLabelmapImageIdReferenceMap.has(segmentationId)) {
154
+ this._stackLabelmapImageIdReferenceMap.set(segmentationId, new Map());
155
+ }
156
+ const { representationData } = segmentation;
157
+ if (!representationData.LABELMAP) {
158
+ return;
159
+ }
160
+ const labelmapImageIds = this.getLabelmapImageIds(representationData);
161
+ const enabledElement = getEnabledElementByViewportId(viewportId);
162
+ const stackViewport = enabledElement.viewport;
163
+ this._updateLabelmapSegmentationReferences(segmentationId, stackViewport, labelmapImageIds, (stackViewport, segmentationId, labelmapImageIds) => {
164
+ const imageIds = stackViewport.getImageIds();
165
+ imageIds.forEach((imageId, index) => {
166
+ for (const labelmapImageId of labelmapImageIds) {
167
+ const viewableImageId = stackViewport.isReferenceViewable({ referencedImageId: labelmapImageId, sliceIndex: index }, { asOverlay: true, withNavigation: true });
168
+ if (viewableImageId) {
169
+ this._stackLabelmapImageIdReferenceMap
170
+ .get(segmentationId)
171
+ .set(imageId, labelmapImageId);
172
+ }
173
+ }
174
+ });
175
+ });
141
176
  }
142
177
  getLabelmapImageIds(representationData) {
143
178
  const labelmapData = representationData.LABELMAP;
@@ -168,6 +203,19 @@ export default class SegmentationStateManager {
168
203
  const imageIdReferenceMap = this._stackLabelmapImageIdReferenceMap.get(segmentationId);
169
204
  return imageIdReferenceMap.get(currentImageId);
170
205
  }
206
+ getStackSegmentationImageIdsForViewport(viewportId, segmentationId) {
207
+ const segmentation = this.getSegmentation(segmentationId);
208
+ if (!segmentation) {
209
+ return [];
210
+ }
211
+ this._updateAllLabelmapSegmentationImageReferences(viewportId, segmentationId);
212
+ const { viewport } = getEnabledElementByViewportId(viewportId);
213
+ const imageIds = viewport.getImageIds();
214
+ const associatedReferenceImageAndLabelmapImageIds = this._stackLabelmapImageIdReferenceMap.get(segmentationId);
215
+ return imageIds.map((imageId) => {
216
+ return associatedReferenceImageAndLabelmapImageIds.get(imageId);
217
+ });
218
+ }
171
219
  getSegmentationRepresentations(viewportId) {
172
220
  const viewport = this.state.viewports[viewportId];
173
221
  if (!viewport) {
@@ -0,0 +1 @@
1
+ export declare function getStackSegmentationImageIdsForViewport(viewportId: string, segmentationId: string): string[];
@@ -0,0 +1,5 @@
1
+ import { defaultSegmentationStateManager } from './SegmentationStateManager';
2
+ export function getStackSegmentationImageIdsForViewport(viewportId, segmentationId) {
3
+ const segmentationStateManager = defaultSegmentationStateManager;
4
+ return segmentationStateManager.getStackSegmentationImageIdsForViewport(viewportId, segmentationId);
5
+ }
@@ -26,4 +26,5 @@ import { getActiveSegmentationRepresentation } from './getActiveSegmentationRepr
26
26
  import { setActiveSegmentationRepresentation } from './setActiveSegmentationRepresentation';
27
27
  import { getCurrentLabelmapImageIdForViewport } from './getCurrentLabelmapImageIdForViewport';
28
28
  import { updateLabelmapSegmentationImageReferences } from './updateLabelmapSegmentationImageReferences';
29
- export { getSegmentation, getSegmentations, addSegmentation, removeSegmentation, getAllSegmentationRepresentations, getSegmentationRepresentation, removeRepresentation, getGlobalConfig, setGlobalConfig, getSegmentationRepresentationConfig, setSegmentationRepresentationConfig, getPerSegmentConfig, setPerSegmentConfig, getSegmentationRepresentations, addSegmentationRepresentation, getSegmentationRepresentationViewportStates, addColorLUT, getColorLUT, getNextColorLUTIndex, removeColorLUT, getSegmentationRepresentationsForSegmentation, getSegmentationRepresentationVisibility, setSegmentationRepresentationVisibility, getViewportIdsWithSegmentation, getActiveSegmentationRepresentation, setActiveSegmentationRepresentation, getCurrentLabelmapImageIdForViewport, updateLabelmapSegmentationImageReferences, };
29
+ import { getStackSegmentationImageIdsForViewport } from './getStackSegmentationImageIdsForViewport';
30
+ export { getSegmentation, getSegmentations, addSegmentation, removeSegmentation, getAllSegmentationRepresentations, getSegmentationRepresentation, removeRepresentation, getGlobalConfig, setGlobalConfig, getSegmentationRepresentationConfig, setSegmentationRepresentationConfig, getPerSegmentConfig, setPerSegmentConfig, getSegmentationRepresentations, addSegmentationRepresentation, getSegmentationRepresentationViewportStates, addColorLUT, getColorLUT, getNextColorLUTIndex, removeColorLUT, getSegmentationRepresentationsForSegmentation, getSegmentationRepresentationVisibility, setSegmentationRepresentationVisibility, getViewportIdsWithSegmentation, getActiveSegmentationRepresentation, setActiveSegmentationRepresentation, getCurrentLabelmapImageIdForViewport, updateLabelmapSegmentationImageReferences, getStackSegmentationImageIdsForViewport, };
@@ -26,4 +26,5 @@ import { getActiveSegmentationRepresentation } from './getActiveSegmentationRepr
26
26
  import { setActiveSegmentationRepresentation } from './setActiveSegmentationRepresentation';
27
27
  import { getCurrentLabelmapImageIdForViewport } from './getCurrentLabelmapImageIdForViewport';
28
28
  import { updateLabelmapSegmentationImageReferences } from './updateLabelmapSegmentationImageReferences';
29
- export { getSegmentation, getSegmentations, addSegmentation, removeSegmentation, getAllSegmentationRepresentations, getSegmentationRepresentation, removeRepresentation, getGlobalConfig, setGlobalConfig, getSegmentationRepresentationConfig, setSegmentationRepresentationConfig, getPerSegmentConfig, setPerSegmentConfig, getSegmentationRepresentations, addSegmentationRepresentation, getSegmentationRepresentationViewportStates, addColorLUT, getColorLUT, getNextColorLUTIndex, removeColorLUT, getSegmentationRepresentationsForSegmentation, getSegmentationRepresentationVisibility, setSegmentationRepresentationVisibility, getViewportIdsWithSegmentation, getActiveSegmentationRepresentation, setActiveSegmentationRepresentation, getCurrentLabelmapImageIdForViewport, updateLabelmapSegmentationImageReferences, };
29
+ import { getStackSegmentationImageIdsForViewport } from './getStackSegmentationImageIdsForViewport';
30
+ export { getSegmentation, getSegmentations, addSegmentation, removeSegmentation, getAllSegmentationRepresentations, getSegmentationRepresentation, removeRepresentation, getGlobalConfig, setGlobalConfig, getSegmentationRepresentationConfig, setSegmentationRepresentationConfig, getPerSegmentConfig, setPerSegmentConfig, getSegmentationRepresentations, addSegmentationRepresentation, getSegmentationRepresentationViewportStates, addColorLUT, getColorLUT, getNextColorLUTIndex, removeColorLUT, getSegmentationRepresentationsForSegmentation, getSegmentationRepresentationVisibility, setSegmentationRepresentationVisibility, getViewportIdsWithSegmentation, getActiveSegmentationRepresentation, setActiveSegmentationRepresentation, getCurrentLabelmapImageIdForViewport, updateLabelmapSegmentationImageReferences, getStackSegmentationImageIdsForViewport, };
@@ -608,13 +608,13 @@ class BidirectionalTool extends AnnotationTool {
608
608
  const index4 = transformWorldToIndex(imageData, worldPos4);
609
609
  const handles1 = [index1, index2];
610
610
  const handles2 = [index3, index4];
611
- const { scale: scale1, lengthUnits: units1 } = getCalibratedLengthUnitsAndScale(image, handles1);
612
- const { scale: scale2, lengthUnits: units2 } = getCalibratedLengthUnitsAndScale(image, handles2);
611
+ const { scale: scale1, unit: units1 } = getCalibratedLengthUnitsAndScale(image, handles1);
612
+ const { scale: scale2, unit: units2 } = getCalibratedLengthUnitsAndScale(image, handles2);
613
613
  const dist1 = this._calculateLength(worldPos1, worldPos2) / scale1;
614
614
  const dist2 = this._calculateLength(worldPos3, worldPos4) / scale2;
615
615
  const length = dist1 > dist2 ? dist1 : dist2;
616
616
  const width = dist1 > dist2 ? dist2 : dist1;
617
- const lengthUnits = dist1 > dist2 ? units1 : units2;
617
+ const unit = dist1 > dist2 ? units1 : units2;
618
618
  const widthUnit = dist1 > dist2 ? units2 : units1;
619
619
  this._isInsideVolume(index1, index2, index3, index4, dimensions)
620
620
  ? (this.isHandleOutsideImage = false)
@@ -622,7 +622,7 @@ class BidirectionalTool extends AnnotationTool {
622
622
  cachedStats[targetId] = {
623
623
  length,
624
624
  width,
625
- lengthUnits,
625
+ unit,
626
626
  widthUnit,
627
627
  };
628
628
  }
@@ -712,7 +712,7 @@ class BidirectionalTool extends AnnotationTool {
712
712
  }
713
713
  function defaultGetTextLines(data, targetId) {
714
714
  const { cachedStats, label } = data;
715
- const { length, width, unit, lengthUnits, widthUnit } = cachedStats[targetId];
715
+ const { length, width, unit } = cachedStats[targetId];
716
716
  const textLines = [];
717
717
  if (label) {
718
718
  textLines.push(label);
@@ -720,7 +720,7 @@ function defaultGetTextLines(data, targetId) {
720
720
  if (length === undefined) {
721
721
  return textLines;
722
722
  }
723
- textLines.push(`L: ${csUtils.roundNumber(length)} ${lengthUnits || unit}`, `W: ${csUtils.roundNumber(width)} ${widthUnit || unit}`);
723
+ textLines.push(`L: ${csUtils.roundNumber(length)} ${unit || unit}`, `W: ${csUtils.roundNumber(width)} ${unit}`);
724
724
  return textLines;
725
725
  }
726
726
  BidirectionalTool.toolName = 'Bidirectional';
@@ -346,14 +346,14 @@ class CircleROITool extends AnnotationTool {
346
346
  const canvasCorners = getCanvasCircleCorners(canvasCoordinates);
347
347
  const { centerPointRadius } = this.configuration;
348
348
  if (!data.cachedStats[targetId] ||
349
- data.cachedStats[targetId].areaUnits == null) {
349
+ data.cachedStats[targetId].areaUnit == null) {
350
350
  data.cachedStats[targetId] = {
351
351
  Modality: null,
352
352
  area: null,
353
353
  max: null,
354
354
  mean: null,
355
355
  stdDev: null,
356
- areaUnits: null,
356
+ areaUnit: null,
357
357
  radius: null,
358
358
  radiusUnit: null,
359
359
  perimeter: null,
@@ -507,7 +507,7 @@ class CircleROITool extends AnnotationTool {
507
507
  const { worldWidth, worldHeight } = getWorldWidthAndHeightFromTwoPoints(viewPlaneNormal, viewUp, worldPos1, worldPos2);
508
508
  const isEmptyArea = worldWidth === 0 && worldHeight === 0;
509
509
  const handles = [pos1Index, pos2Index];
510
- const { scale, lengthUnits, areaUnits } = getCalibratedLengthUnitsAndScale(image, handles);
510
+ const { scale, unit, areaUnit } = getCalibratedLengthUnitsAndScale(image, handles);
511
511
  const aspect = getCalibratedAspect(image);
512
512
  const area = Math.abs(Math.PI *
513
513
  (worldWidth / scale / 2) *
@@ -516,7 +516,7 @@ class CircleROITool extends AnnotationTool {
516
516
  isPreScaled: isViewportPreScaled(viewport, targetId),
517
517
  isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
518
518
  };
519
- const pixelValueUnits = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
519
+ const modalityUnit = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
520
520
  const pointsInShape = voxelManager.forEach(this.configuration.statsCalculator.statsCallback, {
521
521
  isInObject: (pointLPS) => pointInEllipse(ellipseObj, pointLPS, { fast: true }),
522
522
  boundsIJK,
@@ -533,11 +533,11 @@ class CircleROITool extends AnnotationTool {
533
533
  statsArray: stats.array,
534
534
  pointsInShape: pointsInShape,
535
535
  isEmptyArea,
536
- areaUnits,
536
+ areaUnit,
537
537
  radius: worldWidth / 2 / scale,
538
- radiusUnit: lengthUnits,
538
+ radiusUnit: unit,
539
539
  perimeter: (2 * Math.PI * (worldWidth / 2)) / scale,
540
- pixelValueUnits,
540
+ modalityUnit,
541
541
  };
542
542
  }
543
543
  else {
@@ -560,7 +560,7 @@ class CircleROITool extends AnnotationTool {
560
560
  }
561
561
  function defaultGetTextLines(data, targetId) {
562
562
  const cachedVolumeStats = data.cachedStats[targetId];
563
- const { radius, radiusUnit, area, mean, stdDev, max, isEmptyArea, areaUnits, pixelValueUnits, } = cachedVolumeStats;
563
+ const { radius, radiusUnit, area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit, } = cachedVolumeStats;
564
564
  const textLines = [];
565
565
  if (radius) {
566
566
  const radiusLine = isEmptyArea
@@ -571,17 +571,17 @@ function defaultGetTextLines(data, targetId) {
571
571
  if (area) {
572
572
  const areaLine = isEmptyArea
573
573
  ? `Area: Oblique not supported`
574
- : `Area: ${csUtils.roundNumber(area)} ${areaUnits}`;
574
+ : `Area: ${csUtils.roundNumber(area)} ${areaUnit}`;
575
575
  textLines.push(areaLine);
576
576
  }
577
577
  if (mean) {
578
- textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${pixelValueUnits}`);
578
+ textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`);
579
579
  }
580
580
  if (max) {
581
- textLines.push(`Max: ${csUtils.roundNumber(max)} ${pixelValueUnits}`);
581
+ textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`);
582
582
  }
583
583
  if (stdDev) {
584
- textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${pixelValueUnits}`);
584
+ textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`);
585
585
  }
586
586
  return textLines;
587
587
  }
@@ -117,13 +117,13 @@ class DragProbeTool extends ProbeTool {
117
117
  }
118
118
  function defaultGetTextLines(data, targetId) {
119
119
  const cachedVolumeStats = data.cachedStats[targetId];
120
- const { index, value, pixelValueUnits } = cachedVolumeStats;
120
+ const { index, value, modalityUnit } = cachedVolumeStats;
121
121
  if (value === undefined) {
122
122
  return;
123
123
  }
124
124
  const textLines = [];
125
125
  textLines.push(`(${index[0]}, ${index[1]}, ${index[2]})`);
126
- textLines.push(`${value.toFixed(2)} ${pixelValueUnits}`);
126
+ textLines.push(`${value.toFixed(2)} ${modalityUnit}`);
127
127
  return textLines;
128
128
  }
129
129
  DragProbeTool.toolName = 'DragProbe';
@@ -427,14 +427,14 @@ class EllipticalROITool extends AnnotationTool {
427
427
  const canvasCorners = (getCanvasEllipseCorners(canvasCoordinates));
428
428
  const { centerPointRadius } = this.configuration;
429
429
  if (!data.cachedStats[targetId] ||
430
- data.cachedStats[targetId].areaUnits == null) {
430
+ data.cachedStats[targetId].areaUnit == null) {
431
431
  data.cachedStats[targetId] = {
432
432
  Modality: null,
433
433
  area: null,
434
434
  max: null,
435
435
  mean: null,
436
436
  stdDev: null,
437
- areaUnits: null,
437
+ areaUnit: null,
438
438
  };
439
439
  this._calculateCachedStats(annotation, viewport, renderingEngine);
440
440
  }
@@ -587,7 +587,7 @@ class EllipticalROITool extends AnnotationTool {
587
587
  const { worldWidth, worldHeight } = getWorldWidthAndHeightFromTwoPoints(viewPlaneNormal, viewUp, worldPos1, worldPos2);
588
588
  const isEmptyArea = worldWidth === 0 && worldHeight === 0;
589
589
  const handles = [pos1Index, post2Index];
590
- const { scale, areaUnits } = getCalibratedLengthUnitsAndScale(image, handles);
590
+ const { scale, areaUnit } = getCalibratedLengthUnitsAndScale(image, handles);
591
591
  const area = Math.abs(Math.PI * (worldWidth / 2) * (worldHeight / 2)) /
592
592
  scale /
593
593
  scale;
@@ -595,7 +595,7 @@ class EllipticalROITool extends AnnotationTool {
595
595
  isPreScaled: isViewportPreScaled(viewport, targetId),
596
596
  isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
597
597
  };
598
- const pixelValueUnits = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
598
+ const modalityUnit = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
599
599
  const pointsInShape = voxelManager.forEach(this.configuration.statsCalculator.statsCallback, {
600
600
  boundsIJK,
601
601
  imageData,
@@ -612,8 +612,8 @@ class EllipticalROITool extends AnnotationTool {
612
612
  statsArray: stats.array,
613
613
  pointsInShape,
614
614
  isEmptyArea,
615
- areaUnits,
616
- pixelValueUnits,
615
+ areaUnit,
616
+ modalityUnit,
617
617
  };
618
618
  }
619
619
  annotation.invalidated = false;
@@ -651,22 +651,22 @@ class EllipticalROITool extends AnnotationTool {
651
651
  }
652
652
  function defaultGetTextLines(data, targetId) {
653
653
  const cachedVolumeStats = data.cachedStats[targetId];
654
- const { area, mean, stdDev, max, isEmptyArea, areaUnits, pixelValueUnits } = cachedVolumeStats;
654
+ const { area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit } = cachedVolumeStats;
655
655
  const textLines = [];
656
656
  if (area) {
657
657
  const areaLine = isEmptyArea
658
658
  ? `Area: Oblique not supported`
659
- : `Area: ${csUtils.roundNumber(area)} ${areaUnits}`;
659
+ : `Area: ${csUtils.roundNumber(area)} ${areaUnit}`;
660
660
  textLines.push(areaLine);
661
661
  }
662
662
  if (mean) {
663
- textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${pixelValueUnits}`);
663
+ textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`);
664
664
  }
665
665
  if (max) {
666
- textLines.push(`Max: ${csUtils.roundNumber(max)} ${pixelValueUnits}`);
666
+ textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`);
667
667
  }
668
668
  if (stdDev) {
669
- textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${pixelValueUnits}`);
669
+ textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`);
670
670
  }
671
671
  return textLines;
672
672
  }
@@ -403,13 +403,13 @@ class HeightTool extends AnnotationTool {
403
403
  const index1 = transformWorldToIndex(imageData, worldPos1);
404
404
  const index2 = transformWorldToIndex(imageData, worldPos2);
405
405
  const handles = [index1, index2];
406
- const { scale, lengthUnits } = getCalibratedLengthUnitsAndScale(image, handles);
406
+ const { scale, unit } = getCalibratedLengthUnitsAndScale(image, handles);
407
407
  const height = this._calculateHeight(worldPos1, worldPos2) / scale;
408
408
  const outside = this._isInsideVolume(index1, index2, dimensions);
409
409
  this.isHandleOutsideImage = outside;
410
410
  cachedStats[targetId] = {
411
411
  height,
412
- lengthUnits,
412
+ unit,
413
413
  };
414
414
  }
415
415
  annotation.invalidated = false;
@@ -423,11 +423,11 @@ class HeightTool extends AnnotationTool {
423
423
  }
424
424
  function defaultGetTextLines(data, targetId) {
425
425
  const cachedVolumeStats = data.cachedStats[targetId];
426
- const { height, lengthUnits } = cachedVolumeStats;
426
+ const { height, unit } = cachedVolumeStats;
427
427
  if (height === undefined || height === null || isNaN(height)) {
428
428
  return;
429
429
  }
430
- const textLines = [`${csUtils.roundNumber(height)} ${lengthUnits}`];
430
+ const textLines = [`${csUtils.roundNumber(height)} ${unit}`];
431
431
  return textLines;
432
432
  }
433
433
  HeightTool.toolName = 'Height';
@@ -394,14 +394,14 @@ class LengthTool extends AnnotationTool {
394
394
  const index1 = transformWorldToIndex(imageData, worldPos1);
395
395
  const index2 = transformWorldToIndex(imageData, worldPos2);
396
396
  const handles = [index1, index2];
397
- const { scale, lengthUnits } = getCalibratedLengthUnitsAndScale(image, handles);
397
+ const { scale, unit } = getCalibratedLengthUnitsAndScale(image, handles);
398
398
  const length = this._calculateLength(worldPos1, worldPos2) / scale;
399
399
  this._isInsideVolume(index1, index2, dimensions)
400
400
  ? (this.isHandleOutsideImage = false)
401
401
  : (this.isHandleOutsideImage = true);
402
402
  cachedStats[targetId] = {
403
403
  length,
404
- lengthUnits,
404
+ unit,
405
405
  };
406
406
  }
407
407
  annotation.invalidated = false;
@@ -415,11 +415,11 @@ class LengthTool extends AnnotationTool {
415
415
  }
416
416
  function defaultGetTextLines(data, targetId) {
417
417
  const cachedVolumeStats = data.cachedStats[targetId];
418
- const { length, lengthUnits } = cachedVolumeStats;
418
+ const { length, unit } = cachedVolumeStats;
419
419
  if (length === undefined || length === null || isNaN(length)) {
420
420
  return;
421
421
  }
422
- const textLines = [`${csUtils.roundNumber(length)} ${lengthUnits}`];
422
+ const textLines = [`${csUtils.roundNumber(length)} ${unit}`];
423
423
  return textLines;
424
424
  }
425
425
  LengthTool.toolName = 'Length';
@@ -35,23 +35,23 @@ declare class PlanarFreehandROITool extends ContourSegmentationBaseTool {
35
35
  protected renderAnnotationInstance(renderContext: AnnotationRenderContext): boolean;
36
36
  _calculateStatsIfActive(annotation: PlanarFreehandROIAnnotation, targetId: string, viewport: any, renderingEngine: any, enabledElement: any): void;
37
37
  private _calculateCachedStats;
38
- protected updateClosedCachedStats({ viewport, points, imageData, metadata, cachedStats, targetId, pixelValueUnits, canvasCoordinates, calibratedScale, }: {
38
+ protected updateClosedCachedStats({ viewport, points, imageData, metadata, cachedStats, targetId, modalityUnit, canvasCoordinates, calibratedScale, }: {
39
39
  viewport: any;
40
40
  points: any;
41
41
  imageData: any;
42
42
  metadata: any;
43
43
  cachedStats: any;
44
44
  targetId: any;
45
- pixelValueUnits: any;
45
+ modalityUnit: any;
46
46
  canvasCoordinates: any;
47
47
  calibratedScale: any;
48
48
  }): void;
49
- protected updateOpenCachedStats({ targetId, metadata, canvasCoordinates, cachedStats, pixelValueUnits, calibratedScale, }: {
49
+ protected updateOpenCachedStats({ targetId, metadata, canvasCoordinates, cachedStats, modalityUnit, calibratedScale, }: {
50
50
  targetId: any;
51
51
  metadata: any;
52
52
  canvasCoordinates: any;
53
53
  cachedStats: any;
54
- pixelValueUnits: any;
54
+ modalityUnit: any;
55
55
  calibratedScale: any;
56
56
  }): void;
57
57
  private _renderStats;