@cornerstonejs/tools 1.82.6 → 1.83.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/tools/segmentation/CircleROIStartEndThresholdTool.js +23 -20
- package/dist/cjs/tools/segmentation/CircleROIStartEndThresholdTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/RectangleROIStartEndThresholdTool.js +6 -5
- package/dist/cjs/tools/segmentation/RectangleROIStartEndThresholdTool.js.map +1 -1
- package/dist/esm/tools/segmentation/CircleROIStartEndThresholdTool.js +23 -20
- package/dist/esm/tools/segmentation/CircleROIStartEndThresholdTool.js.map +1 -1
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +6 -5
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js.map +1 -1
- package/dist/types/tools/segmentation/CircleROIStartEndThresholdTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/RectangleROIStartEndThresholdTool.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/tools/segmentation/CircleROIStartEndThresholdTool.ts +44 -33
- package/src/tools/segmentation/RectangleROIStartEndThresholdTool.ts +14 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.83.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.83.0",
|
|
33
33
|
"@icr/polyseg-wasm": "0.4.0",
|
|
34
34
|
"@types/offscreencanvas": "2019.7.3",
|
|
35
35
|
"comlink": "^4.4.1",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"type": "individual",
|
|
60
60
|
"url": "https://ohif.org/donate"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "b6bbf9b56de9aab45972d53e0c311280d5d8453f"
|
|
63
63
|
}
|
|
@@ -267,18 +267,6 @@ class CircleROIStartEndThresholdTool extends CircleROITool {
|
|
|
267
267
|
removeAnnotation(annotation.annotationUID);
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
const targetId = this.getTargetId(enabledElement.viewport);
|
|
271
|
-
const imageVolume = cache.getVolume(targetId.split(/volumeId:|\?/)[1]);
|
|
272
|
-
|
|
273
|
-
if (this.configuration.calculatePointsInsideVolume) {
|
|
274
|
-
this._computePointsInsideVolume(
|
|
275
|
-
annotation,
|
|
276
|
-
imageVolume,
|
|
277
|
-
targetId,
|
|
278
|
-
enabledElement
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
270
|
triggerAnnotationRenderForViewportIds(
|
|
283
271
|
enabledElement.renderingEngine,
|
|
284
272
|
viewportIdsToRender
|
|
@@ -346,53 +334,67 @@ class CircleROIStartEndThresholdTool extends CircleROITool {
|
|
|
346
334
|
const focalPoint = viewport.getCamera().focalPoint;
|
|
347
335
|
const viewplaneNormal = viewport.getCamera().viewPlaneNormal;
|
|
348
336
|
|
|
349
|
-
let
|
|
350
|
-
let
|
|
337
|
+
let tempStartCoordinate: number | vec3 = startCoordinate;
|
|
338
|
+
let tempEndCoordinate: number | vec3 = endCoordinate;
|
|
351
339
|
if (Array.isArray(startCoordinate)) {
|
|
352
|
-
|
|
353
|
-
|
|
340
|
+
tempStartCoordinate = this._getCoordinateForViewplaneNormal(
|
|
341
|
+
tempStartCoordinate,
|
|
354
342
|
viewplaneNormal
|
|
355
343
|
);
|
|
344
|
+
data.startCoordinate = tempStartCoordinate;
|
|
356
345
|
}
|
|
357
346
|
if (Array.isArray(endCoordinate)) {
|
|
358
|
-
|
|
359
|
-
|
|
347
|
+
tempEndCoordinate = this._getCoordinateForViewplaneNormal(
|
|
348
|
+
tempEndCoordinate,
|
|
360
349
|
viewplaneNormal
|
|
361
350
|
);
|
|
351
|
+
data.endCoordinate = tempEndCoordinate;
|
|
362
352
|
}
|
|
363
353
|
|
|
364
|
-
const
|
|
365
|
-
|
|
354
|
+
const roundedStartCoordinate = coreUtils.roundToPrecision(
|
|
355
|
+
data.startCoordinate
|
|
356
|
+
);
|
|
357
|
+
const roundedEndCoordinate = coreUtils.roundToPrecision(
|
|
358
|
+
data.endCoordinate
|
|
359
|
+
);
|
|
366
360
|
|
|
367
|
-
const
|
|
361
|
+
const cameraCoordinate = this._getCoordinateForViewplaneNormal(
|
|
368
362
|
focalPoint,
|
|
369
363
|
viewplaneNormal
|
|
370
364
|
);
|
|
371
|
-
const
|
|
365
|
+
const roundedCameraCoordinate =
|
|
366
|
+
coreUtils.roundToPrecision(cameraCoordinate);
|
|
372
367
|
|
|
373
368
|
// if the focalpoint is outside the start/end coordinates, we don't render
|
|
374
369
|
if (
|
|
375
|
-
|
|
376
|
-
|
|
370
|
+
roundedCameraCoordinate <
|
|
371
|
+
Math.min(roundedStartCoordinate, roundedEndCoordinate) ||
|
|
372
|
+
roundedCameraCoordinate >
|
|
373
|
+
Math.max(roundedStartCoordinate, roundedEndCoordinate)
|
|
377
374
|
) {
|
|
378
375
|
continue;
|
|
379
376
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
if (annotation.invalidated) {
|
|
383
|
-
this._throttledCalculateCachedStats(annotation, enabledElement);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
const middleCoord = coreUtils.roundToPrecision(
|
|
387
|
-
(startCoord + endCoord) / 2
|
|
377
|
+
const middleCoordinate = coreUtils.roundToPrecision(
|
|
378
|
+
(data.startCoordinate + data.endCoordinate) / 2
|
|
388
379
|
);
|
|
389
380
|
// if it is inside the start/end slice, but not exactly the first or
|
|
390
381
|
// last slice, we render the line in dash, but not the handles
|
|
391
382
|
|
|
392
383
|
let isMiddleSlice = false;
|
|
393
|
-
if (
|
|
384
|
+
if (roundedCameraCoordinate === middleCoordinate) {
|
|
394
385
|
isMiddleSlice = true;
|
|
395
386
|
}
|
|
387
|
+
|
|
388
|
+
data.handles.points[0][
|
|
389
|
+
this._getIndexOfCoordinatesForViewplaneNormal(viewplaneNormal)
|
|
390
|
+
] = middleCoordinate;
|
|
391
|
+
|
|
392
|
+
// WE HAVE TO CACHE STATS BEFORE FETCHING TEXT
|
|
393
|
+
|
|
394
|
+
if (annotation.invalidated) {
|
|
395
|
+
this._throttledCalculateCachedStats(annotation, enabledElement);
|
|
396
|
+
}
|
|
397
|
+
|
|
396
398
|
// If rendering engine has been destroyed while rendering
|
|
397
399
|
if (!viewport.getRenderingEngine()) {
|
|
398
400
|
console.warn('Rendering Engine has been destroyed');
|
|
@@ -768,6 +770,15 @@ class CircleROIStartEndThresholdTool extends CircleROITool {
|
|
|
768
770
|
// bring the logic for handle to some cachedStats calculation
|
|
769
771
|
this._computeProjectionPoints(annotation, imageVolume);
|
|
770
772
|
|
|
773
|
+
if (this.configuration.calculatePointsInsideVolume) {
|
|
774
|
+
this._computePointsInsideVolume(
|
|
775
|
+
annotation,
|
|
776
|
+
imageVolume,
|
|
777
|
+
targetId,
|
|
778
|
+
enabledElement
|
|
779
|
+
);
|
|
780
|
+
}
|
|
781
|
+
|
|
771
782
|
annotation.invalidated = false;
|
|
772
783
|
|
|
773
784
|
triggerAnnotationModified(annotation, viewport.element);
|
|
@@ -259,18 +259,6 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
|
|
|
259
259
|
removeAnnotation(annotation.annotationUID);
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
const targetId = this.getTargetId(enabledElement.viewport);
|
|
263
|
-
const imageVolume = cache.getVolume(targetId.split(/volumeId:|\?/)[1]);
|
|
264
|
-
|
|
265
|
-
if (this.configuration.calculatePointsInsideVolume) {
|
|
266
|
-
this._computePointsInsideVolume(
|
|
267
|
-
annotation,
|
|
268
|
-
targetId,
|
|
269
|
-
imageVolume,
|
|
270
|
-
enabledElement
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
262
|
triggerAnnotationRenderForViewportIds(
|
|
275
263
|
enabledElement.renderingEngine,
|
|
276
264
|
viewportIdsToRender
|
|
@@ -320,7 +308,6 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
|
|
|
320
308
|
|
|
321
309
|
// distance between start and end slice in the world coordinate
|
|
322
310
|
const distance = vec3.distance(startWorld, endWorld);
|
|
323
|
-
|
|
324
311
|
// for each point inside points, navigate in the direction of the viewPlaneNormal
|
|
325
312
|
// with amount of spacingInNormal, and calculate the next slice until we reach the distance
|
|
326
313
|
const newProjectionPoints = [];
|
|
@@ -334,7 +321,6 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
|
|
|
334
321
|
})
|
|
335
322
|
);
|
|
336
323
|
}
|
|
337
|
-
|
|
338
324
|
data.cachedStats.projectionPoints = newProjectionPoints;
|
|
339
325
|
}
|
|
340
326
|
|
|
@@ -481,6 +467,15 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
|
|
|
481
467
|
// bring the logic for handle to some cachedStats calculation
|
|
482
468
|
this._computeProjectionPoints(annotation, imageVolume);
|
|
483
469
|
|
|
470
|
+
if (this.configuration.calculatePointsInsideVolume) {
|
|
471
|
+
this._computePointsInsideVolume(
|
|
472
|
+
annotation,
|
|
473
|
+
targetId,
|
|
474
|
+
imageVolume,
|
|
475
|
+
enabledElement
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
|
|
484
479
|
annotation.invalidated = false;
|
|
485
480
|
|
|
486
481
|
// Dispatching annotation modified
|
|
@@ -547,6 +542,10 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
|
|
|
547
542
|
startCoord,
|
|
548
543
|
viewplaneNormal
|
|
549
544
|
);
|
|
545
|
+
data.startCoordinate = startCoord;
|
|
546
|
+
data.handles.points[0][
|
|
547
|
+
this._getIndexOfCoordinatesForViewplaneNormal(viewplaneNormal)
|
|
548
|
+
] = startCoord;
|
|
550
549
|
}
|
|
551
550
|
|
|
552
551
|
if (Array.isArray(endCoordinate)) {
|
|
@@ -554,6 +553,7 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
|
|
|
554
553
|
endCoord,
|
|
555
554
|
viewplaneNormal
|
|
556
555
|
);
|
|
556
|
+
data.endCoordinate = endCoord;
|
|
557
557
|
}
|
|
558
558
|
|
|
559
559
|
const roundedStartCoord = coreUtils.roundToPrecision(startCoord);
|