@cornerstonejs/tools 4.0.0-beta.5 → 4.0.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/tools/annotation/AngleTool.js +4 -36
- package/dist/esm/tools/annotation/ArrowAnnotateTool.d.ts +2 -2
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js +15 -50
- package/dist/esm/tools/annotation/BidirectionalTool.js +6 -41
- package/dist/esm/tools/annotation/CircleROITool.js +1 -36
- package/dist/esm/tools/annotation/CobbAngleTool.js +4 -36
- package/dist/esm/tools/annotation/EllipticalROITool.js +6 -43
- package/dist/esm/tools/annotation/HeightTool.js +4 -33
- package/dist/esm/tools/annotation/KeyImageTool.js +4 -4
- package/dist/esm/tools/annotation/LabelTool.d.ts +3 -3
- package/dist/esm/tools/annotation/LabelTool.js +14 -36
- package/dist/esm/tools/annotation/LengthTool.js +4 -33
- package/dist/esm/tools/annotation/SplineROITool.js +0 -2
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js +5 -34
- package/dist/esm/tools/base/AnnotationDisplayTool.d.ts +2 -1
- package/dist/esm/tools/base/AnnotationDisplayTool.js +39 -18
- package/dist/esm/tools/base/AnnotationTool.d.ts +0 -1
- package/dist/esm/tools/base/AnnotationTool.js +0 -31
- package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +5 -5
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +3 -3
|
@@ -34,44 +34,12 @@ class AngleTool extends AnnotationTool {
|
|
|
34
34
|
const eventDetail = evt.detail;
|
|
35
35
|
const { currentPoints, element } = eventDetail;
|
|
36
36
|
const worldPos = currentPoints.world;
|
|
37
|
-
const enabledElement = getEnabledElement(element);
|
|
38
|
-
const { viewport, renderingEngine } = enabledElement;
|
|
39
37
|
hideElementCursor(element);
|
|
40
38
|
this.isDrawing = true;
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const annotation = {
|
|
46
|
-
highlighted: true,
|
|
47
|
-
invalidated: true,
|
|
48
|
-
metadata: {
|
|
49
|
-
toolName: this.getToolName(),
|
|
50
|
-
viewPlaneNormal: [...viewPlaneNormal],
|
|
51
|
-
viewUp: [...viewUp],
|
|
52
|
-
FrameOfReferenceUID,
|
|
53
|
-
referencedImageId,
|
|
54
|
-
...viewport.getViewReference({ points: [worldPos] }),
|
|
55
|
-
},
|
|
56
|
-
data: {
|
|
57
|
-
handles: {
|
|
58
|
-
points: [[...worldPos], [...worldPos]],
|
|
59
|
-
activeHandleIndex: null,
|
|
60
|
-
textBox: {
|
|
61
|
-
hasMoved: false,
|
|
62
|
-
worldPosition: [0, 0, 0],
|
|
63
|
-
worldBoundingBox: {
|
|
64
|
-
topLeft: [0, 0, 0],
|
|
65
|
-
topRight: [0, 0, 0],
|
|
66
|
-
bottomLeft: [0, 0, 0],
|
|
67
|
-
bottomRight: [0, 0, 0],
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
label: '',
|
|
72
|
-
cachedStats: {},
|
|
73
|
-
},
|
|
74
|
-
};
|
|
39
|
+
const annotation = (this.createAnnotation(evt, [
|
|
40
|
+
[...worldPos],
|
|
41
|
+
[...worldPos],
|
|
42
|
+
]));
|
|
75
43
|
addAnnotation(annotation, element);
|
|
76
44
|
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
77
45
|
this.editData = {
|
|
@@ -16,7 +16,7 @@ declare class ArrowAnnotateTool extends AnnotationTool {
|
|
|
16
16
|
isDrawing: boolean;
|
|
17
17
|
isHandleOutsideImage: boolean;
|
|
18
18
|
constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps);
|
|
19
|
-
static hydrate: (viewportId: string, points: Types.Point3[],
|
|
19
|
+
static hydrate: (viewportId: string, points: Types.Point3[], label?: string, options?: {
|
|
20
20
|
annotationUID?: string;
|
|
21
21
|
toolInstance?: ArrowAnnotateTool;
|
|
22
22
|
referencedImageId?: string;
|
|
@@ -31,7 +31,7 @@ declare class ArrowAnnotateTool extends AnnotationTool {
|
|
|
31
31
|
_dragCallback: (evt: EventTypes.InteractionEventType) => void;
|
|
32
32
|
touchTapCallback: (evt: EventTypes.TouchTapEventType) => void;
|
|
33
33
|
doubleClickCallback: (evt: EventTypes.TouchTapEventType) => void;
|
|
34
|
-
_doneChangingTextCallback(element: any, annotation: any,
|
|
34
|
+
_doneChangingTextCallback(element: any, annotation: any, updatedLabel: any): void;
|
|
35
35
|
cancel: (element: HTMLDivElement) => string;
|
|
36
36
|
_activateModify: (element: HTMLDivElement) => void;
|
|
37
37
|
_deactivateModify: (element: HTMLDivElement) => void;
|
|
@@ -30,46 +30,16 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
30
30
|
const eventDetail = evt.detail;
|
|
31
31
|
const { currentPoints, element } = eventDetail;
|
|
32
32
|
const worldPos = currentPoints.world;
|
|
33
|
-
const enabledElement = getEnabledElement(element);
|
|
34
|
-
const { viewport, renderingEngine } = enabledElement;
|
|
35
33
|
hideElementCursor(element);
|
|
36
34
|
this.isDrawing = true;
|
|
37
|
-
const camera = viewport.getCamera();
|
|
38
|
-
const { viewPlaneNormal, viewUp } = camera;
|
|
39
|
-
const referencedImageId = this.getReferencedImageId(viewport, worldPos, viewPlaneNormal, viewUp);
|
|
40
35
|
const { arrowFirst } = this.configuration;
|
|
41
|
-
const
|
|
42
|
-
const annotation = {
|
|
43
|
-
highlighted: true,
|
|
44
|
-
invalidated: true,
|
|
45
|
-
metadata: {
|
|
46
|
-
toolName: this.getToolName(),
|
|
47
|
-
viewPlaneNormal: [...viewPlaneNormal],
|
|
48
|
-
viewUp: [...viewUp],
|
|
49
|
-
FrameOfReferenceUID,
|
|
50
|
-
referencedImageId,
|
|
51
|
-
...viewport.getViewReference({ points: [worldPos] }),
|
|
52
|
-
},
|
|
36
|
+
const annotation = this.createAnnotation(evt, [[...worldPos], [...worldPos]], {
|
|
53
37
|
data: {
|
|
54
|
-
text: '',
|
|
55
38
|
handles: {
|
|
56
|
-
points: [[...worldPos], [...worldPos]],
|
|
57
|
-
activeHandleIndex: null,
|
|
58
39
|
arrowFirst,
|
|
59
|
-
textBox: {
|
|
60
|
-
hasMoved: false,
|
|
61
|
-
worldPosition: [0, 0, 0],
|
|
62
|
-
worldBoundingBox: {
|
|
63
|
-
topLeft: [0, 0, 0],
|
|
64
|
-
topRight: [0, 0, 0],
|
|
65
|
-
bottomLeft: [0, 0, 0],
|
|
66
|
-
bottomRight: [0, 0, 0],
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
40
|
},
|
|
70
|
-
label: '',
|
|
71
41
|
},
|
|
72
|
-
};
|
|
42
|
+
});
|
|
73
43
|
addAnnotation(annotation, element);
|
|
74
44
|
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
75
45
|
this.editData = {
|
|
@@ -142,19 +112,19 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
142
112
|
removeAnnotation(annotation.annotationUID);
|
|
143
113
|
}
|
|
144
114
|
if (newAnnotation) {
|
|
145
|
-
this.configuration.getTextCallback((
|
|
146
|
-
if (!
|
|
115
|
+
this.configuration.getTextCallback((label) => {
|
|
116
|
+
if (!label) {
|
|
147
117
|
removeAnnotation(annotation.annotationUID);
|
|
148
118
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
149
119
|
this.editData = null;
|
|
150
120
|
this.isDrawing = false;
|
|
151
121
|
return;
|
|
152
122
|
}
|
|
153
|
-
annotation.data.
|
|
123
|
+
annotation.data.label = label;
|
|
154
124
|
triggerAnnotationModified(annotation, element, ChangeTypes.HandlesUpdated);
|
|
155
125
|
triggerAnnotationCompleted(annotation);
|
|
156
126
|
this.createMemo(element, annotation, { newAnnotation: !!this.memo });
|
|
157
|
-
setAnnotationLabel(annotation, element,
|
|
127
|
+
setAnnotationLabel(annotation, element, label);
|
|
158
128
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
159
129
|
});
|
|
160
130
|
}
|
|
@@ -305,7 +275,7 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
305
275
|
for (let i = 0; i < annotations.length; i++) {
|
|
306
276
|
const annotation = annotations[i];
|
|
307
277
|
const { annotationUID, data } = annotation;
|
|
308
|
-
const { handles,
|
|
278
|
+
const { handles, label } = data;
|
|
309
279
|
const { points, activeHandleIndex } = handles;
|
|
310
280
|
styleSpecifier.annotationUID = annotationUID;
|
|
311
281
|
const { color, lineWidth, lineDash, markerSize } = this.getAnnotationStyle({
|
|
@@ -353,7 +323,7 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
353
323
|
});
|
|
354
324
|
}
|
|
355
325
|
renderStatus = true;
|
|
356
|
-
if (!
|
|
326
|
+
if (!label) {
|
|
357
327
|
continue;
|
|
358
328
|
}
|
|
359
329
|
const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
|
|
@@ -377,7 +347,7 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
377
347
|
}
|
|
378
348
|
const textBoxPosition = viewport.worldToCanvas(data.handles.textBox.worldPosition);
|
|
379
349
|
const textBoxUID = '1';
|
|
380
|
-
const boundingBox = drawLinkedTextBoxSvg(svgDrawingHelper, annotationUID, textBoxUID, [
|
|
350
|
+
const boundingBox = drawLinkedTextBoxSvg(svgDrawingHelper, annotationUID, textBoxUID, [label], textBoxPosition, canvasCoordinates, {}, options);
|
|
381
351
|
const { x: left, y: top, width, height } = boundingBox;
|
|
382
352
|
data.handles.textBox.worldBoundingBox = {
|
|
383
353
|
topLeft: viewport.canvasToWorld([left, top]),
|
|
@@ -389,26 +359,22 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
389
359
|
return renderStatus;
|
|
390
360
|
};
|
|
391
361
|
}
|
|
392
|
-
static { this.hydrate = (viewportId, points,
|
|
362
|
+
static { this.hydrate = (viewportId, points, label, options) => {
|
|
393
363
|
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
394
364
|
if (!enabledElement) {
|
|
395
365
|
return;
|
|
396
366
|
}
|
|
397
367
|
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(ArrowAnnotateTool, enabledElement, points, options);
|
|
398
368
|
const { toolInstance, ...serializableOptions } = options || {};
|
|
399
|
-
const annotation = {
|
|
369
|
+
const annotation = this.createAnnotation({
|
|
400
370
|
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
401
371
|
data: {
|
|
402
|
-
|
|
372
|
+
label: label || '',
|
|
403
373
|
handles: {
|
|
404
374
|
points,
|
|
405
375
|
},
|
|
406
376
|
},
|
|
407
|
-
highlighted: false,
|
|
408
377
|
autoGenerated: false,
|
|
409
|
-
invalidated: false,
|
|
410
|
-
isLocked: false,
|
|
411
|
-
isVisible: true,
|
|
412
378
|
metadata: {
|
|
413
379
|
toolName: instance.getToolName(),
|
|
414
380
|
viewPlaneNormal,
|
|
@@ -416,7 +382,7 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
416
382
|
referencedImageId,
|
|
417
383
|
...serializableOptions,
|
|
418
384
|
},
|
|
419
|
-
};
|
|
385
|
+
});
|
|
420
386
|
addAnnotation(annotation, viewport.element);
|
|
421
387
|
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
422
388
|
}; }
|
|
@@ -447,9 +413,8 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
447
413
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
448
414
|
evt.preventDefault();
|
|
449
415
|
}
|
|
450
|
-
_doneChangingTextCallback(element, annotation,
|
|
451
|
-
annotation.data.
|
|
452
|
-
const enabledElement = getEnabledElement(element);
|
|
416
|
+
_doneChangingTextCallback(element, annotation, updatedLabel) {
|
|
417
|
+
annotation.data.label = updatedLabel;
|
|
453
418
|
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
454
419
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
455
420
|
triggerAnnotationModified(annotation, element);
|
|
@@ -654,48 +654,13 @@ class BidirectionalTool extends AnnotationTool {
|
|
|
654
654
|
const eventDetail = evt.detail;
|
|
655
655
|
const { currentPoints, element } = eventDetail;
|
|
656
656
|
const worldPos = currentPoints.world;
|
|
657
|
-
const enabledElement = getEnabledElement(element);
|
|
658
|
-
const { viewport, renderingEngine } = enabledElement;
|
|
659
657
|
this.isDrawing = true;
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
invalidated: true,
|
|
667
|
-
metadata: {
|
|
668
|
-
toolName: this.getToolName(),
|
|
669
|
-
viewPlaneNormal: [...viewPlaneNormal],
|
|
670
|
-
viewUp: [...viewUp],
|
|
671
|
-
FrameOfReferenceUID,
|
|
672
|
-
referencedImageId,
|
|
673
|
-
...viewport.getViewReference({ points: [worldPos] }),
|
|
674
|
-
},
|
|
675
|
-
data: {
|
|
676
|
-
handles: {
|
|
677
|
-
points: [
|
|
678
|
-
[...worldPos],
|
|
679
|
-
[...worldPos],
|
|
680
|
-
[...worldPos],
|
|
681
|
-
[...worldPos],
|
|
682
|
-
],
|
|
683
|
-
textBox: {
|
|
684
|
-
hasMoved: false,
|
|
685
|
-
worldPosition: [0, 0, 0],
|
|
686
|
-
worldBoundingBox: {
|
|
687
|
-
topLeft: [0, 0, 0],
|
|
688
|
-
topRight: [0, 0, 0],
|
|
689
|
-
bottomLeft: [0, 0, 0],
|
|
690
|
-
bottomRight: [0, 0, 0],
|
|
691
|
-
},
|
|
692
|
-
},
|
|
693
|
-
activeHandleIndex: null,
|
|
694
|
-
},
|
|
695
|
-
label: '',
|
|
696
|
-
cachedStats: {},
|
|
697
|
-
},
|
|
698
|
-
};
|
|
658
|
+
const annotation = this.createAnnotation(evt, [
|
|
659
|
+
[...worldPos],
|
|
660
|
+
[...worldPos],
|
|
661
|
+
[...worldPos],
|
|
662
|
+
[...worldPos],
|
|
663
|
+
]);
|
|
699
664
|
addAnnotation(annotation, element);
|
|
700
665
|
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
701
666
|
this.editData = {
|
|
@@ -42,13 +42,7 @@ class CircleROITool extends AnnotationTool {
|
|
|
42
42
|
const eventDetail = evt.detail;
|
|
43
43
|
const { currentPoints, element } = eventDetail;
|
|
44
44
|
const worldPos = currentPoints.world;
|
|
45
|
-
const enabledElement = getEnabledElement(element);
|
|
46
|
-
const { viewport } = enabledElement;
|
|
47
45
|
this.isDrawing = true;
|
|
48
|
-
const camera = viewport.getCamera();
|
|
49
|
-
const { viewPlaneNormal, viewUp } = camera;
|
|
50
|
-
const referencedImageId = this.getReferencedImageId(viewport, worldPos, viewPlaneNormal, viewUp);
|
|
51
|
-
const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
|
|
52
46
|
let points;
|
|
53
47
|
if (this.configuration.simplified) {
|
|
54
48
|
points = [[...worldPos], [...worldPos]];
|
|
@@ -62,36 +56,7 @@ class CircleROITool extends AnnotationTool {
|
|
|
62
56
|
[...worldPos],
|
|
63
57
|
];
|
|
64
58
|
}
|
|
65
|
-
const annotation =
|
|
66
|
-
highlighted: true,
|
|
67
|
-
invalidated: true,
|
|
68
|
-
metadata: {
|
|
69
|
-
toolName: this.getToolName(),
|
|
70
|
-
viewPlaneNormal: [...viewPlaneNormal],
|
|
71
|
-
viewUp: [...viewUp],
|
|
72
|
-
FrameOfReferenceUID,
|
|
73
|
-
referencedImageId,
|
|
74
|
-
...viewport.getViewReference({ points: [worldPos] }),
|
|
75
|
-
},
|
|
76
|
-
data: {
|
|
77
|
-
label: '',
|
|
78
|
-
handles: {
|
|
79
|
-
textBox: {
|
|
80
|
-
hasMoved: false,
|
|
81
|
-
worldPosition: [0, 0, 0],
|
|
82
|
-
worldBoundingBox: {
|
|
83
|
-
topLeft: [0, 0, 0],
|
|
84
|
-
topRight: [0, 0, 0],
|
|
85
|
-
bottomLeft: [0, 0, 0],
|
|
86
|
-
bottomRight: [0, 0, 0],
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
points,
|
|
90
|
-
activeHandleIndex: null,
|
|
91
|
-
},
|
|
92
|
-
cachedStats: {},
|
|
93
|
-
},
|
|
94
|
-
};
|
|
59
|
+
const annotation = this.createAnnotation(evt, points);
|
|
95
60
|
addAnnotation(annotation, element);
|
|
96
61
|
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
97
62
|
this.editData = {
|
|
@@ -36,44 +36,12 @@ class CobbAngleTool extends AnnotationTool {
|
|
|
36
36
|
const eventDetail = evt.detail;
|
|
37
37
|
const { currentPoints, element } = eventDetail;
|
|
38
38
|
const worldPos = currentPoints.world;
|
|
39
|
-
const enabledElement = getEnabledElement(element);
|
|
40
|
-
const { viewport, renderingEngine } = enabledElement;
|
|
41
39
|
hideElementCursor(element);
|
|
42
40
|
this.isDrawing = true;
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const annotation = {
|
|
48
|
-
highlighted: true,
|
|
49
|
-
invalidated: true,
|
|
50
|
-
metadata: {
|
|
51
|
-
toolName: this.getToolName(),
|
|
52
|
-
viewPlaneNormal: [...viewPlaneNormal],
|
|
53
|
-
viewUp: [...viewUp],
|
|
54
|
-
FrameOfReferenceUID,
|
|
55
|
-
referencedImageId,
|
|
56
|
-
...viewport.getViewReference({ points: [worldPos] }),
|
|
57
|
-
},
|
|
58
|
-
data: {
|
|
59
|
-
handles: {
|
|
60
|
-
points: [[...worldPos], [...worldPos]],
|
|
61
|
-
activeHandleIndex: null,
|
|
62
|
-
textBox: {
|
|
63
|
-
hasMoved: false,
|
|
64
|
-
worldPosition: [0, 0, 0],
|
|
65
|
-
worldBoundingBox: {
|
|
66
|
-
topLeft: [0, 0, 0],
|
|
67
|
-
topRight: [0, 0, 0],
|
|
68
|
-
bottomLeft: [0, 0, 0],
|
|
69
|
-
bottomRight: [0, 0, 0],
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
label: '',
|
|
74
|
-
cachedStats: {},
|
|
75
|
-
},
|
|
76
|
-
};
|
|
41
|
+
const annotation = (this.createAnnotation(evt, [
|
|
42
|
+
[...worldPos],
|
|
43
|
+
[...worldPos],
|
|
44
|
+
]));
|
|
77
45
|
addAnnotation(annotation, element);
|
|
78
46
|
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
79
47
|
this.editData = {
|
|
@@ -40,50 +40,13 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
40
40
|
const eventDetail = evt.detail;
|
|
41
41
|
const { currentPoints, element } = eventDetail;
|
|
42
42
|
const worldPos = currentPoints.world;
|
|
43
|
-
const canvasPos = currentPoints.canvas;
|
|
44
|
-
const enabledElement = getEnabledElement(element);
|
|
45
|
-
const { viewport, renderingEngine } = enabledElement;
|
|
46
43
|
this.isDrawing = true;
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
invalidated: true,
|
|
54
|
-
metadata: {
|
|
55
|
-
toolName: this.getToolName(),
|
|
56
|
-
viewPlaneNormal: [...viewPlaneNormal],
|
|
57
|
-
viewUp: [...viewUp],
|
|
58
|
-
FrameOfReferenceUID,
|
|
59
|
-
referencedImageId,
|
|
60
|
-
...viewport.getViewReference({ points: [worldPos] }),
|
|
61
|
-
},
|
|
62
|
-
data: {
|
|
63
|
-
label: '',
|
|
64
|
-
handles: {
|
|
65
|
-
textBox: {
|
|
66
|
-
hasMoved: false,
|
|
67
|
-
worldPosition: [0, 0, 0],
|
|
68
|
-
worldBoundingBox: {
|
|
69
|
-
topLeft: [0, 0, 0],
|
|
70
|
-
topRight: [0, 0, 0],
|
|
71
|
-
bottomLeft: [0, 0, 0],
|
|
72
|
-
bottomRight: [0, 0, 0],
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
points: [
|
|
76
|
-
[...worldPos],
|
|
77
|
-
[...worldPos],
|
|
78
|
-
[...worldPos],
|
|
79
|
-
[...worldPos],
|
|
80
|
-
],
|
|
81
|
-
activeHandleIndex: null,
|
|
82
|
-
},
|
|
83
|
-
cachedStats: {},
|
|
84
|
-
initialRotation: viewport.getRotation(),
|
|
85
|
-
},
|
|
86
|
-
};
|
|
44
|
+
const annotation = (this.createAnnotation(evt, [
|
|
45
|
+
[...worldPos],
|
|
46
|
+
[...worldPos],
|
|
47
|
+
[...worldPos],
|
|
48
|
+
[...worldPos],
|
|
49
|
+
]));
|
|
87
50
|
addAnnotation(annotation, element);
|
|
88
51
|
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
89
52
|
this.editData = {
|
|
@@ -29,41 +29,12 @@ class HeightTool extends AnnotationTool {
|
|
|
29
29
|
const eventDetail = evt.detail;
|
|
30
30
|
const { currentPoints, element } = eventDetail;
|
|
31
31
|
const worldPos = currentPoints.world;
|
|
32
|
-
const enabledElement = getEnabledElement(element);
|
|
33
|
-
const { viewport, renderingEngine } = enabledElement;
|
|
34
32
|
hideElementCursor(element);
|
|
35
33
|
this.isDrawing = true;
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
invalidated: true,
|
|
41
|
-
metadata: {
|
|
42
|
-
...viewport.getViewReference({ points: [worldPos] }),
|
|
43
|
-
toolName: this.getToolName(),
|
|
44
|
-
referencedImageId,
|
|
45
|
-
viewUp,
|
|
46
|
-
cameraPosition,
|
|
47
|
-
},
|
|
48
|
-
data: {
|
|
49
|
-
handles: {
|
|
50
|
-
points: [[...worldPos], [...worldPos]],
|
|
51
|
-
activeHandleIndex: null,
|
|
52
|
-
textBox: {
|
|
53
|
-
hasMoved: false,
|
|
54
|
-
worldPosition: [0, 0, 0],
|
|
55
|
-
worldBoundingBox: {
|
|
56
|
-
topLeft: [0, 0, 0],
|
|
57
|
-
topRight: [0, 0, 0],
|
|
58
|
-
bottomLeft: [0, 0, 0],
|
|
59
|
-
bottomRight: [0, 0, 0],
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
label: '',
|
|
64
|
-
cachedStats: {},
|
|
65
|
-
},
|
|
66
|
-
};
|
|
34
|
+
const annotation = (this.createAnnotation(evt, [
|
|
35
|
+
[...worldPos],
|
|
36
|
+
[...worldPos],
|
|
37
|
+
]));
|
|
67
38
|
addAnnotation(annotation, element);
|
|
68
39
|
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
69
40
|
this.editData = {
|
|
@@ -50,14 +50,14 @@ class KeyImageTool extends AnnotationTool {
|
|
|
50
50
|
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
51
51
|
evt.preventDefault();
|
|
52
52
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
53
|
-
this.configuration.getTextCallback((
|
|
54
|
-
if (!
|
|
53
|
+
this.configuration.getTextCallback((label) => {
|
|
54
|
+
if (!label) {
|
|
55
55
|
removeAnnotation(annotation.annotationUID);
|
|
56
56
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
57
57
|
this.isDrawing = false;
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
annotation.data.
|
|
60
|
+
annotation.data.label = label;
|
|
61
61
|
triggerAnnotationCompleted(annotation);
|
|
62
62
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
63
63
|
});
|
|
@@ -233,7 +233,7 @@ class KeyImageTool extends AnnotationTool {
|
|
|
233
233
|
triggerAnnotationModified(annotation, element);
|
|
234
234
|
}
|
|
235
235
|
_doneChangingTextCallback(element, annotation, updatedText) {
|
|
236
|
-
annotation.data.
|
|
236
|
+
annotation.data.label = updatedText;
|
|
237
237
|
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
238
238
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
239
239
|
triggerAnnotationModified(annotation, element);
|
|
@@ -15,15 +15,15 @@ declare class LabelTool extends AnnotationTool {
|
|
|
15
15
|
isHandleOutsideImage: boolean;
|
|
16
16
|
constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps);
|
|
17
17
|
isPointNearTool: (element: HTMLDivElement, annotation: LabelAnnotation, canvasCoords: Types.Point2, proximity: number) => boolean;
|
|
18
|
-
static hydrate: (viewportId: string, position: Types.Point3,
|
|
18
|
+
static hydrate: (viewportId: string, position: Types.Point3, label: string, options?: {
|
|
19
19
|
annotationUID?: string;
|
|
20
20
|
}) => LabelAnnotation;
|
|
21
21
|
addNewAnnotation: (evt: EventTypes.InteractionEventType) => LabelAnnotation;
|
|
22
|
-
handleSelectedCallback(
|
|
22
|
+
handleSelectedCallback(_evt: EventTypes.InteractionEventType, _annotation: Annotation, _handle: ToolHandle, _interactionType: InteractionTypes): void;
|
|
23
23
|
toolSelectedCallback: (evt: EventTypes.InteractionEventType, annotation: LabelAnnotation) => void;
|
|
24
24
|
_endCallback: (evt: EventTypes.InteractionEventType) => void;
|
|
25
25
|
_dragCallback: (evt: EventTypes.InteractionEventType) => void;
|
|
26
|
-
_doneChangingTextCallback(element: any, annotation: any,
|
|
26
|
+
_doneChangingTextCallback(element: any, annotation: any, updatedLabel: any): void;
|
|
27
27
|
cancel: (element: HTMLDivElement) => string;
|
|
28
28
|
_activateModify: (element: HTMLDivElement) => void;
|
|
29
29
|
_deactivateModify: (element: HTMLDivElement) => void;
|
|
@@ -64,34 +64,12 @@ class LabelTool extends AnnotationTool {
|
|
|
64
64
|
const eventDetail = evt.detail;
|
|
65
65
|
const { currentPoints, element } = eventDetail;
|
|
66
66
|
const worldPos = currentPoints.world;
|
|
67
|
-
const enabledElement = getEnabledElement(element);
|
|
68
|
-
const { viewport } = enabledElement;
|
|
69
67
|
hideElementCursor(element);
|
|
70
68
|
this.isDrawing = true;
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const annotation = {
|
|
76
|
-
annotationUID: null,
|
|
77
|
-
highlighted: true,
|
|
78
|
-
invalidated: true,
|
|
79
|
-
metadata: {
|
|
80
|
-
toolName: this.getToolName(),
|
|
81
|
-
viewPlaneNormal: [...viewPlaneNormal],
|
|
82
|
-
viewUp: [...viewUp],
|
|
83
|
-
FrameOfReferenceUID,
|
|
84
|
-
referencedImageId,
|
|
85
|
-
...viewport.getViewReference({ points: [worldPos] }),
|
|
86
|
-
},
|
|
87
|
-
data: {
|
|
88
|
-
text: '',
|
|
89
|
-
handles: {
|
|
90
|
-
points: [[...worldPos], [...worldPos]],
|
|
91
|
-
},
|
|
92
|
-
label: '',
|
|
93
|
-
},
|
|
94
|
-
};
|
|
69
|
+
const annotation = (this.createAnnotation(evt, [
|
|
70
|
+
[...worldPos],
|
|
71
|
+
[...worldPos],
|
|
72
|
+
]));
|
|
95
73
|
addAnnotation(annotation, element);
|
|
96
74
|
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
97
75
|
this.editData = {
|
|
@@ -102,15 +80,15 @@ class LabelTool extends AnnotationTool {
|
|
|
102
80
|
};
|
|
103
81
|
evt.preventDefault();
|
|
104
82
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
105
|
-
this.configuration.getTextCallback((
|
|
106
|
-
if (!
|
|
83
|
+
this.configuration.getTextCallback((label) => {
|
|
84
|
+
if (!label) {
|
|
107
85
|
removeAnnotation(annotation.annotationUID);
|
|
108
86
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
109
87
|
this.isDrawing = false;
|
|
110
88
|
return;
|
|
111
89
|
}
|
|
112
90
|
resetElementCursor(element);
|
|
113
|
-
annotation.data.
|
|
91
|
+
annotation.data.label = label;
|
|
114
92
|
triggerAnnotationCompleted(annotation);
|
|
115
93
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
116
94
|
});
|
|
@@ -266,12 +244,12 @@ class LabelTool extends AnnotationTool {
|
|
|
266
244
|
if (!isAnnotationVisible(annotationUID)) {
|
|
267
245
|
continue;
|
|
268
246
|
}
|
|
269
|
-
if (!data.
|
|
247
|
+
if (!data.label) {
|
|
270
248
|
continue;
|
|
271
249
|
}
|
|
272
250
|
const options = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
|
|
273
251
|
const textBoxUID = '1';
|
|
274
|
-
drawTextBoxSvg(svgDrawingHelper, annotationUID, textBoxUID, [data.
|
|
252
|
+
drawTextBoxSvg(svgDrawingHelper, annotationUID, textBoxUID, [data.label], canvasCoordinates, {
|
|
275
253
|
...options,
|
|
276
254
|
padding: 0,
|
|
277
255
|
});
|
|
@@ -279,7 +257,7 @@ class LabelTool extends AnnotationTool {
|
|
|
279
257
|
return renderStatus;
|
|
280
258
|
};
|
|
281
259
|
}
|
|
282
|
-
static { this.hydrate = (viewportId, position,
|
|
260
|
+
static { this.hydrate = (viewportId, position, label, options) => {
|
|
283
261
|
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
284
262
|
if (!enabledElement) {
|
|
285
263
|
return;
|
|
@@ -292,7 +270,7 @@ class LabelTool extends AnnotationTool {
|
|
|
292
270
|
const annotation = {
|
|
293
271
|
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
294
272
|
data: {
|
|
295
|
-
|
|
273
|
+
label,
|
|
296
274
|
handles: {
|
|
297
275
|
points: [position],
|
|
298
276
|
},
|
|
@@ -313,9 +291,9 @@ class LabelTool extends AnnotationTool {
|
|
|
313
291
|
addAnnotation(annotation, viewport.element);
|
|
314
292
|
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
315
293
|
}; }
|
|
316
|
-
handleSelectedCallback(
|
|
317
|
-
_doneChangingTextCallback(element, annotation,
|
|
318
|
-
annotation.data.
|
|
294
|
+
handleSelectedCallback(_evt, _annotation, _handle, _interactionType) { }
|
|
295
|
+
_doneChangingTextCallback(element, annotation, updatedLabel) {
|
|
296
|
+
annotation.data.label = updatedLabel;
|
|
319
297
|
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
320
298
|
triggerAnnotationRenderForViewportIds(viewportIdsToRender);
|
|
321
299
|
triggerAnnotationModified(annotation, element);
|
|
@@ -39,41 +39,12 @@ class LengthTool extends AnnotationTool {
|
|
|
39
39
|
const eventDetail = evt.detail;
|
|
40
40
|
const { currentPoints, element } = eventDetail;
|
|
41
41
|
const worldPos = currentPoints.world;
|
|
42
|
-
const enabledElement = getEnabledElement(element);
|
|
43
|
-
const { viewport } = enabledElement;
|
|
44
42
|
hideElementCursor(element);
|
|
45
43
|
this.isDrawing = true;
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
invalidated: true,
|
|
51
|
-
metadata: {
|
|
52
|
-
...viewport.getViewReference({ points: [worldPos] }),
|
|
53
|
-
toolName: this.getToolName(),
|
|
54
|
-
referencedImageId,
|
|
55
|
-
viewUp,
|
|
56
|
-
cameraPosition,
|
|
57
|
-
},
|
|
58
|
-
data: {
|
|
59
|
-
handles: {
|
|
60
|
-
points: [[...worldPos], [...worldPos]],
|
|
61
|
-
activeHandleIndex: null,
|
|
62
|
-
textBox: {
|
|
63
|
-
hasMoved: false,
|
|
64
|
-
worldPosition: [0, 0, 0],
|
|
65
|
-
worldBoundingBox: {
|
|
66
|
-
topLeft: [0, 0, 0],
|
|
67
|
-
topRight: [0, 0, 0],
|
|
68
|
-
bottomLeft: [0, 0, 0],
|
|
69
|
-
bottomRight: [0, 0, 0],
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
label: '',
|
|
74
|
-
cachedStats: {},
|
|
75
|
-
},
|
|
76
|
-
};
|
|
44
|
+
const annotation = (this.createAnnotation(evt, [
|
|
45
|
+
[...worldPos],
|
|
46
|
+
[...worldPos],
|
|
47
|
+
]));
|
|
77
48
|
addAnnotation(annotation, element);
|
|
78
49
|
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
79
50
|
this.editData = {
|
|
@@ -534,8 +534,6 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
534
534
|
const { canvas: canvasPos } = currentPoints;
|
|
535
535
|
const contourHoleProcessingEnabled = getMouseModifierKey(evt.detail.event) ===
|
|
536
536
|
this.configuration.contourHoleAdditionModifierKey;
|
|
537
|
-
const enabledElement = getEnabledElement(element);
|
|
538
|
-
const { renderingEngine } = enabledElement;
|
|
539
537
|
const annotation = this.createAnnotation(evt);
|
|
540
538
|
this.isDrawing = true;
|
|
541
539
|
this.addAnnotation(annotation, element);
|
|
@@ -34,45 +34,16 @@ class UltrasoundDirectionalTool extends AnnotationTool {
|
|
|
34
34
|
const { currentPoints, element } = eventDetail;
|
|
35
35
|
const worldPos = currentPoints.world;
|
|
36
36
|
const enabledElement = getEnabledElement(element);
|
|
37
|
-
const { viewport
|
|
37
|
+
const { viewport } = enabledElement;
|
|
38
38
|
if (!(viewport instanceof StackViewport)) {
|
|
39
39
|
throw new Error('UltrasoundDirectionalTool can only be used on a StackViewport');
|
|
40
40
|
}
|
|
41
41
|
hideElementCursor(element);
|
|
42
42
|
this.isDrawing = true;
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const annotation = {
|
|
48
|
-
highlighted: true,
|
|
49
|
-
invalidated: true,
|
|
50
|
-
metadata: {
|
|
51
|
-
toolName: this.getToolName(),
|
|
52
|
-
viewPlaneNormal: [...viewPlaneNormal],
|
|
53
|
-
viewUp: [...viewUp],
|
|
54
|
-
FrameOfReferenceUID,
|
|
55
|
-
referencedImageId,
|
|
56
|
-
},
|
|
57
|
-
data: {
|
|
58
|
-
handles: {
|
|
59
|
-
points: [[...worldPos], [...worldPos]],
|
|
60
|
-
activeHandleIndex: null,
|
|
61
|
-
textBox: {
|
|
62
|
-
hasMoved: false,
|
|
63
|
-
worldPosition: [0, 0, 0],
|
|
64
|
-
worldBoundingBox: {
|
|
65
|
-
topLeft: [0, 0, 0],
|
|
66
|
-
topRight: [0, 0, 0],
|
|
67
|
-
bottomLeft: [0, 0, 0],
|
|
68
|
-
bottomRight: [0, 0, 0],
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
label: '',
|
|
73
|
-
cachedStats: {},
|
|
74
|
-
},
|
|
75
|
-
};
|
|
43
|
+
const annotation = (this.createAnnotation(evt, [
|
|
44
|
+
[...worldPos],
|
|
45
|
+
[...worldPos],
|
|
46
|
+
]));
|
|
76
47
|
addAnnotation(annotation, element);
|
|
77
48
|
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
78
49
|
this.editData = {
|
|
@@ -7,7 +7,8 @@ declare abstract class AnnotationDisplayTool extends BaseTool {
|
|
|
7
7
|
abstract renderAnnotation(enabledElement: Types.IEnabledElement, svgDrawingHelper: SVGDrawingHelper): any;
|
|
8
8
|
filterInteractableAnnotationsForElement(element: HTMLDivElement, annotations: Annotations): Annotations;
|
|
9
9
|
onImageSpacingCalibrated: (evt: Types.EventTypes.ImageSpacingCalibratedEvent) => void;
|
|
10
|
-
|
|
10
|
+
static createAnnotation(...annotationBaseData: any[]): Annotation;
|
|
11
|
+
protected createAnnotation(evt: EventTypes.InteractionEventType, points?: Types.Point3[], ...annotationBaseData: any[]): Annotation;
|
|
11
12
|
protected getReferencedImageId(viewport: Types.IViewport, worldPos: Types.Point3, viewPlaneNormal: Types.Point3, viewUp?: Types.Point3): string;
|
|
12
13
|
getStyle(property: string, specifications: StyleSpecifier, annotation?: Annotation): unknown;
|
|
13
14
|
}
|
|
@@ -41,30 +41,19 @@ class AnnotationDisplayTool extends BaseTool {
|
|
|
41
41
|
const { viewport } = enabledElement;
|
|
42
42
|
return filterAnnotationsForDisplay(viewport, annotations);
|
|
43
43
|
}
|
|
44
|
-
createAnnotation(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const { world: worldPos } = currentPoints;
|
|
48
|
-
const enabledElement = getEnabledElement(element);
|
|
49
|
-
const { viewport } = enabledElement;
|
|
50
|
-
const camera = viewport.getCamera();
|
|
51
|
-
const { viewPlaneNormal, viewUp, position: cameraPosition } = camera;
|
|
52
|
-
const referencedImageId = this.getReferencedImageId(viewport, worldPos, viewPlaneNormal, viewUp);
|
|
53
|
-
const viewReference = viewport.getViewReference({ points: [worldPos] });
|
|
54
|
-
return {
|
|
44
|
+
static createAnnotation(...annotationBaseData) {
|
|
45
|
+
let annotation = {
|
|
46
|
+
annotationUID: null,
|
|
55
47
|
highlighted: true,
|
|
56
48
|
invalidated: true,
|
|
49
|
+
isLocked: false,
|
|
50
|
+
isVisible: true,
|
|
57
51
|
metadata: {
|
|
58
|
-
toolName: this.
|
|
59
|
-
...viewReference,
|
|
60
|
-
referencedImageId,
|
|
61
|
-
viewUp,
|
|
62
|
-
cameraPosition,
|
|
52
|
+
toolName: this.toolName,
|
|
63
53
|
},
|
|
64
54
|
data: {
|
|
65
|
-
cachedStats: {},
|
|
66
55
|
handles: {
|
|
67
|
-
points:
|
|
56
|
+
points: new Array(),
|
|
68
57
|
activeHandleIndex: null,
|
|
69
58
|
textBox: {
|
|
70
59
|
hasMoved: false,
|
|
@@ -77,8 +66,40 @@ class AnnotationDisplayTool extends BaseTool {
|
|
|
77
66
|
},
|
|
78
67
|
},
|
|
79
68
|
},
|
|
69
|
+
cachedStats: {},
|
|
70
|
+
label: '',
|
|
80
71
|
},
|
|
81
72
|
};
|
|
73
|
+
for (const baseData of annotationBaseData) {
|
|
74
|
+
annotation = utilities.deepMerge(annotation, baseData);
|
|
75
|
+
}
|
|
76
|
+
return annotation;
|
|
77
|
+
}
|
|
78
|
+
createAnnotation(evt, points, ...annotationBaseData) {
|
|
79
|
+
const eventDetail = evt.detail;
|
|
80
|
+
const { currentPoints, element } = eventDetail;
|
|
81
|
+
const { world: worldPos } = currentPoints;
|
|
82
|
+
const enabledElement = getEnabledElement(element);
|
|
83
|
+
const { viewport } = enabledElement;
|
|
84
|
+
const camera = viewport.getCamera();
|
|
85
|
+
const { viewPlaneNormal, viewUp, position: cameraPosition } = camera;
|
|
86
|
+
const referencedImageId = this.getReferencedImageId(viewport, worldPos, viewPlaneNormal, viewUp);
|
|
87
|
+
const viewReference = viewport.getViewReference({ points: [worldPos] });
|
|
88
|
+
const annotation = AnnotationDisplayTool.createAnnotation({
|
|
89
|
+
metadata: {
|
|
90
|
+
toolName: this.getToolName(),
|
|
91
|
+
...viewReference,
|
|
92
|
+
referencedImageId,
|
|
93
|
+
viewUp,
|
|
94
|
+
cameraPosition,
|
|
95
|
+
},
|
|
96
|
+
data: {
|
|
97
|
+
handles: {
|
|
98
|
+
points: points || [],
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
}, ...annotationBaseData);
|
|
102
|
+
return annotation;
|
|
82
103
|
}
|
|
83
104
|
getReferencedImageId(viewport, worldPos, viewPlaneNormal, viewUp) {
|
|
84
105
|
const targetId = this.getTargetId(viewport);
|
|
@@ -18,7 +18,6 @@ declare abstract class AnnotationTool extends AnnotationDisplayTool {
|
|
|
18
18
|
movingTextBox?: boolean;
|
|
19
19
|
hasMoved?: boolean;
|
|
20
20
|
} | null;
|
|
21
|
-
static createAnnotation(...annotationBaseData: any[]): Annotation;
|
|
22
21
|
static createAnnotationForViewport<T extends Annotation>(viewport: any, ...annotationBaseData: any[]): T;
|
|
23
22
|
static createAndAddAnnotation(viewport: any, ...annotationBaseData: any[]): void;
|
|
24
23
|
static toolName: any;
|
|
@@ -11,37 +11,6 @@ import { addContourSegmentationAnnotation } from '../../utilities/contourSegment
|
|
|
11
11
|
const { DefaultHistoryMemo } = csUtils.HistoryMemo;
|
|
12
12
|
const { PointsManager } = csUtils;
|
|
13
13
|
class AnnotationTool extends AnnotationDisplayTool {
|
|
14
|
-
static createAnnotation(...annotationBaseData) {
|
|
15
|
-
let annotation = {
|
|
16
|
-
annotationUID: null,
|
|
17
|
-
highlighted: true,
|
|
18
|
-
invalidated: true,
|
|
19
|
-
metadata: {
|
|
20
|
-
toolName: this.toolName,
|
|
21
|
-
},
|
|
22
|
-
data: {
|
|
23
|
-
text: '',
|
|
24
|
-
handles: {
|
|
25
|
-
points: new Array(),
|
|
26
|
-
textBox: {
|
|
27
|
-
hasMoved: false,
|
|
28
|
-
worldPosition: [0, 0, 0],
|
|
29
|
-
worldBoundingBox: {
|
|
30
|
-
topLeft: [0, 0, 0],
|
|
31
|
-
topRight: [0, 0, 0],
|
|
32
|
-
bottomLeft: [0, 0, 0],
|
|
33
|
-
bottomRight: [0, 0, 0],
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
label: '',
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
for (const baseData of annotationBaseData) {
|
|
41
|
-
annotation = csUtils.deepMerge(annotation, baseData);
|
|
42
|
-
}
|
|
43
|
-
return annotation;
|
|
44
|
-
}
|
|
45
14
|
static createAnnotationForViewport(viewport, ...annotationBaseData) {
|
|
46
15
|
return this.createAnnotation({ metadata: viewport.getViewReference() }, ...annotationBaseData);
|
|
47
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
|
-
import type { Annotation } from './AnnotationTypes';
|
|
2
|
+
import type { Annotation, AnnotationData } from './AnnotationTypes';
|
|
3
3
|
import type { ISpline } from './';
|
|
4
4
|
import type { ContourSegmentationAnnotationData } from './ContourSegmentationAnnotation';
|
|
5
5
|
import type { ContourAnnotation } from './ContourAnnotation';
|
|
@@ -326,8 +326,8 @@ export type InterpolationROIAnnotation = ContourAnnotation & ContourSegmentation
|
|
|
326
326
|
isInterpolationUpdate?: boolean;
|
|
327
327
|
};
|
|
328
328
|
export interface ArrowAnnotation extends Annotation {
|
|
329
|
-
data: {
|
|
330
|
-
|
|
329
|
+
data: AnnotationData & {
|
|
330
|
+
label: string;
|
|
331
331
|
handles: {
|
|
332
332
|
points: Types.Point3[];
|
|
333
333
|
arrowFirst: boolean;
|
|
@@ -346,8 +346,8 @@ export interface ArrowAnnotation extends Annotation {
|
|
|
346
346
|
};
|
|
347
347
|
}
|
|
348
348
|
export interface LabelAnnotation extends Annotation {
|
|
349
|
-
data: {
|
|
350
|
-
|
|
349
|
+
data: AnnotationData & {
|
|
350
|
+
label: string;
|
|
351
351
|
handles: {
|
|
352
352
|
points: Types.Point3[];
|
|
353
353
|
};
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.0.0
|
|
1
|
+
export declare const version = "4.0.0";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '4.0.0
|
|
1
|
+
export const version = '4.0.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"types": "./dist/esm/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"canvas": "^3.1.0"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
|
-
"@cornerstonejs/core": "^4.0.0
|
|
111
|
+
"@cornerstonejs/core": "^4.0.0",
|
|
112
112
|
"@kitware/vtk.js": "32.12.1",
|
|
113
113
|
"@types/d3-array": "^3.0.4",
|
|
114
114
|
"@types/d3-interpolate": "^3.0.1",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"type": "individual",
|
|
128
128
|
"url": "https://ohif.org/donate"
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "0f87be152df0106b75908c1a9e929e5c68a149bd"
|
|
131
131
|
}
|