@cornerstonejs/tools 1.22.0 → 1.23.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/drawingSvg/drawPolyline.d.ts +2 -0
- package/dist/cjs/drawingSvg/drawPolyline.js +5 -2
- package/dist/cjs/drawingSvg/drawPolyline.js.map +1 -1
- package/dist/cjs/enums/SegmentationRepresentations.d.ts +2 -1
- package/dist/cjs/enums/SegmentationRepresentations.js +1 -0
- package/dist/cjs/enums/SegmentationRepresentations.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +3 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentations.js +5 -0
- package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentations.js.map +1 -1
- package/dist/cjs/tools/SegmentationIntersectionTool.d.ts +18 -0
- package/dist/cjs/tools/SegmentationIntersectionTool.js +184 -0
- package/dist/cjs/tools/SegmentationIntersectionTool.js.map +1 -0
- package/dist/cjs/tools/displayTools/Contour/addContourSetsToElement.js.map +1 -1
- package/dist/cjs/tools/displayTools/SegmentationDisplayTool.js +7 -3
- package/dist/cjs/tools/displayTools/SegmentationDisplayTool.js.map +1 -1
- package/dist/cjs/tools/displayTools/Surface/addSurfaceToElement.d.ts +2 -0
- package/dist/cjs/tools/displayTools/Surface/addSurfaceToElement.js +84 -0
- package/dist/cjs/tools/displayTools/Surface/addSurfaceToElement.js.map +1 -0
- package/dist/cjs/tools/displayTools/Surface/index.d.ts +2 -0
- package/dist/cjs/tools/displayTools/Surface/index.js +9 -0
- package/dist/cjs/tools/displayTools/Surface/index.js.map +1 -0
- package/dist/cjs/tools/displayTools/Surface/removeSurfaceFromElement.d.ts +2 -0
- package/dist/cjs/tools/displayTools/Surface/removeSurfaceFromElement.js +14 -0
- package/dist/cjs/tools/displayTools/Surface/removeSurfaceFromElement.js.map +1 -0
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.d.ts +11 -0
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.js +140 -0
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.js.map +1 -0
- 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/types/SegmentationStateTypes.d.ts +9 -1
- package/dist/cjs/types/SurfaceTypes.d.ts +4 -0
- package/dist/cjs/types/SurfaceTypes.js +3 -0
- package/dist/cjs/types/SurfaceTypes.js.map +1 -0
- package/dist/cjs/utilities/dynamicVolume/getDataInTime.js +61 -21
- package/dist/cjs/utilities/dynamicVolume/getDataInTime.js.map +1 -1
- package/dist/cjs/utilities/index.d.ts +3 -1
- package/dist/cjs/utilities/index.js +5 -1
- package/dist/cjs/utilities/index.js.map +1 -1
- package/dist/cjs/utilities/math/point/distanceToPoint.d.ts +3 -1
- package/dist/cjs/utilities/math/point/distanceToPoint.js +5 -5
- package/dist/cjs/utilities/math/point/distanceToPoint.js.map +1 -1
- package/dist/cjs/utilities/pointToString.d.ts +1 -0
- package/dist/cjs/utilities/pointToString.js +13 -0
- package/dist/cjs/utilities/pointToString.js.map +1 -0
- package/dist/cjs/utilities/polyData/utils.d.ts +4 -0
- package/dist/cjs/utilities/polyData/utils.js +58 -0
- package/dist/cjs/utilities/polyData/utils.js.map +1 -0
- package/dist/cjs/utilities/segmentation/utilities.js +2 -2
- package/dist/cjs/utilities/segmentation/utilities.js.map +1 -1
- package/dist/esm/drawingSvg/drawPolyline.d.ts +2 -0
- package/dist/esm/drawingSvg/drawPolyline.js +5 -2
- package/dist/esm/drawingSvg/drawPolyline.js.map +1 -1
- package/dist/esm/enums/SegmentationRepresentations.d.ts +2 -1
- package/dist/esm/enums/SegmentationRepresentations.js +1 -0
- package/dist/esm/enums/SegmentationRepresentations.js.map +1 -1
- 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/stateManagement/segmentation/addSegmentationRepresentations.js +5 -0
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.js.map +1 -1
- package/dist/esm/tools/SegmentationIntersectionTool.d.ts +18 -0
- package/dist/esm/tools/SegmentationIntersectionTool.js +177 -0
- package/dist/esm/tools/SegmentationIntersectionTool.js.map +1 -0
- package/dist/esm/tools/displayTools/Contour/addContourSetsToElement.js.map +1 -1
- package/dist/esm/tools/displayTools/SegmentationDisplayTool.js +7 -3
- package/dist/esm/tools/displayTools/SegmentationDisplayTool.js.map +1 -1
- package/dist/esm/tools/displayTools/Surface/addSurfaceToElement.d.ts +2 -0
- package/dist/esm/tools/displayTools/Surface/addSurfaceToElement.js +79 -0
- package/dist/esm/tools/displayTools/Surface/addSurfaceToElement.js.map +1 -0
- package/dist/esm/tools/displayTools/Surface/index.d.ts +2 -0
- package/dist/esm/tools/displayTools/Surface/index.js +3 -0
- package/dist/esm/tools/displayTools/Surface/index.js.map +1 -0
- package/dist/esm/tools/displayTools/Surface/removeSurfaceFromElement.d.ts +2 -0
- package/dist/esm/tools/displayTools/Surface/removeSurfaceFromElement.js +12 -0
- package/dist/esm/tools/displayTools/Surface/removeSurfaceFromElement.js.map +1 -0
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.d.ts +11 -0
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js +101 -0
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js.map +1 -0
- 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/types/SegmentationStateTypes.d.ts +9 -1
- package/dist/esm/types/SurfaceTypes.d.ts +4 -0
- package/dist/esm/types/SurfaceTypes.js +2 -0
- package/dist/esm/types/SurfaceTypes.js.map +1 -0
- package/dist/esm/utilities/dynamicVolume/getDataInTime.js +58 -21
- package/dist/esm/utilities/dynamicVolume/getDataInTime.js.map +1 -1
- package/dist/esm/utilities/index.d.ts +3 -1
- package/dist/esm/utilities/index.js +3 -1
- package/dist/esm/utilities/index.js.map +1 -1
- package/dist/esm/utilities/math/point/distanceToPoint.d.ts +3 -1
- package/dist/esm/utilities/math/point/distanceToPoint.js +5 -5
- package/dist/esm/utilities/math/point/distanceToPoint.js.map +1 -1
- package/dist/esm/utilities/pointToString.d.ts +1 -0
- package/dist/esm/utilities/pointToString.js +9 -0
- package/dist/esm/utilities/pointToString.js.map +1 -0
- package/dist/esm/utilities/polyData/utils.d.ts +4 -0
- package/dist/esm/utilities/polyData/utils.js +52 -0
- package/dist/esm/utilities/polyData/utils.js.map +1 -0
- package/dist/esm/utilities/segmentation/utilities.js +2 -2
- package/dist/esm/utilities/segmentation/utilities.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +4 -4
- package/src/drawingSvg/drawPolyline.ts +17 -11
- package/src/enums/SegmentationRepresentations.ts +1 -1
- package/src/index.ts +2 -0
- package/src/stateManagement/segmentation/addSegmentationRepresentations.ts +8 -0
- package/src/tools/SegmentationIntersectionTool.ts +300 -0
- package/src/tools/displayTools/Contour/addContourSetsToElement.ts +1 -1
- package/src/tools/displayTools/SegmentationDisplayTool.ts +10 -4
- package/src/tools/displayTools/Surface/addSurfaceToElement.ts +115 -0
- package/src/tools/displayTools/Surface/index.ts +3 -0
- package/src/tools/displayTools/Surface/removeSurfaceFromElement.ts +35 -0
- package/src/tools/displayTools/Surface/surfaceDisplay.ts +215 -0
- package/src/tools/index.ts +2 -0
- package/src/types/SegmentationStateTypes.ts +18 -1
- package/src/types/SurfaceTypes.ts +10 -0
- package/src/utilities/dynamicVolume/generateImageFromTimeData.ts +3 -3
- package/src/utilities/dynamicVolume/getDataInTime.ts +115 -25
- package/src/utilities/index.ts +4 -0
- package/src/utilities/math/point/distanceToPoint.ts +12 -11
- package/src/utilities/pointToString.ts +10 -0
- package/src/utilities/polyData/utils.ts +82 -0
- package/src/utilities/segmentation/utilities.ts +2 -3
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { cache, getEnabledElementByIds, utilities, Enums, } from '@cornerstonejs/core';
|
|
2
|
+
import * as SegmentationState from '../../../stateManagement/segmentation/segmentationState';
|
|
3
|
+
import * as SegmentationConfig from '../../../stateManagement/segmentation/config/segmentationConfig';
|
|
4
|
+
import Representations from '../../../enums/SegmentationRepresentations';
|
|
5
|
+
import { getToolGroup } from '../../../store/ToolGroupManager';
|
|
6
|
+
import removeSurfaceFromElement from './removeSurfaceFromElement';
|
|
7
|
+
import addSurfaceToElement from './addSurfaceToElement';
|
|
8
|
+
async function addSegmentationRepresentation(toolGroupId, representationInput, toolGroupSpecificConfig) {
|
|
9
|
+
const { segmentationId } = representationInput;
|
|
10
|
+
const segmentationRepresentationUID = utilities.uuidv4();
|
|
11
|
+
const segmentsHidden = new Set();
|
|
12
|
+
const colorLUTIndex = 0;
|
|
13
|
+
const active = true;
|
|
14
|
+
const toolGroupSpecificRepresentation = {
|
|
15
|
+
segmentationId,
|
|
16
|
+
segmentationRepresentationUID,
|
|
17
|
+
type: Representations.Surface,
|
|
18
|
+
segmentsHidden,
|
|
19
|
+
colorLUTIndex,
|
|
20
|
+
active,
|
|
21
|
+
segmentationRepresentationSpecificConfig: {},
|
|
22
|
+
segmentSpecificConfig: {},
|
|
23
|
+
config: {},
|
|
24
|
+
};
|
|
25
|
+
if (toolGroupSpecificConfig) {
|
|
26
|
+
const currentToolGroupConfig = SegmentationConfig.getToolGroupSpecificConfig(toolGroupId);
|
|
27
|
+
const mergedConfig = utilities.deepMerge(currentToolGroupConfig, toolGroupSpecificConfig);
|
|
28
|
+
SegmentationConfig.setToolGroupSpecificConfig(toolGroupId, {
|
|
29
|
+
renderInactiveSegmentations: mergedConfig.renderInactiveSegmentations || true,
|
|
30
|
+
representations: {
|
|
31
|
+
...mergedConfig.representations,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
SegmentationState.addSegmentationRepresentation(toolGroupId, toolGroupSpecificRepresentation);
|
|
36
|
+
return segmentationRepresentationUID;
|
|
37
|
+
}
|
|
38
|
+
function removeSegmentationRepresentation(toolGroupId, segmentationRepresentationUID, renderImmediate = false) {
|
|
39
|
+
_removeSurfaceFromToolGroupViewports(toolGroupId, segmentationRepresentationUID);
|
|
40
|
+
SegmentationState.removeSegmentationRepresentation(toolGroupId, segmentationRepresentationUID);
|
|
41
|
+
if (renderImmediate) {
|
|
42
|
+
const viewportsInfo = getToolGroup(toolGroupId).getViewportsInfo();
|
|
43
|
+
viewportsInfo.forEach(({ viewportId, renderingEngineId }) => {
|
|
44
|
+
const enabledElement = getEnabledElementByIds(viewportId, renderingEngineId);
|
|
45
|
+
enabledElement.viewport.render();
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async function render(viewport, representation, toolGroupConfig) {
|
|
50
|
+
const { colorLUTIndex, active, segmentationId, segmentationRepresentationUID, segmentsHidden, } = representation;
|
|
51
|
+
const segmentation = SegmentationState.getSegmentation(segmentationId);
|
|
52
|
+
const SurfaceData = segmentation.representationData[Representations.Surface];
|
|
53
|
+
const { geometryId } = SurfaceData;
|
|
54
|
+
if (!geometryId) {
|
|
55
|
+
console.warn(`No Surfaces found for segmentationId ${segmentationId}. Skipping render.`);
|
|
56
|
+
}
|
|
57
|
+
const geometry = cache.getGeometry(geometryId);
|
|
58
|
+
if (!geometry) {
|
|
59
|
+
throw new Error(`No Surfaces found for geometryId ${geometryId}`);
|
|
60
|
+
}
|
|
61
|
+
if (geometry.type !== Enums.GeometryType.SURFACE) {
|
|
62
|
+
throw new Error(`Geometry type ${geometry.type} not supported for rendering.`);
|
|
63
|
+
}
|
|
64
|
+
if (!geometry.data) {
|
|
65
|
+
console.warn(`No Surfaces found for geometryId ${geometryId}. Skipping render.`);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const surface = geometry.data;
|
|
69
|
+
const surfaceUID = `${segmentationRepresentationUID}_${surface.id}}`;
|
|
70
|
+
_renderSurface(viewport, surface, surfaceUID);
|
|
71
|
+
viewport.resetCamera();
|
|
72
|
+
viewport.render();
|
|
73
|
+
}
|
|
74
|
+
function _renderSurface(viewport, surface, surfaceUID) {
|
|
75
|
+
const actorUID = surfaceUID;
|
|
76
|
+
const actorEntry = viewport.getActor(actorUID);
|
|
77
|
+
if (!actorEntry) {
|
|
78
|
+
addSurfaceToElement(viewport.element, surface, actorUID);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
throw new Error('Not implemented yet. (Update surface)');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function _removeSurfaceFromToolGroupViewports(toolGroupId, segmentationRepresentationUID) {
|
|
85
|
+
const toolGroup = getToolGroup(toolGroupId);
|
|
86
|
+
if (toolGroup === undefined) {
|
|
87
|
+
throw new Error(`ToolGroup with ToolGroupId ${toolGroupId} does not exist`);
|
|
88
|
+
}
|
|
89
|
+
const { viewportsInfo } = toolGroup;
|
|
90
|
+
for (const viewportInfo of viewportsInfo) {
|
|
91
|
+
const { viewportId, renderingEngineId } = viewportInfo;
|
|
92
|
+
const enabledElement = getEnabledElementByIds(viewportId, renderingEngineId);
|
|
93
|
+
removeSurfaceFromElement(enabledElement.viewport.element, segmentationRepresentationUID);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export default {
|
|
97
|
+
render,
|
|
98
|
+
addSegmentationRepresentation,
|
|
99
|
+
removeSegmentationRepresentation,
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=surfaceDisplay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surfaceDisplay.js","sourceRoot":"","sources":["../../../../../src/tools/displayTools/Surface/surfaceDisplay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,sBAAsB,EAEtB,SAAS,EACT,KAAK,GACN,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,iBAAiB,MAAM,yDAAyD,CAAC;AAC7F,OAA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F,wBAAwB,CACtB,cAAc,CAAC,QAAQ,CAAC,OAAO,EAC/B,6BAA6B,CAC9B,CAAC;KACH;AACH,CAAC;AAED,eAAe;IACb,MAAM;IACN,6BAA6B;IAC7B,gCAAgC;CACjC,CAAC"}
|
|
@@ -13,6 +13,7 @@ import MagnifyTool from './MagnifyTool';
|
|
|
13
13
|
import AdvancedMagnifyTool from './AdvancedMagnifyTool';
|
|
14
14
|
import ReferenceLinesTool from './ReferenceLinesTool';
|
|
15
15
|
import OverlayGridTool from './OverlayGridTool';
|
|
16
|
+
import SegmentationIntersectionTool from './SegmentationIntersectionTool';
|
|
16
17
|
import BidirectionalTool from './annotation/BidirectionalTool';
|
|
17
18
|
import LengthTool from './annotation/LengthTool';
|
|
18
19
|
import ProbeTool from './annotation/ProbeTool';
|
|
@@ -36,4 +37,4 @@ import RectangleROIStartEndThresholdTool from './segmentation/RectangleROIStartE
|
|
|
36
37
|
import BrushTool from './segmentation/BrushTool';
|
|
37
38
|
import PaintFillTool from './segmentation/PaintFillTool';
|
|
38
39
|
import OrientationMarkerTool from './OrientationMarkerTool';
|
|
39
|
-
export { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, StackScrollTool, PlanarRotateTool, StackScrollMouseWheelTool, ZoomTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, BidirectionalTool, LengthTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, PlanarFreehandROITool, ArrowAnnotateTool, AngleTool, CobbAngleTool, ReferenceCursors, SegmentationDisplayTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, BrushTool, MagnifyTool, AdvancedMagnifyTool, ReferenceLines, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, };
|
|
40
|
+
export { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, StackScrollTool, PlanarRotateTool, StackScrollMouseWheelTool, ZoomTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, BidirectionalTool, LengthTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, PlanarFreehandROITool, ArrowAnnotateTool, AngleTool, CobbAngleTool, ReferenceCursors, SegmentationDisplayTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, BrushTool, MagnifyTool, AdvancedMagnifyTool, ReferenceLines, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, };
|
package/dist/esm/tools/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import MagnifyTool from './MagnifyTool';
|
|
|
13
13
|
import AdvancedMagnifyTool from './AdvancedMagnifyTool';
|
|
14
14
|
import ReferenceLinesTool from './ReferenceLinesTool';
|
|
15
15
|
import OverlayGridTool from './OverlayGridTool';
|
|
16
|
+
import SegmentationIntersectionTool from './SegmentationIntersectionTool';
|
|
16
17
|
import BidirectionalTool from './annotation/BidirectionalTool';
|
|
17
18
|
import LengthTool from './annotation/LengthTool';
|
|
18
19
|
import ProbeTool from './annotation/ProbeTool';
|
|
@@ -36,5 +37,5 @@ import RectangleROIStartEndThresholdTool from './segmentation/RectangleROIStartE
|
|
|
36
37
|
import BrushTool from './segmentation/BrushTool';
|
|
37
38
|
import PaintFillTool from './segmentation/PaintFillTool';
|
|
38
39
|
import OrientationMarkerTool from './OrientationMarkerTool';
|
|
39
|
-
export { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, StackScrollTool, PlanarRotateTool, StackScrollMouseWheelTool, ZoomTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, BidirectionalTool, LengthTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, PlanarFreehandROITool, ArrowAnnotateTool, AngleTool, CobbAngleTool, ReferenceCursors, SegmentationDisplayTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, BrushTool, MagnifyTool, AdvancedMagnifyTool, ReferenceLines, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, };
|
|
40
|
+
export { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, StackScrollTool, PlanarRotateTool, StackScrollMouseWheelTool, ZoomTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, BidirectionalTool, LengthTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, PlanarFreehandROITool, ArrowAnnotateTool, AngleTool, CobbAngleTool, ReferenceCursors, SegmentationDisplayTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, BrushTool, MagnifyTool, AdvancedMagnifyTool, ReferenceLines, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, };
|
|
40
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,yBAAyB,MAAM,iCAAiC,CAAC;AACxE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,0BAA0B,MAAM,8BAA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AqB,GACtB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Enums from '../enums';
|
|
2
2
|
import { ContourConfig, ContourRenderingConfig, ContourSegmentationData } from './ContourTypes';
|
|
3
3
|
import type { LabelmapConfig, LabelmapRenderingConfig, LabelmapSegmentationData } from './LabelmapTypes';
|
|
4
|
+
import { SurfaceSegmentationData, SurfaceRenderingConfig } from './SurfaceTypes';
|
|
4
5
|
export declare type Color = [number, number, number, number];
|
|
5
6
|
export declare type ColorLUT = Array<Color>;
|
|
6
7
|
export declare type SegmentSpecificRepresentationConfig = {
|
|
@@ -9,6 +10,7 @@ export declare type SegmentSpecificRepresentationConfig = {
|
|
|
9
10
|
export declare type RepresentationConfig = {
|
|
10
11
|
LABELMAP?: LabelmapConfig;
|
|
11
12
|
CONTOUR?: ContourConfig;
|
|
13
|
+
SURFACE?: any;
|
|
12
14
|
};
|
|
13
15
|
export declare type SegmentationRepresentationConfig = {
|
|
14
16
|
renderInactiveSegmentations: boolean;
|
|
@@ -17,6 +19,7 @@ export declare type SegmentationRepresentationConfig = {
|
|
|
17
19
|
export declare type SegmentationRepresentationData = {
|
|
18
20
|
LABELMAP?: LabelmapSegmentationData;
|
|
19
21
|
CONTOUR?: ContourSegmentationData;
|
|
22
|
+
SURFACE?: SurfaceSegmentationData;
|
|
20
23
|
};
|
|
21
24
|
export declare type Segmentation = {
|
|
22
25
|
segmentationId: string;
|
|
@@ -50,6 +53,11 @@ export declare type ToolGroupSpecificContourRepresentation = ToolGroupSpecificRe
|
|
|
50
53
|
segmentationRepresentationSpecificConfig?: RepresentationConfig;
|
|
51
54
|
segmentSpecificConfig?: SegmentSpecificRepresentationConfig;
|
|
52
55
|
};
|
|
56
|
+
export declare type ToolGroupSpecificSurfaceRepresentation = ToolGroupSpecificRepresentationState & {
|
|
57
|
+
config: SurfaceRenderingConfig;
|
|
58
|
+
segmentationRepresentationSpecificConfig?: RepresentationConfig;
|
|
59
|
+
segmentSpecificConfig?: SegmentSpecificRepresentationConfig;
|
|
60
|
+
};
|
|
53
61
|
export declare type ToolGroupSpecificRepresentation = ToolGroupSpecificLabelmapRepresentation | ToolGroupSpecificContourRepresentation;
|
|
54
62
|
export declare type ToolGroupSpecificRepresentations = Array<ToolGroupSpecificRepresentation>;
|
|
55
63
|
export declare type SegmentationState = {
|
|
@@ -67,7 +75,7 @@ export declare type SegmentationPublicInput = {
|
|
|
67
75
|
segmentationId: string;
|
|
68
76
|
representation: {
|
|
69
77
|
type: Enums.SegmentationRepresentations;
|
|
70
|
-
data: LabelmapSegmentationData | ContourSegmentationData;
|
|
78
|
+
data: LabelmapSegmentationData | ContourSegmentationData | SurfaceSegmentationData;
|
|
71
79
|
};
|
|
72
80
|
};
|
|
73
81
|
export declare type RepresentationPublicInput = {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurfaceTypes.js","sourceRoot":"","sources":["../../../src/types/SurfaceTypes.ts"],"names":[],"mappings":""}
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
import { utilities, cache } from '@cornerstonejs/core';
|
|
2
|
+
import { getVoxelOverlap } from '../segmentation/utilities';
|
|
3
|
+
import pointInShapeCallback from '../pointInShapeCallback';
|
|
2
4
|
function getDataInTime(dynamicVolume, options) {
|
|
3
5
|
let dataInTime;
|
|
4
6
|
const frames = options.frameNumbers || [
|
|
5
7
|
...Array(dynamicVolume.numTimePoints).keys(),
|
|
6
8
|
];
|
|
7
9
|
if (!options.maskVolumeId && !options.imageCoordinate) {
|
|
8
|
-
throw new Error('
|
|
10
|
+
throw new Error('You should provide either maskVolumeId or imageCoordinate');
|
|
9
11
|
}
|
|
10
12
|
if (options.maskVolumeId && options.imageCoordinate) {
|
|
11
|
-
throw new Error('
|
|
13
|
+
throw new Error('You can only use one of maskVolumeId or imageCoordinate');
|
|
12
14
|
}
|
|
13
15
|
if (options.maskVolumeId) {
|
|
14
16
|
const segmentationVolume = cache.getVolume(options.maskVolumeId);
|
|
15
|
-
const
|
|
16
|
-
const indexArray = [];
|
|
17
|
-
for (let i = 0, len = segScalarData.length; i < len; i++) {
|
|
18
|
-
if (segScalarData[i] !== 0) {
|
|
19
|
-
indexArray.push(i);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
const dataInTime = _getTimePointDataMask(frames, indexArray, dynamicVolume);
|
|
17
|
+
const dataInTime = _getTimePointDataMask(frames, dynamicVolume, segmentationVolume);
|
|
23
18
|
return dataInTime;
|
|
24
19
|
}
|
|
25
20
|
if (options.imageCoordinate) {
|
|
@@ -48,18 +43,60 @@ function _getTimePointDataCoordinate(frames, coordinate, volume) {
|
|
|
48
43
|
});
|
|
49
44
|
return value;
|
|
50
45
|
}
|
|
51
|
-
function _getTimePointDataMask(frames,
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
46
|
+
function _getTimePointDataMask(frames, dynamicVolume, segmentationVolume) {
|
|
47
|
+
const { imageData: maskImageData } = segmentationVolume;
|
|
48
|
+
const segScalarData = segmentationVolume.getScalarData();
|
|
49
|
+
const len = segScalarData.length;
|
|
50
|
+
const nonZeroVoxelIndices = [];
|
|
51
|
+
nonZeroVoxelIndices.length = len;
|
|
52
|
+
let actualLen = 0;
|
|
53
|
+
for (let i = 0, len = segScalarData.length; i < len; i++) {
|
|
54
|
+
if (segScalarData[i] !== 0) {
|
|
55
|
+
nonZeroVoxelIndices[actualLen++] = i;
|
|
56
|
+
}
|
|
61
57
|
}
|
|
62
|
-
|
|
58
|
+
nonZeroVoxelIndices.length = actualLen;
|
|
59
|
+
const dynamicVolumeScalarDataArray = dynamicVolume.getScalarDataArrays();
|
|
60
|
+
const values = [];
|
|
61
|
+
const isSameVolume = dynamicVolumeScalarDataArray[0].length === len &&
|
|
62
|
+
JSON.stringify(dynamicVolume.spacing) ===
|
|
63
|
+
JSON.stringify(segmentationVolume.spacing);
|
|
64
|
+
if (isSameVolume) {
|
|
65
|
+
for (let i = 0; i < nonZeroVoxelIndices.length; i++) {
|
|
66
|
+
const indexValues = [];
|
|
67
|
+
frames.forEach((frame) => {
|
|
68
|
+
const activeScalarData = dynamicVolumeScalarDataArray[frame];
|
|
69
|
+
indexValues.push(activeScalarData[nonZeroVoxelIndices[i]]);
|
|
70
|
+
});
|
|
71
|
+
values.push(indexValues);
|
|
72
|
+
}
|
|
73
|
+
return values;
|
|
74
|
+
}
|
|
75
|
+
const callback = ({ pointLPS: segPointLPS, value: segValue }) => {
|
|
76
|
+
if (segValue === 0) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const overlapIJKMinMax = getVoxelOverlap(dynamicVolume.imageData, dynamicVolume.dimensions, dynamicVolume.spacing, segPointLPS);
|
|
80
|
+
let count = 0;
|
|
81
|
+
const perFrameSum = new Map();
|
|
82
|
+
frames.forEach((frame) => perFrameSum.set(frame, 0));
|
|
83
|
+
const averageCallback = ({ index }) => {
|
|
84
|
+
for (let i = 0; i < frames.length; i++) {
|
|
85
|
+
const value = dynamicVolumeScalarDataArray[i][index];
|
|
86
|
+
const frame = frames[i];
|
|
87
|
+
perFrameSum.set(frame, perFrameSum.get(frame) + value);
|
|
88
|
+
}
|
|
89
|
+
count++;
|
|
90
|
+
};
|
|
91
|
+
pointInShapeCallback(dynamicVolume.imageData, () => true, averageCallback, overlapIJKMinMax);
|
|
92
|
+
const averageValues = [];
|
|
93
|
+
perFrameSum.forEach((sum) => {
|
|
94
|
+
averageValues.push(sum / count);
|
|
95
|
+
});
|
|
96
|
+
values.push(averageValues);
|
|
97
|
+
};
|
|
98
|
+
pointInShapeCallback(maskImageData, () => true, callback);
|
|
99
|
+
return values;
|
|
63
100
|
}
|
|
64
101
|
export default getDataInTime;
|
|
65
102
|
//# sourceMappingURL=getDataInTime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDataInTime.js","sourceRoot":"","sources":["../../../../src/utilities/dynamicVolume/getDataInTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAS,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"getDataInTime.js","sourceRoot":"","sources":["../../../../src/utilities/dynamicVolume/getDataInTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAS,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAc3D,SAAS,aAAa,CACpB,aAAwC,EACxC,OAIC;IAED,IAAI,UAAU,CAAC;IAGf,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,IAAI;QACrC,GAAG,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE;KAC7C,CAAC;IAKF,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE;QACrD,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;KACH;IAED,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,eAAe,EAAE;QACnD,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;KAC5E;IAED,IAAI,OAAO,CAAC,YAAY,EAAE;QACxB,MAAM,kBAAkB,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAEjE,MAAM,UAAU,GAAG,qBAAqB,CACtC,MAAM,EACN,aAAa,EACb,kBAAkB,CACnB,CAAC;QAEF,OAAO,UAAU,CAAC;KACnB;IAED,IAAI,OAAO,CAAC,eAAe,EAAE;QAC3B,MAAM,UAAU,GAAG,2BAA2B,CAC5C,MAAM,EACN,OAAO,CAAC,eAAe,EACvB,aAAa,CACd,CAAC;QAEF,OAAO,UAAU,CAAC;KACnB;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,2BAA2B,CAA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AAG,EAAE,EAAE;YAC1B,aAAa,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC7B,CAAC,CAAC;IAMF,oBAAoB,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAE1D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -11,6 +11,7 @@ import pointInShapeCallback from './pointInShapeCallback';
|
|
|
11
11
|
import pointInSurroundingSphereCallback from './pointInSurroundingSphereCallback';
|
|
12
12
|
import scroll from './scroll';
|
|
13
13
|
import roundNumber from './roundNumber';
|
|
14
|
+
import { pointToString } from './pointToString';
|
|
14
15
|
import * as segmentation from './segmentation';
|
|
15
16
|
import * as drawing from './drawing';
|
|
16
17
|
import * as math from './math';
|
|
@@ -25,5 +26,6 @@ import { stackPrefetch, stackContextPrefetch } from './stackPrefetch';
|
|
|
25
26
|
import * as viewport from './viewport';
|
|
26
27
|
import * as touch from './touch';
|
|
27
28
|
import * as dynamicVolume from './dynamicVolume';
|
|
29
|
+
import * as polyDataUtils from './polyData/utils';
|
|
28
30
|
import { triggerEvent } from '@cornerstonejs/core';
|
|
29
|
-
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, segmentation, triggerAnnotationRenderForViewportIds, triggerAnnotationRender, pointInShapeCallback, pointInSurroundingSphereCallback, getAnnotationNearPoint, getAnnotationNearPointOnEnabledElement, jumpToSlice, viewport, cine, clip, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, scroll, roundNumber, };
|
|
31
|
+
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, segmentation, triggerAnnotationRenderForViewportIds, triggerAnnotationRender, pointInShapeCallback, pointInSurroundingSphereCallback, getAnnotationNearPoint, getAnnotationNearPointOnEnabledElement, jumpToSlice, viewport, cine, clip, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, scroll, roundNumber, pointToString, polyDataUtils, };
|
|
@@ -11,6 +11,7 @@ import pointInShapeCallback from './pointInShapeCallback';
|
|
|
11
11
|
import pointInSurroundingSphereCallback from './pointInSurroundingSphereCallback';
|
|
12
12
|
import scroll from './scroll';
|
|
13
13
|
import roundNumber from './roundNumber';
|
|
14
|
+
import { pointToString } from './pointToString';
|
|
14
15
|
import * as segmentation from './segmentation';
|
|
15
16
|
import * as drawing from './drawing';
|
|
16
17
|
import * as math from './math';
|
|
@@ -25,6 +26,7 @@ import { stackPrefetch, stackContextPrefetch } from './stackPrefetch';
|
|
|
25
26
|
import * as viewport from './viewport';
|
|
26
27
|
import * as touch from './touch';
|
|
27
28
|
import * as dynamicVolume from './dynamicVolume';
|
|
29
|
+
import * as polyDataUtils from './polyData/utils';
|
|
28
30
|
import { triggerEvent } from '@cornerstonejs/core';
|
|
29
|
-
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, segmentation, triggerAnnotationRenderForViewportIds, triggerAnnotationRender, pointInShapeCallback, pointInSurroundingSphereCallback, getAnnotationNearPoint, getAnnotationNearPointOnEnabledElement, jumpToSlice, viewport, cine, clip, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, scroll, roundNumber, };
|
|
31
|
+
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, segmentation, triggerAnnotationRenderForViewportIds, triggerAnnotationRender, pointInShapeCallback, pointInSurroundingSphereCallback, getAnnotationNearPoint, getAnnotationNearPointOnEnabledElement, jumpToSlice, viewport, cine, clip, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, scroll, roundNumber, pointToString, polyDataUtils, };
|
|
30
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sCAAsC,GACvC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,qCAAqC,MAAM,yCAAyC,CAAC;AAC5F,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,WAAW,MAAM,wBAAwB,CAAC;AAEjD,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,gCAAgC,MAAM,oCAAoC,CAAC;AAClF,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,WAAW,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sCAAsC,GACvC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,qCAAqC,MAAM,yCAAyC,CAAC;AAC5F,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,WAAW,MAAM,wBAAwB,CAAC;AAEjD,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,gCAAgC,MAAM,oCAAoC,CAAC;AAClF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N,WAAW,EACX,aAAa,EACb,aAAa,GACd,CAAC"}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
|
-
|
|
2
|
+
declare type Point = Types.Point2 | Types.Point3;
|
|
3
|
+
export default function distanceToPoint(p1: Point, p2: Point): number;
|
|
4
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export default function distanceToPoint(p1, p2) {
|
|
2
|
-
if (p1
|
|
3
|
-
throw Error('points should have
|
|
2
|
+
if (p1.length !== p2.length) {
|
|
3
|
+
throw Error('Both points should have the same dimensionality');
|
|
4
4
|
}
|
|
5
|
-
const [x1, y1] = p1;
|
|
6
|
-
const [x2, y2] = p2;
|
|
7
|
-
return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
|
|
5
|
+
const [x1, y1, z1 = 0] = p1;
|
|
6
|
+
const [x2, y2, z2 = 0] = p2;
|
|
7
|
+
return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2) + Math.pow(z1 - z2, 2));
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=distanceToPoint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distanceToPoint.js","sourceRoot":"","sources":["../../../../../src/utilities/math/point/distanceToPoint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"distanceToPoint.js","sourceRoot":"","sources":["../../../../../src/utilities/math/point/distanceToPoint.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAS,EAAE,EAAS;IAC1D,IAAI,EAAE,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM,EAAE;QAC3B,MAAM,KAAK,CAAC,iDAAiD,CAAC,CAAC;KAChE;IAED,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IAC5B,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IAE5B,OAAO,IAAI,CAAC,IAAI,CACd,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CACnE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function pointToString(point: any, decimals?: number): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointToString.js","sourceRoot":"","sources":["../../../src/utilities/pointToString.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,KAAK,EAAE,QAAQ,GAAG,CAAC;IAC/C,OAAO,CACL,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QACtC,GAAG;QACH,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QACtC,GAAG;QACH,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QACtC,GAAG,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData';
|
|
2
|
+
export declare function getPoint(points: any, idx: any): any[];
|
|
3
|
+
export declare function getPolyDataPointIndexes(polyData: vtkPolyData): any[];
|
|
4
|
+
export declare function getPolyDataPoints(polyData: vtkPolyData): any[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export function getPoint(points, idx) {
|
|
2
|
+
if (idx < points.length / 3) {
|
|
3
|
+
return [points[idx * 3], points[idx * 3 + 1], points[idx * 3 + 2]];
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
export function getPolyDataPointIndexes(polyData) {
|
|
7
|
+
const linesData = polyData.getLines().getData();
|
|
8
|
+
let idx = 0;
|
|
9
|
+
const lineSegments = new Map();
|
|
10
|
+
while (idx < linesData.length) {
|
|
11
|
+
const segmentSize = linesData[idx++];
|
|
12
|
+
const segment = [];
|
|
13
|
+
for (let i = 0; i < segmentSize; i++) {
|
|
14
|
+
segment.push(linesData[idx + i]);
|
|
15
|
+
}
|
|
16
|
+
lineSegments.set(segment[0], segment);
|
|
17
|
+
idx += segmentSize;
|
|
18
|
+
}
|
|
19
|
+
const contours = [];
|
|
20
|
+
const findStartingPoint = (map) => {
|
|
21
|
+
for (const [key, value] of map.entries()) {
|
|
22
|
+
if (value !== undefined) {
|
|
23
|
+
return key;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return -1;
|
|
27
|
+
};
|
|
28
|
+
let startPoint = findStartingPoint(lineSegments);
|
|
29
|
+
while (startPoint !== -1) {
|
|
30
|
+
const contour = [startPoint];
|
|
31
|
+
while (lineSegments.has(startPoint)) {
|
|
32
|
+
const nextPoint = lineSegments.get(startPoint)[1];
|
|
33
|
+
if (lineSegments.has(nextPoint)) {
|
|
34
|
+
contour.push(nextPoint);
|
|
35
|
+
}
|
|
36
|
+
lineSegments.delete(startPoint);
|
|
37
|
+
startPoint = nextPoint;
|
|
38
|
+
}
|
|
39
|
+
contours.push(contour);
|
|
40
|
+
startPoint = findStartingPoint(lineSegments);
|
|
41
|
+
}
|
|
42
|
+
return contours.length ? contours : undefined;
|
|
43
|
+
}
|
|
44
|
+
export function getPolyDataPoints(polyData) {
|
|
45
|
+
const contoursIndexes = getPolyDataPointIndexes(polyData);
|
|
46
|
+
if (!contoursIndexes) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const rawPointsData = polyData.getPoints().getData();
|
|
50
|
+
return contoursIndexes.map((contourIndexes) => contourIndexes.map((index) => getPoint(rawPointsData, index)));
|
|
51
|
+
}
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@ -25,7 +25,7 @@ export function getVoxelOverlap(imageData, dimensions, voxelSpacing, voxelCenter
|
|
|
25
25
|
for (let i = 0; i < 2; i++) {
|
|
26
26
|
for (let j = 0; j < 2; j++) {
|
|
27
27
|
for (let k = 0; k < 2; k++) {
|
|
28
|
-
const point = voxelCenter;
|
|
28
|
+
const point = [...voxelCenter];
|
|
29
29
|
point[0] = point[0] + ((i * 2 - 1) * voxelSpacing[0]) / 2;
|
|
30
30
|
point[1] = point[1] + ((j * 2 - 1) * voxelSpacing[1]) / 2;
|
|
31
31
|
point[2] = point[2] + ((k * 2 - 1) * voxelSpacing[2]) / 2;
|
|
@@ -38,7 +38,7 @@ export function getVoxelOverlap(imageData, dimensions, voxelSpacing, voxelCenter
|
|
|
38
38
|
return overlapBounds;
|
|
39
39
|
}
|
|
40
40
|
export function processVolumes(segmentationVolume, thresholdVolumeInformation) {
|
|
41
|
-
const { spacing: segmentationSpacing
|
|
41
|
+
const { spacing: segmentationSpacing } = segmentationVolume;
|
|
42
42
|
const scalarData = segmentationVolume.getScalarData();
|
|
43
43
|
const volumeInfoList = [];
|
|
44
44
|
let baseVolumeIdx = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/utilities.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,SAAS,MAAM,oCAAoC,CAAC;AAC3D,OAAO,yBAAyB,MAAM,0CAA0C,CAAC;AAQjF,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAC3C,WAAmB,EACnB,QAAiB;IAEjB,MAAM,SAAS,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IAE5C,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,OAAO;KACR;IAED,MAAM,aAAa,GAAG,SAAS,CAAC,cA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