@cornerstonejs/tools 3.0.5 → 3.1.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/esm/enums/ChangeTypes.d.ts +2 -1
- package/dist/esm/enums/ChangeTypes.js +1 -0
- package/dist/esm/tools/SculptorTool.js +2 -2
- package/dist/esm/tools/annotation/AngleTool.js +5 -2
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js +6 -4
- package/dist/esm/tools/annotation/BidirectionalTool.js +6 -2
- package/dist/esm/tools/annotation/CircleROITool.js +6 -2
- package/dist/esm/tools/annotation/CobbAngleTool.js +5 -2
- package/dist/esm/tools/annotation/EllipticalROITool.js +6 -2
- package/dist/esm/tools/annotation/LengthTool.js +5 -2
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +2 -2
- package/dist/esm/tools/annotation/RectangleROITool.js +5 -2
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js +6 -2
- package/dist/esm/tools/base/AnnotationTool.d.ts +2 -15
- package/dist/esm/types/AnnotationTypes.d.ts +18 -16
- package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +1 -0
- package/dist/esm/utilities/index.d.ts +2 -1
- package/dist/esm/utilities/index.js +2 -1
- package/dist/esm/utilities/setAnnotationLabel.d.ts +2 -0
- package/dist/esm/utilities/setAnnotationLabel.js +6 -0
- package/package.json +3 -3
|
@@ -6,6 +6,7 @@ declare enum ChangeTypes {
|
|
|
6
6
|
Completed = "Completed",
|
|
7
7
|
InterpolationUpdated = "InterpolationUpdated",
|
|
8
8
|
History = "History",
|
|
9
|
-
MetadataReferenceModified = "MetadataReferenceModified"
|
|
9
|
+
MetadataReferenceModified = "MetadataReferenceModified",
|
|
10
|
+
LabelChange = "LabelChange"
|
|
10
11
|
}
|
|
11
12
|
export default ChangeTypes;
|
|
@@ -8,5 +8,6 @@ var ChangeTypes;
|
|
|
8
8
|
ChangeTypes["InterpolationUpdated"] = "InterpolationUpdated";
|
|
9
9
|
ChangeTypes["History"] = "History";
|
|
10
10
|
ChangeTypes["MetadataReferenceModified"] = "MetadataReferenceModified";
|
|
11
|
+
ChangeTypes["LabelChange"] = "LabelChange";
|
|
11
12
|
})(ChangeTypes || (ChangeTypes = {}));
|
|
12
13
|
export default ChangeTypes;
|
|
@@ -2,7 +2,7 @@ import { getEnabledElement } from '@cornerstonejs/core';
|
|
|
2
2
|
import { BaseTool } from './base';
|
|
3
3
|
import { getAnnotations } from '../stateManagement';
|
|
4
4
|
import { point } from '../utilities/math';
|
|
5
|
-
import { Events, ToolModes, AnnotationStyleStates } from '../enums';
|
|
5
|
+
import { Events, ToolModes, AnnotationStyleStates, ChangeTypes, } from '../enums';
|
|
6
6
|
import { triggerAnnotationRenderForViewportIds } from '../utilities/triggerAnnotationRenderForViewportIds';
|
|
7
7
|
import { hideElementCursor, resetElementCursor, } from '../cursors/elementCursor';
|
|
8
8
|
import { getStyleProperty } from '../stateManagement/annotation/config/helpers';
|
|
@@ -70,7 +70,7 @@ class SculptorTool extends BaseTool {
|
|
|
70
70
|
if (toolInstance.configuration.calculateStats) {
|
|
71
71
|
activeAnnotation.invalidated = true;
|
|
72
72
|
}
|
|
73
|
-
triggerAnnotationModified(activeAnnotation, element);
|
|
73
|
+
triggerAnnotationModified(activeAnnotation, element, ChangeTypes.HandlesUpdated);
|
|
74
74
|
};
|
|
75
75
|
this.dragCallback = (evt) => {
|
|
76
76
|
const eventData = evt.detail;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Events } from '../../enums';
|
|
1
|
+
import { ChangeTypes, Events } from '../../enums';
|
|
2
2
|
import { getEnabledElement, utilities as csUtils, getEnabledElementByViewportId, } from '@cornerstonejs/core';
|
|
3
3
|
import { AnnotationTool } from '../base';
|
|
4
4
|
import throttle from '../../utilities/throttle';
|
|
@@ -210,6 +210,9 @@ class AngleTool extends AnnotationTool {
|
|
|
210
210
|
const enabledElement = getEnabledElement(element);
|
|
211
211
|
const { renderingEngine } = enabledElement;
|
|
212
212
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
213
|
+
if (annotation.invalidated) {
|
|
214
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.HandlesUpdated);
|
|
215
|
+
}
|
|
213
216
|
};
|
|
214
217
|
this.cancel = (element) => {
|
|
215
218
|
if (this.isDrawing) {
|
|
@@ -465,7 +468,7 @@ class AngleTool extends AnnotationTool {
|
|
|
465
468
|
};
|
|
466
469
|
}
|
|
467
470
|
annotation.invalidated = false;
|
|
468
|
-
triggerAnnotationModified(annotation, element);
|
|
471
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
|
|
469
472
|
return cachedStats;
|
|
470
473
|
}
|
|
471
474
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Events } from '../../enums';
|
|
1
|
+
import { ChangeTypes, Events } from '../../enums';
|
|
2
2
|
import { getEnabledElement, utilities as csUtils, getEnabledElementByViewportId, } from '@cornerstonejs/core';
|
|
3
3
|
import { AnnotationTool } from '../base';
|
|
4
4
|
import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement/annotation/annotationState';
|
|
@@ -11,6 +11,7 @@ import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnota
|
|
|
11
11
|
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
12
12
|
import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
|
|
13
13
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
14
|
+
import { setAnnotationLabel } from '../../utilities';
|
|
14
15
|
class ArrowAnnotateTool extends AnnotationTool {
|
|
15
16
|
static { this.toolName = 'ArrowAnnotate'; }
|
|
16
17
|
constructor(toolProps = {}, defaultToolProps = {
|
|
@@ -127,7 +128,7 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
127
128
|
this._endCallback = (evt) => {
|
|
128
129
|
const eventDetail = evt.detail;
|
|
129
130
|
const { element } = eventDetail;
|
|
130
|
-
const { annotation, viewportIdsToRender, newAnnotation, hasMoved } = this.editData;
|
|
131
|
+
const { annotation, viewportIdsToRender, newAnnotation, hasMoved, movingTextBox, } = this.editData;
|
|
131
132
|
const { data } = annotation;
|
|
132
133
|
if (newAnnotation && !hasMoved) {
|
|
133
134
|
return;
|
|
@@ -152,11 +153,12 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
152
153
|
annotation.data.text = text;
|
|
153
154
|
triggerAnnotationCompleted(annotation);
|
|
154
155
|
this.createMemo(element, annotation, { newAnnotation: !!this.memo });
|
|
156
|
+
setAnnotationLabel(annotation, element, text);
|
|
155
157
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
156
158
|
});
|
|
157
159
|
}
|
|
158
|
-
else {
|
|
159
|
-
triggerAnnotationModified(annotation, element);
|
|
160
|
+
else if (!movingTextBox) {
|
|
161
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.HandlesUpdated);
|
|
160
162
|
}
|
|
161
163
|
this.doneEditMemo();
|
|
162
164
|
this.editData = null;
|
|
@@ -9,7 +9,7 @@ import { isAnnotationVisible } from '../../stateManagement/annotation/annotation
|
|
|
9
9
|
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
10
10
|
import { drawLine as drawLineSvg, drawHandles as drawHandlesSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, } from '../../drawingSvg';
|
|
11
11
|
import { state } from '../../store/state';
|
|
12
|
-
import { Events } from '../../enums';
|
|
12
|
+
import { ChangeTypes, Events } from '../../enums';
|
|
13
13
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
14
14
|
import * as lineSegment from '../../utilities/math/line';
|
|
15
15
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
@@ -219,6 +219,7 @@ class BidirectionalTool extends AnnotationTool {
|
|
|
219
219
|
data.handles.points[3] = viewport.canvasToWorld([endX, endY]);
|
|
220
220
|
annotation.invalidated = true;
|
|
221
221
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
222
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.HandlesUpdated);
|
|
222
223
|
this.editData.hasMoved = true;
|
|
223
224
|
};
|
|
224
225
|
this._dragModifyCallback = (evt) => {
|
|
@@ -254,6 +255,9 @@ class BidirectionalTool extends AnnotationTool {
|
|
|
254
255
|
annotation.invalidated = true;
|
|
255
256
|
}
|
|
256
257
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
258
|
+
if (annotation.invalidated) {
|
|
259
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.HandlesUpdated);
|
|
260
|
+
}
|
|
257
261
|
};
|
|
258
262
|
this._dragModifyHandle = (evt) => {
|
|
259
263
|
const eventDetail = evt.detail;
|
|
@@ -629,7 +633,7 @@ class BidirectionalTool extends AnnotationTool {
|
|
|
629
633
|
};
|
|
630
634
|
}
|
|
631
635
|
annotation.invalidated = false;
|
|
632
|
-
triggerAnnotationModified(annotation, element);
|
|
636
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
|
|
633
637
|
return cachedStats;
|
|
634
638
|
};
|
|
635
639
|
this._isInsideVolume = (index1, index2, index3, index4, dimensions) => {
|
|
@@ -8,7 +8,7 @@ import { isAnnotationVisible } from '../../stateManagement/annotation/annotation
|
|
|
8
8
|
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
9
9
|
import { drawCircle as drawCircleSvg, drawHandles as drawHandlesSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, } from '../../drawingSvg';
|
|
10
10
|
import { state } from '../../store/state';
|
|
11
|
-
import { Events } from '../../enums';
|
|
11
|
+
import { ChangeTypes, Events } from '../../enums';
|
|
12
12
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
13
13
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
14
14
|
import getWorldWidthAndHeightFromTwoPoints from '../../utilities/planar/getWorldWidthAndHeightFromTwoPoints';
|
|
@@ -196,6 +196,7 @@ class CircleROITool extends AnnotationTool {
|
|
|
196
196
|
annotation.invalidated = true;
|
|
197
197
|
this.editData.hasMoved = true;
|
|
198
198
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
199
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.HandlesUpdated);
|
|
199
200
|
};
|
|
200
201
|
this._dragModifyCallback = (evt) => {
|
|
201
202
|
this.isDrawing = true;
|
|
@@ -232,6 +233,9 @@ class CircleROITool extends AnnotationTool {
|
|
|
232
233
|
const enabledElement = getEnabledElement(element);
|
|
233
234
|
const { renderingEngine } = enabledElement;
|
|
234
235
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
236
|
+
if (annotation.invalidated) {
|
|
237
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.HandlesUpdated);
|
|
238
|
+
}
|
|
235
239
|
};
|
|
236
240
|
this._dragHandle = (evt) => {
|
|
237
241
|
const eventDetail = evt.detail;
|
|
@@ -552,7 +556,7 @@ class CircleROITool extends AnnotationTool {
|
|
|
552
556
|
}
|
|
553
557
|
}
|
|
554
558
|
annotation.invalidated = false;
|
|
555
|
-
triggerAnnotationModified(annotation, element);
|
|
559
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
|
|
556
560
|
return cachedStats;
|
|
557
561
|
};
|
|
558
562
|
this._isInsideVolume = (index1, index2, dimensions) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { vec3 } from 'gl-matrix';
|
|
2
|
-
import { Events } from '../../enums';
|
|
2
|
+
import { ChangeTypes, Events } from '../../enums';
|
|
3
3
|
import { getEnabledElement } from '@cornerstonejs/core';
|
|
4
4
|
import { AnnotationTool } from '../base';
|
|
5
5
|
import throttle from '../../utilities/throttle';
|
|
@@ -237,6 +237,9 @@ class CobbAngleTool extends AnnotationTool {
|
|
|
237
237
|
const enabledElement = getEnabledElement(element);
|
|
238
238
|
const { renderingEngine } = enabledElement;
|
|
239
239
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
240
|
+
if (annotation.invalidated) {
|
|
241
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.HandlesUpdated);
|
|
242
|
+
}
|
|
240
243
|
};
|
|
241
244
|
this.cancel = (element) => {
|
|
242
245
|
if (!this.isDrawing) {
|
|
@@ -672,7 +675,7 @@ class CobbAngleTool extends AnnotationTool {
|
|
|
672
675
|
};
|
|
673
676
|
}
|
|
674
677
|
annotation.invalidated = false;
|
|
675
|
-
triggerAnnotationModified(annotation, element);
|
|
678
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
|
|
676
679
|
return cachedStats;
|
|
677
680
|
}
|
|
678
681
|
}
|
|
@@ -8,7 +8,7 @@ import { isAnnotationVisible } from '../../stateManagement/annotation/annotation
|
|
|
8
8
|
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
9
9
|
import { drawCircle as drawCircleSvg, drawEllipseByCoordinates as drawEllipseSvg, drawHandles as drawHandlesSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, } from '../../drawingSvg';
|
|
10
10
|
import { state } from '../../store/state';
|
|
11
|
-
import { Events } from '../../enums';
|
|
11
|
+
import { ChangeTypes, Events } from '../../enums';
|
|
12
12
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
13
13
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
14
14
|
import getWorldWidthAndHeightFromTwoPoints from '../../utilities/planar/getWorldWidthAndHeightFromTwoPoints';
|
|
@@ -240,6 +240,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
240
240
|
annotation.invalidated = true;
|
|
241
241
|
this.editData.hasMoved = true;
|
|
242
242
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
243
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.HandlesUpdated);
|
|
243
244
|
};
|
|
244
245
|
this._dragModifyCallback = (evt) => {
|
|
245
246
|
this.isDrawing = true;
|
|
@@ -276,6 +277,9 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
276
277
|
const enabledElement = getEnabledElement(element);
|
|
277
278
|
const { renderingEngine } = enabledElement;
|
|
278
279
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
280
|
+
if (annotation.invalidated) {
|
|
281
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.HandlesUpdated);
|
|
282
|
+
}
|
|
279
283
|
};
|
|
280
284
|
this._dragHandle = (evt) => {
|
|
281
285
|
const eventDetail = evt.detail;
|
|
@@ -618,7 +622,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
618
622
|
};
|
|
619
623
|
}
|
|
620
624
|
annotation.invalidated = false;
|
|
621
|
-
triggerAnnotationModified(annotation, element);
|
|
625
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
|
|
622
626
|
return cachedStats;
|
|
623
627
|
};
|
|
624
628
|
this._isInsideVolume = (index1, index2, dimensions) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Events } from '../../enums';
|
|
1
|
+
import { Events, ChangeTypes } from '../../enums';
|
|
2
2
|
import { getEnabledElement, utilities as csUtils, utilities, getEnabledElementByViewportId, } from '@cornerstonejs/core';
|
|
3
3
|
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
4
4
|
import { AnnotationTool } from '../base';
|
|
@@ -187,6 +187,9 @@ class LengthTool extends AnnotationTool {
|
|
|
187
187
|
}
|
|
188
188
|
this.editData.hasMoved = true;
|
|
189
189
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
190
|
+
if (annotation.invalidated) {
|
|
191
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.HandlesUpdated);
|
|
192
|
+
}
|
|
190
193
|
};
|
|
191
194
|
this.cancel = (element) => {
|
|
192
195
|
if (this.isDrawing) {
|
|
@@ -448,7 +451,7 @@ class LengthTool extends AnnotationTool {
|
|
|
448
451
|
};
|
|
449
452
|
}
|
|
450
453
|
annotation.invalidated = false;
|
|
451
|
-
triggerAnnotationModified(annotation, element);
|
|
454
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
|
|
452
455
|
return cachedStats;
|
|
453
456
|
}
|
|
454
457
|
_isInsideVolume(index1, index2, dimensions) {
|
|
@@ -365,8 +365,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
365
365
|
}
|
|
366
366
|
if (!this.commonData?.movingTextBox) {
|
|
367
367
|
const { data } = annotation;
|
|
368
|
-
if (!data.cachedStats[targetId]
|
|
369
|
-
data.cachedStats[targetId].areaUnit == null) {
|
|
368
|
+
if (!data.cachedStats[targetId]?.unit) {
|
|
370
369
|
data.cachedStats[targetId] = {
|
|
371
370
|
Modality: null,
|
|
372
371
|
area: null,
|
|
@@ -374,6 +373,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
374
373
|
mean: null,
|
|
375
374
|
stdDev: null,
|
|
376
375
|
areaUnit: null,
|
|
376
|
+
unit: null,
|
|
377
377
|
};
|
|
378
378
|
this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
|
|
379
379
|
}
|
|
@@ -8,7 +8,7 @@ import { isAnnotationVisible } from '../../stateManagement/annotation/annotation
|
|
|
8
8
|
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
9
9
|
import { drawHandles as drawHandlesSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, drawRectByCoordinates as drawRectSvg, } from '../../drawingSvg';
|
|
10
10
|
import { state } from '../../store/state';
|
|
11
|
-
import { Events } from '../../enums';
|
|
11
|
+
import { ChangeTypes, Events } from '../../enums';
|
|
12
12
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
13
13
|
import * as rectangle from '../../utilities/math/rectangle';
|
|
14
14
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
@@ -242,6 +242,9 @@ class RectangleROITool extends AnnotationTool {
|
|
|
242
242
|
this.editData.hasMoved = true;
|
|
243
243
|
const enabledElement = getEnabledElement(element);
|
|
244
244
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
245
|
+
if (annotation.invalidated) {
|
|
246
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.HandlesUpdated);
|
|
247
|
+
}
|
|
245
248
|
};
|
|
246
249
|
this.cancel = (element) => {
|
|
247
250
|
if (this.isDrawing) {
|
|
@@ -504,7 +507,7 @@ class RectangleROITool extends AnnotationTool {
|
|
|
504
507
|
}
|
|
505
508
|
}
|
|
506
509
|
annotation.invalidated = false;
|
|
507
|
-
triggerAnnotationModified(annotation, element);
|
|
510
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.StatsUpdated);
|
|
508
511
|
return cachedStats;
|
|
509
512
|
};
|
|
510
513
|
this._isInsideVolume = (index1, index2, dimensions) => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { getEnabledElement, utilities } from '@cornerstonejs/core';
|
|
2
2
|
import { resetElementCursor, hideElementCursor, } from '../../../cursors/elementCursor';
|
|
3
|
-
import { Events } from '../../../enums';
|
|
3
|
+
import { ChangeTypes, Events } from '../../../enums';
|
|
4
4
|
import { state } from '../../../store/state';
|
|
5
5
|
import { vec3 } from 'gl-matrix';
|
|
6
6
|
import { shouldSmooth, getInterpolatedPoints, } from '../../../utilities/planarFreehandROITool/smoothPoints';
|
|
7
7
|
import getMouseModifierKey from '../../../eventDispatchers/shared/getMouseModifier';
|
|
8
8
|
import triggerAnnotationRenderForViewportIds from '../../../utilities/triggerAnnotationRenderForViewportIds';
|
|
9
|
-
import { triggerContourAnnotationCompleted } from '../../../stateManagement/annotation/helpers/state';
|
|
9
|
+
import { triggerAnnotationModified, triggerContourAnnotationCompleted, } from '../../../stateManagement/annotation/helpers/state';
|
|
10
10
|
import findOpenUShapedContourVectorToPeak from './findOpenUShapedContourVectorToPeak';
|
|
11
11
|
import { polyline } from '../../../utilities/math';
|
|
12
12
|
import { removeAnnotation } from '../../../stateManagement/annotation/annotationState';
|
|
@@ -97,8 +97,12 @@ function mouseDragDrawCallback(evt) {
|
|
|
97
97
|
const numPointsAdded = addCanvasPointsToArray(element, canvasPoints, canvasPos, this.commonData);
|
|
98
98
|
this.drawData.polylineIndex = polylineIndex + numPointsAdded;
|
|
99
99
|
}
|
|
100
|
+
annotation.invalidated = true;
|
|
100
101
|
}
|
|
101
102
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
103
|
+
if (annotation.invalidated) {
|
|
104
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.HandlesUpdated);
|
|
105
|
+
}
|
|
102
106
|
}
|
|
103
107
|
function mouseUpDrawCallback(evt) {
|
|
104
108
|
const { allowOpenContours } = this.configuration;
|
|
@@ -41,22 +41,9 @@ declare abstract class AnnotationTool extends AnnotationDisplayTool {
|
|
|
41
41
|
annotationUID: string;
|
|
42
42
|
data: {
|
|
43
43
|
[key: string]: unknown;
|
|
44
|
-
handles?:
|
|
45
|
-
points?: Types.Point3[];
|
|
46
|
-
activeHandleIndex?: number | null;
|
|
47
|
-
textBox?: {
|
|
48
|
-
hasMoved?: boolean;
|
|
49
|
-
worldPosition?: Types.Point3;
|
|
50
|
-
worldBoundingBox?: {
|
|
51
|
-
topLeft: Types.Point3;
|
|
52
|
-
topRight: Types.Point3;
|
|
53
|
-
bottomLeft: Types.Point3;
|
|
54
|
-
bottomRight: Types.Point3;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
[key: string]: unknown;
|
|
58
|
-
};
|
|
44
|
+
handles?: import("../../types/AnnotationTypes").Handles;
|
|
59
45
|
cachedStats?: Record<string, unknown>;
|
|
46
|
+
label?: string;
|
|
60
47
|
};
|
|
61
48
|
deleting: boolean;
|
|
62
49
|
};
|
|
@@ -16,23 +16,10 @@ type Annotation = {
|
|
|
16
16
|
viewUp?: Types.Point3;
|
|
17
17
|
};
|
|
18
18
|
data: {
|
|
19
|
-
handles?:
|
|
20
|
-
points?: Types.Point3[];
|
|
21
|
-
activeHandleIndex?: number | null;
|
|
22
|
-
textBox?: {
|
|
23
|
-
hasMoved?: boolean;
|
|
24
|
-
worldPosition?: Types.Point3;
|
|
25
|
-
worldBoundingBox?: {
|
|
26
|
-
topLeft: Types.Point3;
|
|
27
|
-
topRight: Types.Point3;
|
|
28
|
-
bottomLeft: Types.Point3;
|
|
29
|
-
bottomRight: Types.Point3;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
[key: string]: unknown;
|
|
33
|
-
};
|
|
19
|
+
handles?: Handles;
|
|
34
20
|
[key: string]: unknown;
|
|
35
21
|
cachedStats?: Record<string, unknown>;
|
|
22
|
+
label?: string;
|
|
36
23
|
};
|
|
37
24
|
};
|
|
38
25
|
type Annotations = Array<Annotation>;
|
|
@@ -42,4 +29,19 @@ type GroupSpecificAnnotations = {
|
|
|
42
29
|
type AnnotationState = {
|
|
43
30
|
[key: string]: GroupSpecificAnnotations;
|
|
44
31
|
};
|
|
45
|
-
|
|
32
|
+
type Handles = {
|
|
33
|
+
points?: Types.Point3[];
|
|
34
|
+
activeHandleIndex?: number | null;
|
|
35
|
+
textBox?: {
|
|
36
|
+
hasMoved?: boolean;
|
|
37
|
+
worldPosition?: Types.Point3;
|
|
38
|
+
worldBoundingBox?: {
|
|
39
|
+
topLeft: Types.Point3;
|
|
40
|
+
topRight: Types.Point3;
|
|
41
|
+
bottomLeft: Types.Point3;
|
|
42
|
+
bottomRight: Types.Point3;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
};
|
|
47
|
+
export type { Annotation, Annotations, GroupSpecificAnnotations, AnnotationState, Handles, };
|
|
@@ -37,4 +37,5 @@ import normalizeViewportPlane from './normalizeViewportPlane';
|
|
|
37
37
|
import IslandRemoval from './segmentation/islandRemoval';
|
|
38
38
|
import { getPixelValueUnits, getPixelValueUnitsImageId } from './getPixelValueUnits';
|
|
39
39
|
import * as geometricSurfaceUtils from './geometricSurfaceUtils';
|
|
40
|
-
|
|
40
|
+
import setAnnotationLabel from './setAnnotationLabel';
|
|
41
|
+
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, getCalibratedLengthUnitsAndScale, getCalibratedProbeUnitsAndValue, getCalibratedAspect, getPixelValueUnits, getPixelValueUnitsImageId, segmentation, contours, triggerAnnotationRenderForViewportIds, triggerAnnotationRenderForToolGroupIds, triggerAnnotationRender, getSphereBoundsInfo, getAnnotationNearPoint, getViewportForAnnotation, getAnnotationNearPointOnEnabledElement, viewport, cine, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, roundNumber, pointToString, polyDataUtils, voi, AnnotationMultiSlice, contourSegmentation, annotationHydration, getClosestImageIdForStackViewport, pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, geometricSurfaceUtils, setAnnotationLabel, };
|
|
@@ -37,4 +37,5 @@ import normalizeViewportPlane from './normalizeViewportPlane';
|
|
|
37
37
|
import IslandRemoval from './segmentation/islandRemoval';
|
|
38
38
|
import { getPixelValueUnits, getPixelValueUnitsImageId, } from './getPixelValueUnits';
|
|
39
39
|
import * as geometricSurfaceUtils from './geometricSurfaceUtils';
|
|
40
|
-
|
|
40
|
+
import setAnnotationLabel from './setAnnotationLabel';
|
|
41
|
+
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, getCalibratedLengthUnitsAndScale, getCalibratedProbeUnitsAndValue, getCalibratedAspect, getPixelValueUnits, getPixelValueUnitsImageId, segmentation, contours, triggerAnnotationRenderForViewportIds, triggerAnnotationRenderForToolGroupIds, triggerAnnotationRender, getSphereBoundsInfo, getAnnotationNearPoint, getViewportForAnnotation, getAnnotationNearPointOnEnabledElement, viewport, cine, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, roundNumber, pointToString, polyDataUtils, voi, AnnotationMultiSlice, contourSegmentation, annotationHydration, getClosestImageIdForStackViewport, pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, geometricSurfaceUtils, setAnnotationLabel, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { triggerAnnotationModified } from '../stateManagement/annotation/helpers/state';
|
|
2
|
+
import { ChangeTypes } from '../enums';
|
|
3
|
+
export default function setAnnotationLabel(annotation, element, updatedLabel) {
|
|
4
|
+
annotation.data.label = updatedLabel;
|
|
5
|
+
triggerAnnotationModified(annotation, element, ChangeTypes.LabelChange);
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.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": "^2.11.2"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
|
-
"@cornerstonejs/core": "^3.0
|
|
106
|
+
"@cornerstonejs/core": "^3.1.0",
|
|
107
107
|
"@kitware/vtk.js": "32.9.0",
|
|
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": "227a990a55bc2dbfb95757f0860ff1a52dd3ab86"
|
|
126
126
|
}
|