@cornerstonejs/tools 3.11.7 → 3.12.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.
|
@@ -7,6 +7,7 @@ import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters'
|
|
|
7
7
|
import getWorldWidthAndHeightFromTwoPoints from '../../utilities/planar/getWorldWidthAndHeightFromTwoPoints';
|
|
8
8
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
9
9
|
import throttle from '../../utilities/throttle';
|
|
10
|
+
import debounce from '../../utilities/debounce';
|
|
10
11
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
11
12
|
import { hideElementCursor, resetElementCursor, } from '../../cursors/elementCursor';
|
|
12
13
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
@@ -26,10 +27,11 @@ class CircleROIStartEndThresholdTool extends CircleROITool {
|
|
|
26
27
|
configuration: {
|
|
27
28
|
storePointData: false,
|
|
28
29
|
numSlicesToPropagate: 10,
|
|
29
|
-
calculatePointsInsideVolume:
|
|
30
|
+
calculatePointsInsideVolume: true,
|
|
30
31
|
getTextLines: defaultGetTextLines,
|
|
31
32
|
statsCalculator: BasicStatsCalculator,
|
|
32
33
|
showTextBox: false,
|
|
34
|
+
throttleTimeout: 100,
|
|
33
35
|
},
|
|
34
36
|
}) {
|
|
35
37
|
super(toolProps, defaultToolProps);
|
|
@@ -133,13 +135,14 @@ class CircleROIStartEndThresholdTool extends CircleROITool {
|
|
|
133
135
|
}
|
|
134
136
|
const targetId = this.getTargetId(enabledElement.viewport);
|
|
135
137
|
const imageVolume = cache.getVolume(targetId.split(/volumeId:|\?/)[1]);
|
|
136
|
-
|
|
137
|
-
this._computePointsInsideVolume(annotation, imageVolume, targetId, enabledElement);
|
|
138
|
-
}
|
|
138
|
+
this._computePointsInsideVolume(annotation, imageVolume, targetId, enabledElement);
|
|
139
139
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
140
140
|
if (newAnnotation) {
|
|
141
141
|
triggerAnnotationCompleted(annotation);
|
|
142
142
|
}
|
|
143
|
+
else {
|
|
144
|
+
triggerAnnotationModified(annotation, element);
|
|
145
|
+
}
|
|
143
146
|
};
|
|
144
147
|
this.renderAnnotation = (enabledElement, svgDrawingHelper) => {
|
|
145
148
|
let renderStatus = false;
|
|
@@ -244,8 +247,7 @@ class CircleROIStartEndThresholdTool extends CircleROITool {
|
|
|
244
247
|
}
|
|
245
248
|
}
|
|
246
249
|
renderStatus = true;
|
|
247
|
-
if (this.configuration.showTextBox
|
|
248
|
-
this.configuration.calculatePointsInsideVolume == true) {
|
|
250
|
+
if (this.configuration.showTextBox) {
|
|
249
251
|
const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
|
|
250
252
|
if (!options.visibility) {
|
|
251
253
|
data.handles.textBox = {
|
|
@@ -284,7 +286,12 @@ class CircleROIStartEndThresholdTool extends CircleROITool {
|
|
|
284
286
|
}
|
|
285
287
|
return renderStatus;
|
|
286
288
|
};
|
|
287
|
-
|
|
289
|
+
if (this.configuration.calculatePointsInsideVolume) {
|
|
290
|
+
this._throttledCalculateCachedStats = throttle(this._calculateCachedStatsTool, this.configuration.throttleTimeout, { trailing: true });
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
this._throttledCalculateCachedStats = debounce(this._calculateCachedStatsTool, this.configuration.throttleTimeout);
|
|
294
|
+
}
|
|
288
295
|
}
|
|
289
296
|
_computeProjectionPoints(annotation, imageVolume) {
|
|
290
297
|
const { data, metadata } = annotation;
|
|
@@ -424,9 +431,7 @@ class CircleROIStartEndThresholdTool extends CircleROITool {
|
|
|
424
431
|
const targetId = this.getTargetId(viewport);
|
|
425
432
|
const imageVolume = cache.getVolume(targetId.split(/volumeId:|\?/)[1]);
|
|
426
433
|
this._computeProjectionPoints(annotation, imageVolume);
|
|
427
|
-
|
|
428
|
-
this._computePointsInsideVolume(annotation, imageVolume, targetId, enabledElement);
|
|
429
|
-
}
|
|
434
|
+
this._computePointsInsideVolume(annotation, imageVolume, targetId, enabledElement);
|
|
430
435
|
annotation.invalidated = false;
|
|
431
436
|
triggerAnnotationModified(annotation, viewport.element);
|
|
432
437
|
return cachedStats;
|
|
@@ -6,6 +6,7 @@ import { isAnnotationLocked } from '../../stateManagement/annotation/annotationL
|
|
|
6
6
|
import { drawHandles as drawHandlesSvg, drawRect as drawRectSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, } from '../../drawingSvg';
|
|
7
7
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
8
8
|
import throttle from '../../utilities/throttle';
|
|
9
|
+
import debounce from '../../utilities/debounce';
|
|
9
10
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
10
11
|
import getWorldWidthAndHeightFromCorners from '../../utilities/planar/getWorldWidthAndHeightFromCorners';
|
|
11
12
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
@@ -23,10 +24,11 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
|
|
|
23
24
|
configuration: {
|
|
24
25
|
storePointData: false,
|
|
25
26
|
numSlicesToPropagate: 10,
|
|
26
|
-
|
|
27
|
+
calculatePointsInsideVolume: true,
|
|
27
28
|
getTextLines: defaultGetTextLines,
|
|
28
29
|
statsCalculator: BasicStatsCalculator,
|
|
29
30
|
showTextBox: false,
|
|
31
|
+
throttleTimeout: 100,
|
|
30
32
|
},
|
|
31
33
|
}) {
|
|
32
34
|
super(toolProps, defaultToolProps);
|
|
@@ -135,13 +137,14 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
|
|
|
135
137
|
}
|
|
136
138
|
const targetId = this.getTargetId(enabledElement.viewport);
|
|
137
139
|
const imageVolume = cache.getVolume(targetId.split(/volumeId:|\?/)[1]);
|
|
138
|
-
|
|
139
|
-
this._computePointsInsideVolume(annotation, targetId, imageVolume, enabledElement);
|
|
140
|
-
}
|
|
140
|
+
this._computePointsInsideVolume(annotation, targetId, imageVolume, enabledElement);
|
|
141
141
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
142
142
|
if (newAnnotation) {
|
|
143
143
|
triggerAnnotationCompleted(annotation);
|
|
144
144
|
}
|
|
145
|
+
else {
|
|
146
|
+
triggerAnnotationModified(annotation, element);
|
|
147
|
+
}
|
|
145
148
|
};
|
|
146
149
|
this.renderAnnotation = (enabledElement, svgDrawingHelper) => {
|
|
147
150
|
let renderStatus = false;
|
|
@@ -230,8 +233,7 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
|
|
|
230
233
|
lineWidth,
|
|
231
234
|
});
|
|
232
235
|
renderStatus = true;
|
|
233
|
-
if (this.configuration.showTextBox
|
|
234
|
-
this.configuration.calculatePointsInsideVolume) {
|
|
236
|
+
if (this.configuration.showTextBox) {
|
|
235
237
|
const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
|
|
236
238
|
if (!options.visibility) {
|
|
237
239
|
data.handles.textBox = {
|
|
@@ -269,7 +271,12 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
|
|
|
269
271
|
}
|
|
270
272
|
return renderStatus;
|
|
271
273
|
};
|
|
272
|
-
|
|
274
|
+
if (this.configuration.calculatePointsInsideVolume) {
|
|
275
|
+
this._throttledCalculateCachedStats = throttle(this._calculateCachedStatsTool, this.configuration.throttleTimeout, { trailing: true });
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
this._throttledCalculateCachedStats = debounce(this._calculateCachedStatsTool, this.configuration.throttleTimeout);
|
|
279
|
+
}
|
|
273
280
|
}
|
|
274
281
|
_computeProjectionPoints(annotation, imageVolume) {
|
|
275
282
|
const { data, metadata } = annotation;
|
|
@@ -385,9 +392,7 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
|
|
|
385
392
|
const targetId = this.getTargetId(viewport);
|
|
386
393
|
const imageVolume = cache.getVolume(targetId.split(/volumeId:|\?/)[1]);
|
|
387
394
|
this._computeProjectionPoints(annotation, imageVolume);
|
|
388
|
-
|
|
389
|
-
this._computePointsInsideVolume(annotation, targetId, imageVolume, enabledElement);
|
|
390
|
-
}
|
|
395
|
+
this._computePointsInsideVolume(annotation, targetId, imageVolume, enabledElement);
|
|
391
396
|
annotation.invalidated = false;
|
|
392
397
|
triggerAnnotationModified(annotation, viewport.element);
|
|
393
398
|
return cachedStats;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.0",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"types": "./dist/esm/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"canvas": "^3.1.0"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
|
-
"@cornerstonejs/core": "^3.
|
|
106
|
+
"@cornerstonejs/core": "^3.12.0",
|
|
107
107
|
"@kitware/vtk.js": "32.12.1",
|
|
108
108
|
"@types/d3-array": "^3.0.4",
|
|
109
109
|
"@types/d3-interpolate": "^3.0.1",
|
|
@@ -122,5 +122,5 @@
|
|
|
122
122
|
"type": "individual",
|
|
123
123
|
"url": "https://ohif.org/donate"
|
|
124
124
|
},
|
|
125
|
-
"gitHead": "
|
|
125
|
+
"gitHead": "763786d4994c50236c5fe7f964546e758bdbe64d"
|
|
126
126
|
}
|