/
ContourSegmentationAnnotation.ts
58 lines (55 loc) · 2.08 KB
/
ContourSegmentationAnnotation.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import type { Types } from '@cornerstonejs/core';
import { ContourAnnotation } from './ContourAnnotation';
// Import the type so it isn't recursive imports
export type ContourSegmentationAnnotationData = {
autoGenerated?: boolean;
interpolationUID?: string;
interpolationCompleted?: boolean;
data: {
segmentation: {
segmentationId: string;
segmentIndex: number;
};
contour: {
/** The original polyline before livewire, to show comparison with
* regenerated data (eg based on spline or livewire changes).
*/
originalPolyline?: Types.Point3[];
};
};
metadata?: {
/** The original name of the tool before adding/removing holes and contours */
originalToolName?: string;
};
handles?: {
/**
* Segmentation contours can be interpolated between slices to produce
* intermediate data. The interpolation sources are source data for
* the interpolation corresponding to the handle points. The object
* will have the kIndex assigned so that one can determine relative slice
* locations that the handles are in originally.
*
* This does NOT necessarily correspond to the handles used on the original
* source data, but is the set of point uses to interpolate the current handles.
* That is, for linear interpolation:
* ```
* handles.points[i] = linear(interpolationSources[0].getPoint(i),
* interpolationSources[1].getPoint(i));
* ```
*
* These are sometimes required for things like livewire which need to
* update the handle position with a snap to nearest live point or can
* be used as an indicator that interpolation has taken place.
*/
interpolationSources?: Types.PointsManager<Types.Point3>[];
};
/**
* This is called when interpolation is performed, and can be used to add
* data specific settings to the annotation instance.
*/
onInterpolationComplete?: (
annotation: ContourSegmentationAnnotation
) => unknown;
};
export type ContourSegmentationAnnotation = ContourAnnotation &
ContourSegmentationAnnotationData;