@cornerstonejs/tools 0.30.7 → 0.31.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/index.d.ts +2 -2
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/store/ToolGroupManager/ToolGroup.d.ts +4 -1
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js +90 -29
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/cjs/store/state.d.ts +4 -6
- package/dist/cjs/tools/base/BaseTool.d.ts +1 -1
- package/dist/cjs/tools/index.d.ts +2 -1
- package/dist/cjs/tools/index.js +3 -1
- package/dist/cjs/tools/index.js.map +1 -1
- package/dist/cjs/tools/segmentation/BrushTool.d.ts +9 -5
- package/dist/cjs/tools/segmentation/BrushTool.js +95 -115
- package/dist/cjs/tools/segmentation/BrushTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/PaintFillTool.d.ts +12 -0
- package/dist/cjs/tools/segmentation/PaintFillTool.js +213 -0
- package/dist/cjs/tools/segmentation/PaintFillTool.js.map +1 -0
- package/dist/cjs/tools/segmentation/strategies/eraseCircle.d.ts +15 -0
- package/dist/cjs/tools/segmentation/strategies/eraseCircle.js +10 -0
- package/dist/cjs/tools/segmentation/strategies/eraseCircle.js.map +1 -0
- package/dist/cjs/tools/segmentation/strategies/eraseSphere.d.ts +13 -0
- package/dist/cjs/tools/segmentation/strategies/eraseSphere.js +12 -0
- package/dist/cjs/tools/segmentation/strategies/eraseSphere.js.map +1 -0
- package/dist/cjs/tools/segmentation/strategies/fillCircle.d.ts +3 -0
- package/dist/cjs/tools/segmentation/strategies/fillCircle.js +41 -12
- package/dist/cjs/tools/segmentation/strategies/fillCircle.js.map +1 -1
- package/dist/cjs/types/FloodFillTypes.d.ts +15 -0
- package/dist/cjs/types/FloodFillTypes.js +3 -0
- package/dist/cjs/types/FloodFillTypes.js.map +1 -0
- package/dist/cjs/types/IToolClassReference.d.ts +3 -0
- package/dist/cjs/types/IToolClassReference.js +3 -0
- package/dist/cjs/types/IToolClassReference.js.map +1 -0
- package/dist/cjs/types/IToolGroup.d.ts +3 -0
- package/dist/cjs/types/index.d.ts +3 -1
- package/dist/cjs/utilities/segmentation/brushSizeForToolGroup.d.ts +2 -0
- package/dist/cjs/utilities/segmentation/brushSizeForToolGroup.js +49 -0
- package/dist/cjs/utilities/segmentation/brushSizeForToolGroup.js.map +1 -0
- package/dist/cjs/utilities/segmentation/brushThresholdForToolGroup.d.ts +3 -0
- package/dist/cjs/utilities/segmentation/brushThresholdForToolGroup.js +49 -0
- package/dist/cjs/utilities/segmentation/brushThresholdForToolGroup.js.map +1 -0
- package/dist/cjs/utilities/segmentation/floodFill.d.ts +3 -0
- package/dist/cjs/utilities/segmentation/floodFill.js +131 -0
- package/dist/cjs/utilities/segmentation/floodFill.js.map +1 -0
- package/dist/cjs/utilities/segmentation/index.d.ts +4 -1
- package/dist/cjs/utilities/segmentation/index.js +9 -1
- package/dist/cjs/utilities/segmentation/index.js.map +1 -1
- package/dist/cjs/utilities/segmentation/utilities.d.ts +2 -0
- package/dist/cjs/utilities/segmentation/utilities.js +21 -0
- package/dist/cjs/utilities/segmentation/utilities.js.map +1 -0
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.d.ts +4 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.js +90 -29
- package/dist/esm/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/esm/store/state.d.ts +4 -6
- package/dist/esm/tools/base/BaseTool.d.ts +1 -1
- package/dist/esm/tools/index.d.ts +2 -1
- package/dist/esm/tools/index.js +2 -1
- package/dist/esm/tools/index.js.map +1 -1
- package/dist/esm/tools/segmentation/BrushTool.d.ts +9 -5
- package/dist/esm/tools/segmentation/BrushTool.js +98 -119
- package/dist/esm/tools/segmentation/BrushTool.js.map +1 -1
- package/dist/esm/tools/segmentation/PaintFillTool.d.ts +12 -0
- package/dist/esm/tools/segmentation/PaintFillTool.js +210 -0
- package/dist/esm/tools/segmentation/PaintFillTool.js.map +1 -0
- package/dist/esm/tools/segmentation/strategies/eraseCircle.d.ts +15 -0
- package/dist/esm/tools/segmentation/strategies/eraseCircle.js +9 -0
- package/dist/esm/tools/segmentation/strategies/eraseCircle.js.map +1 -0
- package/dist/esm/tools/segmentation/strategies/eraseSphere.d.ts +13 -0
- package/dist/esm/tools/segmentation/strategies/eraseSphere.js +8 -0
- package/dist/esm/tools/segmentation/strategies/eraseSphere.js.map +1 -0
- package/dist/esm/tools/segmentation/strategies/fillCircle.d.ts +3 -0
- package/dist/esm/tools/segmentation/strategies/fillCircle.js +38 -10
- package/dist/esm/tools/segmentation/strategies/fillCircle.js.map +1 -1
- package/dist/esm/types/FloodFillTypes.d.ts +15 -0
- package/dist/esm/types/FloodFillTypes.js +2 -0
- package/dist/esm/types/FloodFillTypes.js.map +1 -0
- package/dist/esm/types/IToolClassReference.d.ts +3 -0
- package/dist/esm/types/IToolClassReference.js +2 -0
- package/dist/esm/types/IToolClassReference.js.map +1 -0
- package/dist/esm/types/IToolGroup.d.ts +3 -0
- package/dist/esm/types/index.d.ts +3 -1
- package/dist/esm/utilities/segmentation/brushSizeForToolGroup.d.ts +2 -0
- package/dist/esm/utilities/segmentation/brushSizeForToolGroup.js +41 -0
- package/dist/esm/utilities/segmentation/brushSizeForToolGroup.js.map +1 -0
- package/dist/esm/utilities/segmentation/brushThresholdForToolGroup.d.ts +3 -0
- package/dist/esm/utilities/segmentation/brushThresholdForToolGroup.js +41 -0
- package/dist/esm/utilities/segmentation/brushThresholdForToolGroup.js.map +1 -0
- package/dist/esm/utilities/segmentation/floodFill.d.ts +3 -0
- package/dist/esm/utilities/segmentation/floodFill.js +128 -0
- package/dist/esm/utilities/segmentation/floodFill.js.map +1 -0
- package/dist/esm/utilities/segmentation/index.d.ts +4 -1
- package/dist/esm/utilities/segmentation/index.js +4 -1
- package/dist/esm/utilities/segmentation/index.js.map +1 -1
- package/dist/esm/utilities/segmentation/utilities.d.ts +2 -0
- package/dist/esm/utilities/segmentation/utilities.js +15 -0
- package/dist/esm/utilities/segmentation/utilities.js.map +1 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eraseCircle.js","sourceRoot":"","sources":["../../../../../src/tools/segmentation/strategies/eraseCircle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAehD,MAAM,UAAU,iBAAiB,CAC/B,cAAqC,EACrC,aAA4B;IAI5B,MAAM,kBAAkB,GAAG;QACzB,GAAG,aAAa;QAChB,YAAY,EAAE,CAAC;KAChB,CAAC;IAEF,gBAAgB,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
declare type OperationData = {
|
|
3
|
+
points: [Types.Point3, Types.Point3, Types.Point3, Types.Point3];
|
|
4
|
+
volume: Types.IImageVolume;
|
|
5
|
+
segmentIndex: number;
|
|
6
|
+
segmentationId: string;
|
|
7
|
+
segmentsLocked: number[];
|
|
8
|
+
viewPlaneNormal: Types.Point3;
|
|
9
|
+
viewUp: Types.Point3;
|
|
10
|
+
constraintFn: () => boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function eraseInsideSphere(enabledElement: Types.IEnabledElement, operationData: OperationData): void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { fillInsideSphere } from './fillSphere';
|
|
2
|
+
export function eraseInsideSphere(enabledElement, operationData) {
|
|
3
|
+
const eraseOperationData = Object.assign({}, operationData, {
|
|
4
|
+
segmentIndex: 0,
|
|
5
|
+
});
|
|
6
|
+
fillInsideSphere(enabledElement, eraseOperationData);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=eraseSphere.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eraseSphere.js","sourceRoot":"","sources":["../../../../../src/tools/segmentation/strategies/eraseSphere.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAahD,MAAM,UAAU,iBAAiB,CAC/B,cAAqC,EACrC,aAA4B;IAI5B,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,EAAE;QAC1D,YAAY,EAAE,CAAC;KAChB,CAAC,CAAC;IAEH,gBAAgB,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
2
|
declare type OperationData = {
|
|
3
3
|
segmentationId: string;
|
|
4
|
+
imageVolume: Types.IImageVolume;
|
|
4
5
|
points: any;
|
|
5
6
|
volume: Types.IImageVolume;
|
|
6
7
|
segmentIndex: number;
|
|
7
8
|
segmentsLocked: number[];
|
|
8
9
|
viewPlaneNormal: number[];
|
|
9
10
|
viewUp: number[];
|
|
11
|
+
strategySpecificConfiguration: any;
|
|
10
12
|
constraintFn: () => boolean;
|
|
11
13
|
};
|
|
12
14
|
export declare function fillInsideCircle(enabledElement: Types.IEnabledElement, operationData: OperationData): void;
|
|
15
|
+
export declare function thresholdInsideCircle(enabledElement: Types.IEnabledElement, operationData: OperationData): void;
|
|
13
16
|
export declare function fillOutsideCircle(enabledElement: Types.IEnabledElement, operationData: OperationData): void;
|
|
14
17
|
export {};
|
|
@@ -5,8 +5,8 @@ import { getBoundingBoxAroundShape } from '../../../utilities/boundingBox';
|
|
|
5
5
|
import { triggerSegmentationDataModified } from '../../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
6
6
|
import { pointInShapeCallback } from '../../../utilities';
|
|
7
7
|
const { transformWorldToIndex } = csUtils;
|
|
8
|
-
function fillCircle(enabledElement, operationData,
|
|
9
|
-
const { volume: segmentationVolume, points, segmentsLocked, segmentIndex, segmentationId, } = operationData;
|
|
8
|
+
function fillCircle(enabledElement, operationData, threshold = false) {
|
|
9
|
+
const { volume: segmentationVolume, imageVolume, points, segmentsLocked, segmentIndex, segmentationId, strategySpecificConfiguration, } = operationData;
|
|
10
10
|
const { imageData, dimensions, scalarData } = segmentationVolume;
|
|
11
11
|
const { viewport } = enabledElement;
|
|
12
12
|
const center = vec3.fromValues(0, 0, 0);
|
|
@@ -33,21 +33,49 @@ function fillCircle(enabledElement, operationData, inside = true) {
|
|
|
33
33
|
zRadius: Math.abs(topLeftWorld[2] - bottomRightWorld[2]) / 2,
|
|
34
34
|
};
|
|
35
35
|
const modifiedSlicesToUse = new Set();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
let callback;
|
|
37
|
+
if (threshold) {
|
|
38
|
+
callback = ({ value, index, pointIJK }) => {
|
|
39
|
+
if (segmentsLocked.includes(value)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (isWithinThreshold(index, imageVolume, strategySpecificConfiguration)) {
|
|
43
|
+
scalarData[index] = segmentIndex;
|
|
44
|
+
modifiedSlicesToUse.add(pointIJK[2]);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
callback = ({ value, index, pointIJK }) => {
|
|
50
|
+
if (segmentsLocked.includes(value)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
scalarData[index] = segmentIndex;
|
|
54
|
+
modifiedSlicesToUse.add(pointIJK[2]);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
43
57
|
pointInShapeCallback(imageData, (pointLPS, pointIJK) => pointInEllipse(ellipseObj, pointLPS), callback, boundsIJK);
|
|
44
58
|
const arrayOfSlices = Array.from(modifiedSlicesToUse);
|
|
45
59
|
triggerSegmentationDataModified(segmentationId, arrayOfSlices);
|
|
46
60
|
}
|
|
61
|
+
function isWithinThreshold(index, imageVolume, strategySpecificConfiguration) {
|
|
62
|
+
const { THRESHOLD_INSIDE_CIRCLE } = strategySpecificConfiguration;
|
|
63
|
+
const voxelValue = imageVolume.scalarData[index];
|
|
64
|
+
const { threshold } = THRESHOLD_INSIDE_CIRCLE;
|
|
65
|
+
return threshold[0] <= voxelValue && voxelValue <= threshold[1];
|
|
66
|
+
}
|
|
47
67
|
export function fillInsideCircle(enabledElement, operationData) {
|
|
68
|
+
fillCircle(enabledElement, operationData, false);
|
|
69
|
+
}
|
|
70
|
+
export function thresholdInsideCircle(enabledElement, operationData) {
|
|
71
|
+
const { volume, imageVolume } = operationData;
|
|
72
|
+
if (!csUtils.isEqual(volume.dimensions, imageVolume.dimensions) ||
|
|
73
|
+
!csUtils.isEqual(volume.direction, imageVolume.direction)) {
|
|
74
|
+
throw new Error('Only source data the same dimensions/size/orientation as the segmentation currently supported.');
|
|
75
|
+
}
|
|
48
76
|
fillCircle(enabledElement, operationData, true);
|
|
49
77
|
}
|
|
50
78
|
export function fillOutsideCircle(enabledElement, operationData) {
|
|
51
|
-
|
|
79
|
+
throw new Error('Not yet implemented');
|
|
52
80
|
}
|
|
53
81
|
//# sourceMappingURL=fillCircle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fillCircle.js","sourceRoot":"","sources":["../../../../../src/tools/segmentation/strategies/fillCircle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EACL,uBAAuB,EACvB,cAAc,GACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OA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AAM,EAAE,SAAS,EAAE,GAAG,uBAAuB,CAAC;IAE9C,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,UAAU,IAAI,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAQD,MAAM,UAAU,gBAAgB,CAC9B,cAAqC,EACrC,aAA4B;IAE5B,UAAU,CAAC,cAAc,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC;AAQD,MAAM,UAAU,qBAAqB,CACnC,cAAqC,EACrC,aAA4B;IAE5B,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,aAAa,CAAC;IAE9C,IACE,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC;QAC3D,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,SAAS,CAAC,EACzD;QACA,MAAM,IAAI,KAAK,CACb,gGAAgG,CACjG,CAAC;KACH;IAED,UAAU,CAAC,cAAc,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;AAClD,CAAC;AAQD,MAAM,UAAU,iBAAiB,CAC/B,cAAqC,EACrC,aAA4B;IAE5B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Types } from '@cornerstonejs/core';
|
|
2
|
+
declare type FloodFillResult = {
|
|
3
|
+
flooded: Types.Point2[] | Types.Point3[];
|
|
4
|
+
boundaries: Types.Point2[] | Types.Point3[];
|
|
5
|
+
};
|
|
6
|
+
declare type FloodFillGetter3D = (x: number, y: number, z: number) => number;
|
|
7
|
+
declare type FloodFillGetter2D = (x: number, y: number) => number;
|
|
8
|
+
declare type FloodFillGetter = FloodFillGetter2D | FloodFillGetter3D;
|
|
9
|
+
declare type FloodFillOptions = {
|
|
10
|
+
onFlood?: (x: any, y: any) => void;
|
|
11
|
+
onBoundary?: (x: any, y: any) => void;
|
|
12
|
+
equals?: (a: any, b: any) => boolean;
|
|
13
|
+
diagonals?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export { FloodFillResult, FloodFillGetter, FloodFillOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FloodFillTypes.js","sourceRoot":"","sources":["../../../src/types/FloodFillTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IToolClassReference.js","sourceRoot":"","sources":["../../../src/types/IToolClassReference.ts"],"names":[],"mappings":""}
|
|
@@ -13,6 +13,9 @@ export default interface IToolGroup {
|
|
|
13
13
|
addTool: {
|
|
14
14
|
(toolName: string, toolConfiguration?: any): void;
|
|
15
15
|
};
|
|
16
|
+
addToolInstance: {
|
|
17
|
+
(ttoolName: string, parentClassName: string, configuration?: any): void;
|
|
18
|
+
};
|
|
16
19
|
addViewport: {
|
|
17
20
|
(viewportId: string, renderingEngineId?: string): void;
|
|
18
21
|
};
|
|
@@ -19,4 +19,6 @@ import type SVGDrawingHelper from './SVGDrawingHelper';
|
|
|
19
19
|
import type * as CINETypes from './CINETypes';
|
|
20
20
|
import type { Color, ColorLUT, RepresentationConfig, SegmentationRepresentationConfig, SegmentationRepresentationData, Segmentation, ToolGroupSpecificRepresentationState, ToolGroupSpecificLabelmapRepresentation, ToolGroupSpecificRepresentation, SegmentationState, RepresentationPublicInput } from './SegmentationStateTypes';
|
|
21
21
|
import ISynchronizerEventHandler from './ISynchronizerEventHandler';
|
|
22
|
-
|
|
22
|
+
import { FloodFillGetter, FloodFillOptions, FloodFillResult } from './FloodFillTypes';
|
|
23
|
+
import IToolClassReference from './IToolClassReference';
|
|
24
|
+
export type { Annotation, Annotations, FrameOfReferenceSpecificAnnotations, AnnotationState, AnnotationStyle, ToolSpecificAnnotationTypes, JumpToSliceOptions, PlanarBoundingBox, ToolProps, PublicToolProps, EventTypes, IPoints, IToolBinding, SetToolBindingsType, ToolOptionsType, InteractionTypes, IToolGroup, IToolClassReference, ISynchronizerEventHandler, ToolHandle, AnnotationHandle, TextBoxHandle, Segmentation, SegmentationState, SegmentationRepresentationData, SegmentationRepresentationConfig, RepresentationConfig, ToolGroupSpecificRepresentationState, ToolGroupSpecificLabelmapRepresentation, ToolGroupSpecificRepresentation, RepresentationPublicInput, Color, ColorLUT, LabelmapTypes, SVGCursorDescriptor, SVGPoint, ScrollOptions, CINETypes, BoundsIJK, SVGDrawingHelper, FloodFillResult, FloodFillGetter, FloodFillOptions, };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getToolGroup } from '../../store/ToolGroupManager';
|
|
2
|
+
import triggerAnnotationRenderForViewportIds from '../triggerAnnotationRenderForViewportIds';
|
|
3
|
+
import { getRenderingEngine } from '@cornerstonejs/core';
|
|
4
|
+
import getBrushToolInstances from './utilities';
|
|
5
|
+
export function setBrushSizeForToolGroup(toolGroupId, brushSize) {
|
|
6
|
+
const toolGroup = getToolGroup(toolGroupId);
|
|
7
|
+
if (toolGroup === undefined) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const brushBasedToolInstances = getBrushToolInstances(toolGroupId);
|
|
11
|
+
brushBasedToolInstances.forEach((tool) => {
|
|
12
|
+
tool.configuration.brushSize = brushSize;
|
|
13
|
+
tool.invalidateBrushCursor();
|
|
14
|
+
});
|
|
15
|
+
const viewportsInfo = toolGroup.getViewportsInfo();
|
|
16
|
+
const viewportsInfoArray = Object.keys(viewportsInfo).map((key) => viewportsInfo[key]);
|
|
17
|
+
if (!viewportsInfoArray.length) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const { renderingEngineId } = viewportsInfoArray[0];
|
|
21
|
+
const viewportIds = toolGroup.getViewportIds();
|
|
22
|
+
const renderingEngine = getRenderingEngine(renderingEngineId);
|
|
23
|
+
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIds);
|
|
24
|
+
}
|
|
25
|
+
export function getBrushSizeForToolGroup(toolGroupId) {
|
|
26
|
+
const toolGroup = getToolGroup(toolGroupId);
|
|
27
|
+
if (toolGroup === undefined) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const toolInstances = toolGroup._toolInstances;
|
|
31
|
+
if (!Object.keys(toolInstances).length) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const brushBasedToolInstances = getBrushToolInstances(toolGroupId);
|
|
35
|
+
const brushToolInstance = brushBasedToolInstances[0];
|
|
36
|
+
if (!brushToolInstance) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
return brushToolInstance.configuration.brushSize;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=brushSizeForToolGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brushSizeForToolGroup.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/brushSizeForToolGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,qCAAqC,MAAM,0CAA0C,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,qBAAqB,MAAM,aAAa,CAAC;AAEhD,MAAM,UAAU,wBAAwB,CACtC,WAAmB,EACnB,SAAiB;IAEjB,MAAM,SAAS,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IAE5C,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,OAAO;KACR;IAED,MAAM,uBAAuB,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAEnE,uBAAuB,CAAC,OAAO,CAAC,CAAC,IAAe,EAAE,EAAE;QAClD,IAAI,CAAC,aAAa,CAAC,SAAS,GAAG,SAAS,CAAC;QAGzC,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC/B,CAAC,CAAC,CAAC;IAGH,MAAM,aAAa,GAAG,SAAS,CAAC,gBAAgB,EAAE,CAAC;IAEnD,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,GAAG,CACvD,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAC5B,CAAC;IAEF,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE;QAC9B,OAAO;KACR;IAED,MAAM,EAAE,iBAAiB,EAAE,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAIpD,MAAM,WAAW,GAAG,SAAS,CAAC,cAAc,EAAE,CAAC;IAE/C,MAAM,eAAe,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;IAE9D,qCAAqC,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,WAAmB;IAC1D,MAAM,SAAS,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IAE5C,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,OAAO;KACR;IAED,MAAM,aAAa,GAAG,SAAS,CAAC,cAAc,CAAC;IAE/C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,EAAE;QACtC,OAAO;KACR;IAED,MAAM,uBAAuB,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAGnE,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC;IAErD,IAAI,CAAC,iBAAiB,EAAE;QACtB,OAAO;KACR;IAGD,OAAO,iBAAiB,CAAC,aAAa,CAAC,SAAS,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getToolGroup } from '../../store/ToolGroupManager';
|
|
2
|
+
import triggerAnnotationRenderForViewportIds from '../triggerAnnotationRenderForViewportIds';
|
|
3
|
+
import { getRenderingEngine } from '@cornerstonejs/core';
|
|
4
|
+
import getBrushToolInstances from './utilities';
|
|
5
|
+
export function setBrushThresholdForToolGroup(toolGroupId, threshold) {
|
|
6
|
+
const toolGroup = getToolGroup(toolGroupId);
|
|
7
|
+
if (toolGroup === undefined) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const brushBasedToolInstances = getBrushToolInstances(toolGroupId);
|
|
11
|
+
brushBasedToolInstances.forEach((tool) => {
|
|
12
|
+
tool.configuration.strategySpecificConfiguration.THRESHOLD_INSIDE_CIRCLE.threshold =
|
|
13
|
+
threshold;
|
|
14
|
+
});
|
|
15
|
+
const viewportsInfo = toolGroup.getViewportsInfo();
|
|
16
|
+
if (!viewportsInfo.length) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const { renderingEngineId } = viewportsInfo[0];
|
|
20
|
+
const viewportIds = toolGroup.getViewportIds();
|
|
21
|
+
const renderingEngine = getRenderingEngine(renderingEngineId);
|
|
22
|
+
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIds);
|
|
23
|
+
}
|
|
24
|
+
export function getBrushThresholdForToolGroup(toolGroupId) {
|
|
25
|
+
const toolGroup = getToolGroup(toolGroupId);
|
|
26
|
+
if (toolGroup === undefined) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const toolInstances = toolGroup._toolInstances;
|
|
30
|
+
if (!Object.keys(toolInstances).length) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const brushBasedToolInstances = getBrushToolInstances(toolGroupId);
|
|
34
|
+
const brushToolInstance = brushBasedToolInstances[0];
|
|
35
|
+
if (!brushToolInstance) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
return brushToolInstance.configuration.strategySpecificConfiguration
|
|
39
|
+
.THRESHOLD_INSIDE_CIRCLE.threshold;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=brushThresholdForToolGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brushThresholdForToolGroup.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/brushThresholdForToolGroup.ts"],"names":[],"mappings":"AACA,O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B,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;IACnE,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC;IAErD,IAAI,CAAC,iBAAiB,EAAE;QACtB,OAAO;KACR;IAGD,OAAO,iBAAiB,CAAC,aAAa,CAAC,6BAA6B;SACjE,uBAAuB,CAAC,SAAS,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export default function (getter, seed, options = {}) {
|
|
2
|
+
const onFlood = options.onFlood;
|
|
3
|
+
const onBoundary = options.onBoundary;
|
|
4
|
+
const equals = options.equals || defaultEquals;
|
|
5
|
+
const diagonals = options.diagonals || false;
|
|
6
|
+
const startNode = get(seed);
|
|
7
|
+
const permutations = prunedPermutations();
|
|
8
|
+
const stack = [];
|
|
9
|
+
const flooded = [];
|
|
10
|
+
const visits = {};
|
|
11
|
+
const bounds = {};
|
|
12
|
+
stack.push({ currentArgs: seed });
|
|
13
|
+
while (stack.length > 0) {
|
|
14
|
+
flood(stack.pop());
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
flooded,
|
|
18
|
+
boundaries: boundaries(),
|
|
19
|
+
};
|
|
20
|
+
function flood(job) {
|
|
21
|
+
const getArgs = job.currentArgs;
|
|
22
|
+
const prevArgs = job.previousArgs;
|
|
23
|
+
if (visited(getArgs)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
markAsVisited(getArgs);
|
|
27
|
+
if (member(getArgs)) {
|
|
28
|
+
markAsFlooded(getArgs);
|
|
29
|
+
pushAdjacent(getArgs);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
markAsBoundary(prevArgs);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function visited(key) {
|
|
36
|
+
return visits[key] === true;
|
|
37
|
+
}
|
|
38
|
+
function markAsVisited(key) {
|
|
39
|
+
visits[key] = true;
|
|
40
|
+
}
|
|
41
|
+
function member(getArgs) {
|
|
42
|
+
const node = safely(get, [getArgs]);
|
|
43
|
+
return safely(equals, [node, startNode]);
|
|
44
|
+
}
|
|
45
|
+
function markAsFlooded(getArgs) {
|
|
46
|
+
flooded.push(getArgs);
|
|
47
|
+
if (onFlood) {
|
|
48
|
+
onFlood(...getArgs);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function markAsBoundary(prevArgs) {
|
|
52
|
+
bounds[prevArgs] = prevArgs;
|
|
53
|
+
if (onBoundary) {
|
|
54
|
+
onBoundary(...prevArgs);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function pushAdjacent(getArgs) {
|
|
58
|
+
for (let i = 0; i < permutations.length; i += 1) {
|
|
59
|
+
const perm = permutations[i];
|
|
60
|
+
const nextArgs = getArgs.slice(0);
|
|
61
|
+
for (let j = 0; j < getArgs.length; j += 1) {
|
|
62
|
+
nextArgs[j] += perm[j];
|
|
63
|
+
}
|
|
64
|
+
stack.push({
|
|
65
|
+
currentArgs: nextArgs,
|
|
66
|
+
previousArgs: getArgs,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function get(getArgs) {
|
|
71
|
+
return getter(...getArgs);
|
|
72
|
+
}
|
|
73
|
+
function safely(f, args) {
|
|
74
|
+
try {
|
|
75
|
+
return f(...args);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function prunedPermutations() {
|
|
82
|
+
const permutations = permute(seed.length);
|
|
83
|
+
return permutations.filter(function (perm) {
|
|
84
|
+
const count = countNonZeroes(perm);
|
|
85
|
+
return count !== 0 && (count === 1 || diagonals);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function permute(length) {
|
|
89
|
+
const perms = [];
|
|
90
|
+
const permutation = function (string) {
|
|
91
|
+
return string.split('').map(function (c) {
|
|
92
|
+
return parseInt(c, 10) - 1;
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
for (let i = 0; i < Math.pow(3, length); i += 1) {
|
|
96
|
+
const string = lpad(i.toString(3), '0', length);
|
|
97
|
+
perms.push(permutation(string));
|
|
98
|
+
}
|
|
99
|
+
return perms;
|
|
100
|
+
}
|
|
101
|
+
function boundaries() {
|
|
102
|
+
const array = [];
|
|
103
|
+
for (const key in bounds) {
|
|
104
|
+
if (bounds[key] !== undefined) {
|
|
105
|
+
array.unshift(bounds[key]);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return array;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function defaultEquals(a, b) {
|
|
112
|
+
return a === b;
|
|
113
|
+
}
|
|
114
|
+
function countNonZeroes(array) {
|
|
115
|
+
let count = 0;
|
|
116
|
+
for (let i = 0; i < array.length; i += 1) {
|
|
117
|
+
if (array[i] !== 0) {
|
|
118
|
+
count += 1;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return count;
|
|
122
|
+
}
|
|
123
|
+
function lpad(string, character, length) {
|
|
124
|
+
const array = new Array(length + 1);
|
|
125
|
+
const pad = array.join(character);
|
|
126
|
+
return (pad + string).slice(-length);
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=floodFill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floodFill.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/floodFill.ts"],"names":[],"mappings":"AA0BA,MAAM,CAAC,OAAO,WACZ,MAAuB,EACvB,IAAiC,EACjC,UAA4B,EAAE;IAE9B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAChC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACtC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,aAAa,CAAC;IAC/C,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;IAC7C,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,M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AAK,GAAG,CAAC,CAAC;IAEd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACxC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;YAClB,KAAK,IAAI,CAAC,CAAC;SACZ;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM;IACrC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACpC,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAElC,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -5,4 +5,7 @@ import isValidRepresentationConfig from './isValidRepresentationConfig';
|
|
|
5
5
|
import getDefaultRepresentationConfig from './getDefaultRepresentationConfig';
|
|
6
6
|
import createLabelmapVolumeForViewport from './createLabelmapVolumeForViewport';
|
|
7
7
|
import { triggerSegmentationRender } from './triggerSegmentationRender';
|
|
8
|
-
|
|
8
|
+
import floodFill from './floodFill';
|
|
9
|
+
import { getBrushSizeForToolGroup, setBrushSizeForToolGroup } from './brushSizeForToolGroup';
|
|
10
|
+
import { getBrushThresholdForToolGroup, setBrushThresholdForToolGroup } from './brushThresholdForToolGroup';
|
|
11
|
+
export { thresholdVolumeByRange, createMergedLabelmapForIndex, isValidRepresentationConfig, getDefaultRepresentationConfig, createLabelmapVolumeForViewport, rectangleROIThresholdVolumeByRange, triggerSegmentationRender, floodFill, getBrushSizeForToolGroup, setBrushSizeForToolGroup, getBrushThresholdForToolGroup, setBrushThresholdForToolGroup, };
|
|
@@ -5,5 +5,8 @@ import isValidRepresentationConfig from './isValidRepresentationConfig';
|
|
|
5
5
|
import getDefaultRepresentationConfig from './getDefaultRepresentationConfig';
|
|
6
6
|
import createLabelmapVolumeForViewport from './createLabelmapVolumeForViewport';
|
|
7
7
|
import { triggerSegmentationRender } from './triggerSegmentationRender';
|
|
8
|
-
|
|
8
|
+
import floodFill from './floodFill';
|
|
9
|
+
import { getBrushSizeForToolGroup, setBrushSizeForToolGroup, } from './brushSizeForToolGroup';
|
|
10
|
+
import { getBrushThresholdForToolGroup, setBrushThresholdForToolGroup, } from './brushThresholdForToolGroup';
|
|
11
|
+
export { thresholdVolumeByRange, createMergedLabelmapForIndex, isValidRepresentationConfig, getDefaultRepresentationConfig, createLabelmapVolumeForViewport, rectangleROIThresholdVolumeByRange, triggerSegmentationRender, floodFill, getBrushSizeForToolGroup, setBrushSizeForToolGroup, getBrushThresholdForToolGroup, setBrushThresholdForToolGroup, };
|
|
9
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,kCAAkC,MAAM,sCAAsC,CAAC;AACtF,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAC1E,OAAO,2BAA2B,MAAM,+BAA+B,CAAC;AACxE,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAC9E,OAAO,+BAA+B,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,kCAAkC,MAAM,sCAAsC,CAAC;AACtF,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAC1E,OAAO,2BAA2B,MAAM,+BAA+B,CAAC;AACxE,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAC9E,OAAO,+BAA+B,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,2BAA2B,EAC3B,8BAA8B,EAC9B,+BAA+B,EAC/B,kCAAkC,EAClC,yBAAyB,EACzB,SAAS,EACT,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,EAC7B,6BAA6B,GAC9B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getToolGroup } from '../../store/ToolGroupManager';
|
|
2
|
+
import BrushTool from '../../tools/segmentation/BrushTool';
|
|
3
|
+
export default function getBrushToolInstances(toolGroupId) {
|
|
4
|
+
const toolGroup = getToolGroup(toolGroupId);
|
|
5
|
+
if (toolGroup === undefined) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const toolInstances = toolGroup._toolInstances;
|
|
9
|
+
if (!Object.keys(toolInstances).length) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const brushBasedToolInstances = Object.values(toolInstances).filter((toolInstance) => toolInstance instanceof BrushTool);
|
|
13
|
+
return brushBasedToolInstances;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/utilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,SAAS,MAAM,oCAAoC,CAAC;AAE3D,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,WAAW;IACvD,MAAM,SAAS,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IAE5C,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,OAAO;KACR;IAED,MAAM,aAAa,GAAG,SAAS,CAAC,cAAc,CAAC;IAE/C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,EAAE;QACtC,OAAO;KACR;IAGD,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CACjE,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,YAAY,SAAS,CACrC,CAAC;IAEjB,OAAO,uBAAuB,CAAC;AACjC,CAAC"}
|