@cornerstonejs/tools 1.57.1 → 1.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/drawingSvg/drawPath.js +1 -1
- package/dist/cjs/drawingSvg/drawPath.js.map +1 -1
- package/dist/cjs/enums/WorkerTypes.d.ts +1 -1
- package/dist/cjs/enums/WorkerTypes.js +1 -1
- package/dist/cjs/enums/WorkerTypes.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.d.ts +17 -0
- package/dist/cjs/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.js +112 -0
- package/dist/cjs/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts +3 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js +4 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.d.ts +8 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js +121 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.d.ts +3 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.js +73 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.d.ts +3 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.js +25 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.d.ts +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.js +41 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js +2 -2
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js +1 -1
- package/dist/cjs/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/triggerSegmentationEvents.js +2 -0
- package/dist/cjs/stateManagement/segmentation/triggerSegmentationEvents.js.map +1 -1
- package/dist/cjs/store/ToolGroupManager/getToolGroupForViewport.d.ts +1 -1
- package/dist/cjs/store/ToolGroupManager/getToolGroupForViewport.js +5 -0
- package/dist/cjs/store/ToolGroupManager/getToolGroupForViewport.js.map +1 -1
- package/dist/cjs/tools/annotation/SplineROITool.js +25 -20
- package/dist/cjs/tools/annotation/SplineROITool.js.map +1 -1
- package/dist/cjs/tools/base/BaseTool.js +3 -0
- package/dist/cjs/tools/base/BaseTool.js.map +1 -1
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.js.map +1 -1
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js +13 -5
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/cjs/tools/displayTools/SegmentationDisplayTool.d.ts +1 -0
- package/dist/cjs/tools/displayTools/SegmentationDisplayTool.js +17 -0
- package/dist/cjs/tools/displayTools/SegmentationDisplayTool.js.map +1 -1
- package/dist/cjs/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js +4 -47
- package/dist/cjs/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js.map +1 -1
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.d.ts +3 -9
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.js +7 -148
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.js.map +1 -1
- package/dist/cjs/types/PolySeg.d.ts +1 -1
- package/dist/cjs/utilities/contourSegmentation/addContourSegmentationAnnotation.js +4 -1
- package/dist/cjs/utilities/contourSegmentation/addContourSegmentationAnnotation.js.map +1 -1
- package/dist/cjs/utilities/contourSegmentation/removeContourSegmentationAnnotation.js +3 -0
- package/dist/cjs/utilities/contourSegmentation/removeContourSegmentationAnnotation.js.map +1 -1
- package/dist/cjs/utilities/math/polyline/getAABB.d.ts +3 -1
- package/dist/cjs/utilities/math/polyline/getAABB.js +30 -4
- package/dist/cjs/utilities/math/polyline/getAABB.js.map +1 -1
- package/dist/cjs/utilities/planar/index.d.ts +3 -1
- package/dist/cjs/utilities/planar/index.js +4 -1
- package/dist/cjs/utilities/planar/index.js.map +1 -1
- package/dist/cjs/utilities/planar/isPlaneIntersectingAABB.d.ts +1 -0
- package/dist/cjs/utilities/planar/isPlaneIntersectingAABB.js +32 -0
- package/dist/cjs/utilities/planar/isPlaneIntersectingAABB.js.map +1 -0
- package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.d.ts +3 -1
- package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.js +97 -47
- package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.js.map +1 -1
- package/dist/cjs/workers/polySegConverters.js +73 -0
- package/dist/cjs/workers/polySegConverters.js.map +1 -1
- package/dist/esm/drawingSvg/drawPath.js +1 -1
- package/dist/esm/drawingSvg/drawPath.js.map +1 -1
- package/dist/esm/enums/WorkerTypes.js +1 -1
- package/dist/esm/enums/WorkerTypes.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.js +91 -0
- package/dist/esm/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js +4 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js +105 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.js +72 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.js +21 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.js +26 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.js +2 -0
- package/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.js.map +1 -1
- package/dist/esm/store/ToolGroupManager/getToolGroupForViewport.js +4 -0
- package/dist/esm/store/ToolGroupManager/getToolGroupForViewport.js.map +1 -1
- package/dist/esm/tools/annotation/SplineROITool.js +25 -20
- package/dist/esm/tools/annotation/SplineROITool.js.map +1 -1
- package/dist/esm/tools/base/BaseTool.js +3 -0
- package/dist/esm/tools/base/BaseTool.js.map +1 -1
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js.map +1 -1
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js +13 -5
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/esm/tools/displayTools/SegmentationDisplayTool.js +17 -0
- package/dist/esm/tools/displayTools/SegmentationDisplayTool.js.map +1 -1
- package/dist/esm/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js +3 -46
- package/dist/esm/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js.map +1 -1
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js +8 -139
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js.map +1 -1
- package/dist/esm/utilities/contourSegmentation/addContourSegmentationAnnotation.js +4 -1
- package/dist/esm/utilities/contourSegmentation/addContourSegmentationAnnotation.js.map +1 -1
- package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.js +3 -0
- package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.js.map +1 -1
- package/dist/esm/utilities/math/polyline/getAABB.js +30 -4
- package/dist/esm/utilities/math/polyline/getAABB.js.map +1 -1
- package/dist/esm/utilities/planar/index.js +3 -1
- package/dist/esm/utilities/planar/index.js.map +1 -1
- package/dist/esm/utilities/planar/isPlaneIntersectingAABB.js +28 -0
- package/dist/esm/utilities/planar/isPlaneIntersectingAABB.js.map +1 -0
- package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js +92 -44
- package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js.map +1 -1
- package/dist/esm/workers/polySegConverters.js +74 -1
- package/dist/esm/workers/polySegConverters.js.map +1 -1
- package/dist/types/drawingSvg/drawPath.d.ts.map +1 -1
- package/dist/types/enums/WorkerTypes.d.ts +1 -1
- package/dist/types/enums/WorkerTypes.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.d.ts +18 -0
- package/dist/types/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts +3 -1
- package/dist/types/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.d.ts +9 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.d.ts +4 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.d.ts +4 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.d.ts +2 -0
- package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/triggerSegmentationEvents.d.ts.map +1 -1
- package/dist/types/store/ToolGroupManager/getToolGroupForViewport.d.ts +1 -1
- package/dist/types/store/ToolGroupManager/getToolGroupForViewport.d.ts.map +1 -1
- package/dist/types/tools/annotation/SplineROITool.d.ts.map +1 -1
- package/dist/types/tools/base/BaseTool.d.ts.map +1 -1
- package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Contour/contourDisplay.d.ts.map +1 -1
- package/dist/types/tools/displayTools/SegmentationDisplayTool.d.ts +1 -0
- package/dist/types/tools/displayTools/SegmentationDisplayTool.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Surface/addOrUpdateSurfaceToElement.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Surface/surfaceDisplay.d.ts +3 -9
- package/dist/types/tools/displayTools/Surface/surfaceDisplay.d.ts.map +1 -1
- package/dist/types/types/PolySeg.d.ts +1 -1
- package/dist/types/types/PolySeg.d.ts.map +1 -1
- package/dist/types/utilities/contourSegmentation/addContourSegmentationAnnotation.d.ts.map +1 -1
- package/dist/types/utilities/contourSegmentation/removeContourSegmentationAnnotation.d.ts.map +1 -1
- package/dist/types/utilities/math/polyline/getAABB.d.ts +3 -1
- package/dist/types/utilities/math/polyline/getAABB.d.ts.map +1 -1
- package/dist/types/utilities/planar/index.d.ts +3 -1
- package/dist/types/utilities/planar/index.d.ts.map +1 -1
- package/dist/types/utilities/planar/isPlaneIntersectingAABB.d.ts +2 -0
- package/dist/types/utilities/planar/isPlaneIntersectingAABB.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/getUniqueSegmentIndices.d.ts +3 -1
- package/dist/types/utilities/segmentation/getUniqueSegmentIndices.d.ts.map +1 -1
- package/dist/umd/985.index.js +1 -1
- package/dist/umd/985.index.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +4 -4
- package/src/drawingSvg/drawPath.ts +3 -1
- package/src/enums/WorkerTypes.ts +1 -1
- package/src/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.ts +203 -0
- package/src/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.ts +9 -2
- package/src/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.ts +201 -0
- package/src/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.ts +103 -0
- package/src/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.ts +38 -0
- package/src/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.ts +58 -0
- package/src/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.ts +2 -2
- package/src/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.ts +1 -1
- package/src/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.ts +3 -8
- package/src/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.ts +1 -1
- package/src/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.ts +1 -1
- package/src/stateManagement/segmentation/polySeg/computeAndAddRepresentation.ts +1 -1
- package/src/stateManagement/segmentation/triggerSegmentationEvents.ts +5 -0
- package/src/store/ToolGroupManager/getToolGroupForViewport.ts +8 -1
- package/src/tools/annotation/SplineROITool.ts +34 -27
- package/src/tools/base/BaseTool.ts +7 -0
- package/src/tools/base/ContourSegmentationBaseTool.ts +5 -0
- package/src/tools/displayTools/Contour/contourDisplay.ts +29 -11
- package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +1 -1
- package/src/tools/displayTools/SegmentationDisplayTool.ts +26 -0
- package/src/tools/displayTools/Surface/addOrUpdateSurfaceToElement.ts +3 -65
- package/src/tools/displayTools/Surface/surfaceDisplay.ts +12 -247
- package/src/types/PolySeg.ts +1 -1
- package/src/utilities/contourSegmentation/addContourSegmentationAnnotation.ts +9 -1
- package/src/utilities/contourSegmentation/removeContourSegmentationAnnotation.ts +4 -0
- package/src/utilities/math/polyline/getAABB.ts +58 -4
- package/src/utilities/planar/index.ts +3 -0
- package/src/utilities/planar/isPlaneIntersectingAABB.ts +56 -0
- package/src/utilities/segmentation/getUniqueSegmentIndices.ts +115 -49
- package/src/workers/polySegConverters.js +117 -1
- package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.d.ts +0 -1
- package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.js +0 -27
- package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.js.map +0 -1
- package/dist/cjs/workers/clippingPlaneWorker.d.ts +0 -1
- package/dist/cjs/workers/clippingPlaneWorker.js +0 -63
- package/dist/cjs/workers/clippingPlaneWorker.js.map +0 -1
- package/dist/esm/tools/displayTools/registerDisplayToolsWorker.js +0 -23
- package/dist/esm/tools/displayTools/registerDisplayToolsWorker.js.map +0 -1
- package/dist/esm/workers/clippingPlaneWorker.js +0 -58
- package/dist/esm/workers/clippingPlaneWorker.js.map +0 -1
- package/dist/types/tools/displayTools/registerDisplayToolsWorker.d.ts +0 -2
- package/dist/types/tools/displayTools/registerDisplayToolsWorker.d.ts.map +0 -1
- package/dist/types/workers/clippingPlaneWorker.d.ts +0 -2
- package/dist/types/workers/clippingPlaneWorker.d.ts.map +0 -1
- package/dist/umd/444.index.js +0 -3
- package/dist/umd/444.index.js.LICENSE.txt +0 -5
- package/dist/umd/444.index.js.map +0 -1
- package/src/tools/displayTools/registerDisplayToolsWorker.ts +0 -34
- package/src/workers/clippingPlaneWorker.js +0 -87
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
VolumeViewport,
|
|
4
|
-
volumeLoader,
|
|
5
|
-
utilities,
|
|
6
|
-
} from '@cornerstonejs/core';
|
|
1
|
+
import { VolumeViewport, volumeLoader, utilities } from '@cornerstonejs/core';
|
|
2
|
+
import type { Types } from '@cornerstonejs/core';
|
|
7
3
|
import { getUniqueSegmentIndices } from '../../../../utilities/segmentation';
|
|
8
4
|
import { getSegmentation } from '../../segmentationState';
|
|
9
5
|
import {
|
|
@@ -16,7 +12,6 @@ import {
|
|
|
16
12
|
} from './convertContourToLabelmap';
|
|
17
13
|
import { convertSurfaceToVolumeLabelmap } from './convertSurfaceToLabelmap';
|
|
18
14
|
import { computeStackSegmentationFromVolume } from '../../convertVolumeToStackSegmentation';
|
|
19
|
-
import { PixelDataTypedArray } from '@cornerstonejs/core/dist/types/types';
|
|
20
15
|
import { PolySegConversionOptions } from '../../../../types';
|
|
21
16
|
|
|
22
17
|
export type RawLabelmapData =
|
|
@@ -166,7 +161,7 @@ async function computeLabelmapFromSurfaceSegmentation(
|
|
|
166
161
|
segmentationVolume = await volumeLoader.createLocalSegmentationVolume(
|
|
167
162
|
{
|
|
168
163
|
...volumeProps,
|
|
169
|
-
scalarData: volumeProps.scalarData as PixelDataTypedArray,
|
|
164
|
+
scalarData: volumeProps.scalarData as Types.PixelDataTypedArray,
|
|
170
165
|
referencedImageIds: imageIds,
|
|
171
166
|
},
|
|
172
167
|
volumeId
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
SegmentationRepresentationRemovedEventDetail,
|
|
13
13
|
SegmentationRemovedEventDetail,
|
|
14
14
|
} from '../../types/EventTypes';
|
|
15
|
+
import { setSegmentationDirty } from '../../utilities/segmentation/getUniqueSegmentIndices';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Trigger an event that a segmentation is removed
|
|
@@ -143,6 +144,10 @@ function triggerSegmentationDataModified(
|
|
|
143
144
|
modifiedSlicesToUse,
|
|
144
145
|
};
|
|
145
146
|
|
|
147
|
+
// set it to dirty to force the next call to getUniqueSegmentIndices to
|
|
148
|
+
// recalculate the segment indices
|
|
149
|
+
setSegmentationDirty(segmentationId);
|
|
150
|
+
|
|
146
151
|
triggerEvent(eventTarget, Events.SEGMENTATION_DATA_MODIFIED, eventDetail);
|
|
147
152
|
}
|
|
148
153
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getRenderingEngines } from '@cornerstonejs/core';
|
|
1
2
|
import { state } from '../index';
|
|
2
3
|
import { IToolGroup } from '../../types';
|
|
3
4
|
|
|
@@ -17,8 +18,14 @@ import { IToolGroup } from '../../types';
|
|
|
17
18
|
*/
|
|
18
19
|
function getToolGroupForViewport(
|
|
19
20
|
viewportId: string,
|
|
20
|
-
renderingEngineId
|
|
21
|
+
renderingEngineId?: string
|
|
21
22
|
): IToolGroup | undefined {
|
|
23
|
+
if (!renderingEngineId) {
|
|
24
|
+
renderingEngineId = getRenderingEngines().find((re) =>
|
|
25
|
+
re.getViewports().find((vp) => vp.id === viewportId)
|
|
26
|
+
)?.id;
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
const toolGroupFilteredByIds = state.toolGroups.filter((tg) =>
|
|
23
30
|
tg.viewportsInfo.some(
|
|
24
31
|
(vp) =>
|
|
@@ -692,29 +692,27 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
692
692
|
const spline = annotation.data.spline.instance;
|
|
693
693
|
|
|
694
694
|
// Update current and all child annotations/splines
|
|
695
|
-
|
|
696
|
-
|
|
695
|
+
const splineAnnotationsGroup = [
|
|
696
|
+
annotation,
|
|
697
|
+
...getChildAnnotations(annotation),
|
|
698
|
+
].filter((annotation) =>
|
|
699
|
+
this._isSplineROIAnnotation(annotation)
|
|
700
|
+
) as SplineROIAnnotation[];
|
|
701
|
+
|
|
702
|
+
splineAnnotationsGroup.forEach((annotation) => {
|
|
703
|
+
const spline = this._updateSplineInstance(element, annotation);
|
|
704
|
+
const splinePolylineCanvas = spline.getPolylinePoints();
|
|
705
|
+
|
|
706
|
+
this.updateContourPolyline(
|
|
697
707
|
annotation,
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
this.updateContourPolyline(
|
|
708
|
-
annotation,
|
|
709
|
-
{
|
|
710
|
-
points: splinePolylineCanvas,
|
|
711
|
-
closed: data.contour.closed,
|
|
712
|
-
targetWindingDirection: ContourWindingDirection.Clockwise,
|
|
713
|
-
},
|
|
714
|
-
viewport
|
|
715
|
-
);
|
|
716
|
-
});
|
|
717
|
-
}
|
|
708
|
+
{
|
|
709
|
+
points: splinePolylineCanvas,
|
|
710
|
+
closed: data.contour.closed,
|
|
711
|
+
targetWindingDirection: ContourWindingDirection.Clockwise,
|
|
712
|
+
},
|
|
713
|
+
viewport
|
|
714
|
+
);
|
|
715
|
+
});
|
|
718
716
|
|
|
719
717
|
// Let the base class render the contour
|
|
720
718
|
super.renderAnnotationInstance(renderContext);
|
|
@@ -1069,6 +1067,14 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
1069
1067
|
const splineConfig = this._getSplineConfig(splineType);
|
|
1070
1068
|
const worldPoints = data.handles.points;
|
|
1071
1069
|
const canvasPoints = worldPoints.map(worldToCanvas);
|
|
1070
|
+
const resolution =
|
|
1071
|
+
splineConfig.resolution !== undefined
|
|
1072
|
+
? parseInt(splineConfig.resolution)
|
|
1073
|
+
: undefined;
|
|
1074
|
+
const scale =
|
|
1075
|
+
splineConfig.scale !== undefined
|
|
1076
|
+
? parseFloat(splineConfig.scale)
|
|
1077
|
+
: undefined;
|
|
1072
1078
|
|
|
1073
1079
|
spline.setControlPoints(canvasPoints);
|
|
1074
1080
|
spline.closed = !!data.contour.closed;
|
|
@@ -1076,9 +1082,10 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
1076
1082
|
// Update spline resolution in case it has changed
|
|
1077
1083
|
if (
|
|
1078
1084
|
!spline.fixedResolution &&
|
|
1079
|
-
|
|
1085
|
+
resolution !== undefined &&
|
|
1086
|
+
spline.resolution !== resolution
|
|
1080
1087
|
) {
|
|
1081
|
-
spline.resolution =
|
|
1088
|
+
spline.resolution = resolution;
|
|
1082
1089
|
annotation.invalidated = true;
|
|
1083
1090
|
}
|
|
1084
1091
|
|
|
@@ -1086,10 +1093,10 @@ class SplineROITool extends ContourSegmentationBaseTool {
|
|
|
1086
1093
|
if (
|
|
1087
1094
|
spline instanceof CardinalSpline &&
|
|
1088
1095
|
!spline.fixedScale &&
|
|
1089
|
-
|
|
1090
|
-
spline.scale !==
|
|
1096
|
+
scale !== undefined &&
|
|
1097
|
+
spline.scale !== scale
|
|
1091
1098
|
) {
|
|
1092
|
-
spline.scale =
|
|
1099
|
+
spline.scale = scale;
|
|
1093
1100
|
annotation.invalidated = true;
|
|
1094
1101
|
}
|
|
1095
1102
|
|
|
@@ -104,6 +104,13 @@ abstract class BaseTool implements IBaseTool {
|
|
|
104
104
|
callbackType: StrategyCallbacks | string
|
|
105
105
|
): any {
|
|
106
106
|
const { strategies, activeStrategy } = this.configuration;
|
|
107
|
+
|
|
108
|
+
if (!strategies[activeStrategy]) {
|
|
109
|
+
throw new Error(
|
|
110
|
+
`applyActiveStrategyCallback: active strategy ${activeStrategy} not found, check tool configuration or spellings`
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
107
114
|
return strategies[activeStrategy][callbackType]?.call(
|
|
108
115
|
this,
|
|
109
116
|
enabledElement,
|
|
@@ -196,6 +196,11 @@ abstract class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
|
196
196
|
const segmentsLocked = segmentLocking.getLockedSegments(segmentationId);
|
|
197
197
|
const annotationLocked = segmentsLocked.includes(segmentIndex as never);
|
|
198
198
|
|
|
199
|
+
// Todo: we should really get styles every time we render, since it is getting
|
|
200
|
+
// the style for the visibility and that goes through the segment indices
|
|
201
|
+
// calculation which is expensive. We should cache the styles and only update
|
|
202
|
+
// them if the segmentation representation modified event is triggered.
|
|
203
|
+
|
|
199
204
|
const segmentColor = segmentationConfig.color.getColorForSegmentIndex(
|
|
200
205
|
toolGroupId,
|
|
201
206
|
segmentationRepresentationUID,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getEnabledElementByIds,
|
|
3
3
|
Types,
|
|
4
|
-
StackViewport,
|
|
5
4
|
BaseVolumeViewport,
|
|
6
5
|
} from '@cornerstonejs/core';
|
|
7
6
|
|
|
@@ -15,6 +14,9 @@ import {
|
|
|
15
14
|
import { addOrUpdateVTKContourSets } from './vtkContour/addOrUpdateVTKContourSets';
|
|
16
15
|
import removeContourFromElement from './removeContourFromElement';
|
|
17
16
|
import { deleteConfigCache } from './vtkContour/contourConfigCache';
|
|
17
|
+
import { polySeg } from '../../../stateManagement/segmentation';
|
|
18
|
+
|
|
19
|
+
let polySegConversionInProgress = false;
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* It removes a segmentation representation from the tool group's viewports and
|
|
@@ -72,19 +74,35 @@ async function render(
|
|
|
72
74
|
return;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
let contourData = segmentation.representationData[Representations.Contour];
|
|
78
|
+
|
|
79
|
+
if (
|
|
80
|
+
!contourData &&
|
|
81
|
+
polySeg.canComputeRequestedRepresentation(
|
|
82
|
+
representationConfig.segmentationRepresentationUID
|
|
83
|
+
) &&
|
|
84
|
+
!polySegConversionInProgress
|
|
85
|
+
) {
|
|
86
|
+
polySegConversionInProgress = true;
|
|
87
|
+
|
|
88
|
+
contourData = await polySeg.computeAndAddContourRepresentation(
|
|
89
|
+
segmentationId,
|
|
90
|
+
{
|
|
91
|
+
segmentationRepresentationUID:
|
|
92
|
+
representationConfig.segmentationRepresentationUID,
|
|
93
|
+
viewport,
|
|
94
|
+
}
|
|
95
|
+
);
|
|
81
96
|
}
|
|
82
97
|
|
|
83
|
-
//
|
|
98
|
+
// From here to below it is basically the legacy geometryId based
|
|
99
|
+
// contour rendering via vtkActors that has some bugs for display,
|
|
100
|
+
// as it sometimes appear and sometimes not, and it is not clear.
|
|
101
|
+
// We have moved to the new SVG based contours via our annotation tools
|
|
102
|
+
// check out annotationUIDsMap in the ContourSegmentationData type
|
|
103
|
+
const { geometryIds } = contourData;
|
|
84
104
|
|
|
85
|
-
if (!(viewport instanceof BaseVolumeViewport)) {
|
|
86
|
-
// We don't have a good way to handle stack viewports for contours at the moment.
|
|
87
|
-
// Plus, if we add a segmentation to one viewport, it gets added to all the viewports in the toolGroup too.
|
|
105
|
+
if (!geometryIds?.length || !(viewport instanceof BaseVolumeViewport)) {
|
|
88
106
|
return;
|
|
89
107
|
}
|
|
90
108
|
|
|
@@ -143,7 +143,7 @@ async function render(
|
|
|
143
143
|
let actorEntry = viewport.getActor(segmentationRepresentationUID);
|
|
144
144
|
|
|
145
145
|
if (
|
|
146
|
-
!
|
|
146
|
+
!labelmapData &&
|
|
147
147
|
polySeg.canComputeRequestedRepresentation(segmentationRepresentationUID) &&
|
|
148
148
|
!polySegConversionInProgress
|
|
149
149
|
) {
|
|
@@ -18,7 +18,11 @@ import {
|
|
|
18
18
|
import { surfaceDisplay } from './Surface';
|
|
19
19
|
import { contourDisplay } from './Contour';
|
|
20
20
|
import { labelmapDisplay } from './Labelmap';
|
|
21
|
+
import SegmentationRepresentations from '../../enums/SegmentationRepresentations';
|
|
22
|
+
import { addTool, state } from '../../store';
|
|
23
|
+
import PlanarFreehandContourSegmentationTool from '../annotation/PlanarFreehandContourSegmentationTool';
|
|
21
24
|
|
|
25
|
+
const planarContourToolName = PlanarFreehandContourSegmentationTool.toolName;
|
|
22
26
|
/**
|
|
23
27
|
* In Cornerstone3DTools, displaying of segmentations are handled by the SegmentationDisplayTool.
|
|
24
28
|
* Generally, any Segmentation can be viewed in various representations such as
|
|
@@ -151,6 +155,12 @@ class SegmentationDisplayTool extends BaseTool {
|
|
|
151
155
|
[Representations.Surface]: surfaceDisplay,
|
|
152
156
|
};
|
|
153
157
|
|
|
158
|
+
if (representation.type === SegmentationRepresentations.Contour) {
|
|
159
|
+
// if the representation is contour we need to make sure
|
|
160
|
+
// that the planarFreeHandTool is added to the toolGroup
|
|
161
|
+
this.addPlanarFreeHandToolIfAbsent(toolGroupId);
|
|
162
|
+
}
|
|
163
|
+
|
|
154
164
|
const display = renderers[representation.type];
|
|
155
165
|
|
|
156
166
|
for (const viewport of toolGroupViewports) {
|
|
@@ -174,6 +184,22 @@ class SegmentationDisplayTool extends BaseTool {
|
|
|
174
184
|
});
|
|
175
185
|
};
|
|
176
186
|
|
|
187
|
+
addPlanarFreeHandToolIfAbsent(toolGroupId) {
|
|
188
|
+
// if it is contour we should check if the toolGroup and more importantly
|
|
189
|
+
// the cornerstoneTools have the planarFreeHandTool added
|
|
190
|
+
if (!(planarContourToolName in state.tools)) {
|
|
191
|
+
addTool(PlanarFreehandContourSegmentationTool);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const toolGroup = getToolGroup(toolGroupId);
|
|
195
|
+
|
|
196
|
+
// check if toolGroup has this tool
|
|
197
|
+
if (!toolGroup.hasTool(planarContourToolName)) {
|
|
198
|
+
toolGroup.addTool(planarContourToolName);
|
|
199
|
+
toolGroup.setToolPassive(planarContourToolName);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
177
203
|
/**
|
|
178
204
|
* Merge the toolGroup specific configuration with the default global configuration
|
|
179
205
|
* @param toolGroupId
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getEnabledElement,
|
|
3
|
-
Enums,
|
|
4
|
-
VolumeViewport3D,
|
|
5
|
-
} from '@cornerstonejs/core';
|
|
1
|
+
import { getEnabledElement } from '@cornerstonejs/core';
|
|
6
2
|
import type { Types } from '@cornerstonejs/core';
|
|
7
3
|
import vtkMapper from '@kitware/vtk.js/Rendering/Core/Mapper';
|
|
8
4
|
import vtkActor from '@kitware/vtk.js/Rendering/Core/Actor';
|
|
9
|
-
import vtkClipClosedSurface from '@kitware/vtk.js/Filters/General/ClipClosedSurface';
|
|
10
5
|
import vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData';
|
|
11
6
|
import vtkCellArray from '@kitware/vtk.js/Common/Core/CellArray';
|
|
12
|
-
import {
|
|
13
|
-
generateCacheId,
|
|
14
|
-
getOrCreatePolyData,
|
|
15
|
-
getSurfaceActorUID,
|
|
16
|
-
} from './surfaceDisplay';
|
|
7
|
+
import { getSurfaceActorUID } from '../../../stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport';
|
|
17
8
|
|
|
18
9
|
function addOrUpdateSurfaceToElement(
|
|
19
10
|
element: HTMLDivElement,
|
|
@@ -92,44 +83,7 @@ function addOrUpdateSurfaceToElement(
|
|
|
92
83
|
const mapper = vtkMapper.newInstance({});
|
|
93
84
|
|
|
94
85
|
let clippingFilter;
|
|
95
|
-
|
|
96
|
-
clippingFilter = vtkClipClosedSurface.newInstance({
|
|
97
|
-
clippingPlanes: [],
|
|
98
|
-
activePlaneId: 2,
|
|
99
|
-
passPointData: false,
|
|
100
|
-
});
|
|
101
|
-
clippingFilter.setInputData(surfacePolyData);
|
|
102
|
-
clippingFilter.setGenerateOutline(true);
|
|
103
|
-
clippingFilter.setGenerateFaces(false);
|
|
104
|
-
clippingFilter.update();
|
|
105
|
-
const filteredData = clippingFilter.getOutputData();
|
|
106
|
-
mapper.setInputData(filteredData);
|
|
107
|
-
|
|
108
|
-
// @ts-ignore
|
|
109
|
-
const viewportPlanes = viewport.getClippingPlanesForActor?.();
|
|
110
|
-
|
|
111
|
-
const evt = {
|
|
112
|
-
detail: {
|
|
113
|
-
actorEntry: {
|
|
114
|
-
actor: {
|
|
115
|
-
getMapper: () => mapper,
|
|
116
|
-
},
|
|
117
|
-
clippingFilter,
|
|
118
|
-
uid: actorUID,
|
|
119
|
-
},
|
|
120
|
-
vtkPlanes: viewportPlanes,
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
updateSurfacePlanes(evt);
|
|
125
|
-
|
|
126
|
-
element.addEventListener(
|
|
127
|
-
Enums.Events.CLIPPING_PLANES_UPDATED,
|
|
128
|
-
updateSurfacePlanes
|
|
129
|
-
);
|
|
130
|
-
} else {
|
|
131
|
-
mapper.setInputData(surfacePolyData);
|
|
132
|
-
}
|
|
86
|
+
mapper.setInputData(surfacePolyData);
|
|
133
87
|
|
|
134
88
|
const actor = vtkActor.newInstance();
|
|
135
89
|
actor.setMapper(mapper);
|
|
@@ -155,20 +109,4 @@ function addOrUpdateSurfaceToElement(
|
|
|
155
109
|
}, 0);
|
|
156
110
|
}
|
|
157
111
|
|
|
158
|
-
/**
|
|
159
|
-
* Updates the clipping planes of a surface and caches the resulting poly data
|
|
160
|
-
*/
|
|
161
|
-
function updateSurfacePlanes(evt) {
|
|
162
|
-
const { actorEntry, vtkPlanes, viewport } = evt.detail;
|
|
163
|
-
if (!actorEntry?.clippingFilter || vtkPlanes.length === 0) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
const sliceIndex = viewport.getSliceIndex();
|
|
167
|
-
const mapper = actorEntry.actor.getMapper();
|
|
168
|
-
const { viewPlaneNormal } = viewport.getCamera();
|
|
169
|
-
const cacheId = generateCacheId(viewport, viewPlaneNormal, sliceIndex);
|
|
170
|
-
const polyData = getOrCreatePolyData(actorEntry, cacheId, vtkPlanes);
|
|
171
|
-
mapper.setInputData(polyData);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
112
|
export default addOrUpdateSurfaceToElement;
|