@cornerstonejs/tools 1.57.2 → 1.58.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/drawingSvg/drawPath.js +1 -1
- package/dist/cjs/drawingSvg/drawPath.js.map +1 -1
- package/dist/cjs/enums/WorkerTypes.d.ts +1 -1
- package/dist/cjs/enums/WorkerTypes.js +1 -1
- package/dist/cjs/enums/WorkerTypes.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.d.ts +17 -0
- package/dist/cjs/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.js +112 -0
- package/dist/cjs/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts +3 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js +4 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.d.ts +8 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js +121 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.d.ts +3 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.js +73 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.d.ts +3 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.js +25 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.d.ts +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.js +41 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js +2 -2
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/triggerSegmentationEvents.js +2 -0
- package/dist/cjs/stateManagement/segmentation/triggerSegmentationEvents.js.map +1 -1
- package/dist/cjs/store/ToolGroupManager/getToolGroupForViewport.d.ts +1 -1
- package/dist/cjs/store/ToolGroupManager/getToolGroupForViewport.js +5 -0
- package/dist/cjs/store/ToolGroupManager/getToolGroupForViewport.js.map +1 -1
- package/dist/cjs/tools/base/BaseTool.js +3 -0
- package/dist/cjs/tools/base/BaseTool.js.map +1 -1
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.js.map +1 -1
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js +13 -5
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/cjs/tools/displayTools/SegmentationDisplayTool.d.ts +1 -0
- package/dist/cjs/tools/displayTools/SegmentationDisplayTool.js +17 -0
- package/dist/cjs/tools/displayTools/SegmentationDisplayTool.js.map +1 -1
- package/dist/cjs/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js +4 -47
- package/dist/cjs/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js.map +1 -1
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.d.ts +3 -9
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.js +7 -148
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.js.map +1 -1
- package/dist/cjs/types/PolySeg.d.ts +1 -1
- package/dist/cjs/utilities/contourSegmentation/addContourSegmentationAnnotation.js +4 -1
- package/dist/cjs/utilities/contourSegmentation/addContourSegmentationAnnotation.js.map +1 -1
- package/dist/cjs/utilities/contourSegmentation/removeContourSegmentationAnnotation.js +3 -0
- package/dist/cjs/utilities/contourSegmentation/removeContourSegmentationAnnotation.js.map +1 -1
- package/dist/cjs/utilities/math/polyline/getAABB.d.ts +3 -1
- package/dist/cjs/utilities/math/polyline/getAABB.js +30 -4
- package/dist/cjs/utilities/math/polyline/getAABB.js.map +1 -1
- package/dist/cjs/utilities/planar/index.d.ts +3 -1
- package/dist/cjs/utilities/planar/index.js +4 -1
- package/dist/cjs/utilities/planar/index.js.map +1 -1
- package/dist/cjs/utilities/planar/isPlaneIntersectingAABB.d.ts +1 -0
- package/dist/cjs/utilities/planar/isPlaneIntersectingAABB.js +32 -0
- package/dist/cjs/utilities/planar/isPlaneIntersectingAABB.js.map +1 -0
- package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.d.ts +3 -1
- package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.js +97 -47
- package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.js.map +1 -1
- package/dist/cjs/workers/polySegConverters.js +73 -0
- package/dist/cjs/workers/polySegConverters.js.map +1 -1
- package/dist/esm/drawingSvg/drawPath.js +1 -1
- package/dist/esm/drawingSvg/drawPath.js.map +1 -1
- package/dist/esm/enums/WorkerTypes.js +1 -1
- package/dist/esm/enums/WorkerTypes.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.js +91 -0
- package/dist/esm/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js +4 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js +105 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.js +72 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.js +21 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.js +26 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.js +2 -0
- package/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.js.map +1 -1
- package/dist/esm/store/ToolGroupManager/getToolGroupForViewport.js +4 -0
- package/dist/esm/store/ToolGroupManager/getToolGroupForViewport.js.map +1 -1
- package/dist/esm/tools/base/BaseTool.js +3 -0
- package/dist/esm/tools/base/BaseTool.js.map +1 -1
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js.map +1 -1
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js +13 -5
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/esm/tools/displayTools/SegmentationDisplayTool.js +17 -0
- package/dist/esm/tools/displayTools/SegmentationDisplayTool.js.map +1 -1
- package/dist/esm/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js +3 -46
- package/dist/esm/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js.map +1 -1
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js +8 -139
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js.map +1 -1
- package/dist/esm/utilities/contourSegmentation/addContourSegmentationAnnotation.js +4 -1
- package/dist/esm/utilities/contourSegmentation/addContourSegmentationAnnotation.js.map +1 -1
- package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.js +3 -0
- package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.js.map +1 -1
- package/dist/esm/utilities/math/polyline/getAABB.js +30 -4
- package/dist/esm/utilities/math/polyline/getAABB.js.map +1 -1
- package/dist/esm/utilities/planar/index.js +3 -1
- package/dist/esm/utilities/planar/index.js.map +1 -1
- package/dist/esm/utilities/planar/isPlaneIntersectingAABB.js +28 -0
- package/dist/esm/utilities/planar/isPlaneIntersectingAABB.js.map +1 -0
- package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js +92 -44
- package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js.map +1 -1
- package/dist/esm/workers/polySegConverters.js +74 -1
- package/dist/esm/workers/polySegConverters.js.map +1 -1
- package/dist/types/drawingSvg/drawPath.d.ts.map +1 -1
- package/dist/types/enums/WorkerTypes.d.ts +1 -1
- package/dist/types/enums/WorkerTypes.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.d.ts +18 -0
- package/dist/types/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts +3 -1
- package/dist/types/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.d.ts +9 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.d.ts +4 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.d.ts +4 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.d.ts +2 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/triggerSegmentationEvents.d.ts.map +1 -1
- package/dist/types/store/ToolGroupManager/getToolGroupForViewport.d.ts +1 -1
- package/dist/types/store/ToolGroupManager/getToolGroupForViewport.d.ts.map +1 -1
- package/dist/types/tools/base/BaseTool.d.ts.map +1 -1
- package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Contour/contourDisplay.d.ts.map +1 -1
- package/dist/types/tools/displayTools/SegmentationDisplayTool.d.ts +1 -0
- package/dist/types/tools/displayTools/SegmentationDisplayTool.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Surface/addOrUpdateSurfaceToElement.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Surface/surfaceDisplay.d.ts +3 -9
- package/dist/types/tools/displayTools/Surface/surfaceDisplay.d.ts.map +1 -1
- package/dist/types/types/PolySeg.d.ts +1 -1
- package/dist/types/types/PolySeg.d.ts.map +1 -1
- package/dist/types/utilities/contourSegmentation/addContourSegmentationAnnotation.d.ts.map +1 -1
- package/dist/types/utilities/contourSegmentation/removeContourSegmentationAnnotation.d.ts.map +1 -1
- package/dist/types/utilities/math/polyline/getAABB.d.ts +3 -1
- package/dist/types/utilities/math/polyline/getAABB.d.ts.map +1 -1
- package/dist/types/utilities/planar/index.d.ts +3 -1
- package/dist/types/utilities/planar/index.d.ts.map +1 -1
- package/dist/types/utilities/planar/isPlaneIntersectingAABB.d.ts +2 -0
- package/dist/types/utilities/planar/isPlaneIntersectingAABB.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/getUniqueSegmentIndices.d.ts +3 -1
- package/dist/types/utilities/segmentation/getUniqueSegmentIndices.d.ts.map +1 -1
- package/dist/umd/985.index.js +1 -1
- package/dist/umd/985.index.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/drawPath.ts +3 -1
- package/src/enums/WorkerTypes.ts +1 -1
- package/src/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.ts +203 -0
- package/src/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.ts +9 -2
- package/src/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.ts +201 -0
- package/src/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.ts +103 -0
- package/src/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.ts +38 -0
- package/src/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.ts +58 -0
- package/src/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.ts +2 -2
- package/src/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.ts +1 -1
- package/src/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.ts +3 -8
- package/src/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.ts +1 -1
- package/src/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.ts +1 -1
- package/src/stateManagement/segmentation/polySeg/computeAndAddRepresentation.ts +1 -1
- package/src/stateManagement/segmentation/triggerSegmentationEvents.ts +5 -0
- package/src/store/ToolGroupManager/getToolGroupForViewport.ts +8 -1
- package/src/tools/base/BaseTool.ts +7 -0
- package/src/tools/base/ContourSegmentationBaseTool.ts +5 -0
- package/src/tools/displayTools/Contour/contourDisplay.ts +29 -11
- package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +1 -1
- package/src/tools/displayTools/SegmentationDisplayTool.ts +26 -0
- package/src/tools/displayTools/Surface/addOrUpdateSurfaceToElement.ts +3 -65
- package/src/tools/displayTools/Surface/surfaceDisplay.ts +12 -247
- package/src/types/PolySeg.ts +1 -1
- package/src/utilities/contourSegmentation/addContourSegmentationAnnotation.ts +9 -1
- package/src/utilities/contourSegmentation/removeContourSegmentationAnnotation.ts +4 -0
- package/src/utilities/math/polyline/getAABB.ts +58 -4
- package/src/utilities/planar/index.ts +3 -0
- package/src/utilities/planar/isPlaneIntersectingAABB.ts +56 -0
- package/src/utilities/segmentation/getUniqueSegmentIndices.ts +115 -49
- package/src/workers/polySegConverters.js +117 -1
- package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.d.ts +0 -1
- package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.js +0 -27
- package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.js.map +0 -1
- package/dist/cjs/workers/clippingPlaneWorker.d.ts +0 -1
- package/dist/cjs/workers/clippingPlaneWorker.js +0 -63
- package/dist/cjs/workers/clippingPlaneWorker.js.map +0 -1
- package/dist/esm/tools/displayTools/registerDisplayToolsWorker.js +0 -23
- package/dist/esm/tools/displayTools/registerDisplayToolsWorker.js.map +0 -1
- package/dist/esm/workers/clippingPlaneWorker.js +0 -58
- package/dist/esm/workers/clippingPlaneWorker.js.map +0 -1
- package/dist/types/tools/displayTools/registerDisplayToolsWorker.d.ts +0 -2
- package/dist/types/tools/displayTools/registerDisplayToolsWorker.d.ts.map +0 -1
- package/dist/types/workers/clippingPlaneWorker.d.ts +0 -2
- package/dist/types/workers/clippingPlaneWorker.d.ts.map +0 -1
- package/dist/umd/444.index.js +0 -3
- package/dist/umd/444.index.js.LICENSE.txt +0 -5
- package/dist/umd/444.index.js.map +0 -1
- package/src/tools/displayTools/registerDisplayToolsWorker.ts +0 -34
- package/src/workers/clippingPlaneWorker.js +0 -87
|
@@ -35,29 +35,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.
|
|
39
|
-
const PolyData_1 = __importDefault(require("@kitware/vtk.js/Common/DataModel/PolyData"));
|
|
40
|
-
const CellArray_1 = __importDefault(require("@kitware/vtk.js/Common/Core/CellArray"));
|
|
38
|
+
exports.removeSegmentationRepresentation = exports.render = void 0;
|
|
41
39
|
const core_1 = require("@cornerstonejs/core");
|
|
42
40
|
const SegmentationState = __importStar(require("../../../stateManagement/segmentation/segmentationState"));
|
|
43
41
|
const SegmentationRepresentations_1 = __importDefault(require("../../../enums/SegmentationRepresentations"));
|
|
44
42
|
const ToolGroupManager_1 = require("../../../store/ToolGroupManager");
|
|
45
|
-
const registerDisplayToolsWorker_1 = require("../registerDisplayToolsWorker");
|
|
46
43
|
const removeSurfaceFromElement_1 = __importDefault(require("./removeSurfaceFromElement"));
|
|
47
44
|
const addOrUpdateSurfaceToElement_1 = __importDefault(require("./addOrUpdateSurfaceToElement"));
|
|
48
45
|
const segmentation_1 = require("../../../stateManagement/segmentation");
|
|
49
|
-
const utilities_1 = require("../../../utilities");
|
|
50
|
-
const enums_1 = require("../../../enums");
|
|
51
|
-
const workerManager = (0, core_1.getWebWorkerManager)();
|
|
52
|
-
const polyDataCache = new Map();
|
|
53
|
-
exports.polyDataCache = polyDataCache;
|
|
54
|
-
const currentViewportNormal = new Map();
|
|
55
|
-
const triggerWorkerProgress = (eventTarget, progress) => {
|
|
56
|
-
(0, core_1.triggerEvent)(eventTarget, core_1.Enums.Events.WEB_WORKER_PROGRESS, {
|
|
57
|
-
progress,
|
|
58
|
-
type: enums_1.WorkerTypes.DISPLAY_TOOL_CLIP_SURFACE,
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
46
|
function removeSegmentationRepresentation(toolGroupId, segmentationRepresentationUID, renderImmediate = false) {
|
|
62
47
|
_removeSurfaceFromToolGroupViewports(toolGroupId, segmentationRepresentationUID);
|
|
63
48
|
SegmentationState.removeSegmentationRepresentation(toolGroupId, segmentationRepresentationUID);
|
|
@@ -70,13 +55,16 @@ function removeSegmentationRepresentation(toolGroupId, segmentationRepresentatio
|
|
|
70
55
|
}
|
|
71
56
|
}
|
|
72
57
|
exports.removeSegmentationRepresentation = removeSegmentationRepresentation;
|
|
73
|
-
function render(viewport, representation
|
|
58
|
+
function render(viewport, representation) {
|
|
74
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const { colorLUTIndex,
|
|
60
|
+
const { colorLUTIndex, segmentationId, segmentationRepresentationUID } = representation;
|
|
76
61
|
const segmentation = SegmentationState.getSegmentation(segmentationId);
|
|
77
62
|
if (!segmentation) {
|
|
78
63
|
return;
|
|
79
64
|
}
|
|
65
|
+
if (!(viewport instanceof core_1.VolumeViewport3D)) {
|
|
66
|
+
throw new Error('Surface rendering is only supported in 3D viewports, if you need to visualize the surface cuts in 2D viewports, you can use the Contour representation, see polySeg converters');
|
|
67
|
+
}
|
|
80
68
|
let SurfaceData = segmentation.representationData[SegmentationRepresentations_1.default.Surface];
|
|
81
69
|
if (!SurfaceData &&
|
|
82
70
|
segmentation_1.polySeg.canComputeRequestedRepresentation(segmentationRepresentationUID)) {
|
|
@@ -95,13 +83,7 @@ function render(viewport, representation, toolGroupConfig) {
|
|
|
95
83
|
const surfaces = [];
|
|
96
84
|
geometryIds.forEach((geometryId, segmentIndex) => {
|
|
97
85
|
const geometry = core_1.cache.getGeometry(geometryId);
|
|
98
|
-
if (!geometry) {
|
|
99
|
-
throw new Error(`No Surfaces found for geometryId ${geometryId}`);
|
|
100
|
-
}
|
|
101
|
-
if (geometry.type !== core_1.Enums.GeometryType.SURFACE) {
|
|
102
|
-
throw new Error(`Geometry type ${geometry.type} not supported for rendering.`);
|
|
103
|
-
}
|
|
104
|
-
if (!geometry.data) {
|
|
86
|
+
if (!(geometry === null || geometry === void 0 ? void 0 : geometry.data)) {
|
|
105
87
|
console.warn(`No Surfaces found for geometryId ${geometryId}. Skipping render.`);
|
|
106
88
|
return;
|
|
107
89
|
}
|
|
@@ -111,9 +93,6 @@ function render(viewport, representation, toolGroupConfig) {
|
|
|
111
93
|
(0, addOrUpdateSurfaceToElement_1.default)(viewport.element, surface, segmentationRepresentationUID);
|
|
112
94
|
surfaces.push(surface);
|
|
113
95
|
});
|
|
114
|
-
if (!(viewport instanceof core_1.VolumeViewport3D)) {
|
|
115
|
-
generateAndCacheClippedSurfaces(surfaces, viewport, segmentationRepresentationUID);
|
|
116
|
-
}
|
|
117
96
|
viewport.render();
|
|
118
97
|
});
|
|
119
98
|
}
|
|
@@ -130,126 +109,6 @@ function _removeSurfaceFromToolGroupViewports(toolGroupId, segmentationRepresent
|
|
|
130
109
|
(0, removeSurfaceFromElement_1.default)(enabledElement.viewport.element, segmentationRepresentationUID);
|
|
131
110
|
}
|
|
132
111
|
}
|
|
133
|
-
function generateAndCacheClippedSurfaces(surfaces, viewport, segmentationRepresentationUID) {
|
|
134
|
-
var _a;
|
|
135
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
-
(0, registerDisplayToolsWorker_1.registerDisplayToolsWorker)();
|
|
137
|
-
const planesInfo = (_a = viewport.getSlicesClippingPlanes) === null || _a === void 0 ? void 0 : _a.call(viewport);
|
|
138
|
-
if (!planesInfo) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const currentSliceIndex = viewport.getSliceIndex();
|
|
142
|
-
planesInfo.sort((a, b) => {
|
|
143
|
-
const diffA = Math.abs(a.sliceIndex - currentSliceIndex);
|
|
144
|
-
const diffB = Math.abs(b.sliceIndex - currentSliceIndex);
|
|
145
|
-
return diffA - diffB;
|
|
146
|
-
});
|
|
147
|
-
const pointsAndPolys = surfaces.map((surface) => {
|
|
148
|
-
const id = surface.id;
|
|
149
|
-
const points = surface.getPoints();
|
|
150
|
-
const polys = surface.getPolys();
|
|
151
|
-
return { id, points, polys };
|
|
152
|
-
});
|
|
153
|
-
const camera = viewport.getCamera();
|
|
154
|
-
function cameraModifiedCallback(evt) {
|
|
155
|
-
const { camera } = evt.detail;
|
|
156
|
-
const { viewPlaneNormal } = camera;
|
|
157
|
-
const surface1 = surfaces[0];
|
|
158
|
-
if (core_1.utilities.isEqual(viewPlaneNormal, currentViewportNormal.get(surface1.id))) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
currentViewportNormal.set(surface1.id, viewPlaneNormal);
|
|
162
|
-
workerManager.terminate('displayTools');
|
|
163
|
-
setTimeout(() => {
|
|
164
|
-
generateAndCacheClippedSurfaces(surfaces, viewport, segmentationRepresentationUID);
|
|
165
|
-
}, 0);
|
|
166
|
-
viewport.render();
|
|
167
|
-
}
|
|
168
|
-
viewport.element.removeEventListener(core_1.Enums.Events.CAMERA_MODIFIED, cameraModifiedCallback);
|
|
169
|
-
viewport.element.addEventListener(core_1.Enums.Events.CAMERA_MODIFIED, cameraModifiedCallback);
|
|
170
|
-
triggerWorkerProgress(core_1.eventTarget, 0);
|
|
171
|
-
yield workerManager
|
|
172
|
-
.executeTask('displayTools', 'clipSurfaceWithPlanes', {
|
|
173
|
-
planesInfo,
|
|
174
|
-
pointsAndPolys,
|
|
175
|
-
}, {
|
|
176
|
-
callbacks: [
|
|
177
|
-
({ progress }) => {
|
|
178
|
-
triggerWorkerProgress(core_1.eventTarget, progress);
|
|
179
|
-
},
|
|
180
|
-
({ sliceIndex, polyDataResults }) => {
|
|
181
|
-
polyDataResults.forEach((polyDataResult, surfaceId) => {
|
|
182
|
-
const actorUID = `${segmentationRepresentationUID}_${surfaceId}`;
|
|
183
|
-
const cacheId = generateCacheId(viewport, camera.viewPlaneNormal, sliceIndex);
|
|
184
|
-
updatePolyDataCache(actorUID, cacheId, polyDataResult);
|
|
185
|
-
});
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
})
|
|
189
|
-
.catch((error) => {
|
|
190
|
-
console.error(error);
|
|
191
|
-
});
|
|
192
|
-
triggerWorkerProgress(core_1.eventTarget, 100);
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
function getSurfaceActorUID(segmentationRepresentationUID, surfaceId) {
|
|
196
|
-
return `${segmentationRepresentationUID}_${surfaceId}`;
|
|
197
|
-
}
|
|
198
|
-
exports.getSurfaceActorUID = getSurfaceActorUID;
|
|
199
|
-
function generateCacheId(viewport, viewPlaneNormal, sliceIndex) {
|
|
200
|
-
return `${viewport.id}-${(0, utilities_1.pointToString)(viewPlaneNormal)}-${sliceIndex}`;
|
|
201
|
-
}
|
|
202
|
-
exports.generateCacheId = generateCacheId;
|
|
203
|
-
function getOrCreatePolyData(actorEntry, cacheId, vtkPlanes) {
|
|
204
|
-
let actorCache = polyDataCache.get(actorEntry.uid);
|
|
205
|
-
if (!actorCache) {
|
|
206
|
-
actorCache = new Map();
|
|
207
|
-
polyDataCache.set(actorEntry.uid, actorCache);
|
|
208
|
-
}
|
|
209
|
-
let polyData = actorCache.get(cacheId);
|
|
210
|
-
if (!polyData) {
|
|
211
|
-
const clippingFilter = actorEntry.clippingFilter;
|
|
212
|
-
clippingFilter.setClippingPlanes(vtkPlanes);
|
|
213
|
-
try {
|
|
214
|
-
clippingFilter.update();
|
|
215
|
-
polyData = clippingFilter.getOutputData();
|
|
216
|
-
actorCache.set(cacheId, polyData);
|
|
217
|
-
}
|
|
218
|
-
catch (e) {
|
|
219
|
-
console.error('Error clipping surface', e);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return polyData;
|
|
223
|
-
}
|
|
224
|
-
exports.getOrCreatePolyData = getOrCreatePolyData;
|
|
225
|
-
function updatePolyDataCache(actorUID, cacheId, polyDataResult) {
|
|
226
|
-
const { points, lines } = polyDataResult;
|
|
227
|
-
const polyData = PolyData_1.default.newInstance();
|
|
228
|
-
polyData.getPoints().setData(points, 3);
|
|
229
|
-
const linesArray = CellArray_1.default.newInstance({
|
|
230
|
-
values: Int16Array.from(lines),
|
|
231
|
-
});
|
|
232
|
-
polyData.setLines(linesArray);
|
|
233
|
-
let actorCache = polyDataCache.get(actorUID);
|
|
234
|
-
if (!actorCache) {
|
|
235
|
-
actorCache = new Map();
|
|
236
|
-
polyDataCache.set(actorUID, actorCache);
|
|
237
|
-
}
|
|
238
|
-
actorCache.set(cacheId, polyData);
|
|
239
|
-
}
|
|
240
|
-
exports.updatePolyDataCache = updatePolyDataCache;
|
|
241
|
-
function getSortedPlanesInfo(viewport) {
|
|
242
|
-
var _a;
|
|
243
|
-
const planesInfo = (_a = viewport.getSlicesClippingPlanes) === null || _a === void 0 ? void 0 : _a.call(viewport);
|
|
244
|
-
const currentSliceIndex = viewport.getSliceIndex();
|
|
245
|
-
planesInfo.sort((a, b) => {
|
|
246
|
-
const diffA = Math.abs(a.sliceIndex - currentSliceIndex);
|
|
247
|
-
const diffB = Math.abs(b.sliceIndex - currentSliceIndex);
|
|
248
|
-
return diffA - diffB;
|
|
249
|
-
});
|
|
250
|
-
return planesInfo;
|
|
251
|
-
}
|
|
252
|
-
exports.getSortedPlanesInfo = getSortedPlanesInfo;
|
|
253
112
|
exports.default = {
|
|
254
113
|
render,
|
|
255
114
|
removeSegmentationRepresentation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surfaceDisplay.js","sourceRoot":"","sources":["../../../../../src/tools/displayTools/Surface/surfaceDisplay.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"surfaceDisplay.js","sourceRoot":"","sources":["../../../../../src/tools/displayTools/Surface/surfaceDisplay.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAK6B;AAE7B,2GAA6F;AAC7F,6GAAyE;AACzE,sEAA+D;AAG/D,0FAAkE;AAClE,gGAAwE;AACxE,wEAAgE;AAYhE,SAAS,gCAAgC,CAC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,CAAC,8BAA8B,WAAW,iBAAiB,CAAC,CAAC;KAC7E;IAED,MAAM,EAAE,aAAa,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,gCAAgC;CACjC,CAAC"}
|
|
@@ -8,13 +8,16 @@ function addContourSegmentationAnnotation(annotation) {
|
|
|
8
8
|
}
|
|
9
9
|
const { segmentationId, segmentIndex } = annotation.data.segmentation;
|
|
10
10
|
const segmentation = (0, segmentationState_1.getSegmentation)(segmentationId);
|
|
11
|
+
if (!segmentation.representationData.CONTOUR) {
|
|
12
|
+
segmentation.representationData.CONTOUR = { annotationUIDsMap: new Map() };
|
|
13
|
+
}
|
|
11
14
|
const { annotationUIDsMap } = segmentation.representationData.CONTOUR;
|
|
12
15
|
let annotationsUIDsSet = annotationUIDsMap.get(segmentIndex);
|
|
13
16
|
if (!annotationsUIDsSet) {
|
|
14
17
|
annotationsUIDsSet = new Set();
|
|
15
18
|
annotationUIDsMap.set(segmentIndex, annotationsUIDsSet);
|
|
16
19
|
}
|
|
17
|
-
annotationsUIDsSet.add(annotation.annotationUID);
|
|
20
|
+
annotationUIDsMap.set(segmentIndex, annotationsUIDsSet.add(annotation.annotationUID));
|
|
18
21
|
}
|
|
19
22
|
exports.addContourSegmentationAnnotation = addContourSegmentationAnnotation;
|
|
20
23
|
//# sourceMappingURL=addContourSegmentationAnnotation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addContourSegmentationAnnotation.js","sourceRoot":"","sources":["../../../../src/utilities/contourSegmentation/addContourSegmentationAnnotation.ts"],"names":[],"mappings":";;;AAAA,4FAAuF;AAOvF,SAAgB,gCAAgC,CAC9C,UAAyC;IAEzC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE;QACjC,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;KACH;IAED,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC;IACtE,MAAM,YAAY,GAAG,IAAA,mCAAe,EAAC,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"addContourSegmentationAnnotation.js","sourceRoot":"","sources":["../../../../src/utilities/contourSegmentation/addContourSegmentationAnnotation.ts"],"names":[],"mappings":";;;AAAA,4FAAuF;AAOvF,SAAgB,gCAAgC,CAC9C,UAAyC;IAEzC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE;QACjC,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;KACH;IAED,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC;IACtE,MAAM,YAAY,GAAG,IAAA,mCAAe,EAAC,cAAc,CAAC,CAAC;IAErD,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC5C,YAAY,CAAC,kBAAkB,CAAC,OAAO,GAAG,EAAE,iBAAiB,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;KAC5E;IAED,MAAM,EAAE,iBAAiB,EAAE,GAAG,YAAY,CAAC,kBAAkB,CAAC,OAAO,CAAC;IAEtE,IAAI,kBAAkB,GAAG,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAE7D,IAAI,CAAC,kBAAkB,EAAE;QACvB,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAC;QAC/B,iBAAiB,CAAC,GAAG,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;KACzD;IAED,iBAAiB,CAAC,GAAG,CACnB,YAAY,EACZ,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,CACjD,CAAC;AACJ,CAAC;AA7BD,4EA6BC"}
|
|
@@ -10,6 +10,9 @@ function removeContourSegmentationAnnotation(annotation) {
|
|
|
10
10
|
const segmentation = segmentation_1.state.getSegmentation(segmentationId);
|
|
11
11
|
const { annotationUIDsMap } = segmentation.representationData.CONTOUR;
|
|
12
12
|
const annotationsUIDsSet = annotationUIDsMap.get(segmentIndex);
|
|
13
|
+
if (!annotationsUIDsSet) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
13
16
|
annotationsUIDsSet.delete(annotation.annotationUID);
|
|
14
17
|
if (!annotationsUIDsSet.size) {
|
|
15
18
|
annotationUIDsMap.delete(segmentIndex);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeContourSegmentationAnnotation.js","sourceRoot":"","sources":["../../../../src/utilities/contourSegmentation/removeContourSegmentationAnnotation.ts"],"names":[],"mappings":";;;AAAA,qEAA2D;AAS3D,SAAgB,mCAAmC,CACjD,UAAyC;IAEzC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE;QACjC,MAAM,IAAI,KAAK,CACb,mFAAmF,CACpF,CAAC;KACH;IAED,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC;IACtE,MAAM,YAAY,GAAG,oBAAK,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAC3D,MAAM,EAAE,iBAAiB,EAAE,GAAG,YAAY,CAAC,kBAAkB,CAAC,OAAO,CAAC;IACtE,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAE/D,kBAAkB,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAGpD,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE;QAC5B,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;KACxC;AACH,CAAC;
|
|
1
|
+
{"version":3,"file":"removeContourSegmentationAnnotation.js","sourceRoot":"","sources":["../../../../src/utilities/contourSegmentation/removeContourSegmentationAnnotation.ts"],"names":[],"mappings":";;;AAAA,qEAA2D;AAS3D,SAAgB,mCAAmC,CACjD,UAAyC;IAEzC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE;QACjC,MAAM,IAAI,KAAK,CACb,mFAAmF,CACpF,CAAC;KACH;IAED,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC;IACtE,MAAM,YAAY,GAAG,oBAAK,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAC3D,MAAM,EAAE,iBAAiB,EAAE,GAAG,YAAY,CAAC,kBAAkB,CAAC,OAAO,CAAC;IACtE,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAE/D,IAAI,CAAC,kBAAkB,EAAE;QACvB,OAAO;KACR;IAED,kBAAkB,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAGpD,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE;QAC5B,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;KACxC;AACH,CAAC;AAxBD,kFAwBC"}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { Types } from '@cornerstonejs/core';
|
|
2
|
-
export default function getAABB(polyline: Types.Point2[]
|
|
2
|
+
export default function getAABB(polyline: Types.Point2[] | Types.Point3[] | number[], options?: {
|
|
3
|
+
numDimensions: number;
|
|
4
|
+
}): Types.AABB2 | Types.AABB3;
|
|
@@ -1,18 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function getAABB(polyline) {
|
|
3
|
+
function getAABB(polyline, options) {
|
|
4
|
+
let polylineToUse = polyline;
|
|
5
|
+
const numDimensions = (options === null || options === void 0 ? void 0 : options.numDimensions) || 2;
|
|
6
|
+
const is3D = numDimensions === 3;
|
|
7
|
+
if (!Array.isArray(polyline[0])) {
|
|
8
|
+
const currentPolyline = polyline;
|
|
9
|
+
const totalPoints = currentPolyline.length / numDimensions;
|
|
10
|
+
polylineToUse = new Array(currentPolyline.length / numDimensions);
|
|
11
|
+
for (let i = 0, len = totalPoints; i < len; i++) {
|
|
12
|
+
polylineToUse[i] = [
|
|
13
|
+
currentPolyline[i * numDimensions],
|
|
14
|
+
currentPolyline[i * numDimensions + 1],
|
|
15
|
+
];
|
|
16
|
+
if (is3D) {
|
|
17
|
+
polylineToUse[i].push(currentPolyline[i * numDimensions + 2]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
4
21
|
let minX = Infinity;
|
|
5
22
|
let minY = Infinity;
|
|
6
23
|
let maxX = -Infinity;
|
|
7
24
|
let maxY = -Infinity;
|
|
8
|
-
|
|
9
|
-
|
|
25
|
+
let minZ = Infinity;
|
|
26
|
+
let maxZ = -Infinity;
|
|
27
|
+
polylineToUse = polylineToUse;
|
|
28
|
+
for (let i = 0, len = polylineToUse.length; i < len; i++) {
|
|
29
|
+
const [x, y, z] = polylineToUse[i];
|
|
10
30
|
minX = minX < x ? minX : x;
|
|
11
31
|
minY = minY < y ? minY : y;
|
|
12
32
|
maxX = maxX > x ? maxX : x;
|
|
13
33
|
maxY = maxY > y ? maxY : y;
|
|
34
|
+
if (is3D) {
|
|
35
|
+
minZ = minZ < z ? minZ : z;
|
|
36
|
+
maxZ = maxZ > z ? maxZ : z;
|
|
37
|
+
}
|
|
14
38
|
}
|
|
15
|
-
return
|
|
39
|
+
return is3D
|
|
40
|
+
? { minX, maxX, minY, maxY, minZ, maxZ }
|
|
41
|
+
: { minX, maxX, minY, maxY };
|
|
16
42
|
}
|
|
17
43
|
exports.default = getAABB;
|
|
18
44
|
//# sourceMappingURL=getAABB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAABB.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/getAABB.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"getAABB.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/getAABB.ts"],"names":[],"mappings":";;AAWA,SAAwB,OAAO,CAC7B,QAAoD,EACpD,OAEC;IAID,IAAI,aAAa,GAAG,QAAQ,CAAC;IAC7B,MAAM,aAAa,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,KAAI,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,aAAa,KAAK,CAAC,CAAC;IAEjC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;QAC/B,MAAM,eAAe,GAAG,QAAoB,CAAC;QAI7C,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM,GAAG,aAAa,CAAC;QAE3D,aAAa,GAAG,IAAI,KAAK,CAAC,eAAe,CAAC,MAAM,GAAG,aAAa,CAE9C,CAAC;QAEnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,WAAW,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;YAC/C,aAAa,CAAC,CAAC,CAAC,GAAG;gBACjB,eAAe,CAAC,CAAC,GAAG,aAAa,CAAC;gBAClC,eAAe,CAAC,CAAC,GAAG,aAAa,GAAG,CAAC,CAAC;aACvC,CAAC;YAEF,IAAI,IAAI,EAAE;gBACR,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC;aAC/D;SACF;KACF;IAED,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,IAAI,IAAI,GAAG,CAAC,QA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otationsWithinSlice';
|
|
|
2
2
|
import getWorldWidthAndHeightFromCorners from './getWorldWidthAndHeightFromCorners';
|
|
3
3
|
import filterAnnotationsForDisplay from './filterAnnotationsForDisplay';
|
|
4
4
|
import getPointInLineOfSightWithCriteria from './getPointInLineOfSightWithCriteria';
|
|
5
|
+
import { isPlaneIntersectingAABB } from './isPlaneIntersectingAABB';
|
|
5
6
|
declare const _default: {
|
|
6
7
|
filterAnnotationsWithinSlice: typeof filterAnnotationsWithinSlice;
|
|
7
8
|
getWorldWidthAndHeightFromCorners: typeof getWorldWidthAndHeightFromCorners;
|
|
8
9
|
filterAnnotationsForDisplay: typeof filterAnnotationsForDisplay;
|
|
9
10
|
getPointInLineOfSightWithCriteria: typeof getPointInLineOfSightWithCriteria;
|
|
11
|
+
isPlaneIntersectingAABB: (origin: any, normal: any, minX: any, minY: any, minZ: any, maxX: any, maxY: any, maxZ: any) => boolean;
|
|
10
12
|
};
|
|
11
13
|
export default _default;
|
|
12
|
-
export { filterAnnotationsWithinSlice, getWorldWidthAndHeightFromCorners, filterAnnotationsForDisplay, getPointInLineOfSightWithCriteria, };
|
|
14
|
+
export { filterAnnotationsWithinSlice, getWorldWidthAndHeightFromCorners, filterAnnotationsForDisplay, getPointInLineOfSightWithCriteria, isPlaneIntersectingAABB, };
|
|
@@ -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.getPointInLineOfSightWithCriteria = exports.filterAnnotationsForDisplay = exports.getWorldWidthAndHeightFromCorners = exports.filterAnnotationsWithinSlice = void 0;
|
|
6
|
+
exports.isPlaneIntersectingAABB = exports.getPointInLineOfSightWithCriteria = exports.filterAnnotationsForDisplay = exports.getWorldWidthAndHeightFromCorners = exports.filterAnnotationsWithinSlice = void 0;
|
|
7
7
|
const filterAnnotationsWithinSlice_1 = __importDefault(require("./filterAnnotationsWithinSlice"));
|
|
8
8
|
exports.filterAnnotationsWithinSlice = filterAnnotationsWithinSlice_1.default;
|
|
9
9
|
const getWorldWidthAndHeightFromCorners_1 = __importDefault(require("./getWorldWidthAndHeightFromCorners"));
|
|
@@ -12,10 +12,13 @@ const filterAnnotationsForDisplay_1 = __importDefault(require("./filterAnnotatio
|
|
|
12
12
|
exports.filterAnnotationsForDisplay = filterAnnotationsForDisplay_1.default;
|
|
13
13
|
const getPointInLineOfSightWithCriteria_1 = __importDefault(require("./getPointInLineOfSightWithCriteria"));
|
|
14
14
|
exports.getPointInLineOfSightWithCriteria = getPointInLineOfSightWithCriteria_1.default;
|
|
15
|
+
const isPlaneIntersectingAABB_1 = require("./isPlaneIntersectingAABB");
|
|
16
|
+
Object.defineProperty(exports, "isPlaneIntersectingAABB", { enumerable: true, get: function () { return isPlaneIntersectingAABB_1.isPlaneIntersectingAABB; } });
|
|
15
17
|
exports.default = {
|
|
16
18
|
filterAnnotationsWithinSlice: filterAnnotationsWithinSlice_1.default,
|
|
17
19
|
getWorldWidthAndHeightFromCorners: getWorldWidthAndHeightFromCorners_1.default,
|
|
18
20
|
filterAnnotationsForDisplay: filterAnnotationsForDisplay_1.default,
|
|
19
21
|
getPointInLineOfSightWithCriteria: getPointInLineOfSightWithCriteria_1.default,
|
|
22
|
+
isPlaneIntersectingAABB: isPlaneIntersectingAABB_1.isPlaneIntersectingAABB,
|
|
20
23
|
};
|
|
21
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/planar/index.ts"],"names":[],"mappings":";;;;;;AAAA,kGAA0E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/planar/index.ts"],"names":[],"mappings":";;;;;;AAAA,kGAA0E;AAexE,uCAfK,sCAA4B,CAeL;AAd9B,4GAAoF;AAelF,4CAfK,2CAAiC,CAeL;AAdnC,gGAAwE;AAetE,sCAfK,qCAA2B,CAeL;AAd7B,4GAAoF;AAelF,4CAfK,2CAAiC,CAeL;AAdnC,uEAAoE;AAelE,wGAfO,iDAAuB,OAeP;AAbzB,kBAAe;IACb,4BAA4B,EAA5B,sCAA4B;IAC5B,iCAAiC,EAAjC,2CAAiC;IACjC,2BAA2B,EAA3B,qCAA2B;IAC3B,iCAAiC,EAAjC,2CAAiC;IACjC,uBAAuB,EAAvB,iDAAuB;CACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isPlaneIntersectingAABB: (origin: any, normal: any, minX: any, minY: any, minZ: any, maxX: any, maxY: any, maxZ: any) => boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPlaneIntersectingAABB = void 0;
|
|
4
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
5
|
+
const isPlaneIntersectingAABB = (origin, normal, minX, minY, minZ, maxX, maxY, maxZ) => {
|
|
6
|
+
const vertices = [
|
|
7
|
+
gl_matrix_1.vec3.fromValues(minX, minY, minZ),
|
|
8
|
+
gl_matrix_1.vec3.fromValues(maxX, minY, minZ),
|
|
9
|
+
gl_matrix_1.vec3.fromValues(minX, maxY, minZ),
|
|
10
|
+
gl_matrix_1.vec3.fromValues(maxX, maxY, minZ),
|
|
11
|
+
gl_matrix_1.vec3.fromValues(minX, minY, maxZ),
|
|
12
|
+
gl_matrix_1.vec3.fromValues(maxX, minY, maxZ),
|
|
13
|
+
gl_matrix_1.vec3.fromValues(minX, maxY, maxZ),
|
|
14
|
+
gl_matrix_1.vec3.fromValues(maxX, maxY, maxZ),
|
|
15
|
+
];
|
|
16
|
+
const normalVec = gl_matrix_1.vec3.fromValues(normal[0], normal[1], normal[2]);
|
|
17
|
+
const originVec = gl_matrix_1.vec3.fromValues(origin[0], origin[1], origin[2]);
|
|
18
|
+
const planeDistance = -gl_matrix_1.vec3.dot(normalVec, originVec);
|
|
19
|
+
let initialSign = null;
|
|
20
|
+
for (const vertex of vertices) {
|
|
21
|
+
const distance = gl_matrix_1.vec3.dot(normalVec, vertex) + planeDistance;
|
|
22
|
+
if (initialSign === null) {
|
|
23
|
+
initialSign = Math.sign(distance);
|
|
24
|
+
}
|
|
25
|
+
else if (Math.sign(distance) !== initialSign) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
};
|
|
31
|
+
exports.isPlaneIntersectingAABB = isPlaneIntersectingAABB;
|
|
32
|
+
//# sourceMappingURL=isPlaneIntersectingAABB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPlaneIntersectingAABB.js","sourceRoot":"","sources":["../../../../src/utilities/planar/isPlaneIntersectingAABB.ts"],"names":[],"mappings":";;;AAAA,yCAAiC;AAe1B,MAAM,uBAAuB,GAAG,CACrC,MAAM,EACN,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,EAAE;IACF,MAAM,QAAQ,GAAG;QACf,gBAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QACjC,gBAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QACjC,gBAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QACjC,gBAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QACjC,gBAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QACjC,gBAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QACjC,gBAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QACjC,gBAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;KAClC,CAAC;IAEF,MAAM,SAAS,GAAG,gBAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,MAAM,SAAS,GAAG,gBAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAGnE,MAAM,aAAa,GAAG,CAAC,gBAAI,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAGtD,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,KAAK,MAAM,MAAM,IAAI,QAAQ,EAAE;QAE7B,MAAM,QAAQ,GAAG,gBAAI,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,aAAa,CAAC;QAC7D,IAAI,WAAW,KAAK,IAAI,EAAE;YACxB,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACnC;aAAM,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,WAAW,EAAE;YAC9C,OAAO,IAAI,CAAC;SACb;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAxCW,QAAA,uBAAuB,2BAwClC"}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
declare
|
|
1
|
+
export declare const setSegmentationDirty: (segmentationId: string) => void;
|
|
2
|
+
export declare const setSegmentationClean: (segmentationId: string) => void;
|
|
3
|
+
declare function getUniqueSegmentIndices(segmentationId: any): any;
|
|
2
4
|
export { getUniqueSegmentIndices };
|
|
@@ -1,59 +1,109 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUniqueSegmentIndices = void 0;
|
|
3
|
+
exports.getUniqueSegmentIndices = exports.setSegmentationClean = exports.setSegmentationDirty = void 0;
|
|
4
4
|
const core_1 = require("@cornerstonejs/core");
|
|
5
|
-
const enums_1 = require("../../enums");
|
|
6
5
|
const segmentationState_1 = require("../../stateManagement/segmentation/segmentationState");
|
|
7
6
|
const stackVolumeCheck_1 = require("../../tools/segmentation/strategies/utils/stackVolumeCheck");
|
|
7
|
+
const enums_1 = require("../../enums");
|
|
8
|
+
const segmentIndicesCache = new Map();
|
|
9
|
+
const setSegmentationDirty = (segmentationId) => {
|
|
10
|
+
const cached = segmentIndicesCache.get(segmentationId);
|
|
11
|
+
if (cached) {
|
|
12
|
+
cached.isDirty = true;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.setSegmentationDirty = setSegmentationDirty;
|
|
16
|
+
const setSegmentationClean = (segmentationId) => {
|
|
17
|
+
const cached = segmentIndicesCache.get(segmentationId);
|
|
18
|
+
if (cached) {
|
|
19
|
+
cached.isDirty = false;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.setSegmentationClean = setSegmentationClean;
|
|
23
|
+
function getCachedSegmentIndices(segmentationId) {
|
|
24
|
+
const cached = segmentIndicesCache.get(segmentationId);
|
|
25
|
+
if (cached && !cached.isDirty) {
|
|
26
|
+
return cached.indices;
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
8
30
|
function getUniqueSegmentIndices(segmentationId) {
|
|
9
|
-
|
|
31
|
+
const cachedResult = getCachedSegmentIndices(segmentationId);
|
|
32
|
+
if (cachedResult) {
|
|
33
|
+
return cachedResult;
|
|
34
|
+
}
|
|
10
35
|
const segmentation = (0, segmentationState_1.getSegmentation)(segmentationId);
|
|
11
|
-
if (segmentation
|
|
12
|
-
|
|
13
|
-
const keySet = new Set();
|
|
14
|
-
if ((0, stackVolumeCheck_1.isVolumeSegmentation)(labelmapData)) {
|
|
15
|
-
const volume = core_1.cache.getVolume(segmentationId);
|
|
16
|
-
const scalarData = volume.getScalarData();
|
|
17
|
-
for (let i = 0; i < scalarData.length; i++) {
|
|
18
|
-
const segmentIndex = scalarData[i];
|
|
19
|
-
if (segmentIndex !== 0) {
|
|
20
|
-
keySet.add(segmentIndex);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
labelmapData.imageIdReferenceMap.forEach((segmentationImageId) => {
|
|
26
|
-
const image = core_1.cache.getImage(segmentationImageId);
|
|
27
|
-
const scalarData = image.getPixelData();
|
|
28
|
-
for (let i = 0; i < scalarData.length; i++) {
|
|
29
|
-
const segmentIndex = scalarData[i];
|
|
30
|
-
if (segmentIndex !== 0) {
|
|
31
|
-
keySet.add(segmentIndex);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
return Array.from(keySet)
|
|
37
|
-
.map((it) => parseInt(it))
|
|
38
|
-
.sort();
|
|
39
|
-
}
|
|
40
|
-
else if (segmentation.type === enums_1.SegmentationRepresentations.Contour) {
|
|
41
|
-
const annotationUIDsMap = (_a = segmentation.representationData.CONTOUR) === null || _a === void 0 ? void 0 : _a.annotationUIDsMap;
|
|
42
|
-
const indices = new Set(annotationUIDsMap.keys());
|
|
43
|
-
const geometryIds = (_b = segmentation.representationData.CONTOUR) === null || _b === void 0 ? void 0 : _b.geometryIds;
|
|
44
|
-
if (!geometryIds) {
|
|
45
|
-
throw new Error(`No geometryIds found for segmentationId ${segmentationId}`);
|
|
46
|
-
}
|
|
47
|
-
geometryIds.forEach((geometryId) => {
|
|
48
|
-
const geometry = core_1.cache.getGeometry(geometryId);
|
|
49
|
-
indices.add(geometry.data.getSegmentIndex());
|
|
50
|
-
});
|
|
51
|
-
return Array.from(indices.values()).sort();
|
|
36
|
+
if (!segmentation) {
|
|
37
|
+
throw new Error(`No segmentation found for segmentationId ${segmentationId}`);
|
|
52
38
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
39
|
+
let indices;
|
|
40
|
+
switch (segmentation.type) {
|
|
41
|
+
case enums_1.SegmentationRepresentations.Labelmap:
|
|
42
|
+
indices = handleLabelmapSegmentation(segmentation, segmentationId);
|
|
43
|
+
break;
|
|
44
|
+
case enums_1.SegmentationRepresentations.Contour:
|
|
45
|
+
indices = handleContourSegmentation(segmentation);
|
|
46
|
+
break;
|
|
47
|
+
case enums_1.SegmentationRepresentations.Surface:
|
|
48
|
+
indices = handleSurfaceSegmentation(segmentation);
|
|
49
|
+
break;
|
|
50
|
+
default:
|
|
51
|
+
throw new Error(`Unsupported segmentation type: ${segmentation.type}`);
|
|
56
52
|
}
|
|
53
|
+
segmentIndicesCache.set(segmentationId, { indices, isDirty: false });
|
|
54
|
+
return indices;
|
|
57
55
|
}
|
|
58
56
|
exports.getUniqueSegmentIndices = getUniqueSegmentIndices;
|
|
57
|
+
function handleLabelmapSegmentation(segmentation, segmentationId) {
|
|
58
|
+
const labelmapData = segmentation.representationData[enums_1.SegmentationRepresentations.Labelmap];
|
|
59
|
+
const keySet = new Set();
|
|
60
|
+
if ((0, stackVolumeCheck_1.isVolumeSegmentation)(labelmapData)) {
|
|
61
|
+
addVolumeSegmentIndices(keySet, segmentationId);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
addImageSegmentIndices(keySet, labelmapData.imageIdReferenceMap);
|
|
65
|
+
}
|
|
66
|
+
return Array.from(keySet)
|
|
67
|
+
.map(Number)
|
|
68
|
+
.sort((a, b) => a - b);
|
|
69
|
+
}
|
|
70
|
+
function addVolumeSegmentIndices(keySet, segmentationId) {
|
|
71
|
+
const volume = core_1.cache.getVolume(segmentationId);
|
|
72
|
+
const scalarData = volume.getScalarData();
|
|
73
|
+
scalarData.forEach((segmentIndex) => {
|
|
74
|
+
if (segmentIndex !== 0) {
|
|
75
|
+
keySet.add(segmentIndex);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function addImageSegmentIndices(keySet, imageIdReferenceMap) {
|
|
80
|
+
imageIdReferenceMap.forEach((segmentationImageId) => {
|
|
81
|
+
const image = core_1.cache.getImage(segmentationImageId);
|
|
82
|
+
const scalarData = image.getPixelData();
|
|
83
|
+
scalarData.forEach((segmentIndex) => {
|
|
84
|
+
if (segmentIndex !== 0) {
|
|
85
|
+
keySet.add(segmentIndex);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function handleContourSegmentation(segmentation) {
|
|
91
|
+
const { annotationUIDsMap, geometryIds } = segmentation.representationData.CONTOUR || {};
|
|
92
|
+
if (!geometryIds) {
|
|
93
|
+
throw new Error(`No geometryIds found for segmentationId ${segmentation.segmentationId}`);
|
|
94
|
+
}
|
|
95
|
+
const indices = new Set([...annotationUIDsMap.keys()]);
|
|
96
|
+
geometryIds.forEach((geometryId) => {
|
|
97
|
+
const geometry = core_1.cache.getGeometry(geometryId);
|
|
98
|
+
indices.add(geometry.data.getSegmentIndex());
|
|
99
|
+
});
|
|
100
|
+
return Array.from(indices).sort((a, b) => a - b);
|
|
101
|
+
}
|
|
102
|
+
function handleSurfaceSegmentation(segmentation) {
|
|
103
|
+
var _a, _b;
|
|
104
|
+
const geometryIds = (_b = (_a = segmentation.representationData.SURFACE) === null || _a === void 0 ? void 0 : _a.geometryIds) !== null && _b !== void 0 ? _b : [];
|
|
105
|
+
return Array.from(geometryIds.keys())
|
|
106
|
+
.map(Number)
|
|
107
|
+
.sort((a, b) => a - b);
|
|
108
|
+
}
|
|
59
109
|
//# sourceMappingURL=getUniqueSegmentIndices.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUniqueSegmentIndices.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/getUniqueSegmentIndices.ts"],"names":[],"mappings":";;;AAAA,8CAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"getUniqueSegmentIndices.js","sourceRoot":"","sources":["../../../../src/utilities/segmentation/getUniqueSegmentIndices.ts"],"names":[],"mappings":";;;A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