@cornerstonejs/tools 3.31.0 → 3.31.1
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/CrosshairsTool.d.ts +13 -12
- package/dist/esm/tools/CrosshairsTool.js +1 -2
- package/dist/esm/tools/OverlayGridTool.d.ts +2 -2
- package/dist/esm/tools/SegmentationIntersectionTool.d.ts +8 -5
- package/dist/esm/tools/SegmentationIntersectionTool.js +1 -1
- package/dist/esm/tools/annotation/VideoRedactionTool.d.ts +1 -1
- package/dist/esm/tools/annotation/VideoRedactionTool.js +1 -1
- package/dist/esm/tools/base/AnnotationTool.d.ts +1 -11
- package/dist/esm/types/AnnotationTypes.d.ts +21 -19
- package/dist/esm/types/ContourAnnotation.d.ts +1 -0
- package/dist/esm/types/index.d.ts +2 -2
- package/dist/esm/utilities/planar/filterAnnotationsWithinSlice.js +17 -5
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { AnnotationTool } from './base';
|
|
2
2
|
import type { Types } from '@cornerstonejs/core';
|
|
3
|
-
import type { Annotation, Annotations, EventTypes, ToolHandle, PublicToolProps, ToolProps, InteractionTypes, SVGDrawingHelper } from '../types';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
toolCenter: Types.Point3;
|
|
11
|
-
};
|
|
12
|
-
activeViewportIds: string[];
|
|
13
|
-
viewportId: string;
|
|
3
|
+
import type { Annotation, AnnotationData, Annotations, EventTypes, ToolHandle, PublicToolProps, ToolProps, InteractionTypes, SVGDrawingHelper } from '../types';
|
|
4
|
+
export type CrosshairsAnnotationData = AnnotationData & {
|
|
5
|
+
handles: {
|
|
6
|
+
rotationPoints: Types.Point3[];
|
|
7
|
+
slabThicknessPoints: Types.Point3[];
|
|
8
|
+
activeOperation: number | null;
|
|
9
|
+
toolCenter: Types.Point3;
|
|
14
10
|
};
|
|
15
|
-
|
|
11
|
+
activeViewportIds: string[];
|
|
12
|
+
viewportId: string;
|
|
13
|
+
};
|
|
14
|
+
export type CrosshairsAnnotation = Annotation & {
|
|
15
|
+
data: CrosshairsAnnotationData;
|
|
16
|
+
};
|
|
16
17
|
declare class CrosshairsTool extends AnnotationTool {
|
|
17
18
|
static toolName: any;
|
|
18
19
|
toolCenter: Types.Point3;
|
|
@@ -32,7 +32,6 @@ const OPERATION = {
|
|
|
32
32
|
ROTATE: 2,
|
|
33
33
|
SLAB: 3,
|
|
34
34
|
};
|
|
35
|
-
const EPSILON = 1e-3;
|
|
36
35
|
class CrosshairsTool extends AnnotationTool {
|
|
37
36
|
constructor(toolProps = {}, defaultToolProps = {
|
|
38
37
|
supportedInteractionTypes: ['Mouse'],
|
|
@@ -1052,7 +1051,7 @@ class CrosshairsTool extends AnnotationTool {
|
|
|
1052
1051
|
];
|
|
1053
1052
|
const viewportDraggableRotatable = this._getReferenceLineDraggableRotatable(otherViewport.id);
|
|
1054
1053
|
if (!viewportDraggableRotatable) {
|
|
1055
|
-
const { rotationPoints } = this.editData.annotation.data.handles;
|
|
1054
|
+
const { rotationPoints } = (this.editData.annotation.data).handles;
|
|
1056
1055
|
const otherViewportRotationPoints = rotationPoints.filter((point) => point[1].uid === otherViewport.id);
|
|
1057
1056
|
if (otherViewportRotationPoints.length === 2) {
|
|
1058
1057
|
const point1 = viewport.canvasToWorld(otherViewportRotationPoints[0][3]);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
2
|
import type { PublicToolProps, ToolProps, SVGDrawingHelper, Annotation } from '../types';
|
|
3
3
|
import AnnotationDisplayTool from './base/AnnotationDisplayTool';
|
|
4
|
-
export
|
|
4
|
+
export type OverlayGridAnnotation = Annotation & {
|
|
5
5
|
data: {
|
|
6
6
|
viewportData: Map<string, object>;
|
|
7
7
|
pointSets: Array<object>;
|
|
8
8
|
};
|
|
9
|
-
}
|
|
9
|
+
};
|
|
10
10
|
declare class OverlayGridTool extends AnnotationDisplayTool {
|
|
11
11
|
static toolName: any;
|
|
12
12
|
_throttledCalculateCachedStats: Function;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
|
-
import type { PublicToolProps, ToolProps, SVGDrawingHelper } from '../types';
|
|
2
|
+
import type { PublicToolProps, ToolProps, SVGDrawingHelper, Annotation } from '../types';
|
|
3
3
|
import AnnotationDisplayTool from './base/AnnotationDisplayTool';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export type WorldPointSet = {
|
|
5
|
+
worldPointsSet: any;
|
|
6
|
+
color: any;
|
|
7
|
+
};
|
|
8
|
+
export type SegmentationIntersectionAnnotation = Annotation & {
|
|
6
9
|
data: {
|
|
7
|
-
actorsWorldPointsMap: Map<string, Map<string,
|
|
10
|
+
actorsWorldPointsMap: Map<string, Map<string, WorldPointSet>>;
|
|
8
11
|
};
|
|
9
|
-
}
|
|
12
|
+
};
|
|
10
13
|
declare class SegmentationIntersectionTool extends AnnotationDisplayTool {
|
|
11
14
|
static toolName: any;
|
|
12
15
|
constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps);
|
|
@@ -60,7 +60,7 @@ class SegmentationIntersectionTool extends AnnotationDisplayTool {
|
|
|
60
60
|
}
|
|
61
61
|
const annotation = annotations[0];
|
|
62
62
|
const { annotationUID } = annotation;
|
|
63
|
-
const actorsWorldPointsMap = annotation.data.actorsWorldPointsMap;
|
|
63
|
+
const actorsWorldPointsMap = (annotation).data.actorsWorldPointsMap;
|
|
64
64
|
calculateSurfaceSegmentationIntersectionsForViewport(actorsWorldPointsMap, viewport);
|
|
65
65
|
const actorEntries = viewport.getActors();
|
|
66
66
|
const cacheId = getCacheId(viewport);
|
|
@@ -22,7 +22,7 @@ declare class VideoRedactionTool extends AnnotationTool {
|
|
|
22
22
|
handleSelectedCallback: (evt: any, annotation: any, handle: any, interactionType?: string) => void;
|
|
23
23
|
_endCallback: (evt: any) => void;
|
|
24
24
|
_dragCallback: (evt: any) => void;
|
|
25
|
-
cancel(element: any):
|
|
25
|
+
cancel(element: any): string;
|
|
26
26
|
_activateDraw: (element: any) => void;
|
|
27
27
|
_deactivateDraw: (element: any) => void;
|
|
28
28
|
_activateModify: (element: any) => void;
|
|
@@ -424,7 +424,7 @@ class VideoRedactionTool extends AnnotationTool {
|
|
|
424
424
|
data.handles.activeHandleIndex = null;
|
|
425
425
|
triggerAnnotationRenderForViewportIds(viewportUIDsToRender);
|
|
426
426
|
this.editData = null;
|
|
427
|
-
return annotation.
|
|
427
|
+
return annotation.annotationUID;
|
|
428
428
|
}
|
|
429
429
|
_getImageVolumeFromTargetUID(targetUID, renderingEngine) {
|
|
430
430
|
let imageVolume, viewport;
|
|
@@ -40,17 +40,7 @@ declare abstract class AnnotationTool extends AnnotationDisplayTool {
|
|
|
40
40
|
private _imagePointNearToolOrHandle;
|
|
41
41
|
protected static createAnnotationState(annotation: Annotation, deleting?: boolean): {
|
|
42
42
|
annotationUID: string;
|
|
43
|
-
data:
|
|
44
|
-
[key: string]: unknown;
|
|
45
|
-
handles?: import("../../types/AnnotationTypes").Handles;
|
|
46
|
-
cachedStats?: Record<string, unknown>;
|
|
47
|
-
label?: string;
|
|
48
|
-
contour?: {
|
|
49
|
-
polyline?: Types.Point3[];
|
|
50
|
-
pointsManager?: Types.IPointsManager<Types.Point3>;
|
|
51
|
-
closed?: boolean;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
43
|
+
data: import("../../types").AnnotationData;
|
|
54
44
|
deleting: boolean;
|
|
55
45
|
};
|
|
56
46
|
static createAnnotationMemo(element: any, annotation: Annotation, options?: {
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
|
-
type
|
|
2
|
+
export type AnnotationMetadata = Types.ViewReference & {
|
|
3
|
+
toolName: string;
|
|
4
|
+
cameraPosition?: Types.Point3;
|
|
5
|
+
viewUp?: Types.Point3;
|
|
6
|
+
segmentColor?: any;
|
|
7
|
+
};
|
|
8
|
+
export type AnnotationData = {
|
|
9
|
+
handles?: Handles;
|
|
10
|
+
cachedStats?: Record<string, unknown>;
|
|
11
|
+
label?: string;
|
|
12
|
+
contour?: Contour;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
15
|
+
export type Annotation = {
|
|
3
16
|
annotationUID?: string;
|
|
4
17
|
parentAnnotationUID?: string;
|
|
5
18
|
interpolationUID?: string;
|
|
@@ -10,32 +23,22 @@ type Annotation = {
|
|
|
10
23
|
invalidated?: boolean;
|
|
11
24
|
isSelected?: boolean;
|
|
12
25
|
autoGenerated?: boolean;
|
|
13
|
-
metadata
|
|
14
|
-
|
|
15
|
-
cameraPosition?: Types.Point3;
|
|
16
|
-
viewUp?: Types.Point3;
|
|
17
|
-
};
|
|
18
|
-
data: {
|
|
19
|
-
handles?: Handles;
|
|
20
|
-
[key: string]: unknown;
|
|
21
|
-
cachedStats?: Record<string, unknown>;
|
|
22
|
-
label?: string;
|
|
23
|
-
contour?: Contour;
|
|
24
|
-
};
|
|
26
|
+
metadata?: AnnotationMetadata;
|
|
27
|
+
data: AnnotationData;
|
|
25
28
|
};
|
|
26
|
-
type Contour = {
|
|
29
|
+
export type Contour = {
|
|
27
30
|
polyline?: Types.Point3[];
|
|
28
31
|
pointsManager?: Types.IPointsManager<Types.Point3>;
|
|
29
32
|
closed?: boolean;
|
|
30
33
|
};
|
|
31
|
-
type Annotations = Array<Annotation>;
|
|
32
|
-
type GroupSpecificAnnotations = {
|
|
34
|
+
export type Annotations = Array<Annotation>;
|
|
35
|
+
export type GroupSpecificAnnotations = {
|
|
33
36
|
[toolName: string]: Annotations;
|
|
34
37
|
};
|
|
35
|
-
type AnnotationState = {
|
|
38
|
+
export type AnnotationState = {
|
|
36
39
|
[key: string]: GroupSpecificAnnotations;
|
|
37
40
|
};
|
|
38
|
-
type Handles = {
|
|
41
|
+
export type Handles = {
|
|
39
42
|
points?: Types.Point3[];
|
|
40
43
|
activeHandleIndex?: number | null;
|
|
41
44
|
textBox?: {
|
|
@@ -50,4 +53,3 @@ type Handles = {
|
|
|
50
53
|
};
|
|
51
54
|
[key: string]: unknown;
|
|
52
55
|
};
|
|
53
|
-
export type { Annotation, Annotations, GroupSpecificAnnotations, AnnotationState, Handles, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export type * from './AnnotationTypes';
|
|
2
2
|
import type { ContourAnnotationData, ContourAnnotation } from './ContourAnnotation';
|
|
3
3
|
import type { ContourSegmentationAnnotationData, ContourSegmentationAnnotation } from './ContourSegmentationAnnotation';
|
|
4
4
|
import type * as EventTypes from './EventTypes';
|
|
@@ -47,4 +47,4 @@ import type { RepresentationStyle } from './../stateManagement/segmentation/Segm
|
|
|
47
47
|
import type { LogicalOperation } from '../utilities/contourSegmentation';
|
|
48
48
|
import type { LabelmapStyle, LabelmapSegmentationData, LabelmapSegmentationDataStack, LabelmapSegmentationDataVolume, BaseLabelmapStyle, InactiveLabelmapStyle } from './LabelmapTypes';
|
|
49
49
|
import type { SurfaceStyle, SurfaceSegmentationData, SurfaceStateStyles } from './SurfaceTypes';
|
|
50
|
-
export type {
|
|
50
|
+
export type { ContourAnnotationData, ContourAnnotation, ContourSegmentationAnnotationData, ContourSegmentationAnnotation, BidirectionalData, CanvasCoordinates, IAnnotationManager, InterpolationViewportData, ImageInterpolationData, AnnotationStyle, ToolSpecificAnnotationTypes, AnnotationGroupSelector, AnnotationRenderContext, PlanarBoundingBox, ToolProps, PublicToolProps, ToolConfiguration, EventTypes, IPoints, ITouchPoints, IDistance, IToolBinding, SetToolBindingsType, ToolOptionsType, InteractionTypes, ToolAction, IToolGroup, IToolClassReference, ISynchronizerEventHandler, ToolHandle, AnnotationHandle, TextBoxHandle, Segmentation, SegmentationRepresentation, SegmentationState, RepresentationData, RepresentationsData, SVGCursorDescriptor, SVGPoint, CINETypes, BoundsIJK, SVGDrawingHelper, FloodFillResult, FloodFillGetter, FloodFillOptions, ContourSegmentationData, ISculptToolShape, Statistics, NamedStatistics, LabelmapToolOperationData, LabelmapToolOperationDataStack, LabelmapToolOperationDataVolume, CardinalSplineProps, ClosestControlPoint, ClosestPoint, ClosestSplinePoint, ControlPointInfo, ISpline, SplineCurveSegment, SplineLineSegment, SplineProps, IBaseTool, RepresentationStyle, Segment, SegmentationPublicInput, LabelmapStyle, ContourStyle, SurfaceStyle, SurfaceSegmentationData, SurfaceStateStyles, LabelmapSegmentationData, LabelmapSegmentationDataStack, LabelmapSegmentationDataVolume, BaseLabelmapStyle, InactiveLabelmapStyle, LogicalOperation, };
|
|
@@ -6,23 +6,35 @@ const PARALLEL_THRESHOLD = 1 - EPSILON;
|
|
|
6
6
|
export default function filterAnnotationsWithinSlice(annotations, camera, spacingInNormalDirection) {
|
|
7
7
|
const { viewPlaneNormal } = camera;
|
|
8
8
|
const annotationsWithParallelNormals = annotations.filter((td) => {
|
|
9
|
-
|
|
9
|
+
const { planeRestriction, referencedImageId } = td.metadata;
|
|
10
|
+
let { viewPlaneNormal: annotationViewPlaneNormal } = td.metadata;
|
|
11
|
+
if (planeRestriction) {
|
|
12
|
+
const { inPlaneVector1, inPlaneVector2 } = planeRestriction;
|
|
13
|
+
if (inPlaneVector1 &&
|
|
14
|
+
!isEqual(0, vec3.dot(viewPlaneNormal, inPlaneVector1))) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
if (inPlaneVector2 &&
|
|
18
|
+
!isEqual(0, vec3.dot(viewPlaneNormal, inPlaneVector2))) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
10
23
|
if (!td.metadata.referencedImageId &&
|
|
11
24
|
!annotationViewPlaneNormal &&
|
|
12
25
|
td.metadata.FrameOfReferenceUID) {
|
|
13
26
|
for (const point of td.data.handles.points) {
|
|
14
27
|
const vector = vec3.sub(vec3.create(), point, camera.focalPoint);
|
|
15
|
-
const dotProduct = vec3.dot(vector,
|
|
28
|
+
const dotProduct = vec3.dot(vector, viewPlaneNormal);
|
|
16
29
|
if (!isEqual(dotProduct, 0)) {
|
|
17
30
|
return false;
|
|
18
31
|
}
|
|
19
32
|
}
|
|
20
|
-
td.metadata.viewPlaneNormal =
|
|
33
|
+
td.metadata.viewPlaneNormal = viewPlaneNormal;
|
|
21
34
|
td.metadata.cameraFocalPoint = camera.focalPoint;
|
|
22
35
|
return true;
|
|
23
36
|
}
|
|
24
|
-
if (!annotationViewPlaneNormal) {
|
|
25
|
-
const { referencedImageId } = td.metadata;
|
|
37
|
+
if (!annotationViewPlaneNormal && referencedImageId) {
|
|
26
38
|
const { imageOrientationPatient } = metaData.get('imagePlaneModule', referencedImageId);
|
|
27
39
|
const rowCosineVec = vec3.fromValues(imageOrientationPatient[0], imageOrientationPatient[1], imageOrientationPatient[2]);
|
|
28
40
|
const colCosineVec = vec3.fromValues(imageOrientationPatient[3], imageOrientationPatient[4], imageOrientationPatient[5]);
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "3.31.
|
|
1
|
+
export declare const version = "3.31.1";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '3.31.
|
|
1
|
+
export const version = '3.31.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "3.31.
|
|
3
|
+
"version": "3.31.1",
|
|
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": "^3.31.
|
|
111
|
+
"@cornerstonejs/core": "^3.31.1",
|
|
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": "0fc65e9cc1d86a9a8b97ee9e7eb5802ce5e1e635"
|
|
131
131
|
}
|