@cornerstonejs/tools 1.53.0 → 1.54.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/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,7 @@
|
|
|
1
|
+
import { ContourSegmentationData, PolySegConversionOptions } from '../../../../types';
|
|
2
|
+
export declare function convertContourToVolumeLabelmap(contourRepresentationData: ContourSegmentationData, options?: PolySegConversionOptions): Promise<{
|
|
3
|
+
volumeId: string;
|
|
4
|
+
}>;
|
|
5
|
+
export declare function convertContourToStackLabelmap(contourRepresentationData: ContourSegmentationData, options?: PolySegConversionOptions): Promise<{
|
|
6
|
+
imageIdReferenceMap: Map<any, any>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.convertContourToStackLabelmap = exports.convertContourToVolumeLabelmap = void 0;
|
|
13
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
14
|
+
const core_1 = require("@cornerstonejs/core");
|
|
15
|
+
const __1 = require("../../..");
|
|
16
|
+
const enums_1 = require("../../../../enums");
|
|
17
|
+
const workerManager = (0, core_1.getWebWorkerManager)();
|
|
18
|
+
const triggerWorkerProgress = (eventTarget, progress) => {
|
|
19
|
+
(0, core_1.triggerEvent)(eventTarget, core_1.Enums.Events.WEB_WORKER_PROGRESS, {
|
|
20
|
+
progress,
|
|
21
|
+
type: enums_1.WorkerTypes.POLYSEG_CONTOUR_TO_LABELMAP,
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
function convertContourToVolumeLabelmap(contourRepresentationData, options = {}) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const { viewport } = options;
|
|
27
|
+
const imageIds = core_1.utilities.getViewportImageIds(viewport);
|
|
28
|
+
if (!imageIds) {
|
|
29
|
+
throw new Error('No imageIds found, labelmap computation from contour requires viewports with imageIds');
|
|
30
|
+
}
|
|
31
|
+
const segmentationVolumeId = core_1.utilities.uuidv4();
|
|
32
|
+
const volumeProps = core_1.utilities.generateVolumePropsFromImageIds(imageIds, segmentationVolumeId);
|
|
33
|
+
const { metadata, dimensions, origin, direction, spacing, scalarData } = volumeProps;
|
|
34
|
+
const segmentationVolume = yield core_1.volumeLoader.createLocalSegmentationVolume({
|
|
35
|
+
dimensions,
|
|
36
|
+
origin,
|
|
37
|
+
direction,
|
|
38
|
+
spacing,
|
|
39
|
+
metadata,
|
|
40
|
+
imageIds: imageIds.map((imageId) => `generated://${imageId}`),
|
|
41
|
+
referencedImageIds: imageIds,
|
|
42
|
+
}, segmentationVolumeId);
|
|
43
|
+
const { segmentIndices, annotationUIDsInSegmentMap } = _getAnnotationMapFromSegmentation(contourRepresentationData, options);
|
|
44
|
+
triggerWorkerProgress(core_1.eventTarget, 0);
|
|
45
|
+
const newScalarData = yield workerManager.executeTask('polySeg', 'convertContourToVolumeLabelmap', {
|
|
46
|
+
segmentIndices,
|
|
47
|
+
dimensions,
|
|
48
|
+
scalarData,
|
|
49
|
+
origin,
|
|
50
|
+
direction,
|
|
51
|
+
spacing,
|
|
52
|
+
annotationUIDsInSegmentMap,
|
|
53
|
+
}, {
|
|
54
|
+
callbacks: [
|
|
55
|
+
(progress) => {
|
|
56
|
+
triggerWorkerProgress(core_1.eventTarget, progress);
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
});
|
|
60
|
+
triggerWorkerProgress(core_1.eventTarget, 100);
|
|
61
|
+
segmentationVolume.imageData
|
|
62
|
+
.getPointData()
|
|
63
|
+
.getScalars()
|
|
64
|
+
.setData(newScalarData);
|
|
65
|
+
segmentationVolume.imageData.modified();
|
|
66
|
+
segmentationVolume.modified();
|
|
67
|
+
return {
|
|
68
|
+
volumeId: segmentationVolume.volumeId,
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
exports.convertContourToVolumeLabelmap = convertContourToVolumeLabelmap;
|
|
73
|
+
function convertContourToStackLabelmap(contourRepresentationData, options = {}) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
if (!options.viewport) {
|
|
76
|
+
throw new Error('No viewport provided, labelmap computation from contour requires viewports');
|
|
77
|
+
}
|
|
78
|
+
const viewport = options.viewport;
|
|
79
|
+
const imageIds = viewport.getImageIds();
|
|
80
|
+
if (!imageIds) {
|
|
81
|
+
throw new Error('No imageIds found, labelmap computation from contour requires viewports with imageIds');
|
|
82
|
+
}
|
|
83
|
+
imageIds.forEach((imageId) => {
|
|
84
|
+
if (!core_1.cache.getImageLoadObject(imageId)) {
|
|
85
|
+
throw new Error('ImageIds must be cached before converting contour to labelmap');
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
const { imageIds: segmentationImageIds } = yield core_1.imageLoader.createAndCacheDerivedSegmentationImages(imageIds);
|
|
89
|
+
const { segmentIndices, annotationUIDsInSegmentMap } = _getAnnotationMapFromSegmentation(contourRepresentationData, options);
|
|
90
|
+
const segmentationsInfo = new Map();
|
|
91
|
+
segmentationImageIds.forEach((segImageId, index) => {
|
|
92
|
+
const segImage = core_1.cache.getImage(segImageId);
|
|
93
|
+
const imagePlaneModule = core_1.metaData.get(core_1.Enums.MetadataModules.IMAGE_PLANE, segImageId);
|
|
94
|
+
let { columnCosines, rowCosines, rowPixelSpacing, columnPixelSpacing, imagePositionPatient, } = imagePlaneModule;
|
|
95
|
+
columnCosines = columnCosines !== null && columnCosines !== void 0 ? columnCosines : [0, 1, 0];
|
|
96
|
+
rowCosines = rowCosines !== null && rowCosines !== void 0 ? rowCosines : [1, 0, 0];
|
|
97
|
+
rowPixelSpacing = rowPixelSpacing !== null && rowPixelSpacing !== void 0 ? rowPixelSpacing : 1;
|
|
98
|
+
columnPixelSpacing = columnPixelSpacing !== null && columnPixelSpacing !== void 0 ? columnPixelSpacing : 1;
|
|
99
|
+
imagePositionPatient = imagePositionPatient !== null && imagePositionPatient !== void 0 ? imagePositionPatient : [0, 0, 0];
|
|
100
|
+
const rowCosineVec = gl_matrix_1.vec3.fromValues(rowCosines[0], rowCosines[1], rowCosines[2]);
|
|
101
|
+
const colCosineVec = gl_matrix_1.vec3.fromValues(columnCosines[0], columnCosines[1], columnCosines[2]);
|
|
102
|
+
const scanAxisNormal = gl_matrix_1.vec3.create();
|
|
103
|
+
gl_matrix_1.vec3.cross(scanAxisNormal, rowCosineVec, colCosineVec);
|
|
104
|
+
const direction = [...rowCosineVec, ...colCosineVec, ...scanAxisNormal];
|
|
105
|
+
const spacing = [rowPixelSpacing, columnPixelSpacing, 1];
|
|
106
|
+
const origin = imagePositionPatient;
|
|
107
|
+
segmentationsInfo.set(imageIds[index], {
|
|
108
|
+
direction,
|
|
109
|
+
spacing,
|
|
110
|
+
origin,
|
|
111
|
+
scalarData: segImage.getPixelData(),
|
|
112
|
+
imageId: segImageId,
|
|
113
|
+
dimensions: [segImage.width, segImage.height, 1],
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
triggerWorkerProgress(core_1.eventTarget, 0);
|
|
117
|
+
const newSegmentationsScalarData = yield workerManager.executeTask('polySeg', 'convertContourToStackLabelmap', {
|
|
118
|
+
segmentationsInfo,
|
|
119
|
+
annotationUIDsInSegmentMap,
|
|
120
|
+
segmentIndices,
|
|
121
|
+
}, {
|
|
122
|
+
callbacks: [
|
|
123
|
+
(progress) => {
|
|
124
|
+
triggerWorkerProgress(core_1.eventTarget, progress);
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
});
|
|
128
|
+
triggerWorkerProgress(core_1.eventTarget, 100);
|
|
129
|
+
const imageIdReferenceMap = new Map();
|
|
130
|
+
newSegmentationsScalarData.forEach(({ scalarData }, referencedImageId) => {
|
|
131
|
+
var _a, _b;
|
|
132
|
+
const segmentationInfo = segmentationsInfo.get(referencedImageId);
|
|
133
|
+
const { imageId: segImageId } = segmentationInfo;
|
|
134
|
+
const segImage = core_1.cache.getImage(segImageId);
|
|
135
|
+
segImage.getPixelData().set(scalarData);
|
|
136
|
+
(_b = (_a = segImage.imageFrame) === null || _a === void 0 ? void 0 : _a.pixelData) === null || _b === void 0 ? void 0 : _b.set(scalarData);
|
|
137
|
+
imageIdReferenceMap.set(referencedImageId, segImageId);
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
imageIdReferenceMap,
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
exports.convertContourToStackLabelmap = convertContourToStackLabelmap;
|
|
145
|
+
function _getAnnotationMapFromSegmentation(contourRepresentationData, options = {}) {
|
|
146
|
+
var _a;
|
|
147
|
+
const annotationMap = contourRepresentationData.annotationUIDsMap;
|
|
148
|
+
const segmentIndices = ((_a = options.segmentIndices) === null || _a === void 0 ? void 0 : _a.length)
|
|
149
|
+
? options.segmentIndices
|
|
150
|
+
: Array.from(annotationMap.keys());
|
|
151
|
+
const annotationUIDsInSegmentMap = new Map();
|
|
152
|
+
segmentIndices.forEach((index) => {
|
|
153
|
+
const annotationUIDsInSegment = annotationMap.get(index);
|
|
154
|
+
const annotations = Array.from(annotationUIDsInSegment).map((uid) => {
|
|
155
|
+
const annotation = (0, __1.getAnnotation)(uid);
|
|
156
|
+
return annotation;
|
|
157
|
+
});
|
|
158
|
+
annotationUIDsInSegmentMap.set(index, annotations);
|
|
159
|
+
});
|
|
160
|
+
return { segmentIndices, annotationUIDsInSegmentMap };
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=convertContourToLabelmap.js.map
|
package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertContourToLabelmap.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiC;AACjC,8CAW6B;AAM7B,gCAAyC;AACzC,6CAAgD;AAEhD,MAAM,aAAa,GAAG,IAAA,0BAAmB,GAAE,CAAC;AAE5C,MAAM,qBAAqB,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE;IACtD,IAAA,mBAAY,EAAC,WAAW,EAAE,YAAK,CAAC,MAAM,CAAC,mBAAmB,EAAE;QAC1D,QAAQ;QACR,IAAI,EAAE,mBAAW,CAAC,2BAA2B;KAC9C,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,SAAsB,8BAA8B,CAClD,yBAAkD,EAClD,UA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UAAU,CAAC,CAAC;YAEhD,mBAAmB,CAAC,GAAG,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,mBAAmB;SACpB,CAAC;IACJ,CAAC;CAAA;AAzID,sEAyIC;AAED,SAAS,iCAAiC,CACxC,yBAAkD,EAClD,UAAoC,EAAE;;IAEtC,MAAM,aAAa,GAAG,yBAAyB,CAAC,iBAAiB,CAAC;IAElE,MAAM,cAAc,GAAG,CAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM;QACnD,CAAC,CAAC,OAAO,CAAC,cAAc;QACxB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;IAErC,MAAM,0BAA0B,GAAG,IAAI,GAAG,EAAwB,CAAC;IACnE,cAAc,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAC/B,MAAM,uBAAuB,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEzD,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAClE,MAAM,UAAU,GAAG,IAAA,iBAAa,EAAC,GAAG,CAAC,CAAC;YAEtC,OAAO,UAAU,CAAC;QACpB,CAAC,CAAC,CAAC;QAEH,0BAA0B,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Types } from '@cornerstonejs/core';
|
|
2
|
+
import { SurfaceSegmentationData } from '../../../../types/SurfaceTypes';
|
|
3
|
+
export declare function convertSurfaceToVolumeLabelmap(surfaceRepresentationData: SurfaceSegmentationData, segmentationVolume: Types.IImageVolume): Promise<{
|
|
4
|
+
volumeId: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function convertSurfaceToStackLabelmap(): Promise<void>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.convertSurfaceToStackLabelmap = exports.convertSurfaceToVolumeLabelmap = void 0;
|
|
13
|
+
const core_1 = require("@cornerstonejs/core");
|
|
14
|
+
const enums_1 = require("../../../../enums");
|
|
15
|
+
const workerManager = (0, core_1.getWebWorkerManager)();
|
|
16
|
+
const triggerWorkerProgress = (eventTarget, progress) => {
|
|
17
|
+
(0, core_1.triggerEvent)(eventTarget, core_1.Enums.Events.WEB_WORKER_PROGRESS, {
|
|
18
|
+
progress,
|
|
19
|
+
type: enums_1.WorkerTypes.POLYSEG_SURFACE_TO_LABELMAP,
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
function convertSurfaceToVolumeLabelmap(surfaceRepresentationData, segmentationVolume) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const { geometryIds } = surfaceRepresentationData;
|
|
25
|
+
if (!(geometryIds === null || geometryIds === void 0 ? void 0 : geometryIds.size)) {
|
|
26
|
+
throw new Error('No geometry IDs found for surface representation');
|
|
27
|
+
}
|
|
28
|
+
const segmentsInfo = new Map();
|
|
29
|
+
geometryIds.forEach((geometryId, segmentIndex) => {
|
|
30
|
+
const geometry = core_1.cache.getGeometry(geometryId);
|
|
31
|
+
const geometryData = geometry.data;
|
|
32
|
+
const points = geometryData.getPoints();
|
|
33
|
+
const polys = geometryData.getPolys();
|
|
34
|
+
segmentsInfo.set(segmentIndex, {
|
|
35
|
+
points,
|
|
36
|
+
polys,
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
const { dimensions, direction, origin, spacing } = segmentationVolume;
|
|
40
|
+
triggerWorkerProgress(core_1.eventTarget, 0);
|
|
41
|
+
const newScalarData = yield workerManager.executeTask('polySeg', 'convertSurfacesToVolumeLabelmap', {
|
|
42
|
+
segmentsInfo,
|
|
43
|
+
dimensions,
|
|
44
|
+
spacing,
|
|
45
|
+
direction,
|
|
46
|
+
origin,
|
|
47
|
+
}, {
|
|
48
|
+
callbacks: [
|
|
49
|
+
(progress) => {
|
|
50
|
+
triggerWorkerProgress(core_1.eventTarget, progress);
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
});
|
|
54
|
+
triggerWorkerProgress(core_1.eventTarget, 100);
|
|
55
|
+
segmentationVolume.imageData
|
|
56
|
+
.getPointData()
|
|
57
|
+
.getScalars()
|
|
58
|
+
.setData(newScalarData);
|
|
59
|
+
segmentationVolume.imageData.modified();
|
|
60
|
+
segmentationVolume.modified();
|
|
61
|
+
return {
|
|
62
|
+
volumeId: segmentationVolume.volumeId,
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
exports.convertSurfaceToVolumeLabelmap = convertSurfaceToVolumeLabelmap;
|
|
67
|
+
function convertSurfaceToStackLabelmap() {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
69
|
+
}
|
|
70
|
+
exports.convertSurfaceToStackLabelmap = convertSurfaceToStackLabelmap;
|
|
71
|
+
//# sourceMappingURL=convertSurfaceToLabelmap.js.map
|
package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertSurfaceToLabelmap.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAO6B;AAE7B,6CAAgD;AAEhD,MAAM,aAAa,GAAG,IAAA,0BAAmB,GAAE,CAAC;AAE5C,MAAM,qBAAqB,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE;IACtD,IAAA,mBAAY,EAAC,WAAW,EAAE,YAAK,CAAC,MAAM,CAAC,mBAAmB,EAAE;QAC1D,QAAQ;QACR,IAAI,EAAE,mBAAW,CAAC,2BAA2B;KAC9C,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,SAAsB,8BAA8B,CAClD,yBAAkD,EAClD,kBAAsC;;QAEtC,MAAM,EAAE,WAAW,EAAE,GAAG,yBAAyB,CAAC;QAClD,IAAI,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,CAAA,EAAE;YACtB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;SACrE;QAED,MAAM,YAAY,GAAG,IAAI,GAAG,EAM3B,CAAC;QAEF,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,YAAY,EAAE,EAAE;YAC/C,MAAM,QAAQ,GAAG,YAAK,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YAC/C,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAsB,CAAC;YACrD,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC;YACxC,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;YAEtC,YAAY,CAAC,GAAG,CAAC,YAAY,EAAE;gBAC7B,MAAM;gBACN,KAAK;aACN,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,kBAAkB,CAAC;QAEtE,qBAAqB,CAAC,kBAAW,EAAE,CAAC,CAAC,CAAC;QAEtC,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC,WAAW,CACnD,SAAS,EACT,iCAAiC,EACjC;YACE,YAAY;YACZ,UAAU;YACV,OAAO;YACP,SAAS;YACT,MAAM;SACP,EACD;YACE,SAAS,EAAE;gBACT,CAAC,QAAQ,EAAE,EAAE;oBACX,qBAAqB,CAAC,kBAAW,EAAE,QAAQ,CAAC,CAAC;gBAC/C,CAAC;aACF;SACF,CACF,CAAC;QAEF,qBAAqB,CAAC,kBAAW,EAAE,GAAG,CAAC,CAAC;QAExC,kBAAkB,CAAC,SAAS;aACzB,YAAY,EAAE;aACd,UAAU,EAAE;aACZ,OAAO,CAAC,aAAa,CAAC,CAAC;QAC1B,kBAAkB,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;QAGxC,kBAAkB,CAAC,QAAQ,EAAE,CAAC;QAE9B,OAAO;YACL,QAAQ,EAAE,kBAAkB,CAAC,QAAQ;SACtC,CAAC;IACJ,CAAC;CAAA;AAlED,wEAkEC;AAED,SAAsB,6BAA6B;0DAAI,CAAC;CAAA;AAAxD,sEAAwD"}
|
package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LabelmapSegmentationDataStack, LabelmapSegmentationDataVolume } from '../../../../types/LabelmapTypes';
|
|
2
|
+
import { PolySegConversionOptions } from '../../../../types';
|
|
3
|
+
export declare type RawLabelmapData = LabelmapSegmentationDataVolume | LabelmapSegmentationDataStack;
|
|
4
|
+
export declare function computeLabelmapData(segmentationId: string, options?: PolySegConversionOptions): Promise<RawLabelmapData>;
|
|
5
|
+
declare function computeLabelmapFromContourSegmentation(segmentationId: any, options?: PolySegConversionOptions): Promise<LabelmapSegmentationDataVolume | LabelmapSegmentationDataStack>;
|
|
6
|
+
export { computeLabelmapFromContourSegmentation };
|
package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.computeLabelmapFromContourSegmentation = exports.computeLabelmapData = void 0;
|
|
13
|
+
const core_1 = require("@cornerstonejs/core");
|
|
14
|
+
const segmentation_1 = require("../../../../utilities/segmentation");
|
|
15
|
+
const segmentationState_1 = require("../../segmentationState");
|
|
16
|
+
const convertContourToLabelmap_1 = require("./convertContourToLabelmap");
|
|
17
|
+
const convertSurfaceToLabelmap_1 = require("./convertSurfaceToLabelmap");
|
|
18
|
+
const convertVolumeToStackSegmentation_1 = require("../../convertVolumeToStackSegmentation");
|
|
19
|
+
function computeLabelmapData(segmentationId, options = {}) {
|
|
20
|
+
var _a;
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const segmentIndices = ((_a = options.segmentIndices) === null || _a === void 0 ? void 0 : _a.length)
|
|
23
|
+
? options.segmentIndices
|
|
24
|
+
: (0, segmentation_1.getUniqueSegmentIndices)(segmentationId);
|
|
25
|
+
let rawLabelmapData;
|
|
26
|
+
const segmentation = (0, segmentationState_1.getSegmentation)(segmentationId);
|
|
27
|
+
const representationData = segmentation.representationData;
|
|
28
|
+
try {
|
|
29
|
+
if (representationData.CONTOUR) {
|
|
30
|
+
rawLabelmapData = yield computeLabelmapFromContourSegmentation(segmentationId, Object.assign({ segmentIndices }, options));
|
|
31
|
+
}
|
|
32
|
+
else if (representationData.SURFACE) {
|
|
33
|
+
rawLabelmapData = yield computeLabelmapFromSurfaceSegmentation(segmentation.segmentationId, Object.assign({ segmentIndices }, options));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.error(error);
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
if (!rawLabelmapData) {
|
|
41
|
+
throw new Error('Not enough data to convert to surface, currently only support converting volume labelmap to surface if available');
|
|
42
|
+
}
|
|
43
|
+
return rawLabelmapData;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
exports.computeLabelmapData = computeLabelmapData;
|
|
47
|
+
function computeLabelmapFromContourSegmentation(segmentationId, options = {}) {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const isVolume = (_a = options.viewport instanceof core_1.VolumeViewport) !== null && _a !== void 0 ? _a : true;
|
|
51
|
+
if (isVolume && !options.viewport) {
|
|
52
|
+
throw new Error('Cannot compute labelmap from contour segmentation without providing the viewport');
|
|
53
|
+
}
|
|
54
|
+
const segmentIndices = ((_b = options.segmentIndices) === null || _b === void 0 ? void 0 : _b.length)
|
|
55
|
+
? options.segmentIndices
|
|
56
|
+
: (0, segmentation_1.getUniqueSegmentIndices)(segmentationId);
|
|
57
|
+
const segmentation = (0, segmentationState_1.getSegmentation)(segmentationId);
|
|
58
|
+
const representationData = segmentation.representationData.CONTOUR;
|
|
59
|
+
let result;
|
|
60
|
+
if (isVolume) {
|
|
61
|
+
result = yield (0, convertContourToLabelmap_1.convertContourToVolumeLabelmap)(representationData, {
|
|
62
|
+
segmentIndices,
|
|
63
|
+
segmentationRepresentationUID: options.segmentationRepresentationUID,
|
|
64
|
+
viewport: options.viewport,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
result = yield (0, convertContourToLabelmap_1.convertContourToStackLabelmap)(representationData, {
|
|
69
|
+
segmentIndices,
|
|
70
|
+
segmentationRepresentationUID: options.segmentationRepresentationUID,
|
|
71
|
+
viewport: options.viewport,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
exports.computeLabelmapFromContourSegmentation = computeLabelmapFromContourSegmentation;
|
|
78
|
+
function computeLabelmapFromSurfaceSegmentation(segmentationId, options = {}) {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
const isVolume = (_a = options.viewport instanceof core_1.VolumeViewport) !== null && _a !== void 0 ? _a : true;
|
|
82
|
+
const segmentIndices = ((_b = options.segmentIndices) === null || _b === void 0 ? void 0 : _b.length)
|
|
83
|
+
? options.segmentIndices
|
|
84
|
+
: (0, segmentation_1.getUniqueSegmentIndices)(segmentationId);
|
|
85
|
+
const segmentation = (0, segmentationState_1.getSegmentation)(segmentationId);
|
|
86
|
+
const segmentsGeometryIds = new Map();
|
|
87
|
+
const representationData = segmentation.representationData.SURFACE;
|
|
88
|
+
representationData.geometryIds.forEach((geometryId, segmentIndex) => {
|
|
89
|
+
if (segmentIndices.includes(segmentIndex)) {
|
|
90
|
+
segmentsGeometryIds.set(segmentIndex, geometryId);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
if (isVolume && !options.viewport) {
|
|
94
|
+
throw new Error('Cannot compute labelmap from surface segmentation without providing the viewport');
|
|
95
|
+
}
|
|
96
|
+
let segmentationVolume;
|
|
97
|
+
if (isVolume) {
|
|
98
|
+
const defaultActor = options.viewport.getDefaultActor();
|
|
99
|
+
const { uid: volumeId } = defaultActor;
|
|
100
|
+
segmentationVolume =
|
|
101
|
+
yield core_1.volumeLoader.createAndCacheDerivedSegmentationVolume(volumeId);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
const imageIds = options.viewport.getImageIds();
|
|
105
|
+
const volumeId = 'generatedSegmentationVolumeId';
|
|
106
|
+
const volumeProps = core_1.utilities.generateVolumePropsFromImageIds(imageIds, volumeId);
|
|
107
|
+
delete volumeProps.imageIds;
|
|
108
|
+
segmentationVolume = yield core_1.volumeLoader.createLocalSegmentationVolume(Object.assign(Object.assign({}, volumeProps), { scalarData: volumeProps.scalarData, referencedImageIds: imageIds }), volumeId);
|
|
109
|
+
}
|
|
110
|
+
const result = yield (0, convertSurfaceToLabelmap_1.convertSurfaceToVolumeLabelmap)({ geometryIds: segmentsGeometryIds }, segmentationVolume);
|
|
111
|
+
if (isVolume) {
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
const stackData = (yield (0, convertVolumeToStackSegmentation_1.computeStackSegmentationFromVolume)({
|
|
115
|
+
volumeId: segmentationVolume.volumeId,
|
|
116
|
+
}));
|
|
117
|
+
return stackData;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=labelmapComputationStrategies.js.map
|
package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"labelmapComputationStrategies.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAK6B;AAC7B,qEAA6E;AAC7E,+DAA0D;AAK1D,yEAGoC;AACpC,yEAA4E;AAC5E,6FAA4F;AAQ5F,SAAsB,mBAAmB,CACvC,cAAsB,EACtB,UAAoC,EAAE;;;QAEtC,MAAM,cAAc,GAAG,CAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM;YACnD,CAAC,CAAC,OAAO,CAAC,cAAc;YACxB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AE;YAMjC,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAC;SACH;QAED,IAAI,kBAAkB,CAAC;QACvB,IAAI,QAAQ,EAAE;YACZ,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC;YACxD,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC;YACvC,kBAAkB;gBAChB,MAAM,mBAAY,CAAC,uCAAuC,CAAC,QAAQ,CAAC,CAAC;SACxE;aAAM;YAKL,MAAM,QAAQ,GAAI,OAAO,CAAC,QAAiC,CAAC,WAAW,EAAE,CAAC;YAC1E,MAAM,QAAQ,GAAG,+BAA+B,CAAC;YACjD,MAAM,WAAW,GAAG,gBAAS,CAAC,+BAA+B,CAC3D,QAAQ,EACR,QAAQ,CACT,CAAC;YAIF,OAAO,WAAW,CAAC,QAAQ,CAAC;YAE5B,kBAAkB,GAAG,MAAM,mBAAY,CAAC,6BAA6B,iCAE9D,WAAW,KACd,UAAU,EAAE,WAAW,CAAC,UAAiC,EACzD,kBAAkB,EAAE,QAAQ,KAE9B,QAAQ,CACT,CAAC;SACH;QAED,MAAM,MAAM,GAAG,MAAM,IAAA,yDAA8B,EACjD,EAAE,WAAW,EAAE,mBAAmB,EAAE,EACpC,kBAAkB,CACnB,CAAC;QAEF,IAAI,QAAQ,EAAE;YACZ,OAAO,MAAM,CAAC;SACf;QAGD,MAAM,SAAS,GAAG,CAAC,MAAM,IAAA,qEAAkC,EAAC;YAC1D,QAAQ,EAAE,kBAAkB,CAAC,QAAQ;SACtC,CAAC,CAAkC,CAAC;QAErC,OAAO,SAAS,CAAC;;CAClB"}
|
package/dist/cjs/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeAndAddSurfaceRepresentation = void 0;
|
|
4
|
+
const enums_1 = require("../../../../enums");
|
|
5
|
+
const computeAndAddRepresentation_1 = require("../computeAndAddRepresentation");
|
|
6
|
+
const surfaceComputationStrategies_1 = require("./surfaceComputationStrategies");
|
|
7
|
+
const updateSurfaceData_1 = require("./updateSurfaceData");
|
|
8
|
+
function computeAndAddSurfaceRepresentation(segmentationId, options = {}) {
|
|
9
|
+
return (0, computeAndAddRepresentation_1.computeAndAddRepresentation)(segmentationId, enums_1.SegmentationRepresentations.Surface, () => (0, surfaceComputationStrategies_1.computeSurfaceData)(segmentationId, options), () => (0, updateSurfaceData_1.updateSurfaceData)(segmentationId));
|
|
10
|
+
}
|
|
11
|
+
exports.computeAndAddSurfaceRepresentation = computeAndAddSurfaceRepresentation;
|
|
12
|
+
//# sourceMappingURL=computeAndAddSurfaceRepresentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeAndAddSurfaceRepresentation.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.ts"],"names":[],"mappings":";;;AAAA,6CAAgE;AAEhE,gFAA6E;AAC7E,iFAAoE;AACpE,2DAAwD;AAWxD,SAAgB,kCAAkC,CAChD,cAAsB,EACtB,UAAoC,EAAE;IAEtC,OAAO,IAAA,yDAA2B,EAChC,cAAc,EACd,mCAA2B,CAAC,OAAO,EACnC,GAAG,EAAE,CAAC,IAAA,iDAAkB,EAAC,cAAc,EAAE,OAAO,CAAC,EACjD,GAAG,EAAE,CAAC,IAAA,qCAAiB,EAAC,cAAc,CAAC,CACxC,CAAC;AACJ,CAAC;AAVD,gFAUC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.convertContourToSurface = void 0;
|
|
13
|
+
const core_1 = require("@cornerstonejs/core");
|
|
14
|
+
const core_2 = require("@cornerstonejs/core");
|
|
15
|
+
const annotationState_1 = require("../../../annotation/annotationState");
|
|
16
|
+
const enums_1 = require("../../../../enums");
|
|
17
|
+
const workerManager = (0, core_2.getWebWorkerManager)();
|
|
18
|
+
const triggerWorkerProgress = (eventTarget, progress) => {
|
|
19
|
+
(0, core_1.triggerEvent)(eventTarget, core_1.Enums.Events.WEB_WORKER_PROGRESS, {
|
|
20
|
+
progress,
|
|
21
|
+
type: enums_1.WorkerTypes.POLYSEG_CONTOUR_TO_SURFACE,
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
function convertContourToSurface(contourRepresentationData, segmentIndex) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const { annotationUIDsMap } = contourRepresentationData;
|
|
27
|
+
const polylines = [];
|
|
28
|
+
const numPointsArray = [];
|
|
29
|
+
const annotationUIDs = annotationUIDsMap.get(segmentIndex);
|
|
30
|
+
for (const annotationUID of annotationUIDs) {
|
|
31
|
+
const annotation = (0, annotationState_1.getAnnotation)(annotationUID);
|
|
32
|
+
const { polyline } = annotation.data.contour;
|
|
33
|
+
numPointsArray.push(polyline.length);
|
|
34
|
+
polyline.forEach((polyline) => polylines.push(...polyline));
|
|
35
|
+
}
|
|
36
|
+
triggerWorkerProgress(core_1.eventTarget, 0);
|
|
37
|
+
const results = yield workerManager.executeTask('polySeg', 'convertContourToSurface', {
|
|
38
|
+
polylines,
|
|
39
|
+
numPointsArray,
|
|
40
|
+
}, {
|
|
41
|
+
callbacks: [
|
|
42
|
+
(progress) => {
|
|
43
|
+
triggerWorkerProgress(core_1.eventTarget, progress);
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
});
|
|
47
|
+
triggerWorkerProgress(core_1.eventTarget, 100);
|
|
48
|
+
return results;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.convertContourToSurface = convertContourToSurface;
|
|
52
|
+
//# sourceMappingURL=convertContourToSurface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertContourToSurface.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA8E;AAC9E,8CAA0D;AAE1D,yEAAoE;AACpE,6CAAgD;AAEhD,MAAM,aAAa,GAAG,IAAA,0BAAmB,GAAE,CAAC;AAE5C,MAAM,qBAAqB,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE;IACtD,IAAA,mBAAY,EAAC,WAAW,EAAE,YAAK,CAAC,MAAM,CAAC,mBAAmB,EAAE;QAC1D,QAAQ;QACR,IAAI,EAAE,mBAAW,CAAC,0BAA0B;KAC7C,CAAC,CAAC;AACL,CAAC,CAAC;AASF,SAAsB,uBAAuB,CAC3C,yBAAkD,EAClD,YAAoB;;QAEpB,MAAM,EAAE,iBAAiB,EAAE,GAAG,yBAAyB,CAAC;QAGxD,MAAM,SAAS,GAAG,EAAE,CAAC;QACrB,MAAM,cAAc,GAAG,EAAE,CAAC;QAC1B,MAAM,cAAc,GAAG,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAE3D,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE;YAC1C,MAAM,UAAU,GAAG,IAAA,+BAAa,EAAC,aAAa,CAAC,CAAC;YAChD,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;YAC7C,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YACrC,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;SAC7D;QAED,qBAAqB,CAAC,kBAAW,EAAE,CAAC,CAAC,CAAC;QAEtC,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,WAAW,CAC7C,SAAS,EACT,yBAAyB,EACzB;YACE,SAAS;YACT,cAAc;SACf,EACD;YACE,SAAS,EAAE;gBACT,CAAC,QAAQ,EAAE,EAAE;oBACX,qBAAqB,CAAC,kBAAW,EAAE,QAAQ,CAAC,CAAC;gBAC/C,CAAC;aACF;SACF,CACF,CAAC;QAEF,qBAAqB,CAAC,kBAAW,EAAE,GAAG,CAAC,CAAC;QAExC,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AAvCD,0DAuCC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Types } from '@cornerstonejs/core';
|
|
2
|
+
import { LabelmapSegmentationData } from '../../../../types/LabelmapTypes';
|
|
3
|
+
export declare function convertLabelmapToSurface(labelmapRepresentationData: LabelmapSegmentationData, segmentIndex: number, isVolume?: boolean): Promise<Types.SurfaceData>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.convertLabelmapToSurface = void 0;
|
|
13
|
+
const core_1 = require("@cornerstonejs/core");
|
|
14
|
+
const core_2 = require("@cornerstonejs/core");
|
|
15
|
+
const convertStackToVolumeSegmentation_1 = require("../../convertStackToVolumeSegmentation");
|
|
16
|
+
const enums_1 = require("../../../../enums");
|
|
17
|
+
const workerManager = (0, core_2.getWebWorkerManager)();
|
|
18
|
+
const triggerWorkerProgress = (eventTarget, progress) => {
|
|
19
|
+
(0, core_1.triggerEvent)(eventTarget, core_1.Enums.Events.WEB_WORKER_PROGRESS, {
|
|
20
|
+
progress,
|
|
21
|
+
type: enums_1.WorkerTypes.POLYSEG_LABELMAP_TO_SURFACE,
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
function convertLabelmapToSurface(labelmapRepresentationData, segmentIndex, isVolume = true) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
let volumeId;
|
|
27
|
+
if (isVolume) {
|
|
28
|
+
volumeId = labelmapRepresentationData
|
|
29
|
+
.volumeId;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const { imageIdReferenceMap } = labelmapRepresentationData;
|
|
33
|
+
({ volumeId } = yield (0, convertStackToVolumeSegmentation_1.computeVolumeSegmentationFromStack)({
|
|
34
|
+
imageIdReferenceMap,
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
const volume = core_1.cache.getVolume(volumeId);
|
|
38
|
+
const scalarData = volume.getScalarData();
|
|
39
|
+
const { dimensions, spacing, origin, direction } = volume;
|
|
40
|
+
triggerWorkerProgress(core_1.eventTarget, 0);
|
|
41
|
+
const results = yield workerManager.executeTask('polySeg', 'convertLabelmapToSurface', {
|
|
42
|
+
scalarData,
|
|
43
|
+
dimensions,
|
|
44
|
+
spacing,
|
|
45
|
+
origin,
|
|
46
|
+
direction,
|
|
47
|
+
segmentIndex,
|
|
48
|
+
}, {
|
|
49
|
+
callbacks: [
|
|
50
|
+
(progress) => {
|
|
51
|
+
triggerWorkerProgress(core_1.eventTarget, progress);
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
triggerWorkerProgress(core_1.eventTarget, 100);
|
|
56
|
+
return results;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
exports.convertLabelmapToSurface = convertLabelmapToSurface;
|
|
60
|
+
//# sourceMappingURL=convertLabelmapToSurface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertLabelmapToSurface.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAM6B;AAC7B,8CAA0D;AAM1D,6FAA4F;AAC5F,6CAAgD;AAEhD,MAAM,aAAa,GAAG,IAAA,0BAAmB,GAAE,CAAC;AAE5C,MAAM,qBAAqB,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE;IACtD,IAAA,mBAAY,EAAC,WAAW,EAAE,YAAK,CAAC,MAAM,CAAC,mBAAmB,EAAE;QAC1D,QAAQ;QACR,IAAI,EAAE,mBAAW,CAAC,2BAA2B;KAC9C,CAAC,CAAC;AACL,CAAC,CAAC;AAUF,SAAsB,wBAAwB,CAC5C,0BAAoD,EACpD,YAAoB,EACpB,QAAQ,GAAG,IAAI;;QAEf,IAAI,QAAQ,CAAC;QACb,IAAI,QAAQ,EAAE;YACZ,QAAQ,GAAI,0BAA6D;iBACtE,QAAQ,CAAC;SACb;aAAM;YACL,MAAM,EAAE,mBAAmB,EAAE,GAC3B,0BAA2D,CAAC;YAC9D,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAA,qEAAkC,EAAC;gBACvD,mBAAmB;aACpB,CAAC,CAAC,CAAC;SACL;QAED,MAAM,MAAM,GAAG,YAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAEzC,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC;QAC1C,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAE1D,qBAAqB,CAAC,kBAAW,EAAE,CAAC,CAAC,CAAC;QAEtC,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,WAAW,CAC7C,SAAS,EACT,0BAA0B,EAC1B;YACE,UAAU;YACV,UAAU;YACV,OAAO;YACP,MAAM;YACN,SAAS;YACT,YAAY;SACb,EACD;YACE,SAAS,EAAE;gBACT,CAAC,QAAQ,EAAE,EAAE;oBACX,qBAAqB,CAAC,kBAAW,EAAE,QAAQ,CAAC,CAAC;gBAC/C,CAAC;aACF;SACF,CACF,CAAC;QAEF,qBAAqB,CAAC,kBAAW,EAAE,GAAG,CAAC,CAAC;QAExC,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AA/CD,4DA+CC"}
|
package/dist/cjs/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RawSurfacesData } from './surfaceComputationStrategies';
|
|
2
|
+
import { PolySegConversionOptions } from '../../../../types';
|
|
3
|
+
export declare function createAndCacheSurfacesFromRaw(segmentationId: string, rawSurfacesData: RawSurfacesData, options?: PolySegConversionOptions): Promise<{
|
|
4
|
+
geometryIds: Map<number, string>;
|
|
5
|
+
}>;
|
package/dist/cjs/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createAndCacheSurfacesFromRaw = void 0;
|
|
13
|
+
const core_1 = require("@cornerstonejs/core");
|
|
14
|
+
const segmentationColor_1 = require("../../config/segmentationColor");
|
|
15
|
+
const segmentationState_1 = require("../../segmentationState");
|
|
16
|
+
function createAndCacheSurfacesFromRaw(segmentationId, rawSurfacesData, options = {}) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
let segmentationRepresentation, toolGroupId;
|
|
19
|
+
if (options.segmentationRepresentationUID) {
|
|
20
|
+
({ segmentationRepresentation, toolGroupId } =
|
|
21
|
+
(0, segmentationState_1.findSegmentationRepresentationByUID)(options.segmentationRepresentationUID));
|
|
22
|
+
}
|
|
23
|
+
const segmentation = (0, segmentationState_1.getSegmentation)(segmentationId);
|
|
24
|
+
const geometryIds = new Map();
|
|
25
|
+
const promises = Object.keys(rawSurfacesData).map((index) => __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const rawSurfaceData = rawSurfacesData[index];
|
|
27
|
+
const segmentIndex = rawSurfaceData.segmentIndex;
|
|
28
|
+
const color = segmentationRepresentation;
|
|
29
|
+
(0, segmentationColor_1.getColorForSegmentIndex)(toolGroupId, segmentationRepresentation.segmentationRepresentationUID, segmentIndex).slice(0, 3);
|
|
30
|
+
if (!color) {
|
|
31
|
+
throw new Error('No color found for segment index, unable to create surface');
|
|
32
|
+
}
|
|
33
|
+
const closedSurface = {
|
|
34
|
+
id: `segmentation_${segmentation.segmentationId}_surface_${segmentIndex}`,
|
|
35
|
+
color,
|
|
36
|
+
frameOfReferenceUID: 'test-frameOfReferenceUID',
|
|
37
|
+
data: {
|
|
38
|
+
points: rawSurfaceData.data.points,
|
|
39
|
+
polys: rawSurfaceData.data.polys,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const geometryId = closedSurface.id;
|
|
43
|
+
geometryIds.set(segmentIndex, geometryId);
|
|
44
|
+
return core_1.geometryLoader.createAndCacheGeometry(geometryId, {
|
|
45
|
+
type: core_1.Enums.GeometryType.SURFACE,
|
|
46
|
+
geometryData: closedSurface,
|
|
47
|
+
});
|
|
48
|
+
}));
|
|
49
|
+
yield Promise.all(promises);
|
|
50
|
+
return {
|
|
51
|
+
geometryIds,
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
exports.createAndCacheSurfacesFromRaw = createAndCacheSurfacesFromRaw;
|
|
56
|
+
//# sourceMappingURL=createAndCacheSurfacesFromRaw.js.map
|
package/dist/cjs/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAndCacheSurfacesFromRaw.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAmE;AACnE,sEAAyE;AACzE,+DAGiC;AAcjC,SAAsB,6BAA6B,CACjD,cAAsB,EACtB,eAAgC,EAChC,UAAoC,EAAE;;QAGtC,IAAI,0BAA+B,EAAE,WAAgB,CAAC;QACtD,IAAI,OAAO,CAAC,6BAA6B,EAAE;YACzC,CAAC,EAAE,0BAA0B,EAAE,WAAW,EAAE;gBAC1C,IAAA,uDAAmC,EACjC,OAAO,CAAC,6BAA6B,CACtC,CAAC,CAAC;SACN;QAED,MAAM,YAAY,GAAG,IAAA,mCAAe,EAAC,cAAc,CAAC,CAAC;QAErD,MAAM,WAAW,GAAG,IA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