@cornerstonejs/tools 1.47.4 → 1.48.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/stateManagement/segmentation/config/segmentationVisibility.js +22 -6
- package/dist/cjs/stateManagement/segmentation/config/segmentationVisibility.js.map +1 -1
- package/dist/cjs/tools/annotation/AngleTool.js +4 -0
- package/dist/cjs/tools/annotation/AngleTool.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.js +22 -6
- package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.js.map +1 -1
- package/dist/esm/tools/annotation/AngleTool.js +5 -1
- package/dist/esm/tools/annotation/AngleTool.js.map +1 -1
- package/dist/types/stateManagement/segmentation/config/segmentationVisibility.d.ts.map +1 -1
- package/dist/types/tools/annotation/AngleTool.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/stateManagement/segmentation/config/segmentationVisibility.ts +26 -6
- package/src/tools/annotation/AngleTool.ts +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.48.0",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cornerstonejs/core": "^1.
|
|
32
|
+
"@cornerstonejs/core": "^1.48.0",
|
|
33
33
|
"comlink": "^4.4.1",
|
|
34
34
|
"lodash.clonedeep": "4.5.0",
|
|
35
35
|
"lodash.get": "^4.4.2"
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"type": "individual",
|
|
54
54
|
"url": "https://ohif.org/donate"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "ace7497b03ab306f179a3673f25a575c3152fc9e"
|
|
57
57
|
}
|
|
@@ -4,21 +4,41 @@ import { getSegmentationRepresentations } from '../../../stateManagement/segment
|
|
|
4
4
|
import { ToolGroupSpecificRepresentation } from '../../../types/SegmentationStateTypes';
|
|
5
5
|
import { triggerSegmentationRepresentationModified } from '../triggerSegmentationEvents';
|
|
6
6
|
import SegmentationRepresentations from '../../../enums/SegmentationRepresentations';
|
|
7
|
+
import { isVolumeSegmentation } from '../../../tools/segmentation/strategies/utils/stackVolumeCheck';
|
|
7
8
|
|
|
8
9
|
function getUniqueSegmentIndices(segmentationId) {
|
|
9
10
|
const segmentation = SegmentationState.getSegmentation(segmentationId);
|
|
10
11
|
|
|
11
12
|
if (segmentation.type === SegmentationRepresentations.Labelmap) {
|
|
12
|
-
const
|
|
13
|
-
|
|
13
|
+
const labelmapData =
|
|
14
|
+
segmentation.representationData[SegmentationRepresentations.Labelmap];
|
|
14
15
|
|
|
15
16
|
const keySet = {};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
|
|
18
|
+
if (isVolumeSegmentation(labelmapData)) {
|
|
19
|
+
const volume = cache.getVolume(segmentationId);
|
|
20
|
+
const scalarData = volume.getScalarData();
|
|
21
|
+
|
|
22
|
+
for (let i = 0; i < scalarData.length; i++) {
|
|
23
|
+
const segmentIndex = scalarData[i];
|
|
24
|
+
if (segmentIndex !== 0 && !keySet[segmentIndex]) {
|
|
25
|
+
keySet[segmentIndex] = true;
|
|
26
|
+
}
|
|
20
27
|
}
|
|
28
|
+
} else {
|
|
29
|
+
labelmapData.imageIdReferenceMap.forEach((segmentationImageId) => {
|
|
30
|
+
const image = cache.getImage(segmentationImageId);
|
|
31
|
+
const scalarData = image.getPixelData();
|
|
32
|
+
|
|
33
|
+
for (let i = 0; i < scalarData.length; i++) {
|
|
34
|
+
const segmentIndex = scalarData[i];
|
|
35
|
+
if (segmentIndex !== 0 && !keySet[segmentIndex]) {
|
|
36
|
+
keySet[segmentIndex] = true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
21
40
|
}
|
|
41
|
+
|
|
22
42
|
return Object.keys(keySet).map((it) => parseInt(it, 10));
|
|
23
43
|
} else if (segmentation.type === SegmentationRepresentations.Contour) {
|
|
24
44
|
const annotationUIDsMap =
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
getEnabledElement,
|
|
4
4
|
triggerEvent,
|
|
5
5
|
eventTarget,
|
|
6
|
+
utilities as csUtils,
|
|
6
7
|
} from '@cornerstonejs/core';
|
|
7
8
|
import type { Types } from '@cornerstonejs/core';
|
|
8
9
|
|
|
@@ -823,7 +824,15 @@ class AngleTool extends AnnotationTool {
|
|
|
823
824
|
[worldPos1, worldPos2],
|
|
824
825
|
[worldPos2, worldPos3]
|
|
825
826
|
);
|
|
827
|
+
const { dimensions, imageData } = this.getTargetIdImage(
|
|
828
|
+
targetId,
|
|
829
|
+
renderingEngine
|
|
830
|
+
);
|
|
826
831
|
|
|
832
|
+
// Decide if there's at least one handle is outside of image
|
|
833
|
+
this.isHandleOutsideImage = [worldPos1, worldPos2, worldPos3]
|
|
834
|
+
.map((worldPos) => csUtils.transformWorldToIndex(imageData, worldPos))
|
|
835
|
+
.some((index) => !csUtils.indexWithinDimensions(index, dimensions));
|
|
827
836
|
cachedStats[targetId] = {
|
|
828
837
|
angle: isNaN(angle) ? 'Incomplete Angle' : angle,
|
|
829
838
|
};
|