@cornerstonejs/tools 1.53.0 → 1.54.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/enums/WorkerTypes.d.ts +8 -0
- package/dist/cjs/enums/WorkerTypes.js +12 -0
- package/dist/cjs/enums/WorkerTypes.js.map +1 -0
- package/dist/cjs/enums/index.d.ts +2 -1
- package/dist/cjs/enums/index.js +3 -1
- package/dist/cjs/enums/index.js.map +1 -1
- package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +6 -11
- package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -1
- package/dist/cjs/eventListeners/segmentation/imageChangeEventListener.js +4 -3
- package/dist/cjs/eventListeners/segmentation/imageChangeEventListener.js.map +1 -1
- package/dist/cjs/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +58 -47
- package/dist/cjs/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js.map +1 -1
- package/dist/cjs/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.d.ts +1 -0
- package/dist/cjs/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js +5 -0
- package/dist/cjs/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js.map +1 -1
- package/dist/cjs/stateManagement/annotation/annotationState.d.ts +2 -1
- package/dist/cjs/stateManagement/annotation/annotationState.js +6 -1
- package/dist/cjs/stateManagement/annotation/annotationState.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.js +4 -1
- package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/addRepresentationData.d.ts +12 -0
- package/dist/cjs/stateManagement/segmentation/addRepresentationData.js +35 -0
- package/dist/cjs/stateManagement/segmentation/addRepresentationData.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentation.js +32 -14
- package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentation.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/config/segmentationVisibility.js +3 -52
- package/dist/cjs/stateManagement/segmentation/config/segmentationVisibility.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/convertStackToVolumeSegmentation.d.ts +9 -2
- package/dist/cjs/stateManagement/segmentation/convertStackToVolumeSegmentation.js +44 -27
- package/dist/cjs/stateManagement/segmentation/convertStackToVolumeSegmentation.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/convertVolumeToStackSegmentation.d.ts +13 -0
- package/dist/cjs/stateManagement/segmentation/convertVolumeToStackSegmentation.js +52 -26
- package/dist/cjs/stateManagement/segmentation/convertVolumeToStackSegmentation.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/helpers/validateSegmentationInput.js +6 -9
- package/dist/cjs/stateManagement/segmentation/helpers/validateSegmentationInput.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/index.d.ts +3 -1
- package/dist/cjs/stateManagement/segmentation/index.js +5 -1
- package/dist/cjs/stateManagement/segmentation/index.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts +2 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js +8 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.d.ts +2 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.js +11 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.d.ts +7 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js +162 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.d.ts +6 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js +71 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.d.ts +6 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js +120 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.d.ts +4 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.js +12 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.d.ts +3 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js +52 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.d.ts +3 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js +60 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.d.ts +5 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js +56 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.d.ts +12 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.js +94 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.d.ts +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.js +74 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.d.ts +2 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.js +83 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/computeAndAddRepresentation.d.ts +3 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js +64 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/index.d.ts +5 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/index.js +12 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/index.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/registerPolySegWorker.d.ts +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/registerPolySegWorker.js +27 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/registerPolySegWorker.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/segmentIndex.js +4 -0
- package/dist/cjs/stateManagement/segmentation/segmentIndex.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/segmentationState.d.ts +6 -1
- package/dist/cjs/stateManagement/segmentation/segmentationState.js +30 -1
- package/dist/cjs/stateManagement/segmentation/segmentationState.js.map +1 -1
- package/dist/cjs/tools/ScaleOverlayTool.js +2 -1
- package/dist/cjs/tools/ScaleOverlayTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts +1 -2
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.js +0 -11
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +1 -2
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/ProbeTool.js +3 -0
- package/dist/cjs/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js.map +1 -1
- package/dist/cjs/tools/base/AnnotationTool.js +1 -1
- package/dist/cjs/tools/base/AnnotationTool.js.map +1 -1
- package/dist/cjs/tools/base/BaseTool.js.map +1 -1
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.d.ts +1 -2
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.js +24 -24
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.js.map +1 -1
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js +9 -6
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/cjs/tools/displayTools/Contour/removeContourFromElement.js.map +1 -1
- package/dist/cjs/tools/displayTools/Contour/{addContourSetsToElement.d.ts → vtkContour/addContourSetsToElement.d.ts} +1 -1
- package/dist/cjs/tools/displayTools/Contour/vtkContour/addContourSetsToElement.js.map +1 -0
- package/dist/cjs/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.d.ts +3 -0
- package/dist/cjs/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.js +14 -0
- package/dist/cjs/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.js.map +1 -0
- package/dist/cjs/tools/displayTools/Contour/vtkContour/contourConfigCache.js.map +1 -0
- package/dist/cjs/tools/displayTools/Contour/vtkContour/updateVTKContourSets.d.ts +3 -0
- package/dist/cjs/tools/displayTools/Contour/{updateContourSets.js → vtkContour/updateVTKContourSets.js} +4 -4
- package/dist/cjs/tools/displayTools/Contour/vtkContour/updateVTKContourSets.js.map +1 -0
- package/dist/cjs/tools/displayTools/Contour/{utils.d.ts → vtkContour/utils.d.ts} +2 -2
- package/dist/cjs/tools/displayTools/Contour/vtkContour/utils.js.map +1 -0
- package/dist/cjs/tools/displayTools/Labelmap/addLabelmapToElement.js +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/addLabelmapToElement.js.map +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/index.d.ts +2 -1
- package/dist/cjs/tools/displayTools/Labelmap/index.js +4 -1
- package/dist/cjs/tools/displayTools/Labelmap/index.js.map +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js +20 -2
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/validateLabelmap.d.ts +4 -0
- package/dist/cjs/tools/displayTools/Labelmap/validateLabelmap.js +38 -0
- package/dist/cjs/tools/displayTools/Labelmap/validateLabelmap.js.map +1 -0
- package/dist/cjs/tools/displayTools/Surface/addOrUpdateSurfaceToElement.d.ts +3 -0
- package/dist/cjs/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js +112 -0
- package/dist/cjs/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js.map +1 -0
- package/dist/cjs/tools/displayTools/Surface/surfaceConfig.d.ts +3 -0
- package/dist/cjs/tools/displayTools/Surface/surfaceConfig.js +11 -0
- package/dist/cjs/tools/displayTools/Surface/surfaceConfig.js.map +1 -0
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.d.ts +7 -0
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.js +173 -27
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.js.map +1 -1
- package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.d.ts +1 -0
- package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.js +27 -0
- package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.js.map +1 -0
- package/dist/cjs/tools/segmentation/BrushTool.js +1 -1
- package/dist/cjs/tools/segmentation/BrushTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/CircleScissorsTool.js +1 -1
- package/dist/cjs/tools/segmentation/CircleScissorsTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/PaintFillTool.js +1 -1
- package/dist/cjs/tools/segmentation/PaintFillTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/RectangleScissorsTool.js +1 -1
- package/dist/cjs/tools/segmentation/RectangleScissorsTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/SegmentSelectTool.d.ts +6 -2
- package/dist/cjs/tools/segmentation/SegmentSelectTool.js +45 -35
- package/dist/cjs/tools/segmentation/SegmentSelectTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/SphereScissorsTool.js +1 -1
- package/dist/cjs/tools/segmentation/SphereScissorsTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/BrushStrategy.js +7 -5
- package/dist/cjs/tools/segmentation/strategies/BrushStrategy.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/compositions/regionFill.js +1 -1
- package/dist/cjs/tools/segmentation/strategies/compositions/regionFill.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillSphere.js +14 -5
- package/dist/cjs/tools/segmentation/strategies/fillSphere.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/utils/getStrategyData.js +21 -9
- package/dist/cjs/tools/segmentation/strategies/utils/getStrategyData.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/utils/stackVolumeCheck.d.ts +5 -5
- package/dist/cjs/tools/segmentation/strategies/utils/stackVolumeCheck.js +15 -8
- package/dist/cjs/tools/segmentation/strategies/utils/stackVolumeCheck.js.map +1 -1
- package/dist/cjs/types/ContourSegmentationAnnotation.d.ts +0 -1
- package/dist/cjs/types/LabelmapTypes.d.ts +5 -1
- package/dist/cjs/types/PolySeg.d.ts +6 -0
- package/dist/cjs/types/PolySeg.js +3 -0
- package/dist/cjs/types/PolySeg.js.map +1 -0
- package/dist/cjs/types/SegmentationStateTypes.d.ts +12 -2
- package/dist/cjs/types/SurfaceTypes.d.ts +1 -1
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/cjs/utilities/boundingBox/getBoundingBoxAroundShape.js +6 -6
- package/dist/cjs/utilities/boundingBox/getBoundingBoxAroundShape.js.map +1 -1
- package/dist/cjs/utilities/contourSegmentation/addContourSegmentationAnnotation.d.ts +2 -0
- package/dist/cjs/utilities/contourSegmentation/addContourSegmentationAnnotation.js +20 -0
- package/dist/cjs/utilities/contourSegmentation/addContourSegmentationAnnotation.js.map +1 -0
- package/dist/cjs/utilities/contourSegmentation/areSameSegment.js +0 -2
- package/dist/cjs/utilities/contourSegmentation/areSameSegment.js.map +1 -1
- package/dist/cjs/utilities/contourSegmentation/index.d.ts +2 -0
- package/dist/cjs/utilities/contourSegmentation/index.js +5 -1
- package/dist/cjs/utilities/contourSegmentation/index.js.map +1 -1
- package/dist/cjs/utilities/contourSegmentation/removeContourSegmentationAnnotation.d.ts +2 -0
- package/dist/cjs/utilities/contourSegmentation/removeContourSegmentationAnnotation.js +19 -0
- package/dist/cjs/utilities/contourSegmentation/removeContourSegmentationAnnotation.js.map +1 -0
- package/dist/cjs/utilities/contours/detectContourHoles.js.map +1 -1
- package/dist/cjs/utilities/contours/generateContourSetsFromLabelmap.js +2 -2
- package/dist/cjs/utilities/contours/generateContourSetsFromLabelmap.js.map +1 -1
- package/dist/cjs/utilities/contours/getDeduplicatedVTKPolyDataPoints.d.ts +11 -0
- package/dist/cjs/utilities/contours/getDeduplicatedVTKPolyDataPoints.js +50 -0
- package/dist/cjs/utilities/contours/getDeduplicatedVTKPolyDataPoints.js.map +1 -0
- package/dist/cjs/utilities/contours/index.d.ts +2 -2
- package/dist/cjs/utilities/contours/index.js +3 -3
- package/dist/cjs/utilities/contours/index.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/polyline/containsPoint.js.map +1 -1
- package/dist/cjs/utilities/math/polyline/index.d.ts +2 -1
- package/dist/cjs/utilities/math/polyline/index.js +3 -1
- package/dist/cjs/utilities/math/polyline/index.js.map +1 -1
- package/dist/cjs/utilities/math/polyline/isPointInsidePolyline3D.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/isPointInsidePolyline3D.js +34 -0
- package/dist/cjs/utilities/math/polyline/isPointInsidePolyline3D.js.map +1 -0
- package/dist/cjs/utilities/segmentation/contourAndFindLargestBidirectional.js +0 -1
- package/dist/cjs/utilities/segmentation/contourAndFindLargestBidirectional.js.map +1 -1
- package/dist/cjs/utilities/segmentation/getHoveredContourSegmentationAnnotation.d.ts +1 -0
- package/dist/cjs/utilities/segmentation/getHoveredContourSegmentationAnnotation.js +18 -0
- package/dist/cjs/utilities/segmentation/getHoveredContourSegmentationAnnotation.js.map +1 -0
- package/dist/cjs/utilities/segmentation/getSegmentAtLabelmapBorder.d.ts +7 -0
- package/dist/cjs/utilities/segmentation/getSegmentAtLabelmapBorder.js +77 -0
- package/dist/cjs/utilities/segmentation/getSegmentAtLabelmapBorder.js.map +1 -0
- package/dist/cjs/utilities/segmentation/getSegmentAtWorldPoint.d.ts +11 -0
- package/dist/cjs/utilities/segmentation/getSegmentAtWorldPoint.js +82 -0
- package/dist/cjs/utilities/segmentation/getSegmentAtWorldPoint.js.map +1 -0
- package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.d.ts +2 -0
- package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.js +59 -0
- package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.js.map +1 -0
- package/dist/cjs/utilities/segmentation/index.d.ts +5 -1
- package/dist/cjs/utilities/segmentation/index.js +9 -1
- package/dist/cjs/utilities/segmentation/index.js.map +1 -1
- package/dist/cjs/utilities/triggerAnnotationRenderForToolGroupIds.d.ts +2 -0
- package/dist/cjs/utilities/triggerAnnotationRenderForToolGroupIds.js +32 -0
- package/dist/cjs/utilities/triggerAnnotationRenderForToolGroupIds.js.map +1 -0
- package/dist/cjs/workers/clippingPlaneWorker.d.ts +1 -0
- package/dist/cjs/workers/clippingPlaneWorker.js +63 -0
- package/dist/cjs/workers/clippingPlaneWorker.js.map +1 -0
- package/dist/cjs/workers/polySegConverters.d.ts +1 -0
- package/dist/cjs/workers/polySegConverters.js +267 -0
- package/dist/cjs/workers/polySegConverters.js.map +1 -0
- package/dist/esm/enums/WorkerTypes.js +10 -0
- package/dist/esm/enums/WorkerTypes.js.map +1 -0
- package/dist/esm/enums/index.js +2 -1
- package/dist/esm/enums/index.js.map +1 -1
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +7 -12
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -1
- package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js +3 -3
- package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js.map +1 -1
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +59 -45
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js.map +1 -1
- package/dist/esm/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js +5 -0
- package/dist/esm/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js.map +1 -1
- package/dist/esm/stateManagement/annotation/annotationState.js +5 -1
- package/dist/esm/stateManagement/annotation/annotationState.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +4 -1
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/addRepresentationData.js +30 -0
- package/dist/esm/stateManagement/segmentation/addRepresentationData.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentation.js +32 -15
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentation.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.js +1 -46
- package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/convertStackToVolumeSegmentation.js +42 -27
- package/dist/esm/stateManagement/segmentation/convertStackToVolumeSegmentation.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/convertVolumeToStackSegmentation.js +49 -25
- package/dist/esm/stateManagement/segmentation/convertVolumeToStackSegmentation.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/helpers/validateSegmentationInput.js +6 -6
- package/dist/esm/stateManagement/segmentation/helpers/validateSegmentationInput.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/index.js +3 -1
- package/dist/esm/stateManagement/segmentation/index.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js +4 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.js +7 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js +142 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js +53 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js +108 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.js +8 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js +37 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js +45 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js +41 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.js +78 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.js +59 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.js +68 -0
- package/dist/esm/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js +47 -0
- package/dist/esm/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/index.js +6 -0
- package/dist/esm/stateManagement/segmentation/polySeg/index.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/registerPolySegWorker.js +23 -0
- package/dist/esm/stateManagement/segmentation/polySeg/registerPolySegWorker.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/segmentIndex.js +4 -0
- package/dist/esm/stateManagement/segmentation/segmentIndex.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/segmentationState.js +28 -1
- package/dist/esm/stateManagement/segmentation/segmentationState.js.map +1 -1
- package/dist/esm/tools/ScaleOverlayTool.js +2 -1
- package/dist/esm/tools/ScaleOverlayTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js +0 -11
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +1 -2
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/esm/tools/annotation/ProbeTool.js +3 -0
- package/dist/esm/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js.map +1 -1
- package/dist/esm/tools/base/AnnotationTool.js +1 -1
- package/dist/esm/tools/base/AnnotationTool.js.map +1 -1
- package/dist/esm/tools/base/BaseTool.js +1 -1
- package/dist/esm/tools/base/BaseTool.js.map +1 -1
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js +24 -24
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js.map +1 -1
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js +10 -7
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/esm/tools/displayTools/Contour/removeContourFromElement.js.map +1 -1
- package/dist/esm/tools/displayTools/Contour/vtkContour/addContourSetsToElement.js.map +1 -0
- package/dist/esm/tools/displayTools/Contour/{addOrUpdateContourSets.js → vtkContour/addOrUpdateVTKContourSets.js} +4 -4
- package/dist/esm/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.js.map +1 -0
- package/dist/esm/tools/displayTools/Contour/vtkContour/contourConfigCache.js.map +1 -0
- package/dist/esm/tools/displayTools/Contour/{updateContourSets.js → vtkContour/updateVTKContourSets.js} +2 -2
- package/dist/esm/tools/displayTools/Contour/vtkContour/updateVTKContourSets.js.map +1 -0
- package/dist/esm/tools/displayTools/Contour/vtkContour/utils.js.map +1 -0
- package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.js +1 -1
- package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.js.map +1 -1
- package/dist/esm/tools/displayTools/Labelmap/index.js +2 -1
- package/dist/esm/tools/displayTools/Labelmap/index.js.map +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +20 -2
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/esm/tools/displayTools/Labelmap/validateLabelmap.js +33 -0
- package/dist/esm/tools/displayTools/Labelmap/validateLabelmap.js.map +1 -0
- package/dist/esm/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js +106 -0
- package/dist/esm/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js.map +1 -0
- package/dist/esm/tools/displayTools/Surface/surfaceConfig.js +9 -0
- package/dist/esm/tools/displayTools/Surface/surfaceConfig.js.map +1 -0
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js +162 -28
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js.map +1 -1
- package/dist/esm/tools/displayTools/registerDisplayToolsWorker.js +23 -0
- package/dist/esm/tools/displayTools/registerDisplayToolsWorker.js.map +1 -0
- package/dist/esm/tools/segmentation/BrushTool.js +1 -1
- package/dist/esm/tools/segmentation/BrushTool.js.map +1 -1
- package/dist/esm/tools/segmentation/CircleScissorsTool.js +1 -1
- package/dist/esm/tools/segmentation/CircleScissorsTool.js.map +1 -1
- package/dist/esm/tools/segmentation/PaintFillTool.js +1 -1
- package/dist/esm/tools/segmentation/PaintFillTool.js.map +1 -1
- package/dist/esm/tools/segmentation/RectangleScissorsTool.js +1 -1
- package/dist/esm/tools/segmentation/RectangleScissorsTool.js.map +1 -1
- package/dist/esm/tools/segmentation/SegmentSelectTool.js +47 -37
- package/dist/esm/tools/segmentation/SegmentSelectTool.js.map +1 -1
- package/dist/esm/tools/segmentation/SphereScissorsTool.js +1 -1
- package/dist/esm/tools/segmentation/SphereScissorsTool.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.js +7 -5
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/compositions/regionFill.js +1 -1
- package/dist/esm/tools/segmentation/strategies/compositions/regionFill.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/fillSphere.js +14 -5
- package/dist/esm/tools/segmentation/strategies/fillSphere.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js +21 -9
- package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/utils/stackVolumeCheck.js +15 -7
- package/dist/esm/tools/segmentation/strategies/utils/stackVolumeCheck.js.map +1 -1
- package/dist/esm/types/PolySeg.js +2 -0
- package/dist/esm/types/PolySeg.js.map +1 -0
- package/dist/esm/utilities/boundingBox/getBoundingBoxAroundShape.js +3 -2
- package/dist/esm/utilities/boundingBox/getBoundingBoxAroundShape.js.map +1 -1
- package/dist/esm/utilities/contourSegmentation/addContourSegmentationAnnotation.js +16 -0
- package/dist/esm/utilities/contourSegmentation/addContourSegmentationAnnotation.js.map +1 -0
- package/dist/esm/utilities/contourSegmentation/areSameSegment.js +0 -2
- package/dist/esm/utilities/contourSegmentation/areSameSegment.js.map +1 -1
- package/dist/esm/utilities/contourSegmentation/index.js +2 -0
- package/dist/esm/utilities/contourSegmentation/index.js.map +1 -1
- package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.js +15 -0
- package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.js.map +1 -0
- package/dist/esm/utilities/contours/detectContourHoles.js.map +1 -1
- package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js +2 -2
- package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js.map +1 -1
- package/dist/esm/utilities/contours/getDeduplicatedVTKPolyDataPoints.js +46 -0
- package/dist/esm/utilities/contours/getDeduplicatedVTKPolyDataPoints.js.map +1 -0
- package/dist/esm/utilities/contours/index.js +2 -2
- package/dist/esm/utilities/contours/index.js.map +1 -1
- package/dist/esm/utilities/index.js +3 -1
- package/dist/esm/utilities/index.js.map +1 -1
- package/dist/esm/utilities/math/polyline/containsPoint.js.map +1 -1
- package/dist/esm/utilities/math/polyline/index.js +2 -1
- package/dist/esm/utilities/math/polyline/index.js.map +1 -1
- package/dist/esm/utilities/math/polyline/isPointInsidePolyline3D.js +27 -0
- package/dist/esm/utilities/math/polyline/isPointInsidePolyline3D.js.map +1 -0
- package/dist/esm/utilities/segmentation/contourAndFindLargestBidirectional.js +0 -1
- package/dist/esm/utilities/segmentation/contourAndFindLargestBidirectional.js.map +1 -1
- package/dist/esm/utilities/segmentation/getHoveredContourSegmentationAnnotation.js +14 -0
- package/dist/esm/utilities/segmentation/getHoveredContourSegmentationAnnotation.js.map +1 -0
- package/dist/esm/utilities/segmentation/getSegmentAtLabelmapBorder.js +73 -0
- package/dist/esm/utilities/segmentation/getSegmentAtLabelmapBorder.js.map +1 -0
- package/dist/esm/utilities/segmentation/getSegmentAtWorldPoint.js +75 -0
- package/dist/esm/utilities/segmentation/getSegmentAtWorldPoint.js.map +1 -0
- package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js +55 -0
- package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js.map +1 -0
- package/dist/esm/utilities/segmentation/index.js +5 -1
- package/dist/esm/utilities/segmentation/index.js.map +1 -1
- package/dist/esm/utilities/triggerAnnotationRenderForToolGroupIds.js +25 -0
- package/dist/esm/utilities/triggerAnnotationRenderForToolGroupIds.js.map +1 -0
- package/dist/esm/workers/clippingPlaneWorker.js +58 -0
- package/dist/esm/workers/clippingPlaneWorker.js.map +1 -0
- package/dist/esm/workers/polySegConverters.js +241 -0
- package/dist/esm/workers/polySegConverters.js.map +1 -0
- package/dist/types/enums/WorkerTypes.d.ts +9 -0
- package/dist/types/enums/WorkerTypes.d.ts.map +1 -0
- package/dist/types/enums/index.d.ts +2 -1
- package/dist/types/eventListeners/segmentation/imageChangeEventListener.d.ts.map +1 -1
- package/dist/types/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.d.ts.map +1 -1
- package/dist/types/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.d.ts +1 -0
- package/dist/types/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.d.ts.map +1 -1
- package/dist/types/stateManagement/annotation/annotationState.d.ts +2 -1
- package/dist/types/stateManagement/annotation/annotationState.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/SegmentationStateManager.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/addRepresentationData.d.ts +13 -0
- package/dist/types/stateManagement/segmentation/addRepresentationData.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/addSegmentationRepresentation.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/config/segmentationVisibility.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/convertStackToVolumeSegmentation.d.ts +9 -2
- package/dist/types/stateManagement/segmentation/convertStackToVolumeSegmentation.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/convertVolumeToStackSegmentation.d.ts +13 -0
- package/dist/types/stateManagement/segmentation/convertVolumeToStackSegmentation.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/helpers/validateSegmentationInput.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/index.d.ts +3 -1
- package/dist/types/stateManagement/segmentation/index.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts +3 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.d.ts +3 -0
- package/dist/types/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.d.ts +8 -0
- package/dist/types/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.d.ts +7 -0
- package/dist/types/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.d.ts +7 -0
- package/dist/types/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.d.ts +5 -0
- package/dist/types/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.d.ts +4 -0
- package/dist/types/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.d.ts +4 -0
- package/dist/types/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.d.ts +6 -0
- package/dist/types/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.d.ts +13 -0
- package/dist/types/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.d.ts +2 -0
- package/dist/types/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.d.ts +3 -0
- package/dist/types/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/computeAndAddRepresentation.d.ts +4 -0
- package/dist/types/stateManagement/segmentation/polySeg/computeAndAddRepresentation.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/index.d.ts +6 -0
- package/dist/types/stateManagement/segmentation/polySeg/index.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/registerPolySegWorker.d.ts +2 -0
- package/dist/types/stateManagement/segmentation/polySeg/registerPolySegWorker.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/segmentIndex.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/segmentationState.d.ts +6 -1
- package/dist/types/stateManagement/segmentation/segmentationState.d.ts.map +1 -1
- package/dist/types/tools/ScaleOverlayTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts +1 -2
- package/dist/types/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/ProbeTool.d.ts.map +1 -1
- package/dist/types/tools/base/BaseTool.d.ts.map +1 -1
- package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts +1 -2
- 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/Contour/removeContourFromElement.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Contour/{addContourSetsToElement.d.ts → vtkContour/addContourSetsToElement.d.ts} +1 -1
- package/dist/types/tools/displayTools/Contour/vtkContour/addContourSetsToElement.d.ts.map +1 -0
- package/dist/types/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.d.ts +4 -0
- package/dist/types/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.d.ts.map +1 -0
- package/dist/types/tools/displayTools/Contour/vtkContour/contourConfigCache.d.ts.map +1 -0
- package/dist/types/tools/displayTools/Contour/vtkContour/updateVTKContourSets.d.ts +4 -0
- package/dist/types/tools/displayTools/Contour/vtkContour/updateVTKContourSets.d.ts.map +1 -0
- package/dist/types/tools/displayTools/Contour/{utils.d.ts → vtkContour/utils.d.ts} +2 -2
- package/dist/types/tools/displayTools/Contour/vtkContour/utils.d.ts.map +1 -0
- package/dist/types/tools/displayTools/Labelmap/index.d.ts +2 -1
- package/dist/types/tools/displayTools/Labelmap/index.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Labelmap/labelmapDisplay.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Labelmap/validateLabelmap.d.ts +5 -0
- package/dist/types/tools/displayTools/Labelmap/validateLabelmap.d.ts.map +1 -0
- package/dist/types/tools/displayTools/Surface/addOrUpdateSurfaceToElement.d.ts +4 -0
- package/dist/types/tools/displayTools/Surface/addOrUpdateSurfaceToElement.d.ts.map +1 -0
- package/dist/types/tools/displayTools/Surface/surfaceConfig.d.ts +4 -0
- package/dist/types/tools/displayTools/Surface/surfaceConfig.d.ts.map +1 -0
- package/dist/types/tools/displayTools/Surface/surfaceDisplay.d.ts +7 -0
- package/dist/types/tools/displayTools/Surface/surfaceDisplay.d.ts.map +1 -1
- package/dist/types/tools/displayTools/registerDisplayToolsWorker.d.ts +2 -0
- package/dist/types/tools/displayTools/registerDisplayToolsWorker.d.ts.map +1 -0
- package/dist/types/tools/segmentation/CircleScissorsTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/RectangleScissorsTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/SegmentSelectTool.d.ts +6 -2
- package/dist/types/tools/segmentation/SegmentSelectTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/SphereScissorsTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/BrushStrategy.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/fillSphere.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/utils/getStrategyData.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/utils/stackVolumeCheck.d.ts +5 -5
- package/dist/types/tools/segmentation/strategies/utils/stackVolumeCheck.d.ts.map +1 -1
- package/dist/types/types/ContourSegmentationAnnotation.d.ts +0 -1
- package/dist/types/types/ContourSegmentationAnnotation.d.ts.map +1 -1
- package/dist/types/types/LabelmapTypes.d.ts +5 -1
- package/dist/types/types/LabelmapTypes.d.ts.map +1 -1
- package/dist/types/types/PolySeg.d.ts +7 -0
- package/dist/types/types/PolySeg.d.ts.map +1 -0
- package/dist/types/types/SegmentationStateTypes.d.ts +12 -2
- package/dist/types/types/SegmentationStateTypes.d.ts.map +1 -1
- package/dist/types/types/SurfaceTypes.d.ts +1 -1
- package/dist/types/types/SurfaceTypes.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utilities/boundingBox/getBoundingBoxAroundShape.d.ts.map +1 -1
- package/dist/types/utilities/contourSegmentation/addContourSegmentationAnnotation.d.ts +3 -0
- package/dist/types/utilities/contourSegmentation/addContourSegmentationAnnotation.d.ts.map +1 -0
- package/dist/types/utilities/contourSegmentation/areSameSegment.d.ts.map +1 -1
- package/dist/types/utilities/contourSegmentation/index.d.ts +2 -0
- package/dist/types/utilities/contourSegmentation/index.d.ts.map +1 -1
- package/dist/types/utilities/contourSegmentation/removeContourSegmentationAnnotation.d.ts +3 -0
- package/dist/types/utilities/contourSegmentation/removeContourSegmentationAnnotation.d.ts.map +1 -0
- package/dist/types/utilities/contours/detectContourHoles.d.ts.map +1 -1
- package/dist/types/utilities/contours/getDeduplicatedVTKPolyDataPoints.d.ts +12 -0
- package/dist/types/utilities/contours/getDeduplicatedVTKPolyDataPoints.d.ts.map +1 -0
- package/dist/types/utilities/contours/index.d.ts +2 -2
- package/dist/types/utilities/contours/index.d.ts.map +1 -1
- package/dist/types/utilities/index.d.ts +3 -1
- package/dist/types/utilities/index.d.ts.map +1 -1
- package/dist/types/utilities/math/polyline/containsPoint.d.ts.map +1 -1
- package/dist/types/utilities/math/polyline/index.d.ts +2 -1
- package/dist/types/utilities/math/polyline/index.d.ts.map +1 -1
- package/dist/types/utilities/math/polyline/isPointInsidePolyline3D.d.ts +3 -0
- package/dist/types/utilities/math/polyline/isPointInsidePolyline3D.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/contourAndFindLargestBidirectional.d.ts.map +1 -1
- package/dist/types/utilities/segmentation/getHoveredContourSegmentationAnnotation.d.ts +2 -0
- package/dist/types/utilities/segmentation/getHoveredContourSegmentationAnnotation.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/getSegmentAtLabelmapBorder.d.ts +8 -0
- package/dist/types/utilities/segmentation/getSegmentAtLabelmapBorder.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/getSegmentAtWorldPoint.d.ts +12 -0
- package/dist/types/utilities/segmentation/getSegmentAtWorldPoint.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/getUniqueSegmentIndices.d.ts +3 -0
- package/dist/types/utilities/segmentation/getUniqueSegmentIndices.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/index.d.ts +5 -1
- package/dist/types/utilities/segmentation/index.d.ts.map +1 -1
- package/dist/types/utilities/triggerAnnotationRenderForToolGroupIds.d.ts +3 -0
- package/dist/types/utilities/triggerAnnotationRenderForToolGroupIds.d.ts.map +1 -0
- package/dist/types/workers/clippingPlaneWorker.d.ts +2 -0
- package/dist/types/workers/clippingPlaneWorker.d.ts.map +1 -0
- package/dist/types/workers/polySegConverters.d.ts +2 -0
- package/dist/types/workers/polySegConverters.d.ts.map +1 -0
- package/dist/umd/17dd54813d5acc10bf8f.wasm +0 -0
- package/dist/umd/444.index.js +3 -0
- package/dist/umd/444.index.js.LICENSE.txt +5 -0
- package/dist/umd/444.index.js.map +1 -0
- package/dist/umd/78.index.js +3 -0
- package/dist/umd/78.index.js.LICENSE.txt +5 -0
- package/dist/umd/78.index.js.map +1 -0
- package/dist/umd/985.index.js +2 -0
- package/dist/umd/985.index.js.map +1 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +5 -3
- package/src/enums/WorkerTypes.ts +16 -0
- package/src/enums/index.js +2 -0
- package/src/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.ts +10 -17
- package/src/eventListeners/segmentation/imageChangeEventListener.ts +3 -4
- package/src/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.ts +97 -69
- package/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts +11 -0
- package/src/stateManagement/annotation/annotationState.ts +6 -0
- package/src/stateManagement/segmentation/SegmentationStateManager.ts +4 -1
- package/src/stateManagement/segmentation/addRepresentationData.ts +71 -0
- package/src/stateManagement/segmentation/addSegmentationRepresentation.ts +39 -16
- package/src/stateManagement/segmentation/config/segmentationVisibility.ts +1 -59
- package/src/stateManagement/segmentation/convertStackToVolumeSegmentation.ts +74 -37
- package/src/stateManagement/segmentation/convertVolumeToStackSegmentation.ts +102 -38
- package/src/stateManagement/segmentation/helpers/validateSegmentationInput.ts +13 -8
- package/src/stateManagement/segmentation/index.ts +9 -2
- package/src/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.ts +17 -0
- package/src/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.ts +25 -0
- package/src/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.ts +273 -0
- package/src/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.ts +89 -0
- package/src/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.ts +193 -0
- package/src/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.ts +26 -0
- package/src/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.ts +62 -0
- package/src/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.ts +81 -0
- package/src/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.ts +81 -0
- package/src/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.ts +167 -0
- package/src/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.ts +95 -0
- package/src/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.ts +123 -0
- package/src/stateManagement/segmentation/polySeg/computeAndAddRepresentation.ts +97 -0
- package/src/stateManagement/segmentation/polySeg/index.ts +12 -0
- package/src/stateManagement/segmentation/polySeg/registerPolySegWorker.ts +34 -0
- package/src/stateManagement/segmentation/segmentIndex.ts +5 -0
- package/src/stateManagement/segmentation/segmentationState.ts +62 -0
- package/src/tools/ScaleOverlayTool.ts +4 -1
- package/src/tools/annotation/PlanarFreehandContourSegmentationTool.ts +1 -22
- package/src/tools/annotation/PlanarFreehandROITool.ts +2 -4
- package/src/tools/annotation/ProbeTool.ts +4 -0
- package/src/tools/annotation/SplineROITool.ts +1 -1
- package/src/tools/annotation/planarFreehandROITool/drawLoop.ts +2 -2
- package/src/tools/annotation/planarFreehandROITool/openContourEndEditLoop.ts +1 -1
- package/src/tools/base/AnnotationTool.ts +1 -1
- package/src/tools/base/BaseTool.ts +1 -6
- package/src/tools/base/ContourBaseTool.ts +1 -1
- package/src/tools/base/ContourSegmentationBaseTool.ts +45 -42
- package/src/tools/displayTools/Contour/contourDisplay.ts +82 -9
- package/src/tools/displayTools/Contour/removeContourFromElement.ts +2 -0
- package/src/tools/displayTools/Contour/{addContourSetsToElement.ts → vtkContour/addContourSetsToElement.ts} +1 -1
- package/src/tools/displayTools/Contour/{addOrUpdateContourSets.ts → vtkContour/addOrUpdateVTKContourSets.ts} +4 -4
- package/src/tools/displayTools/Contour/{updateContourSets.ts → vtkContour/updateVTKContourSets.ts} +2 -2
- package/src/tools/displayTools/Contour/{utils.ts → vtkContour/utils.ts} +1 -1
- package/src/tools/displayTools/Labelmap/addLabelmapToElement.ts +1 -1
- package/src/tools/displayTools/Labelmap/index.ts +10 -1
- package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +39 -4
- package/src/tools/displayTools/Labelmap/validateLabelmap.ts +71 -0
- package/src/tools/displayTools/Surface/addOrUpdateSurfaceToElement.ts +172 -0
- package/src/tools/displayTools/Surface/surfaceConfig.ts +12 -0
- package/src/tools/displayTools/Surface/surfaceDisplay.ts +275 -35
- package/src/tools/displayTools/registerDisplayToolsWorker.ts +34 -0
- package/src/tools/segmentation/BrushTool.ts +1 -1
- package/src/tools/segmentation/CircleScissorsTool.ts +3 -1
- package/src/tools/segmentation/PaintFillTool.ts +1 -1
- package/src/tools/segmentation/RectangleScissorsTool.ts +3 -1
- package/src/tools/segmentation/SegmentSelectTool.ts +70 -75
- package/src/tools/segmentation/SphereScissorsTool.ts +3 -1
- package/src/tools/segmentation/strategies/BrushStrategy.ts +12 -9
- package/src/tools/segmentation/strategies/compositions/regionFill.ts +1 -1
- package/src/tools/segmentation/strategies/fillSphere.ts +13 -5
- package/src/tools/segmentation/strategies/utils/getStrategyData.ts +30 -15
- package/src/tools/segmentation/strategies/utils/stackVolumeCheck.ts +24 -17
- package/src/types/ContourSegmentationAnnotation.ts +0 -1
- package/src/types/LabelmapTypes.ts +7 -1
- package/src/types/PolySeg.ts +7 -0
- package/src/types/SegmentationStateTypes.ts +20 -4
- package/src/types/SurfaceTypes.ts +1 -1
- package/src/types/index.ts +3 -0
- package/src/utilities/boundingBox/getBoundingBoxAroundShape.ts +4 -2
- package/src/utilities/contourSegmentation/addContourSegmentationAnnotation.ts +29 -0
- package/src/utilities/contourSegmentation/areSameSegment.ts +0 -2
- package/src/utilities/contourSegmentation/index.ts +2 -0
- package/src/utilities/contourSegmentation/removeContourSegmentationAnnotation.ts +30 -0
- package/src/utilities/contours/detectContourHoles.ts +2 -0
- package/src/utilities/contours/generateContourSetsFromLabelmap.ts +2 -2
- package/src/utilities/contours/getDeduplicatedVTKPolyDataPoints.ts +66 -0
- package/src/utilities/contours/index.ts +2 -2
- package/src/utilities/index.ts +4 -0
- package/src/utilities/math/polyline/containsPoint.ts +3 -1
- package/src/utilities/math/polyline/index.ts +2 -0
- package/src/utilities/math/polyline/isPointInsidePolyline3D.ts +56 -0
- package/src/utilities/segmentation/contourAndFindLargestBidirectional.ts +0 -1
- package/src/utilities/segmentation/getHoveredContourSegmentationAnnotation.ts +25 -0
- package/src/utilities/segmentation/getSegmentAtLabelmapBorder.ts +179 -0
- package/src/utilities/segmentation/getSegmentAtWorldPoint.ts +173 -0
- package/src/utilities/segmentation/getUniqueSegmentIndices.ts +76 -0
- package/src/utilities/segmentation/index.ts +8 -0
- package/src/utilities/triggerAnnotationRenderForToolGroupIds.ts +38 -0
- package/src/workers/clippingPlaneWorker.js +87 -0
- package/src/workers/polySegConverters.js +467 -0
- package/dist/cjs/tools/displayTools/Contour/addContourSetsToElement.js.map +0 -1
- package/dist/cjs/tools/displayTools/Contour/addOrUpdateContourSets.d.ts +0 -3
- package/dist/cjs/tools/displayTools/Contour/addOrUpdateContourSets.js +0 -14
- package/dist/cjs/tools/displayTools/Contour/addOrUpdateContourSets.js.map +0 -1
- package/dist/cjs/tools/displayTools/Contour/contourConfigCache.js.map +0 -1
- package/dist/cjs/tools/displayTools/Contour/updateContourSets.d.ts +0 -3
- package/dist/cjs/tools/displayTools/Contour/updateContourSets.js.map +0 -1
- package/dist/cjs/tools/displayTools/Contour/utils.js.map +0 -1
- package/dist/cjs/tools/displayTools/Labelmap/validateRepresentationData.d.ts +0 -3
- package/dist/cjs/tools/displayTools/Labelmap/validateRepresentationData.js +0 -20
- package/dist/cjs/tools/displayTools/Labelmap/validateRepresentationData.js.map +0 -1
- package/dist/cjs/tools/displayTools/Surface/addSurfaceToElement.d.ts +0 -2
- package/dist/cjs/tools/displayTools/Surface/addSurfaceToElement.js +0 -84
- package/dist/cjs/tools/displayTools/Surface/addSurfaceToElement.js.map +0 -1
- package/dist/cjs/utilities/contours/mergePoints.d.ts +0 -8
- package/dist/cjs/utilities/contours/mergePoints.js +0 -77
- package/dist/cjs/utilities/contours/mergePoints.js.map +0 -1
- package/dist/esm/tools/displayTools/Contour/addContourSetsToElement.js.map +0 -1
- package/dist/esm/tools/displayTools/Contour/addOrUpdateContourSets.js.map +0 -1
- package/dist/esm/tools/displayTools/Contour/contourConfigCache.js.map +0 -1
- package/dist/esm/tools/displayTools/Contour/updateContourSets.js.map +0 -1
- package/dist/esm/tools/displayTools/Contour/utils.js.map +0 -1
- package/dist/esm/tools/displayTools/Labelmap/validateRepresentationData.js +0 -18
- package/dist/esm/tools/displayTools/Labelmap/validateRepresentationData.js.map +0 -1
- package/dist/esm/tools/displayTools/Surface/addSurfaceToElement.js +0 -79
- package/dist/esm/tools/displayTools/Surface/addSurfaceToElement.js.map +0 -1
- package/dist/esm/utilities/contours/mergePoints.js +0 -73
- package/dist/esm/utilities/contours/mergePoints.js.map +0 -1
- package/dist/types/tools/displayTools/Contour/addContourSetsToElement.d.ts.map +0 -1
- package/dist/types/tools/displayTools/Contour/addOrUpdateContourSets.d.ts +0 -4
- package/dist/types/tools/displayTools/Contour/addOrUpdateContourSets.d.ts.map +0 -1
- package/dist/types/tools/displayTools/Contour/contourConfigCache.d.ts.map +0 -1
- package/dist/types/tools/displayTools/Contour/updateContourSets.d.ts +0 -4
- package/dist/types/tools/displayTools/Contour/updateContourSets.d.ts.map +0 -1
- package/dist/types/tools/displayTools/Contour/utils.d.ts.map +0 -1
- package/dist/types/tools/displayTools/Labelmap/validateRepresentationData.d.ts +0 -4
- package/dist/types/tools/displayTools/Labelmap/validateRepresentationData.d.ts.map +0 -1
- package/dist/types/tools/displayTools/Surface/addSurfaceToElement.d.ts +0 -3
- package/dist/types/tools/displayTools/Surface/addSurfaceToElement.d.ts.map +0 -1
- package/dist/types/utilities/contours/mergePoints.d.ts +0 -9
- package/dist/types/utilities/contours/mergePoints.d.ts.map +0 -1
- package/src/tools/displayTools/Labelmap/validateRepresentationData.ts +0 -36
- package/src/tools/displayTools/Surface/addSurfaceToElement.ts +0 -115
- package/src/utilities/contours/mergePoints.ts +0 -108
- /package/dist/cjs/tools/displayTools/Contour/{addContourSetsToElement.js → vtkContour/addContourSetsToElement.js} +0 -0
- /package/dist/cjs/tools/displayTools/Contour/{contourConfigCache.d.ts → vtkContour/contourConfigCache.d.ts} +0 -0
- /package/dist/cjs/tools/displayTools/Contour/{contourConfigCache.js → vtkContour/contourConfigCache.js} +0 -0
- /package/dist/cjs/tools/displayTools/Contour/{utils.js → vtkContour/utils.js} +0 -0
- /package/dist/esm/tools/displayTools/Contour/{addContourSetsToElement.js → vtkContour/addContourSetsToElement.js} +0 -0
- /package/dist/esm/tools/displayTools/Contour/{contourConfigCache.js → vtkContour/contourConfigCache.js} +0 -0
- /package/dist/esm/tools/displayTools/Contour/{utils.js → vtkContour/utils.js} +0 -0
- /package/dist/types/tools/displayTools/Contour/{contourConfigCache.d.ts → vtkContour/contourConfigCache.d.ts} +0 -0
- /package/src/tools/displayTools/Contour/{contourConfigCache.ts → vtkContour/contourConfigCache.ts} +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { state } from '../../stateManagement/segmentation';
|
|
2
|
+
import { ContourSegmentationAnnotation } from '../../types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Removes a contour segmentation annotation from the given annotation.
|
|
6
|
+
* If the annotation does not have a segmentation data, an error is thrown.
|
|
7
|
+
* @param annotation - The contour segmentation annotation to remove.
|
|
8
|
+
* @throws Error if the annotation does not have a segmentation data.
|
|
9
|
+
*/
|
|
10
|
+
export function removeContourSegmentationAnnotation(
|
|
11
|
+
annotation: ContourSegmentationAnnotation
|
|
12
|
+
) {
|
|
13
|
+
if (!annotation.data.segmentation) {
|
|
14
|
+
throw new Error(
|
|
15
|
+
'removeContourSegmentationAnnotation: annotation does not have a segmentation data'
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const { segmentationId, segmentIndex } = annotation.data.segmentation;
|
|
20
|
+
const segmentation = state.getSegmentation(segmentationId);
|
|
21
|
+
const { annotationUIDsMap } = segmentation.representationData.CONTOUR;
|
|
22
|
+
const annotationsUIDsSet = annotationUIDsMap.get(segmentIndex);
|
|
23
|
+
|
|
24
|
+
annotationsUIDsSet.delete(annotation.annotationUID);
|
|
25
|
+
|
|
26
|
+
// Delete segmentIndex Set if there is no more annotations
|
|
27
|
+
if (!annotationsUIDsSet.size) {
|
|
28
|
+
annotationUIDsMap.delete(segmentIndex);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -3,7 +3,7 @@ import vtkImageMarchingSquares from '@kitware/vtk.js/Filters/General/ImageMarchi
|
|
|
3
3
|
import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray';
|
|
4
4
|
import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { getDeduplicatedVTKPolyDataPoints } from '../contours';
|
|
7
7
|
import { findContoursFromReducedSet } from './contourFinder';
|
|
8
8
|
import SegmentationRepresentations from '../../enums/SegmentationRepresentations';
|
|
9
9
|
|
|
@@ -107,7 +107,7 @@ function generateContourSetsFromLabelmap({ segmentations }) {
|
|
|
107
107
|
const msOutput = mSquares.getOutputData();
|
|
108
108
|
|
|
109
109
|
// Clean up output from marching squares
|
|
110
|
-
const reducedSet =
|
|
110
|
+
const reducedSet = getDeduplicatedVTKPolyDataPoints(msOutput);
|
|
111
111
|
if (reducedSet.points?.length) {
|
|
112
112
|
const contours = findContoursFromReducedSet(reducedSet.lines);
|
|
113
113
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Iterate through polyData from vtkjs and merge any points that are the same
|
|
3
|
+
* then update merged point references within lines array
|
|
4
|
+
* @param polyData - vtkPolyData
|
|
5
|
+
* @param bypass - bypass the duplicate point removal
|
|
6
|
+
* @returns the updated polyData
|
|
7
|
+
*/
|
|
8
|
+
export function getDeduplicatedVTKPolyDataPoints(polyData, bypass = false) {
|
|
9
|
+
const points = polyData.getPoints();
|
|
10
|
+
const lines = polyData.getLines();
|
|
11
|
+
|
|
12
|
+
// Todo: This is cloning which is not ideal, we should move to use the PointsArrayManager
|
|
13
|
+
// that will get merged soon
|
|
14
|
+
const pointsArray = new Array(points.getNumberOfPoints())
|
|
15
|
+
.fill(0)
|
|
16
|
+
.map((_, i) => points.getPoint(i).slice());
|
|
17
|
+
|
|
18
|
+
const linesArray = new Array(lines.getNumberOfCells()).fill(0).map((_, i) => {
|
|
19
|
+
const cell = lines.getCell(i * 3).slice();
|
|
20
|
+
return { a: cell[0], b: cell[1] };
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
if (bypass) {
|
|
24
|
+
return { points: pointsArray, lines: linesArray };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const newPoints = [];
|
|
28
|
+
for (const [i, pt] of pointsArray.entries()) {
|
|
29
|
+
// Todo: This is an n^2 algorithm - consider using a Map<string,Point3>.
|
|
30
|
+
// Generates a reasonable amount of garbage, but I think the performance
|
|
31
|
+
// of that is better than doing repeated compares across the entire array.
|
|
32
|
+
const index = newPoints.findIndex(
|
|
33
|
+
(point) => point[0] === pt[0] && point[1] === pt[1] && point[2] === pt[2]
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
if (index >= 0) {
|
|
37
|
+
linesArray.map((line) => {
|
|
38
|
+
if (line.a === i) {
|
|
39
|
+
line.a = index;
|
|
40
|
+
}
|
|
41
|
+
if (line.b === i) {
|
|
42
|
+
line.b = index;
|
|
43
|
+
}
|
|
44
|
+
return line;
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
const newIndex = newPoints.length;
|
|
48
|
+
newPoints.push(pt);
|
|
49
|
+
linesArray.map((line) => {
|
|
50
|
+
if (line.a === i) {
|
|
51
|
+
line.a = newIndex;
|
|
52
|
+
}
|
|
53
|
+
if (line.b === i) {
|
|
54
|
+
line.b = newIndex;
|
|
55
|
+
}
|
|
56
|
+
return line;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const newLines = linesArray.filter((line) => line.a !== line.b);
|
|
62
|
+
|
|
63
|
+
return { points: newPoints, lines: newLines };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default { getDeduplicatedVTKPolyDataPoints };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import areCoplanarContours from './areCoplanarContours';
|
|
2
2
|
import contourFinder from './contourFinder';
|
|
3
|
-
import
|
|
3
|
+
import { getDeduplicatedVTKPolyDataPoints } from './getDeduplicatedVTKPolyDataPoints';
|
|
4
4
|
import detectContourHoles from './detectContourHoles';
|
|
5
5
|
import { generateContourSetsFromLabelmap } from './generateContourSetsFromLabelmap';
|
|
6
6
|
import AnnotationToPointData from './AnnotationToPointData';
|
|
@@ -14,7 +14,7 @@ import findHandlePolylineIndex from './findHandlePolylineIndex';
|
|
|
14
14
|
export {
|
|
15
15
|
areCoplanarContours,
|
|
16
16
|
contourFinder,
|
|
17
|
-
|
|
17
|
+
getDeduplicatedVTKPolyDataPoints,
|
|
18
18
|
detectContourHoles,
|
|
19
19
|
generateContourSetsFromLabelmap,
|
|
20
20
|
AnnotationToPointData,
|
package/src/utilities/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
getCalibratedScale,
|
|
18
18
|
} from './getCalibratedUnits';
|
|
19
19
|
import triggerAnnotationRenderForViewportIds from './triggerAnnotationRenderForViewportIds';
|
|
20
|
+
import triggerAnnotationRenderForToolGroupIds from './triggerAnnotationRenderForToolGroupIds';
|
|
20
21
|
import triggerAnnotationRender from './triggerAnnotationRender';
|
|
21
22
|
import jumpToSlice from './viewport/jumpToSlice';
|
|
22
23
|
|
|
@@ -46,6 +47,7 @@ import * as touch from './touch';
|
|
|
46
47
|
import * as dynamicVolume from './dynamicVolume';
|
|
47
48
|
import * as polyDataUtils from './polyData/utils';
|
|
48
49
|
import * as voi from './voi';
|
|
50
|
+
import * as contourSegmentation from './contourSegmentation';
|
|
49
51
|
|
|
50
52
|
const roundNumber = utilities.roundNumber;
|
|
51
53
|
|
|
@@ -71,6 +73,7 @@ export {
|
|
|
71
73
|
segmentation,
|
|
72
74
|
contours,
|
|
73
75
|
triggerAnnotationRenderForViewportIds,
|
|
76
|
+
triggerAnnotationRenderForToolGroupIds,
|
|
74
77
|
triggerAnnotationRender,
|
|
75
78
|
pointInShapeCallback,
|
|
76
79
|
getSphereBoundsInfo,
|
|
@@ -93,4 +96,5 @@ export {
|
|
|
93
96
|
polyDataUtils,
|
|
94
97
|
voi,
|
|
95
98
|
annotationFrameRange,
|
|
99
|
+
contourSegmentation,
|
|
96
100
|
};
|
|
@@ -8,6 +8,8 @@ import isClosed from './isClosed';
|
|
|
8
8
|
* ray emanating from the given point and to the right and the line segments is odd.
|
|
9
9
|
* https://www.eecs.umich.edu/courses/eecs380/HANDOUTS/PROJ2/InsidePoly.html
|
|
10
10
|
*
|
|
11
|
+
* Note that a point on the polyline is considered inside.
|
|
12
|
+
*
|
|
11
13
|
* @param polyline - Polyline points (2D)
|
|
12
14
|
* @param point - 2D Point
|
|
13
15
|
* @returns True if the point is inside the polyline or false otherwise
|
|
@@ -24,7 +26,7 @@ export default function containsPoint(
|
|
|
24
26
|
const numPolylinePoints = polyline.length;
|
|
25
27
|
let numIntersections = 0;
|
|
26
28
|
|
|
27
|
-
// Test intersection
|
|
29
|
+
// Test intersection against [end, start] line segment if it should be closed
|
|
28
30
|
const shouldClose = !(closed === undefined ? isClosed(polyline) : closed);
|
|
29
31
|
const maxSegmentIndex = polyline.length - (shouldClose ? 1 : 2);
|
|
30
32
|
|
|
@@ -17,6 +17,7 @@ import getSubPixelSpacingAndXYDirections from './getSubPixelSpacingAndXYDirectio
|
|
|
17
17
|
import pointsAreWithinCloseContourProximity from './pointsAreWithinCloseContourProximity';
|
|
18
18
|
import addCanvasPointsToArray from './addCanvasPointsToArray';
|
|
19
19
|
import pointCanProjectOnLine from './pointCanProjectOnLine';
|
|
20
|
+
import { isPointInsidePolyline3D } from './isPointInsidePolyline3D';
|
|
20
21
|
|
|
21
22
|
export {
|
|
22
23
|
isClosed,
|
|
@@ -39,4 +40,5 @@ export {
|
|
|
39
40
|
pointCanProjectOnLine,
|
|
40
41
|
mergePolylines,
|
|
41
42
|
subtractPolylines,
|
|
43
|
+
isPointInsidePolyline3D,
|
|
42
44
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import containsPoint from './containsPoint';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Determines whether a 3D point is inside a polyline in 3D space.
|
|
6
|
+
*
|
|
7
|
+
* The algorithm works by reducing the polyline and point to 2D space, and then
|
|
8
|
+
* using the 2D algorithm to determine whether the point is inside the polyline.
|
|
9
|
+
*
|
|
10
|
+
* @param point - The 3D point to test.
|
|
11
|
+
* @param polyline - The polyline represented as an array of 3D points.
|
|
12
|
+
* @returns A boolean indicating whether the point is inside the polyline.
|
|
13
|
+
* @throws An error if a shared dimension index cannot be found for the polyline points.
|
|
14
|
+
*/
|
|
15
|
+
export function isPointInsidePolyline3D(
|
|
16
|
+
point: Types.Point3,
|
|
17
|
+
polyline: Types.Point3[]
|
|
18
|
+
) {
|
|
19
|
+
// Todo: handle oblique planes
|
|
20
|
+
|
|
21
|
+
// We need to reduce one dimension to 2D, so basically
|
|
22
|
+
// we need to find the dimension index that is shared by all points
|
|
23
|
+
// Use the first three points, two is enough but three is more robust
|
|
24
|
+
let sharedDimensionIndex;
|
|
25
|
+
|
|
26
|
+
const testPoints = polyline.slice(0, 3);
|
|
27
|
+
for (let i = 0; i < 3; i++) {
|
|
28
|
+
if (testPoints.every((point, index, array) => point[i] === array[0][i])) {
|
|
29
|
+
sharedDimensionIndex = i;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (sharedDimensionIndex === undefined) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
'Cannot find a shared dimension index for polyline, probably oblique plane'
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// convert polyline list and point to 2D
|
|
41
|
+
const points2D = [] as Types.Point2[];
|
|
42
|
+
|
|
43
|
+
for (let i = 0; i < polyline.length; i++) {
|
|
44
|
+
points2D.push([
|
|
45
|
+
polyline[i][(sharedDimensionIndex + 1) % 3],
|
|
46
|
+
polyline[i][(sharedDimensionIndex + 2) % 3],
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const point2D = [
|
|
51
|
+
point[(sharedDimensionIndex + 1) % 3],
|
|
52
|
+
point[(sharedDimensionIndex + 2) % 3],
|
|
53
|
+
] as Types.Point2;
|
|
54
|
+
|
|
55
|
+
return containsPoint(points2D, point2D);
|
|
56
|
+
}
|
|
@@ -2,7 +2,6 @@ import { generateContourSetsFromLabelmap } from '../contours';
|
|
|
2
2
|
import SegmentationRepresentations from '../../enums/SegmentationRepresentations';
|
|
3
3
|
import findLargestBidirectional from './findLargestBidirectional';
|
|
4
4
|
|
|
5
|
-
const EPSILON = 1e-2;
|
|
6
5
|
const { Labelmap } = SegmentationRepresentations;
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getAnnotation } from '../../stateManagement';
|
|
2
|
+
import { getSegmentation } from '../../stateManagement/segmentation/segmentationState';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Retrieves the index of the hovered contour segmentation annotation for a given segmentation ID.
|
|
6
|
+
*
|
|
7
|
+
* @param segmentationId - The ID of the segmentation.
|
|
8
|
+
* @returns The index of the hovered contour segmentation annotation, or undefined if none is found.
|
|
9
|
+
*/
|
|
10
|
+
export function getHoveredContourSegmentationAnnotation(segmentationId) {
|
|
11
|
+
const segmentation = getSegmentation(segmentationId);
|
|
12
|
+
const { annotationUIDsMap } = segmentation.representationData.CONTOUR;
|
|
13
|
+
|
|
14
|
+
for (const [segmentIndex, annotationUIDs] of annotationUIDsMap.entries()) {
|
|
15
|
+
const highlightedAnnotationUID = Array.from(annotationUIDs).find(
|
|
16
|
+
(annotationUID) => getAnnotation(annotationUID).highlighted
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
if (highlightedAnnotationUID) {
|
|
20
|
+
return segmentIndex;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { cache, utilities } from '@cornerstonejs/core';
|
|
2
|
+
import type { Types } from '@cornerstonejs/core';
|
|
3
|
+
import {
|
|
4
|
+
getSegmentation,
|
|
5
|
+
getSegmentationIdRepresentations,
|
|
6
|
+
} from '../../stateManagement/segmentation/segmentationState';
|
|
7
|
+
import {
|
|
8
|
+
LabelmapSegmentationDataStack,
|
|
9
|
+
LabelmapSegmentationDataVolume,
|
|
10
|
+
} from '../../types/LabelmapTypes';
|
|
11
|
+
import { isVolumeSegmentation } from '../../tools/segmentation/strategies/utils/stackVolumeCheck';
|
|
12
|
+
|
|
13
|
+
type Options = {
|
|
14
|
+
viewport?: Types.IViewport;
|
|
15
|
+
searchRadius?: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves the segment index at the border of a labelmap in a segmentation.
|
|
20
|
+
*
|
|
21
|
+
* @param segmentationId - The ID of the segmentation.
|
|
22
|
+
* @param worldPoint - The world coordinates of the point.
|
|
23
|
+
* @param options - Additional options.
|
|
24
|
+
* @param options.viewport - The viewport to use.
|
|
25
|
+
* @param options.searchRadius - The search radius to use.
|
|
26
|
+
* @returns The segment index at the labelmap border, or undefined if not found.
|
|
27
|
+
*/
|
|
28
|
+
export function getSegmentAtLabelmapBorder(
|
|
29
|
+
segmentationId: string,
|
|
30
|
+
worldPoint: Types.Point3,
|
|
31
|
+
{ viewport, searchRadius }: Options
|
|
32
|
+
): number {
|
|
33
|
+
const segmentation = getSegmentation(segmentationId);
|
|
34
|
+
|
|
35
|
+
const labelmapData = segmentation.representationData.LABELMAP;
|
|
36
|
+
|
|
37
|
+
if (isVolumeSegmentation(labelmapData)) {
|
|
38
|
+
const { volumeId } = labelmapData as LabelmapSegmentationDataVolume;
|
|
39
|
+
const segmentationVolume = cache.getVolume(volumeId);
|
|
40
|
+
|
|
41
|
+
if (!segmentationVolume) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const imageData = segmentationVolume.imageData;
|
|
46
|
+
|
|
47
|
+
const segmentIndex = imageData.getScalarValueFromWorld(worldPoint);
|
|
48
|
+
|
|
49
|
+
const canvasPoint = viewport.worldToCanvas(worldPoint);
|
|
50
|
+
|
|
51
|
+
const onEdge = isSegmentOnEdgeCanvas(
|
|
52
|
+
canvasPoint as Types.Point2,
|
|
53
|
+
segmentIndex,
|
|
54
|
+
viewport,
|
|
55
|
+
imageData,
|
|
56
|
+
searchRadius
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
return onEdge ? segmentIndex : undefined;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// stack segmentation case
|
|
63
|
+
const { imageIdReferenceMap } = labelmapData as LabelmapSegmentationDataStack;
|
|
64
|
+
|
|
65
|
+
const currentImageId = (viewport as Types.IStackViewport).getCurrentImageId();
|
|
66
|
+
|
|
67
|
+
const segmentationImageId = imageIdReferenceMap.get(currentImageId);
|
|
68
|
+
const image = cache.getImage(segmentationImageId);
|
|
69
|
+
|
|
70
|
+
if (!image) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// find the first segmentationRepresentationUID for the segmentationId, since
|
|
75
|
+
// that is what we use as actorUID in the viewport
|
|
76
|
+
|
|
77
|
+
const segmentationRepresentations = getSegmentationIdRepresentations(
|
|
78
|
+
segmentation.segmentationId
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const { segmentationRepresentationUID } = segmentationRepresentations[0];
|
|
82
|
+
const segmentationActor = viewport.getActor(segmentationRepresentationUID);
|
|
83
|
+
const imageData = segmentationActor?.actor.getMapper().getInputData();
|
|
84
|
+
const indexIJK = utilities.transformWorldToIndex(imageData, worldPoint);
|
|
85
|
+
|
|
86
|
+
const dimensions = imageData.getDimensions();
|
|
87
|
+
const voxelManager = utilities.VoxelManager.createVolumeVoxelManager(
|
|
88
|
+
dimensions,
|
|
89
|
+
imageData.getPointData().getScalars().getData()
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const segmentIndex = voxelManager.getAtIJK(...(indexIJK as Types.Point3));
|
|
93
|
+
|
|
94
|
+
const onEdge = isSegmentOnEdgeIJK(
|
|
95
|
+
indexIJK as Types.Point3,
|
|
96
|
+
dimensions,
|
|
97
|
+
voxelManager,
|
|
98
|
+
segmentIndex
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
return onEdge ? segmentIndex : undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Checks if a segment is on the edge of a labelmap.
|
|
106
|
+
* @param getNeighborIndex - A function that returns the neighbor index given the delta values.
|
|
107
|
+
* @param segmentIndex - The index of the segment to check.
|
|
108
|
+
* @param searchRadius - The radius within which to search for neighboring segments. Default is 1.
|
|
109
|
+
* @returns A boolean indicating whether the segment is on the edge.
|
|
110
|
+
*/
|
|
111
|
+
function isSegmentOnEdge(
|
|
112
|
+
getNeighborIndex: (
|
|
113
|
+
deltaI: number,
|
|
114
|
+
deltaJ: number,
|
|
115
|
+
deltaK: number
|
|
116
|
+
) => number | undefined,
|
|
117
|
+
segmentIndex: number,
|
|
118
|
+
searchRadius = 1 // Default search radius
|
|
119
|
+
): boolean {
|
|
120
|
+
const neighborRange = Array.from(
|
|
121
|
+
{ length: 2 * searchRadius + 1 },
|
|
122
|
+
(_, i) => i - searchRadius
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
for (const deltaI of neighborRange) {
|
|
126
|
+
for (const deltaJ of neighborRange) {
|
|
127
|
+
for (const deltaK of neighborRange) {
|
|
128
|
+
if (deltaI === 0 && deltaJ === 0 && deltaK === 0) {
|
|
129
|
+
continue; // Skipping the central point
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const neighborIndex = getNeighborIndex(deltaI, deltaJ, deltaK);
|
|
133
|
+
|
|
134
|
+
if (neighborIndex !== undefined && segmentIndex !== neighborIndex) {
|
|
135
|
+
return true; // On the edge
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return false; // No edge neighbors found
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function isSegmentOnEdgeIJK(
|
|
145
|
+
indexIJK: Types.Point3,
|
|
146
|
+
dimensions: Types.Point3,
|
|
147
|
+
voxelManager: any,
|
|
148
|
+
segmentIndex: number,
|
|
149
|
+
searchRadius?: number
|
|
150
|
+
): boolean {
|
|
151
|
+
const getNeighborIndex = (deltaI: number, deltaJ: number, deltaK: number) => {
|
|
152
|
+
const neighborIJK = [
|
|
153
|
+
indexIJK[0] + deltaI,
|
|
154
|
+
indexIJK[1] + deltaJ,
|
|
155
|
+
indexIJK[2] + deltaK,
|
|
156
|
+
];
|
|
157
|
+
|
|
158
|
+
return voxelManager.getAtIJK(...neighborIJK);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
return isSegmentOnEdge(getNeighborIndex, segmentIndex, searchRadius);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function isSegmentOnEdgeCanvas(
|
|
165
|
+
canvasPoint: Types.Point2,
|
|
166
|
+
segmentIndex: number,
|
|
167
|
+
viewport: Types.IViewport,
|
|
168
|
+
imageData: any,
|
|
169
|
+
searchRadius?: number
|
|
170
|
+
): boolean {
|
|
171
|
+
const getNeighborIndex = (deltaI: number, deltaJ: number) => {
|
|
172
|
+
const neighborCanvas = [canvasPoint[0] + deltaI, canvasPoint[1] + deltaJ];
|
|
173
|
+
|
|
174
|
+
const worldPoint = viewport.canvasToWorld(neighborCanvas as Types.Point2);
|
|
175
|
+
return imageData.getScalarValueFromWorld(worldPoint);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
return isSegmentOnEdge(getNeighborIndex, segmentIndex, searchRadius);
|
|
179
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { cache, utilities } from '@cornerstonejs/core';
|
|
2
|
+
import type { Types } from '@cornerstonejs/core';
|
|
3
|
+
import { SegmentationRepresentations } from '../../enums';
|
|
4
|
+
import {
|
|
5
|
+
getSegmentation,
|
|
6
|
+
getSegmentationIdRepresentations,
|
|
7
|
+
} from '../../stateManagement/segmentation/segmentationState';
|
|
8
|
+
import {
|
|
9
|
+
LabelmapSegmentationDataStack,
|
|
10
|
+
LabelmapSegmentationDataVolume,
|
|
11
|
+
} from '../../types/LabelmapTypes';
|
|
12
|
+
import { isVolumeSegmentation } from '../../tools/segmentation/strategies/utils/stackVolumeCheck';
|
|
13
|
+
import { ContourSegmentationAnnotation, Segmentation } from '../../types';
|
|
14
|
+
import { getAnnotation } from '../../stateManagement';
|
|
15
|
+
import { isPointInsidePolyline3D } from '../math/polyline';
|
|
16
|
+
|
|
17
|
+
type Options = {
|
|
18
|
+
representationType?: SegmentationRepresentations;
|
|
19
|
+
viewport?: Types.IViewport;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Get the segment at the specified world point in the viewport.
|
|
24
|
+
* @param segmentationId - The ID of the segmentation to get the segment for.
|
|
25
|
+
* @param worldPoint - The world point to get the segment for.
|
|
26
|
+
*
|
|
27
|
+
* @returns The index of the segment at the world point, or undefined if not found.
|
|
28
|
+
*/
|
|
29
|
+
export function getSegmentAtWorldPoint(
|
|
30
|
+
segmentationId: string,
|
|
31
|
+
worldPoint: Types.Point3,
|
|
32
|
+
options = {} as Options
|
|
33
|
+
): number {
|
|
34
|
+
const segmentation = getSegmentation(segmentationId);
|
|
35
|
+
|
|
36
|
+
const representationData = segmentation.representationData;
|
|
37
|
+
|
|
38
|
+
// if representationType is not provided, we will use the first representation
|
|
39
|
+
const desiredRepresentation =
|
|
40
|
+
options?.representationType ?? Object.keys(representationData)[0];
|
|
41
|
+
|
|
42
|
+
if (!desiredRepresentation) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
`Segmentation ${segmentationId} does not have any representations`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
switch (desiredRepresentation) {
|
|
49
|
+
case SegmentationRepresentations.Labelmap:
|
|
50
|
+
return getSegmentAtWorldForLabelmap(segmentation, worldPoint, options);
|
|
51
|
+
case SegmentationRepresentations.Contour:
|
|
52
|
+
return getSegmentAtWorldForContour(segmentation, worldPoint, options);
|
|
53
|
+
default:
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Retrieves the segment index at a given world point for a labelmap.
|
|
60
|
+
*
|
|
61
|
+
* @param labelmapData - The labelmap segmentation data.
|
|
62
|
+
* @param worldPoint - The world point to retrieve the segment at.
|
|
63
|
+
*
|
|
64
|
+
* @returns The segment index at the given world point, or undefined if not found.
|
|
65
|
+
*/
|
|
66
|
+
export function getSegmentAtWorldForLabelmap(
|
|
67
|
+
segmentation: Segmentation,
|
|
68
|
+
worldPoint: Types.Point3,
|
|
69
|
+
{ viewport }: Options
|
|
70
|
+
): number | undefined {
|
|
71
|
+
const labelmapData = segmentation.representationData.LABELMAP;
|
|
72
|
+
|
|
73
|
+
if (isVolumeSegmentation(labelmapData)) {
|
|
74
|
+
const { volumeId } = labelmapData as LabelmapSegmentationDataVolume;
|
|
75
|
+
const segmentationVolume = cache.getVolume(volumeId);
|
|
76
|
+
|
|
77
|
+
if (!segmentationVolume) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const segmentIndex =
|
|
82
|
+
segmentationVolume.imageData.getScalarValueFromWorld(worldPoint);
|
|
83
|
+
|
|
84
|
+
return segmentIndex;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// stack segmentation case
|
|
88
|
+
const { imageIdReferenceMap } = labelmapData as LabelmapSegmentationDataStack;
|
|
89
|
+
|
|
90
|
+
const currentImageId = (viewport as Types.IStackViewport).getCurrentImageId();
|
|
91
|
+
|
|
92
|
+
const segmentationImageId = imageIdReferenceMap.get(currentImageId);
|
|
93
|
+
const image = cache.getImage(segmentationImageId);
|
|
94
|
+
|
|
95
|
+
if (!image) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// find the first segmentationRepresentationUID for the segmentationId, since
|
|
100
|
+
// that is what we use as actorUID in the viewport
|
|
101
|
+
|
|
102
|
+
const segmentationRepresentations = getSegmentationIdRepresentations(
|
|
103
|
+
segmentation.segmentationId
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const { segmentationRepresentationUID } = segmentationRepresentations[0];
|
|
107
|
+
|
|
108
|
+
const segmentationActor = viewport.getActor(segmentationRepresentationUID);
|
|
109
|
+
const imageData = segmentationActor?.actor.getMapper().getInputData();
|
|
110
|
+
const indexIJK = utilities.transformWorldToIndex(imageData, worldPoint);
|
|
111
|
+
|
|
112
|
+
const dimensions = imageData.getDimensions();
|
|
113
|
+
const voxelManager = utilities.VoxelManager.createVolumeVoxelManager(
|
|
114
|
+
dimensions,
|
|
115
|
+
imageData.getPointData().getScalars().getData()
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
const segmentIndex = voxelManager.getAtIJK(...(indexIJK as Types.Point3));
|
|
119
|
+
|
|
120
|
+
return segmentIndex;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Retrieves the segment index at a given world point for contour segmentation.
|
|
125
|
+
*
|
|
126
|
+
* @param segmentation - The segmentation data.
|
|
127
|
+
* @param worldPoint - The world point to check.
|
|
128
|
+
* @param options - The options for segmentation.
|
|
129
|
+
* @returns The segment index at the given world point, or undefined if not found.
|
|
130
|
+
*/
|
|
131
|
+
export function getSegmentAtWorldForContour(
|
|
132
|
+
segmentation: Segmentation,
|
|
133
|
+
worldPoint: Types.Point3,
|
|
134
|
+
{ viewport }: Options
|
|
135
|
+
): number {
|
|
136
|
+
const contourData = segmentation.representationData.CONTOUR;
|
|
137
|
+
|
|
138
|
+
const segmentIndices = Array.from(contourData.annotationUIDsMap.keys());
|
|
139
|
+
const { viewPlaneNormal } = viewport.getCamera();
|
|
140
|
+
|
|
141
|
+
for (const segmentIndex of segmentIndices) {
|
|
142
|
+
const annotationsSet = contourData.annotationUIDsMap.get(segmentIndex);
|
|
143
|
+
|
|
144
|
+
if (!annotationsSet) {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
for (const annotationUID of annotationsSet) {
|
|
149
|
+
const annotation = getAnnotation(
|
|
150
|
+
annotationUID
|
|
151
|
+
) as ContourSegmentationAnnotation;
|
|
152
|
+
|
|
153
|
+
if (!annotation) {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const { polyline } = annotation.data.contour;
|
|
158
|
+
|
|
159
|
+
if (
|
|
160
|
+
!utilities.isEqual(viewPlaneNormal, annotation.metadata.viewPlaneNormal)
|
|
161
|
+
) {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// This function checks whether we are inside the contour. It does not
|
|
166
|
+
// check if we are exactly on the contour, which is highly unlikely given
|
|
167
|
+
// the canvas pixel resolution of 1 decimal place we have by design.
|
|
168
|
+
if (isPointInsidePolyline3D(worldPoint, polyline)) {
|
|
169
|
+
return Number(segmentIndex);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|