@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,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const core_1 = require("@cornerstonejs/core");
|
|
39
|
+
const SegmentationState = __importStar(require("../../../stateManagement/segmentation/segmentationState"));
|
|
40
|
+
const SegmentationConfig = __importStar(require("../../../stateManagement/segmentation/config/segmentationConfig"));
|
|
41
|
+
const SegmentationRepresentations_1 = __importDefault(require("../../../enums/SegmentationRepresentations"));
|
|
42
|
+
const ToolGroupManager_1 = require("../../../store/ToolGroupManager");
|
|
43
|
+
const removeSurfaceFromElement_1 = __importDefault(require("./removeSurfaceFromElement"));
|
|
44
|
+
const addSurfaceToElement_1 = __importDefault(require("./addSurfaceToElement"));
|
|
45
|
+
function addSegmentationRepresentation(toolGroupId, representationInput, toolGroupSpecificConfig) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const { segmentationId } = representationInput;
|
|
48
|
+
const segmentationRepresentationUID = core_1.utilities.uuidv4();
|
|
49
|
+
const segmentsHidden = new Set();
|
|
50
|
+
const colorLUTIndex = 0;
|
|
51
|
+
const active = true;
|
|
52
|
+
const toolGroupSpecificRepresentation = {
|
|
53
|
+
segmentationId,
|
|
54
|
+
segmentationRepresentationUID,
|
|
55
|
+
type: SegmentationRepresentations_1.default.Surface,
|
|
56
|
+
segmentsHidden,
|
|
57
|
+
colorLUTIndex,
|
|
58
|
+
active,
|
|
59
|
+
segmentationRepresentationSpecificConfig: {},
|
|
60
|
+
segmentSpecificConfig: {},
|
|
61
|
+
config: {},
|
|
62
|
+
};
|
|
63
|
+
if (toolGroupSpecificConfig) {
|
|
64
|
+
const currentToolGroupConfig = SegmentationConfig.getToolGroupSpecificConfig(toolGroupId);
|
|
65
|
+
const mergedConfig = core_1.utilities.deepMerge(currentToolGroupConfig, toolGroupSpecificConfig);
|
|
66
|
+
SegmentationConfig.setToolGroupSpecificConfig(toolGroupId, {
|
|
67
|
+
renderInactiveSegmentations: mergedConfig.renderInactiveSegmentations || true,
|
|
68
|
+
representations: Object.assign({}, mergedConfig.representations),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
SegmentationState.addSegmentationRepresentation(toolGroupId, toolGroupSpecificRepresentation);
|
|
72
|
+
return segmentationRepresentationUID;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function removeSegmentationRepresentation(toolGroupId, segmentationRepresentationUID, renderImmediate = false) {
|
|
76
|
+
_removeSurfaceFromToolGroupViewports(toolGroupId, segmentationRepresentationUID);
|
|
77
|
+
SegmentationState.removeSegmentationRepresentation(toolGroupId, segmentationRepresentationUID);
|
|
78
|
+
if (renderImmediate) {
|
|
79
|
+
const viewportsInfo = (0, ToolGroupManager_1.getToolGroup)(toolGroupId).getViewportsInfo();
|
|
80
|
+
viewportsInfo.forEach(({ viewportId, renderingEngineId }) => {
|
|
81
|
+
const enabledElement = (0, core_1.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
82
|
+
enabledElement.viewport.render();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function render(viewport, representation, toolGroupConfig) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const { colorLUTIndex, active, segmentationId, segmentationRepresentationUID, segmentsHidden, } = representation;
|
|
89
|
+
const segmentation = SegmentationState.getSegmentation(segmentationId);
|
|
90
|
+
const SurfaceData = segmentation.representationData[SegmentationRepresentations_1.default.Surface];
|
|
91
|
+
const { geometryId } = SurfaceData;
|
|
92
|
+
if (!geometryId) {
|
|
93
|
+
console.warn(`No Surfaces found for segmentationId ${segmentationId}. Skipping render.`);
|
|
94
|
+
}
|
|
95
|
+
const geometry = core_1.cache.getGeometry(geometryId);
|
|
96
|
+
if (!geometry) {
|
|
97
|
+
throw new Error(`No Surfaces found for geometryId ${geometryId}`);
|
|
98
|
+
}
|
|
99
|
+
if (geometry.type !== core_1.Enums.GeometryType.SURFACE) {
|
|
100
|
+
throw new Error(`Geometry type ${geometry.type} not supported for rendering.`);
|
|
101
|
+
}
|
|
102
|
+
if (!geometry.data) {
|
|
103
|
+
console.warn(`No Surfaces found for geometryId ${geometryId}. Skipping render.`);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const surface = geometry.data;
|
|
107
|
+
const surfaceUID = `${segmentationRepresentationUID}_${surface.id}}`;
|
|
108
|
+
_renderSurface(viewport, surface, surfaceUID);
|
|
109
|
+
viewport.resetCamera();
|
|
110
|
+
viewport.render();
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function _renderSurface(viewport, surface, surfaceUID) {
|
|
114
|
+
const actorUID = surfaceUID;
|
|
115
|
+
const actorEntry = viewport.getActor(actorUID);
|
|
116
|
+
if (!actorEntry) {
|
|
117
|
+
(0, addSurfaceToElement_1.default)(viewport.element, surface, actorUID);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
throw new Error('Not implemented yet. (Update surface)');
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function _removeSurfaceFromToolGroupViewports(toolGroupId, segmentationRepresentationUID) {
|
|
124
|
+
const toolGroup = (0, ToolGroupManager_1.getToolGroup)(toolGroupId);
|
|
125
|
+
if (toolGroup === undefined) {
|
|
126
|
+
throw new Error(`ToolGroup with ToolGroupId ${toolGroupId} does not exist`);
|
|
127
|
+
}
|
|
128
|
+
const { viewportsInfo } = toolGroup;
|
|
129
|
+
for (const viewportInfo of viewportsInfo) {
|
|
130
|
+
const { viewportId, renderingEngineId } = viewportInfo;
|
|
131
|
+
const enabledElement = (0, core_1.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
132
|
+
(0, removeSurfaceFromElement_1.default)(enabledElement.viewport.element, segmentationRepresentationUID);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
exports.default = {
|
|
136
|
+
render,
|
|
137
|
+
addSegmentationRepresentation,
|
|
138
|
+
removeSegmentationRepresentation,
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=surfaceDisplay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surfaceDisplay.js","sourceRoot":"","sources":["../../../../../src/tools/displayTools/Surface/surfaceDisplay.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAM6B;AAE7B,2GAA6F;AAC7F,oHAAsG;AACtG,6GAAyE;AACzE,sEAA+D;AAO/D,0FAAkE;AAClE,gFAAwD;AAUxD,SAAe,6BAA6B,CAC1C,WAAmB,EACnB,mBAA8C,EAC9C,uBAA0D;;QAE1D,MAAM,EAAE,cAAc,EAAE,GAAG,mBAAmB,CAAC;QAC/C,MAAM,6BAA6B,GAAG,gBAAS,CAAC,MAAM,EAAE,CAAC;QAEzD,MAAM,cAAc,GAAG,IAAI,GAAG,EAAiB,CAAC;QAChD,MAAM,aAAa,GAAG,CAAC,CAAC;QACxB,MAAM,MAAM,GAAG,IAAI,CAAC;QACpB,MAAM,+BAA+B,GAAoC;YACvE,cAAc;YACd,6BAA6B;YAC7B,IAAI,EAAE,qCAAe,CAAC,OAAO;YAC7B,cAAc;YACd,aAAa;YACb,MAAM;YACN,wCAAwC,EAAE,EAAE;YAC5C,qBAAqB,EAAE,EAAE;YACzB,MAAM,EAAE,EAAE;SACX,CAAC;QAEF,IAAI,uBAAuB,EAAE;YAI3B,MAAM,sBAAsB,GAC1B,kBAAkB,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAC;YAC7D,MAAM,YAAY,GAAG,gBAAS,CAAC,SAAS,CACtC,sBAAsB,EACtB,uBAAuB,CACxB,CAAC;YACF,kBAAkB,CAAC,0BAA0B,CAAC,WAAW,EAAE;gBACzD,2BAA2B,EACzB,YAAY,CAAC,2BAA2B,IAAI,IAAI;gBAClD,eAAe,oBACV,YAAY,CAAC,eAAe,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Aa,EAAE,GAAG,SAAS,CAAC;IAEpC,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;QACxC,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,YAAY,CAAC;QACvD,MAAM,cAAc,GAAG,IAAA,6BAAsB,EAC3C,UAAU,EACV,iBAAiB,CAClB,CAAC;QACF,IAAA,kCAAwB,EACtB,cAAc,CAAC,QAAQ,CAAC,OAAO,EAC/B,6BAA6B,CAC9B,CAAC;KACH;AACH,CAAC;AAED,kBAAe;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/cjs/tools/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.OrientationMarkerTool = exports.ScaleOverlayTool = exports.PaintFillTool = exports.ReferenceLines = exports.AdvancedMagnifyTool = exports.MagnifyTool = exports.BrushTool = exports.RectangleROIStartEndThresholdTool = exports.RectangleROIThresholdTool = exports.SphereScissorsTool = exports.CircleScissorsTool = exports.RectangleScissorsTool = exports.SegmentationDisplayTool = exports.ReferenceCursors = exports.CobbAngleTool = exports.AngleTool = exports.ArrowAnnotateTool = exports.PlanarFreehandROITool = exports.CircleROITool = exports.EllipticalROITool = exports.RectangleROITool = exports.ProbeTool = exports.LengthTool = exports.BidirectionalTool = exports.OverlayGridTool = exports.ReferenceLinesTool = exports.CrosshairsTool = exports.MIPJumpToClickTool = exports.VolumeRotateMouseWheelTool = exports.ZoomTool = exports.StackScrollMouseWheelTool = exports.PlanarRotateTool = exports.StackScrollTool = exports.WindowLevelTool = exports.DragProbeTool = exports.TrackballRotateTool = exports.PanTool = exports.AnnotationDisplayTool = exports.AnnotationTool = exports.BaseTool = void 0;
|
|
6
|
+
exports.OrientationMarkerTool = exports.ScaleOverlayTool = exports.PaintFillTool = exports.ReferenceLines = exports.AdvancedMagnifyTool = exports.MagnifyTool = exports.BrushTool = exports.RectangleROIStartEndThresholdTool = exports.RectangleROIThresholdTool = exports.SphereScissorsTool = exports.CircleScissorsTool = exports.RectangleScissorsTool = exports.SegmentationDisplayTool = exports.ReferenceCursors = exports.CobbAngleTool = exports.AngleTool = exports.ArrowAnnotateTool = exports.PlanarFreehandROITool = exports.CircleROITool = exports.EllipticalROITool = exports.RectangleROITool = exports.ProbeTool = exports.LengthTool = exports.BidirectionalTool = exports.SegmentationIntersectionTool = exports.OverlayGridTool = exports.ReferenceLinesTool = exports.CrosshairsTool = exports.MIPJumpToClickTool = exports.VolumeRotateMouseWheelTool = exports.ZoomTool = exports.StackScrollMouseWheelTool = exports.PlanarRotateTool = exports.StackScrollTool = exports.WindowLevelTool = exports.DragProbeTool = exports.TrackballRotateTool = exports.PanTool = exports.AnnotationDisplayTool = exports.AnnotationTool = exports.BaseTool = void 0;
|
|
7
7
|
const base_1 = require("./base");
|
|
8
8
|
Object.defineProperty(exports, "BaseTool", { enumerable: true, get: function () { return base_1.BaseTool; } });
|
|
9
9
|
Object.defineProperty(exports, "AnnotationTool", { enumerable: true, get: function () { return base_1.AnnotationTool; } });
|
|
@@ -36,6 +36,8 @@ const ReferenceLinesTool_1 = __importDefault(require("./ReferenceLinesTool"));
|
|
|
36
36
|
exports.ReferenceLinesTool = ReferenceLinesTool_1.default;
|
|
37
37
|
const OverlayGridTool_1 = __importDefault(require("./OverlayGridTool"));
|
|
38
38
|
exports.OverlayGridTool = OverlayGridTool_1.default;
|
|
39
|
+
const SegmentationIntersectionTool_1 = __importDefault(require("./SegmentationIntersectionTool"));
|
|
40
|
+
exports.SegmentationIntersectionTool = SegmentationIntersectionTool_1.default;
|
|
39
41
|
const BidirectionalTool_1 = __importDefault(require("./annotation/BidirectionalTool"));
|
|
40
42
|
exports.BidirectionalTool = BidirectionalTool_1.default;
|
|
41
43
|
const LengthTool_1 = __importDefault(require("./annotation/LengthTool"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAyE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAyE;AA+CvE,yFA/CO,eAAQ,OA+CP;AACR,+FAhDiB,qBAAc,OAgDjB;AACd,sGAjDiC,4BAAqB,OAiDjC;AAhDvB,wDAAgC;AAkD9B,kBAlDK,iBAAO,CAkDL;AAjDT,gFAAwD;AAkDtD,8BAlDK,6BAAmB,CAkDL;AAjDrB,wEAAgD;AAmD9C,0BAnDK,yBAAe,CAmDL;AAlDjB,wEAAgD;AAmD9C,0BAnDK,yBAAe,CAmDL;AAlDjB,0EAAkD;AAmDhD,2BAnDK,0BAAgB,CAmDL;AAlDlB,oGAAwE;AAmDtE,oCAnDK,uCAAyB,CAmDL;AAlD3B,0DAAkC;AAmDhC,mBAnDK,kBAAQ,CAmDL;AAlDV,8FAAsE;AAmDpE,qCAnDK,oCAA0B,CAmDL;AAlD5B,8EAAsD;AAmDpD,6BAnDK,4BAAkB,CAmDL;AAlDpB,sEAA8C;AAoD5C,yBApDK,wBAAc,CAoDL;AAnDhB,gEAAwC;AA2EtC,sBA3EK,qBAAW,CA2EL;AA1Eb,gFAAwD;AA2EtD,8BA3EK,6BAAmB,CA2EL;AA1ErB,8EAAsD;AAkDpD,6BAlDK,4BAAkB,CAkDL;AAjDpB,wEA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
|
|
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,27 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const core_1 = require("@cornerstonejs/core");
|
|
7
|
+
const utilities_1 = require("../segmentation/utilities");
|
|
8
|
+
const pointInShapeCallback_1 = __importDefault(require("../pointInShapeCallback"));
|
|
4
9
|
function getDataInTime(dynamicVolume, options) {
|
|
5
10
|
let dataInTime;
|
|
6
11
|
const frames = options.frameNumbers || [
|
|
7
12
|
...Array(dynamicVolume.numTimePoints).keys(),
|
|
8
13
|
];
|
|
9
14
|
if (!options.maskVolumeId && !options.imageCoordinate) {
|
|
10
|
-
throw new Error('
|
|
15
|
+
throw new Error('You should provide either maskVolumeId or imageCoordinate');
|
|
11
16
|
}
|
|
12
17
|
if (options.maskVolumeId && options.imageCoordinate) {
|
|
13
|
-
throw new Error('
|
|
18
|
+
throw new Error('You can only use one of maskVolumeId or imageCoordinate');
|
|
14
19
|
}
|
|
15
20
|
if (options.maskVolumeId) {
|
|
16
21
|
const segmentationVolume = core_1.cache.getVolume(options.maskVolumeId);
|
|
17
|
-
const
|
|
18
|
-
const indexArray = [];
|
|
19
|
-
for (let i = 0, len = segScalarData.length; i < len; i++) {
|
|
20
|
-
if (segScalarData[i] !== 0) {
|
|
21
|
-
indexArray.push(i);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const dataInTime = _getTimePointDataMask(frames, indexArray, dynamicVolume);
|
|
22
|
+
const dataInTime = _getTimePointDataMask(frames, dynamicVolume, segmentationVolume);
|
|
25
23
|
return dataInTime;
|
|
26
24
|
}
|
|
27
25
|
if (options.imageCoordinate) {
|
|
@@ -50,18 +48,60 @@ function _getTimePointDataCoordinate(frames, coordinate, volume) {
|
|
|
50
48
|
});
|
|
51
49
|
return value;
|
|
52
50
|
}
|
|
53
|
-
function _getTimePointDataMask(frames,
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
function _getTimePointDataMask(frames, dynamicVolume, segmentationVolume) {
|
|
52
|
+
const { imageData: maskImageData } = segmentationVolume;
|
|
53
|
+
const segScalarData = segmentationVolume.getScalarData();
|
|
54
|
+
const len = segScalarData.length;
|
|
55
|
+
const nonZeroVoxelIndices = [];
|
|
56
|
+
nonZeroVoxelIndices.length = len;
|
|
57
|
+
let actualLen = 0;
|
|
58
|
+
for (let i = 0, len = segScalarData.length; i < len; i++) {
|
|
59
|
+
if (segScalarData[i] !== 0) {
|
|
60
|
+
nonZeroVoxelIndices[actualLen++] = i;
|
|
61
|
+
}
|
|
63
62
|
}
|
|
64
|
-
|
|
63
|
+
nonZeroVoxelIndices.length = actualLen;
|
|
64
|
+
const dynamicVolumeScalarDataArray = dynamicVolume.getScalarDataArrays();
|
|
65
|
+
const values = [];
|
|
66
|
+
const isSameVolume = dynamicVolumeScalarDataArray[0].length === len &&
|
|
67
|
+
JSON.stringify(dynamicVolume.spacing) ===
|
|
68
|
+
JSON.stringify(segmentationVolume.spacing);
|
|
69
|
+
if (isSameVolume) {
|
|
70
|
+
for (let i = 0; i < nonZeroVoxelIndices.length; i++) {
|
|
71
|
+
const indexValues = [];
|
|
72
|
+
frames.forEach((frame) => {
|
|
73
|
+
const activeScalarData = dynamicVolumeScalarDataArray[frame];
|
|
74
|
+
indexValues.push(activeScalarData[nonZeroVoxelIndices[i]]);
|
|
75
|
+
});
|
|
76
|
+
values.push(indexValues);
|
|
77
|
+
}
|
|
78
|
+
return values;
|
|
79
|
+
}
|
|
80
|
+
const callback = ({ pointLPS: segPointLPS, value: segValue }) => {
|
|
81
|
+
if (segValue === 0) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const overlapIJKMinMax = (0, utilities_1.getVoxelOverlap)(dynamicVolume.imageData, dynamicVolume.dimensions, dynamicVolume.spacing, segPointLPS);
|
|
85
|
+
let count = 0;
|
|
86
|
+
const perFrameSum = new Map();
|
|
87
|
+
frames.forEach((frame) => perFrameSum.set(frame, 0));
|
|
88
|
+
const averageCallback = ({ index }) => {
|
|
89
|
+
for (let i = 0; i < frames.length; i++) {
|
|
90
|
+
const value = dynamicVolumeScalarDataArray[i][index];
|
|
91
|
+
const frame = frames[i];
|
|
92
|
+
perFrameSum.set(frame, perFrameSum.get(frame) + value);
|
|
93
|
+
}
|
|
94
|
+
count++;
|
|
95
|
+
};
|
|
96
|
+
(0, pointInShapeCallback_1.default)(dynamicVolume.imageData, () => true, averageCallback, overlapIJKMinMax);
|
|
97
|
+
const averageValues = [];
|
|
98
|
+
perFrameSum.forEach((sum) => {
|
|
99
|
+
averageValues.push(sum / count);
|
|
100
|
+
});
|
|
101
|
+
values.push(averageValues);
|
|
102
|
+
};
|
|
103
|
+
(0, pointInShapeCallback_1.default)(maskImageData, () => true, callback);
|
|
104
|
+
return values;
|
|
65
105
|
}
|
|
66
106
|
exports.default = getDataInTime;
|
|
67
107
|
//# sourceMappingURL=getDataInTime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDataInTime.js","sourceRoot":"","sources":["../../../../src/utilities/dynamicVolume/getDataInTime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDataInTime.js","sourceRoot":"","sources":["../../../../src/utilities/dynamicVolume/getDataInTime.ts"],"names":[],"mappings":";;;;;AAAA,8CAA8D;AAC9D,yDAA4D;AAC5D,mFAA2D;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,YAAK,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,CAAC,MAAM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CAAC,GAAG,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,IAAA,8BAAoB,EAAC,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAE1D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,kBAAe,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, };
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.roundNumber = exports.scroll = exports.stackContextPrefetch = exports.stackPrefetch = exports.planarFreehandROITool = exports.rectangleROITool = exports.boundingBox = exports.clip = exports.cine = exports.viewport = exports.jumpToSlice = exports.getAnnotationNearPointOnEnabledElement = exports.getAnnotationNearPoint = exports.pointInSurroundingSphereCallback = exports.pointInShapeCallback = exports.triggerAnnotationRender = exports.triggerAnnotationRenderForViewportIds = exports.segmentation = exports.calibrateImageSpacing = exports.triggerEvent = exports.touch = exports.isObject = exports.orientation = exports.throttle = exports.dynamicVolume = exports.debounce = exports.drawing = exports.viewportFilters = exports.planar = exports.math = void 0;
|
|
29
|
+
exports.polyDataUtils = exports.pointToString = exports.roundNumber = exports.scroll = exports.stackContextPrefetch = exports.stackPrefetch = exports.planarFreehandROITool = exports.rectangleROITool = exports.boundingBox = exports.clip = exports.cine = exports.viewport = exports.jumpToSlice = exports.getAnnotationNearPointOnEnabledElement = exports.getAnnotationNearPoint = exports.pointInSurroundingSphereCallback = exports.pointInShapeCallback = exports.triggerAnnotationRender = exports.triggerAnnotationRenderForViewportIds = exports.segmentation = exports.calibrateImageSpacing = exports.triggerEvent = exports.touch = exports.isObject = exports.orientation = exports.throttle = exports.dynamicVolume = exports.debounce = exports.drawing = exports.viewportFilters = exports.planar = exports.math = void 0;
|
|
30
30
|
const getAnnotationNearPoint_1 = require("./getAnnotationNearPoint");
|
|
31
31
|
Object.defineProperty(exports, "getAnnotationNearPoint", { enumerable: true, get: function () { return getAnnotationNearPoint_1.getAnnotationNearPoint; } });
|
|
32
32
|
Object.defineProperty(exports, "getAnnotationNearPointOnEnabledElement", { enumerable: true, get: function () { return getAnnotationNearPoint_1.getAnnotationNearPointOnEnabledElement; } });
|
|
@@ -54,6 +54,8 @@ const scroll_1 = __importDefault(require("./scroll"));
|
|
|
54
54
|
exports.scroll = scroll_1.default;
|
|
55
55
|
const roundNumber_1 = __importDefault(require("./roundNumber"));
|
|
56
56
|
exports.roundNumber = roundNumber_1.default;
|
|
57
|
+
const pointToString_1 = require("./pointToString");
|
|
58
|
+
Object.defineProperty(exports, "pointToString", { enumerable: true, get: function () { return pointToString_1.pointToString; } });
|
|
57
59
|
const segmentation = __importStar(require("./segmentation"));
|
|
58
60
|
exports.segmentation = segmentation;
|
|
59
61
|
const drawing = __importStar(require("./drawing"));
|
|
@@ -83,6 +85,8 @@ const touch = __importStar(require("./touch"));
|
|
|
83
85
|
exports.touch = touch;
|
|
84
86
|
const dynamicVolume = __importStar(require("./dynamicVolume"));
|
|
85
87
|
exports.dynamicVolume = dynamicVolume;
|
|
88
|
+
const polyDataUtils = __importStar(require("./polyData/utils"));
|
|
89
|
+
exports.polyDataUtils = polyDataUtils;
|
|
86
90
|
const core_1 = require("@cornerstonejs/core");
|
|
87
91
|
Object.defineProperty(exports, "triggerEvent", { enumerable: true, get: function () { return core_1.triggerEvent; } });
|
|
88
92
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAGkC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAGkC;AAwDhC,uGA1DA,+CAAsB,OA0DA;AACtB,uHA1DA,+DAAsC,O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erstonejs/core';
|
|
2
|
-
|
|
2
|
+
declare type Point = Types.Point2 | Types.Point3;
|
|
3
|
+
export default function distanceToPoint(p1: Point, p2: Point): number;
|
|
4
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
function distanceToPoint(p1, p2) {
|
|
4
|
-
if (
|
|
5
|
-
throw Error('points should have
|
|
4
|
+
if (p1.length !== p2.length) {
|
|
5
|
+
throw Error('Both points should have the same dimensionality');
|
|
6
6
|
}
|
|
7
|
-
const [x1, y1] = p1;
|
|
8
|
-
const [x2, y2] = p2;
|
|
9
|
-
return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
|
|
7
|
+
const [x1, y1, z1 = 0] = p1;
|
|
8
|
+
const [x2, y2, z2 = 0] = p2;
|
|
9
|
+
return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2) + Math.pow(z1 - z2, 2));
|
|
10
10
|
}
|
|
11
11
|
exports.default = distanceToPoint;
|
|
12
12
|
//# 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,SAAwB,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;AAXD,kCAWC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function pointToString(point: any, decimals?: number): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pointToString = void 0;
|
|
4
|
+
function pointToString(point, decimals = 5) {
|
|
5
|
+
return (parseFloat(point[0]).toFixed(decimals) +
|
|
6
|
+
',' +
|
|
7
|
+
parseFloat(point[1]).toFixed(decimals) +
|
|
8
|
+
',' +
|
|
9
|
+
parseFloat(point[2]).toFixed(decimals) +
|
|
10
|
+
',');
|
|
11
|
+
}
|
|
12
|
+
exports.pointToString = pointToString;
|
|
13
|
+
//# sourceMappingURL=pointToString.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointToString.js","sourceRoot":"","sources":["../../../src/utilities/pointToString.ts"],"names":[],"mappings":";;;AAAA,SAAgB,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;AATD,sCASC"}
|
|
@@ -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,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPolyDataPoints = exports.getPolyDataPointIndexes = exports.getPoint = void 0;
|
|
4
|
+
function getPoint(points, idx) {
|
|
5
|
+
if (idx < points.length / 3) {
|
|
6
|
+
return [points[idx * 3], points[idx * 3 + 1], points[idx * 3 + 2]];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.getPoint = getPoint;
|
|
10
|
+
function getPolyDataPointIndexes(polyData) {
|
|
11
|
+
const linesData = polyData.getLines().getData();
|
|
12
|
+
let idx = 0;
|
|
13
|
+
const lineSegments = new Map();
|
|
14
|
+
while (idx < linesData.length) {
|
|
15
|
+
const segmentSize = linesData[idx++];
|
|
16
|
+
const segment = [];
|
|
17
|
+
for (let i = 0; i < segmentSize; i++) {
|
|
18
|
+
segment.push(linesData[idx + i]);
|
|
19
|
+
}
|
|
20
|
+
lineSegments.set(segment[0], segment);
|
|
21
|
+
idx += segmentSize;
|
|
22
|
+
}
|
|
23
|
+
const contours = [];
|
|
24
|
+
const findStartingPoint = (map) => {
|
|
25
|
+
for (const [key, value] of map.entries()) {
|
|
26
|
+
if (value !== undefined) {
|
|
27
|
+
return key;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return -1;
|
|
31
|
+
};
|
|
32
|
+
let startPoint = findStartingPoint(lineSegments);
|
|
33
|
+
while (startPoint !== -1) {
|
|
34
|
+
const contour = [startPoint];
|
|
35
|
+
while (lineSegments.has(startPoint)) {
|
|
36
|
+
const nextPoint = lineSegments.get(startPoint)[1];
|
|
37
|
+
if (lineSegments.has(nextPoint)) {
|
|
38
|
+
contour.push(nextPoint);
|
|
39
|
+
}
|
|
40
|
+
lineSegments.delete(startPoint);
|
|
41
|
+
startPoint = nextPoint;
|
|
42
|
+
}
|
|
43
|
+
contours.push(contour);
|
|
44
|
+
startPoint = findStartingPoint(lineSegments);
|
|
45
|
+
}
|
|
46
|
+
return contours.length ? contours : undefined;
|
|
47
|
+
}
|
|
48
|
+
exports.getPolyDataPointIndexes = getPolyDataPointIndexes;
|
|
49
|
+
function getPolyDataPoints(polyData) {
|
|
50
|
+
const contoursIndexes = getPolyDataPointIndexes(polyData);
|
|
51
|
+
if (!contoursIndexes) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const rawPointsData = polyData.getPoints().getData();
|
|
55
|
+
return contoursIndexes.map((contourIndexes) => contourIndexes.map((index) => getPoint(rawPointsData, index)));
|
|
56
|
+
}
|
|
57
|
+
exports.getPolyDataPoints = getPolyDataPoints;
|
|
58
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/utilities/polyData/utils.ts"],"names":[],"mappings":";;;AAQA,SAAgB,QAAQ,CAAC,MAAM,EAAE,GAAG;IAClC,IAAI,GAAG,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QAC3B,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACpE;AACH,CAAC;AAJD,4BAIC;AAOD,SAAgB,uBAAuB,CAAC,QAAqB;IAC3D,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC;IAChD,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ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,CAAC;SACxB;QACD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,UAAU,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC;KAC9C;IAED,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AAChD,CAAC;AA7CD,0DA6CC;AAOD,SAAgB,iBAAiB,CAAC,QAAqB;IACrD,MAAM,eAAe,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAC1D,IAAI,CAAC,eAAe,EAAE;QACpB,OAAO;KACR;IAED,MAAM,aAAa,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC;IACrD,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE,CAC5C,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAC9D,CAAC;AACJ,CAAC;AAVD,8CAUC"}
|
|
@@ -32,7 +32,7 @@ function getVoxelOverlap(imageData, dimensions, voxelSpacing, voxelCenter) {
|
|
|
32
32
|
for (let i = 0; i < 2; i++) {
|
|
33
33
|
for (let j = 0; j < 2; j++) {
|
|
34
34
|
for (let k = 0; k < 2; k++) {
|
|
35
|
-
const point = voxelCenter;
|
|
35
|
+
const point = [...voxelCenter];
|
|
36
36
|
point[0] = point[0] + ((i * 2 - 1) * voxelSpacing[0]) / 2;
|
|
37
37
|
point[1] = point[1] + ((j * 2 - 1) * voxelSpacing[1]) / 2;
|
|
38
38
|
point[2] = point[2] + ((k * 2 - 1) * voxelSpacing[2]) / 2;
|
|
@@ -46,7 +46,7 @@ function getVoxelOverlap(imageData, dimensions, voxelSpacing, voxelCenter) {
|
|
|
46
46
|
}
|
|
47
47
|
exports.getVoxelOverlap = getVoxelOverlap;
|
|
48
48
|
function processVolumes(segmentationVolume, thresholdVolumeInformation) {
|
|
49
|
-
const { spacing: segmentationSpacing
|
|
49
|
+
const { spacing: segmentationSpacing } = segmentationVolume;
|
|
50
50
|
const scalarData = segmentationVolume.getScalarData();
|
|
51
51
|
const volumeInfoList = [];
|
|
52
52
|
let baseVolumeIdx = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/utilities.ts"],"names":[],"mappings":";;;;;;AACA,8CAA2D;AAC3D,mEAA4D;AAC5D,mFAA2D;AAC3D,yGAAiF;AAQjF,SAAwB,qBAAqB,CAC3C,WAAmB,EACnB,QAAiB;IAEjB,MAAM,SAAS,GAAG,IAAA,+BAAY,EAAC,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,IAAI,QAAQ,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE;QACvC,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;KAClC;IAGD,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CACjE,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,YAAY,mBAAS,CACrC,CAAC;IAEjB,OAAO,uBAAuB,CAAC;AACjC,CAAC;AA1BD,wCA0BC;AAED,MAAM,WAAW,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;IAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC;AAMF,SAAgB,eAAe,CAC7B,SAAS,EACT,UAAU,EACV,YAAY,EACZ,WAAW;IAEX,MAAM,iBAAiB,GAAG,EAAE,CAAC;I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