@cornerstonejs/tools 5.1.2 → 5.1.3

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.
@@ -445,9 +445,10 @@ class LivewireContourTool extends ContourSegmentationBaseTool {
445
445
  const sourceViewport = viewport;
446
446
  if (csUtils.viewportSupportsDisplaySetPresentation(sourceViewport)) {
447
447
  const dataId = sourceViewport.getSourceDataId();
448
- voiRange = (((dataId
448
+ voiRange = ((dataId
449
449
  ? sourceViewport.getDisplaySetPresentation(dataId)?.voiRange
450
- : undefined) ?? sourceViewport.getDefaultVOIRange(dataId)) ??
450
+ : undefined) ??
451
+ sourceViewport.getDefaultVOIRange(dataId) ??
451
452
  undefined);
452
453
  }
453
454
  else {
@@ -1,9 +1,9 @@
1
1
  import { BaseVolumeViewport, cache, utilities } from '@cornerstonejs/core';
2
- import getViewportICamera from '../getViewportICamera';
3
2
  import { SegmentationRepresentations } from '../../enums';
4
3
  import { getSegmentation, getCurrentLabelmapImageIdsForViewport, } from '../../stateManagement/segmentation/segmentationState';
5
4
  import { getAnnotation } from '../../stateManagement';
6
5
  import { isPointInsidePolyline3D } from '../math/polyline';
6
+ import filterAnnotationsForDisplay from '../planar/filterAnnotationsForDisplay';
7
7
  import { getLabelmapActorEntry } from '../../stateManagement/segmentation/helpers/getSegmentationActor';
8
8
  import getViewportLabelmapRenderMode from '../../stateManagement/segmentation/helpers/getViewportLabelmapRenderMode';
9
9
  import { getLabelmaps, getOrCreateLabelmapVolume, getSegmentIndexForLabelValue, } from '../../stateManagement/segmentation/helpers/labelmapSegmentationState';
@@ -75,25 +75,21 @@ export function getSegmentIndexAtWorldForLabelmap(segmentation, worldPoint, { vi
75
75
  }
76
76
  export function getSegmentIndexAtWorldForContour(segmentation, worldPoint, { viewport }) {
77
77
  const contourData = segmentation.representationData.Contour;
78
- const segmentIndices = Array.from(contourData.annotationUIDsMap.keys());
79
- const { viewPlaneNormal } = getViewportICamera(viewport);
80
- for (const segmentIndex of segmentIndices) {
81
- const annotationsSet = contourData.annotationUIDsMap.get(segmentIndex);
82
- if (!annotationsSet) {
83
- continue;
84
- }
85
- for (const annotationUID of annotationsSet) {
78
+ const segmentIndexByAnnotation = new Map();
79
+ for (const [segmentIndex, annotationUIDs] of contourData.annotationUIDsMap) {
80
+ for (const annotationUID of annotationUIDs) {
86
81
  const annotation = getAnnotation(annotationUID);
87
- if (!annotation) {
88
- continue;
89
- }
90
- const { polyline } = annotation.data.contour;
91
- if (!utilities.isEqual(viewPlaneNormal, annotation.metadata.viewPlaneNormal)) {
92
- continue;
93
- }
94
- if (isPointInsidePolyline3D(worldPoint, polyline)) {
95
- return Number(segmentIndex);
82
+ if (annotation) {
83
+ segmentIndexByAnnotation.set(annotation, Number(segmentIndex));
96
84
  }
97
85
  }
98
86
  }
87
+ const displayableAnnotations = filterAnnotationsForDisplay(viewport, Array.from(segmentIndexByAnnotation.keys()));
88
+ for (const annotation of displayableAnnotations) {
89
+ const { polyline } = annotation.data
90
+ .contour;
91
+ if (isPointInsidePolyline3D(worldPoint, polyline)) {
92
+ return segmentIndexByAnnotation.get(annotation);
93
+ }
94
+ }
99
95
  }
@@ -1 +1 @@
1
- export declare const version = "5.1.2";
1
+ export declare const version = "5.1.3";
@@ -1 +1 @@
1
- export const version = '5.1.2';
1
+ export const version = '5.1.3';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "5.1.2",
3
+ "version": "5.1.3",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -108,11 +108,11 @@
108
108
  "lodash.get": "4.4.2"
109
109
  },
110
110
  "devDependencies": {
111
- "@cornerstonejs/core": "5.1.2",
111
+ "@cornerstonejs/core": "5.1.3",
112
112
  "canvas": "3.2.0"
113
113
  },
114
114
  "peerDependencies": {
115
- "@cornerstonejs/core": "5.1.2",
115
+ "@cornerstonejs/core": "5.1.3",
116
116
  "@kitware/vtk.js": "35.5.3",
117
117
  "@types/d3-array": "3.2.1",
118
118
  "@types/d3-interpolate": "3.0.4",
@@ -131,5 +131,5 @@
131
131
  "type": "individual",
132
132
  "url": "https://ohif.org/donate"
133
133
  },
134
- "gitHead": "50f6fe315e3e0fb9e3f12dc1fe50c9cc0e8a6bb9"
134
+ "gitHead": "e3694f1ab70dc631b251985c54364e65a5e90ea6"
135
135
  }