@cornerstonejs/tools 2.2.10 → 2.2.12

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.
@@ -115,7 +115,7 @@ export default class SegmentationStateManager {
115
115
  type,
116
116
  active: true,
117
117
  visible: true,
118
- colorLUTIndex: 0,
118
+ colorLUTIndex: renderingConfig?.colorLUTIndex || 0,
119
119
  segments: segmentReps,
120
120
  config: {
121
121
  ...getDefaultRenderingConfig(type),
@@ -19,16 +19,19 @@ function internalAddSegmentationRepresentation(viewportId, representationInput)
19
19
  }
20
20
  function getColorLUTIndex(config) {
21
21
  const { colorLUTOrIndex } = config || {};
22
- const isIndexProvided = typeof colorLUTOrIndex === 'number';
23
- const selectedColorLUT = isIndexProvided
24
- ? getColorLUT(colorLUTOrIndex)
25
- : CORNERSTONE_COLOR_LUT;
26
- const colorLUTIndex = isIndexProvided
27
- ? colorLUTOrIndex
28
- : getNextColorLUTIndex();
29
- if (!isIndexProvided) {
30
- addColorLUT(selectedColorLUT, colorLUTIndex);
22
+ if (colorLUTOrIndex === undefined) {
23
+ const index = addColorLUT(CORNERSTONE_COLOR_LUT);
24
+ return index;
31
25
  }
32
- return colorLUTIndex;
26
+ if (typeof colorLUTOrIndex === 'number') {
27
+ return colorLUTOrIndex;
28
+ }
29
+ if (Array.isArray(colorLUTOrIndex) &&
30
+ colorLUTOrIndex.every((item) => Array.isArray(item) && item.length === 4)) {
31
+ const index = addColorLUT(colorLUTOrIndex);
32
+ return index;
33
+ }
34
+ const index = addColorLUT(CORNERSTONE_COLOR_LUT);
35
+ return index;
33
36
  }
34
37
  export { internalAddSegmentationRepresentation };
@@ -56,7 +56,7 @@ declare class CrosshairsTool extends AnnotationTool {
56
56
  _getAnnotationsForViewportsWithDifferentCameras: (enabledElement: any, annotations: any) => any;
57
57
  _filterViewportWithSameOrientation: (enabledElement: any, referenceAnnotation: any, annotations: any) => any;
58
58
  _filterAnnotationsByUniqueViewportOrientations: (enabledElement: any, annotations: any) => any[];
59
- _checkIfViewportsRenderingSameScene: (viewport: any, otherViewport: any) => boolean;
59
+ _checkIfViewportsRenderingSameScene: (viewport: any, otherViewport: any) => any;
60
60
  _jump: (enabledElement: any, jumpWorld: any) => boolean;
61
61
  _activateModify: (element: any) => void;
62
62
  _deactivateModify: (element: any) => void;
@@ -846,16 +846,10 @@ class CrosshairsTool extends AnnotationTool {
846
846
  return otherViewportsAnnotationsWithUniqueCameras;
847
847
  };
848
848
  this._checkIfViewportsRenderingSameScene = (viewport, otherViewport) => {
849
- const actors = viewport.getActors();
850
- const otherViewportActors = otherViewport.getActors();
851
- let sameScene = true;
852
- actors.forEach((actor) => {
853
- if (actors.length !== otherViewportActors.length ||
854
- otherViewportActors.find(({ uid }) => uid === actor.uid) === undefined) {
855
- sameScene = false;
856
- }
857
- });
858
- return sameScene;
849
+ const volumeIds = viewport.getAllVolumeIds();
850
+ const otherVolumeIds = otherViewport.getAllVolumeIds();
851
+ return (volumeIds.length === otherVolumeIds.length &&
852
+ volumeIds.every((id) => otherVolumeIds.includes(id)));
859
853
  };
860
854
  this._jump = (enabledElement, jumpWorld) => {
861
855
  state.isInteractingWithTool = true;
@@ -34,6 +34,7 @@ export type Segmentation = {
34
34
  export type LabelmapRenderingConfig = {
35
35
  cfun: vtkColorTransferFunction;
36
36
  ofun: vtkPiecewiseFunction;
37
+ colorLUTIndex: number;
37
38
  };
38
39
  export type ContourRenderingConfig = {};
39
40
  export type SurfaceRenderingConfig = {};
@@ -87,7 +88,7 @@ export type RepresentationPublicInput = {
87
88
  segmentationId: string;
88
89
  type?: Enums.SegmentationRepresentations;
89
90
  config?: {
90
- colorLUTOrIndex?: Types.ColorLUT[] | number;
91
+ colorLUTOrIndex?: Types.ColorLUT | number;
91
92
  };
92
93
  };
93
94
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "2.2.10",
3
+ "version": "2.2.12",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -104,8 +104,8 @@
104
104
  "canvas": "^2.11.2"
105
105
  },
106
106
  "peerDependencies": {
107
- "@cornerstonejs/core": "^2.2.10",
108
- "@kitware/vtk.js": "32.1.0",
107
+ "@cornerstonejs/core": "^2.2.12",
108
+ "@kitware/vtk.js": "32.1.1",
109
109
  "@types/d3-array": "^3.0.4",
110
110
  "@types/d3-interpolate": "^3.0.1",
111
111
  "d3-array": "^3.2.3",
@@ -123,5 +123,5 @@
123
123
  "type": "individual",
124
124
  "url": "https://ohif.org/donate"
125
125
  },
126
- "gitHead": "8575aed359ecd7ca55caaa9b104deef54e44c7fb"
126
+ "gitHead": "dc01412c3f38ddfc4c0397e85a888887190fd1bf"
127
127
  }