@cornerstonejs/tools 1.7.1 → 1.8.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/cursors/SVGCursorDescriptor.d.ts +1 -37
- package/dist/cjs/cursors/SVGCursorDescriptor.js +1 -3
- package/dist/cjs/cursors/SVGCursorDescriptor.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.d.ts +1 -0
- package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.js +8 -0
- package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/segmentationState.d.ts +2 -1
- package/dist/cjs/stateManagement/segmentation/segmentationState.js +9 -1
- package/dist/cjs/stateManagement/segmentation/segmentationState.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/eraseRectangle.js +0 -3
- package/dist/cjs/tools/segmentation/strategies/eraseRectangle.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillCircle.js +0 -3
- package/dist/cjs/tools/segmentation/strategies/fillCircle.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillRectangle.js +0 -3
- package/dist/cjs/tools/segmentation/strategies/fillRectangle.js.map +1 -1
- package/dist/esm/cursors/SVGCursorDescriptor.d.ts +1 -37
- package/dist/esm/cursors/SVGCursorDescriptor.js +1 -3
- package/dist/esm/cursors/SVGCursorDescriptor.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +8 -0
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/segmentationState.d.ts +2 -1
- package/dist/esm/stateManagement/segmentation/segmentationState.js +8 -1
- package/dist/esm/stateManagement/segmentation/segmentationState.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/eraseRectangle.js +0 -3
- package/dist/esm/tools/segmentation/strategies/eraseRectangle.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/fillCircle.js +0 -3
- package/dist/esm/tools/segmentation/strategies/fillCircle.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/fillRectangle.js +0 -3
- package/dist/esm/tools/segmentation/strategies/fillRectangle.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +4 -3
- package/src/cursors/SVGCursorDescriptor.ts +2 -4
- package/src/stateManagement/segmentation/SegmentationStateManager.ts +19 -0
- package/src/stateManagement/segmentation/segmentationState.ts +17 -0
- package/src/tools/segmentation/strategies/eraseRectangle.ts +0 -4
- package/src/tools/segmentation/strategies/fillCircle.ts +0 -4
- package/src/tools/segmentation/strategies/fillRectangle.ts +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "dist/umd/index.js",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build:cjs": "tsc --project ./tsconfig.cjs.json",
|
|
19
19
|
"build:esm": "tsc --project ./tsconfig.esm.json",
|
|
20
|
+
"build:esm:watch": "tsc --project ./tsconfig.esm.json --watch",
|
|
20
21
|
"build:umd": "cross-env NODE_ENV=production webpack --config .webpack/webpack.prod.js",
|
|
21
22
|
"build:all": "yarn run build:umd && yarn run build:cjs && yarn run build:esm",
|
|
22
23
|
"build": "yarn run build:all",
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@cornerstonejs/core": "^1.
|
|
32
|
+
"@cornerstonejs/core": "^1.8.0",
|
|
32
33
|
"lodash.clonedeep": "4.5.0",
|
|
33
34
|
"lodash.get": "^4.4.2"
|
|
34
35
|
},
|
|
@@ -51,5 +52,5 @@
|
|
|
51
52
|
"type": "individual",
|
|
52
53
|
"url": "https://ohif.org/donate"
|
|
53
54
|
},
|
|
54
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "adb02393675fbdb364b9b7d9a9f6d5113b15d8be"
|
|
55
56
|
}
|
|
@@ -39,7 +39,7 @@ const SCISSOR_ICON = `<path fill="{{color}}" d="M82.89,10a12.09,12.09,0,0,0-16.8
|
|
|
39
39
|
const RECTANGLE_ICON = `<path fill="{{color}}" d="M8.86,2.25V66.08H72.69V2.25H8.86ZM65.28,58.67h-49v-49h49v49Z" transform="translate(-8.86 -2.25)"/>`;
|
|
40
40
|
const CIRCLE_ICON = `<path fill="{{color}}" d="M40.77,2.25A31.92,31.92,0,1,0,72.69,34.16,31.92,31.92,0,0,0,40.77,2.25Zm0,57.63A25.71,25.71,0,1,1,66.48,34.16,25.71,25.71,0,0,1,40.77,59.87Z" transform="translate(-8.86 -2.25)"/>`;
|
|
41
41
|
|
|
42
|
-
const CursorSVG = {
|
|
42
|
+
const CursorSVG: Record<string, SVGCursorDescriptor> = {
|
|
43
43
|
Angle: extend(BASE, {
|
|
44
44
|
iconContent: `<path fill="{{color}}" d="M1203 544q0 13-10 23l-393 393 393 393q10 10 10 23t-10 23l-50
|
|
45
45
|
50q-10 10-23 10t-23-10l-466-466q-10-10-10-23t10-23l466-466q10-10 23-10t23
|
|
@@ -444,9 +444,7 @@ function registerCursor(
|
|
|
444
444
|
function getDefinedSVGCursorDescriptor(
|
|
445
445
|
name: string
|
|
446
446
|
): SVGCursorDescriptor | undefined {
|
|
447
|
-
|
|
448
|
-
return CursorSVG[name];
|
|
449
|
-
}
|
|
447
|
+
return CursorSVG[name];
|
|
450
448
|
}
|
|
451
449
|
|
|
452
450
|
/*
|
|
@@ -134,6 +134,25 @@ export default class SegmentationStateManager {
|
|
|
134
134
|
return toolGroupSegRepresentationsWithConfig.segmentationRepresentations;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Returns an array of all segmentation representations for all tool groups.
|
|
139
|
+
* @returns An array of ToolGroupSpecificRepresentations.
|
|
140
|
+
*/
|
|
141
|
+
getAllSegmentationRepresentations(): Record<
|
|
142
|
+
string,
|
|
143
|
+
ToolGroupSpecificRepresentation[]
|
|
144
|
+
> {
|
|
145
|
+
const toolGroupSegReps: Record<string, ToolGroupSpecificRepresentation[]> =
|
|
146
|
+
{};
|
|
147
|
+
Object.entries(this.state.toolGroups).forEach(
|
|
148
|
+
([toolGroupId, toolGroupSegRepresentationsWithConfig]) => {
|
|
149
|
+
toolGroupSegReps[toolGroupId] =
|
|
150
|
+
toolGroupSegRepresentationsWithConfig.segmentationRepresentations;
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
return toolGroupSegReps;
|
|
154
|
+
}
|
|
155
|
+
|
|
137
156
|
/**
|
|
138
157
|
* Add a new segmentation representation to the toolGroup's segmentation representations.
|
|
139
158
|
* @param toolGroupId - The Id of the tool group .
|
|
@@ -85,6 +85,18 @@ function getSegmentationRepresentations(
|
|
|
85
85
|
return segmentationStateManager.getSegmentationRepresentations(toolGroupId);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Get all segmentation representations in the state
|
|
90
|
+
* @returns An array of segmentation representation objects.
|
|
91
|
+
*/
|
|
92
|
+
function getAllSegmentationRepresentations(): Record<
|
|
93
|
+
string,
|
|
94
|
+
ToolGroupSpecificRepresentation[]
|
|
95
|
+
> {
|
|
96
|
+
const segmentationStateManager = getDefaultSegmentationStateManager();
|
|
97
|
+
return segmentationStateManager.getAllSegmentationRepresentations();
|
|
98
|
+
}
|
|
99
|
+
|
|
88
100
|
/**
|
|
89
101
|
* Get the tool group IDs that have a segmentation representation with the given
|
|
90
102
|
* segmentationId
|
|
@@ -92,6 +104,10 @@ function getSegmentationRepresentations(
|
|
|
92
104
|
* @returns An array of tool group IDs.
|
|
93
105
|
*/
|
|
94
106
|
function getToolGroupIdsWithSegmentation(segmentationId: string): string[] {
|
|
107
|
+
if (!segmentationId) {
|
|
108
|
+
throw new Error('getToolGroupIdsWithSegmentation: segmentationId is empty');
|
|
109
|
+
}
|
|
110
|
+
|
|
95
111
|
const segmentationStateManager = getDefaultSegmentationStateManager();
|
|
96
112
|
const state = segmentationStateManager.getState();
|
|
97
113
|
const toolGroupIds = Object.keys(state.toolGroups);
|
|
@@ -405,6 +421,7 @@ export {
|
|
|
405
421
|
setSegmentSpecificRepresentationConfig,
|
|
406
422
|
// helpers s
|
|
407
423
|
getToolGroupIdsWithSegmentation,
|
|
424
|
+
getAllSegmentationRepresentations,
|
|
408
425
|
getSegmentationRepresentationByUID,
|
|
409
426
|
// color
|
|
410
427
|
addColorLUT,
|
|
@@ -35,10 +35,6 @@ function eraseRectangle(
|
|
|
35
35
|
|
|
36
36
|
const boundsIJK = getBoundingBoxAroundShape(rectangleCornersIJK, dimensions);
|
|
37
37
|
|
|
38
|
-
if (boundsIJK.every(([min, max]) => min !== max)) {
|
|
39
|
-
throw new Error('Oblique segmentation tools are not supported yet');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
38
|
// Since always all points inside the boundsIJK is inside the rectangle...
|
|
43
39
|
const pointInShape = () => true;
|
|
44
40
|
|
|
@@ -68,10 +68,6 @@ function fillCircle(
|
|
|
68
68
|
|
|
69
69
|
const boundsIJK = getBoundingBoxAroundShape(ellipsoidCornersIJK, dimensions);
|
|
70
70
|
|
|
71
|
-
if (boundsIJK.every(([min, max]) => min !== max)) {
|
|
72
|
-
throw new Error('Oblique segmentation tools are not supported yet');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
71
|
// using circle as a form of ellipse
|
|
76
72
|
const ellipseObj = {
|
|
77
73
|
center: center as Types.Point3,
|
|
@@ -54,10 +54,6 @@ function fillRectangle(
|
|
|
54
54
|
|
|
55
55
|
const boundsIJK = getBoundingBoxAroundShape(rectangleCornersIJK, dimensions);
|
|
56
56
|
|
|
57
|
-
if (boundsIJK.every(([min, max]) => min !== max)) {
|
|
58
|
-
throw new Error('Oblique segmentation tools are not supported yet');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
57
|
// Since always all points inside the boundsIJK is inside the rectangle...
|
|
62
58
|
const pointInRectangle = () => true;
|
|
63
59
|
|