@cornerstonejs/core 1.62.0 → 1.63.0
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.
- package/dist/cjs/RenderingEngine/BaseVolumeViewport.js +5 -2
- package/dist/cjs/RenderingEngine/BaseVolumeViewport.js.map +1 -1
- package/dist/esm/RenderingEngine/BaseVolumeViewport.js +5 -2
- package/dist/esm/RenderingEngine/BaseVolumeViewport.js.map +1 -1
- package/dist/types/RenderingEngine/BaseVolumeViewport.d.ts.map +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
- package/src/RenderingEngine/BaseVolumeViewport.ts +31 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.63.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"type": "individual",
|
|
48
48
|
"url": "https://ohif.org/donate"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "952379ee23e86f276b66bc7f58c4b37431a35a53"
|
|
51
51
|
}
|
|
@@ -288,9 +288,9 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
|
|
|
288
288
|
|
|
289
289
|
if (!suppressEvents) {
|
|
290
290
|
const eventDetail = {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
viewportId: this.id,
|
|
292
|
+
colormap,
|
|
293
|
+
volumeId,
|
|
294
294
|
};
|
|
295
295
|
triggerEvent(this.element, Events.COLORMAP_MODIFIED, eventDetail);
|
|
296
296
|
}
|
|
@@ -827,7 +827,6 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
|
|
|
827
827
|
colormap = latestColormap;
|
|
828
828
|
}
|
|
829
829
|
|
|
830
|
-
|
|
831
830
|
return {
|
|
832
831
|
colormap: colormap,
|
|
833
832
|
voiRange: voiRange,
|
|
@@ -839,7 +838,6 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
|
|
|
839
838
|
};
|
|
840
839
|
};
|
|
841
840
|
|
|
842
|
-
|
|
843
841
|
/**
|
|
844
842
|
* This function extracts the nodes from the RGB Transfer Function, transforming each node's x, r, g, b properties
|
|
845
843
|
* into a unified array "RGB Points." Then, it compares these RGB Points—specifically the r, g, b values—with
|
|
@@ -856,50 +854,55 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
|
|
|
856
854
|
private getColormap = (applicableVolumeActorInfo) => {
|
|
857
855
|
const { volumeActor } = applicableVolumeActorInfo;
|
|
858
856
|
const cfun = volumeActor.getProperty().getRGBTransferFunction(0);
|
|
859
|
-
const { nodes } = cfun.getState()
|
|
857
|
+
const { nodes } = cfun.getState();
|
|
860
858
|
const RGBPoints = nodes.reduce((acc, node) => {
|
|
861
859
|
acc.push(node.x, node.r, node.g, node.b);
|
|
862
860
|
return acc;
|
|
863
|
-
}
|
|
864
|
-
, []);
|
|
861
|
+
}, []);
|
|
865
862
|
const colormaps = vtkColorMaps.rgbPresetNames.map((presetName) =>
|
|
866
|
-
|
|
863
|
+
vtkColorMaps.getPresetByName(presetName)
|
|
867
864
|
);
|
|
868
865
|
const matchedColormap = colormaps.find((colormap) => {
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
866
|
+
const { RGBPoints: presetRGBPoints } = colormap;
|
|
867
|
+
if (presetRGBPoints.length !== RGBPoints.length) {
|
|
868
|
+
return false;
|
|
869
|
+
}
|
|
873
870
|
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
)
|
|
878
|
-
|
|
879
|
-
|
|
871
|
+
for (let i = 0; i < presetRGBPoints.length; i += 4) {
|
|
872
|
+
if (
|
|
873
|
+
!isEqual(
|
|
874
|
+
presetRGBPoints.slice(i + 1, i + 4),
|
|
875
|
+
RGBPoints.slice(i + 1, i + 4)
|
|
876
|
+
)
|
|
877
|
+
) {
|
|
878
|
+
return false;
|
|
880
879
|
}
|
|
880
|
+
}
|
|
881
881
|
|
|
882
|
-
|
|
882
|
+
return true;
|
|
883
883
|
});
|
|
884
884
|
|
|
885
885
|
if (!matchedColormap) {
|
|
886
|
-
|
|
886
|
+
return null;
|
|
887
887
|
}
|
|
888
888
|
|
|
889
|
-
const opacityPoints = volumeActor
|
|
889
|
+
const opacityPoints = volumeActor
|
|
890
|
+
.getProperty()
|
|
891
|
+
.getScalarOpacity(0)
|
|
892
|
+
.getDataPointer();
|
|
890
893
|
|
|
891
|
-
const opacity = []
|
|
894
|
+
const opacity = [];
|
|
892
895
|
for (let i = 0; i < opacityPoints.length; i += 2) {
|
|
893
|
-
|
|
896
|
+
opacity.push({ value: opacityPoints[i], opacity: opacityPoints[i + 1] });
|
|
894
897
|
}
|
|
895
898
|
|
|
896
899
|
const colormap = {
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
}
|
|
900
|
+
name: matchedColormap.Name,
|
|
901
|
+
opacity: opacity,
|
|
902
|
+
};
|
|
900
903
|
|
|
901
904
|
return colormap;
|
|
902
|
-
}
|
|
905
|
+
};
|
|
903
906
|
|
|
904
907
|
/**
|
|
905
908
|
* Creates volume actors for all volumes defined in the `volumeInputArray`.
|