@cornerstonejs/tools 2.0.0-beta.21 → 2.0.0-beta.22
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/esm/cursors/elementCursor.d.ts +1 -1
- package/dist/esm/cursors/elementCursor.js +1 -1
- package/dist/esm/drawingSvg/getSvgDrawingHelper.js +1 -1
- package/dist/esm/eventDispatchers/keyboardEventHandlers/keyDown.js +2 -2
- package/dist/esm/eventDispatchers/keyboardEventHandlers/keyUp.js +2 -2
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDown.js +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDownActivate.js +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.js +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDrag.js +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseMove.js +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseWheel.js +1 -1
- package/dist/esm/eventDispatchers/shared/customCallbackHandler.js +3 -2
- package/dist/esm/eventDispatchers/shared/getActiveToolForKeyboardEvent.js +2 -2
- package/dist/esm/eventDispatchers/shared/getActiveToolForMouseEvent.js +2 -2
- package/dist/esm/eventDispatchers/shared/getActiveToolForTouchEvent.js +3 -3
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForKeyboardEvents.js +2 -2
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForMouseEvent.js +2 -2
- package/dist/esm/eventDispatchers/shared/getToolsWithModesForMouseEvent.js +2 -2
- package/dist/esm/eventDispatchers/shared/getToolsWithModesForTouchEvent.js +2 -2
- package/dist/esm/eventDispatchers/touchEventHandlers/touchDrag.js +1 -1
- package/dist/esm/eventDispatchers/touchEventHandlers/touchStart.js +1 -1
- package/dist/esm/eventDispatchers/touchEventHandlers/touchStartActivate.js +1 -1
- package/dist/esm/eventListeners/annotations/annotationSelectionListener.js +1 -1
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +21 -20
- package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js +8 -6
- package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js +1 -1
- package/dist/esm/eventListeners/segmentation/segmentationModifiedEventListener.js +1 -1
- package/dist/esm/eventListeners/segmentation/segmentationRepresentationModifiedEventListener.js +1 -1
- package/dist/esm/eventListeners/segmentation/segmentationRepresentationRemovedEventListener.js +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/init.js +2 -2
- package/dist/esm/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js +0 -2
- package/dist/esm/stateManagement/annotation/annotationSelection.js +1 -1
- package/dist/esm/stateManagement/annotation/annotationState.d.ts +2 -2
- package/dist/esm/stateManagement/annotation/annotationState.js +4 -6
- package/dist/esm/stateManagement/annotation/annotationVisibility.js +1 -1
- package/dist/esm/stateManagement/annotation/getAnnotation.d.ts +2 -0
- package/dist/esm/stateManagement/annotation/getAnnotation.js +6 -0
- package/dist/esm/stateManagement/index.d.ts +0 -2
- package/dist/esm/stateManagement/index.js +2 -1
- package/dist/esm/stateManagement/segmentation/SegmentationRenderingEngine.d.ts +3 -1
- package/dist/esm/stateManagement/segmentation/SegmentationRenderingEngine.js +13 -6
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.d.ts +17 -1
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +46 -4
- package/dist/esm/stateManagement/segmentation/activeSegmentation.js +6 -4
- package/dist/esm/stateManagement/segmentation/addColorLUT.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/addColorLUT.js +5 -0
- package/dist/esm/stateManagement/segmentation/addRepresentationData.js +1 -1
- package/dist/esm/stateManagement/segmentation/addSegmentation.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/addSegmentation.js +11 -0
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentation.js +29 -8
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentationState.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentationState.js +10 -0
- package/dist/esm/stateManagement/segmentation/config/segmentationColor.js +8 -6
- package/dist/esm/stateManagement/segmentation/config/segmentationConfig.js +14 -9
- package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.js +8 -5
- package/dist/esm/stateManagement/segmentation/convertVolumeToStackSegmentation.d.ts +0 -8
- package/dist/esm/stateManagement/segmentation/convertVolumeToStackSegmentation.js +3 -33
- package/dist/esm/stateManagement/segmentation/events/triggerSegmentationDataModified.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/events/triggerSegmentationDataModified.js +11 -0
- package/dist/esm/stateManagement/segmentation/events/triggerSegmentationModified.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/events/triggerSegmentationModified.js +18 -0
- package/dist/esm/stateManagement/segmentation/events/triggerSegmentationRemoved.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/events/triggerSegmentationRemoved.js +8 -0
- package/dist/esm/stateManagement/segmentation/events/triggerSegmentationRepresentationModified.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/events/triggerSegmentationRepresentationModified.js +8 -0
- package/dist/esm/stateManagement/segmentation/events/triggerSegmentationRepresentationRemoved.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/events/triggerSegmentationRepresentationRemoved.js +8 -0
- package/dist/esm/stateManagement/segmentation/getActiveSegmentIndex.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/getActiveSegmentIndex.js +7 -0
- package/dist/esm/stateManagement/segmentation/getActiveSegmentationRepresentation.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/getActiveSegmentationRepresentation.js +5 -0
- package/dist/esm/stateManagement/segmentation/getAllSegmentationRepresentations.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/getAllSegmentationRepresentations.js +6 -0
- package/dist/esm/stateManagement/segmentation/getColorLUT.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/getColorLUT.js +5 -0
- package/dist/esm/stateManagement/segmentation/getCurrentLabelmapImageIdForViewport.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/getCurrentLabelmapImageIdForViewport.js +5 -0
- package/dist/esm/stateManagement/segmentation/getGlobalConfig.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/getGlobalConfig.js +5 -0
- package/dist/esm/stateManagement/segmentation/getNextColorLUTIndex.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/getNextColorLUTIndex.js +5 -0
- package/dist/esm/stateManagement/segmentation/getPerSegmentConfig.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/getPerSegmentConfig.js +5 -0
- package/dist/esm/stateManagement/segmentation/getSegmentation.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/getSegmentation.js +5 -0
- package/dist/esm/stateManagement/segmentation/getSegmentationRepresentation.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/getSegmentationRepresentation.js +5 -0
- package/dist/esm/stateManagement/segmentation/getSegmentationRepresentationConfig.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/getSegmentationRepresentationConfig.js +5 -0
- package/dist/esm/stateManagement/segmentation/getSegmentationRepresentationViewportStates.d.ts +7 -0
- package/dist/esm/stateManagement/segmentation/getSegmentationRepresentationViewportStates.js +6 -0
- package/dist/esm/stateManagement/segmentation/getSegmentationRepresentationVisibility.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/getSegmentationRepresentationVisibility.js +5 -0
- package/dist/esm/stateManagement/segmentation/getSegmentationRepresentations.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/getSegmentationRepresentations.js +12 -0
- package/dist/esm/stateManagement/segmentation/getSegmentationRepresentationsForSegmentation.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/getSegmentationRepresentationsForSegmentation.js +5 -0
- package/dist/esm/stateManagement/segmentation/getSegmentations.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/getSegmentations.js +6 -0
- package/dist/esm/stateManagement/segmentation/getViewportIdsWithSegmentation.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/getViewportIdsWithSegmentation.js +10 -0
- package/dist/esm/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.js +1 -1
- package/dist/esm/stateManagement/segmentation/helpers/updateStackSegmentationState.d.ts +8 -0
- package/dist/esm/stateManagement/segmentation/helpers/updateStackSegmentationState.js +31 -0
- package/dist/esm/stateManagement/segmentation/index.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/index.js +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js +3 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.js +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js +3 -3
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js +2 -3
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js +2 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.js +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.js +2 -3
- package/dist/esm/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.js +3 -2
- package/dist/esm/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js +1 -1
- package/dist/esm/stateManagement/segmentation/removeColorLUT.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/removeColorLUT.js +5 -0
- package/dist/esm/stateManagement/segmentation/removeRepresentation.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/removeRepresentation.js +9 -0
- package/dist/esm/stateManagement/segmentation/removeSegmentation.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/removeSegmentation.js +7 -0
- package/dist/esm/stateManagement/segmentation/removeSegmentationRepresentations.js +2 -2
- package/dist/esm/stateManagement/segmentation/segmentIndex.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/segmentIndex.js +5 -9
- package/dist/esm/stateManagement/segmentation/segmentLocking.js +1 -1
- package/dist/esm/stateManagement/segmentation/segmentationState.d.ts +29 -38
- package/dist/esm/stateManagement/segmentation/segmentationState.js +29 -157
- package/dist/esm/stateManagement/segmentation/setActiveSegmentationRepresentation.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/setActiveSegmentationRepresentation.js +9 -0
- package/dist/esm/stateManagement/segmentation/setGlobalConfig.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/setGlobalConfig.js +9 -0
- package/dist/esm/stateManagement/segmentation/setPerSegmentConfig.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/setPerSegmentConfig.js +9 -0
- package/dist/esm/stateManagement/segmentation/setSegmentationRepresentationConfig.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/setSegmentationRepresentationConfig.js +9 -0
- package/dist/esm/stateManagement/segmentation/setSegmentationRepresentationVisibility.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/setSegmentationRepresentationVisibility.js +5 -0
- package/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.d.ts +5 -5
- package/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.js +5 -45
- package/dist/esm/stateManagement/segmentation/updateLabelmapSegmentationImageReferences.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/updateLabelmapSegmentationImageReferences.js +5 -0
- package/dist/esm/store/SynchronizerManager/createSynchronizer.js +1 -1
- package/dist/esm/store/SynchronizerManager/destroy.js +1 -1
- package/dist/esm/store/SynchronizerManager/destroySynchronizer.js +1 -1
- package/dist/esm/store/SynchronizerManager/getAllSynchronizers.js +1 -1
- package/dist/esm/store/SynchronizerManager/getSynchronizer.js +1 -1
- package/dist/esm/store/SynchronizerManager/getSynchronizersForViewport.js +1 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.js +7 -6
- package/dist/esm/store/ToolGroupManager/createToolGroup.js +1 -1
- package/dist/esm/store/ToolGroupManager/destroy.js +3 -3
- package/dist/esm/store/ToolGroupManager/destroyToolGroup.js +1 -2
- package/dist/esm/store/ToolGroupManager/getAllToolGroups.js +1 -1
- package/dist/esm/store/ToolGroupManager/getToolGroup.js +1 -1
- package/dist/esm/store/ToolGroupManager/getToolGroupForViewport.js +1 -1
- package/dist/esm/store/ToolGroupManager/getToolGroupsWithToolName.js +1 -1
- package/dist/esm/store/addTool.d.ts +1 -0
- package/dist/esm/store/addTool.js +3 -0
- package/dist/esm/store/index.d.ts +1 -2
- package/dist/esm/store/index.js +1 -2
- package/dist/esm/tools/AdvancedMagnifyTool.d.ts +93 -2
- package/dist/esm/tools/AdvancedMagnifyTool.js +506 -4
- package/dist/esm/tools/AnnotationEraserTool.js +2 -2
- package/dist/esm/tools/CrosshairsTool.js +1 -1
- package/dist/esm/tools/MagnifyTool.js +1 -1
- package/dist/esm/tools/SculptorTool.js +3 -3
- package/dist/esm/tools/WindowLevelRegionTool.js +1 -1
- package/dist/esm/tools/annotation/AngleTool.js +4 -3
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js +1 -1
- package/dist/esm/tools/annotation/BidirectionalTool.js +2 -3
- package/dist/esm/tools/annotation/CircleROITool.js +7 -8
- package/dist/esm/tools/annotation/CobbAngleTool.js +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js +5 -6
- package/dist/esm/tools/annotation/HeightTool.js +2 -3
- package/dist/esm/tools/annotation/KeyImageTool.js +1 -1
- package/dist/esm/tools/annotation/LengthTool.js +2 -3
- package/dist/esm/tools/annotation/LivewireContourTool.js +3 -2
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts +1 -2
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +7 -7
- package/dist/esm/tools/annotation/ProbeTool.js +3 -4
- package/dist/esm/tools/annotation/RectangleROITool.js +5 -6
- package/dist/esm/tools/annotation/SplineROITool.js +7 -4
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js +6 -7
- package/dist/esm/tools/annotation/VideoRedactionTool.js +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js +2 -2
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/renderMethods.js +1 -1
- package/dist/esm/tools/base/ContourBaseTool.js +2 -2
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js +24 -15
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js +9 -8
- package/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js +3 -3
- package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.js +2 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.d.ts +1 -8
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +19 -25
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js +10 -7
- package/dist/esm/tools/segmentation/BrushTool.js +10 -8
- package/dist/esm/tools/segmentation/CircleROIStartEndThresholdTool.js +4 -5
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +7 -9
- package/dist/esm/tools/segmentation/SegmentSelectTool.js +1 -1
- package/dist/esm/tools/segmentation/strategies/compositions/preview.js +4 -4
- package/dist/esm/utilities/annotationHydration.js +1 -1
- package/dist/esm/utilities/contourSegmentation/addContourSegmentationAnnotation.js +1 -1
- package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.js +2 -2
- package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js +1 -1
- package/dist/esm/utilities/contours/getContourHolesDataWorld.js +1 -1
- package/dist/esm/utilities/contours/index.d.ts +1 -2
- package/dist/esm/utilities/contours/index.js +1 -2
- package/dist/esm/utilities/contours/updateContourPolyline.js +1 -1
- package/dist/esm/utilities/getToolsWithModesForElement.js +2 -2
- package/dist/esm/utilities/index.d.ts +1 -2
- package/dist/esm/utilities/index.js +1 -2
- package/dist/esm/utilities/math/line/distanceToPointSquaredInfo.js +3 -3
- package/dist/esm/utilities/math/polyline/isClosed.js +2 -2
- package/dist/esm/utilities/planarFreehandROITool/smoothAnnotation.js +3 -3
- package/dist/esm/utilities/segmentation/brushSizeForToolGroup.js +1 -1
- package/dist/esm/utilities/segmentation/brushThresholdForToolGroup.js +1 -1
- package/dist/esm/utilities/segmentation/getBrushToolInstances.d.ts +1 -0
- package/dist/esm/utilities/segmentation/getBrushToolInstances.js +17 -0
- package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.d.ts +0 -2
- package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js +3 -22
- package/dist/esm/utilities/segmentation/index.d.ts +2 -2
- package/dist/esm/utilities/segmentation/index.js +2 -2
- package/dist/esm/utilities/segmentation/invalidateBrushCursor.js +1 -4
- package/dist/esm/utilities/segmentation/rectangleROIThresholdVolumeByRange.js +2 -1
- package/dist/esm/utilities/segmentation/segmentContourAction.js +5 -5
- package/dist/esm/utilities/segmentation/utilities.d.ts +4 -1
- package/dist/esm/utilities/segmentation/utilities.js +23 -17
- package/dist/esm/utilities/viewportFilters/filterViewportsWithToolEnabled.js +2 -2
- package/dist/umd/985.index.js.map +1 -1
- package/dist/umd/index.js +2 -1
- package/dist/umd/index.js.LICENSE.txt +6 -0
- package/dist/umd/index.js.map +1 -1
- package/package.json +5 -4
- package/dist/esm/stateManagement/segmentation/convertStackToVolumeSegmentation.d.ts +0 -17
- package/dist/esm/stateManagement/segmentation/convertStackToVolumeSegmentation.js +0 -50
- package/dist/esm/stateManagement/segmentation/helpers/getSegmentationRepresentationRenderingConfig.d.ts +0 -2
- package/dist/esm/stateManagement/segmentation/helpers/getSegmentationRepresentationRenderingConfig.js +0 -11
- package/dist/esm/tools/AdvancedMagnifyViewport.d.ts +0 -76
- package/dist/esm/tools/AdvancedMagnifyViewport.js +0 -351
- package/dist/esm/tools/AdvancedMagnifyViewportManager.d.ts +0 -38
- package/dist/esm/tools/AdvancedMagnifyViewportManager.js +0 -161
- package/dist/esm/utilities/contours/interpolation/index.d.ts +0 -2
- package/dist/esm/utilities/contours/interpolation/index.js +0 -2
- package/dist/esm/utilities/segmentation/triggerSegmentationRender.d.ts +0 -3
- package/dist/esm/utilities/segmentation/triggerSegmentationRender.js +0 -8
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { vec2, vec3 } from 'gl-matrix';
|
|
2
2
|
import { getEnabledElement, utilities as csUtils } from '@cornerstonejs/core';
|
|
3
3
|
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
4
|
-
import { roundNumber } from '../../utilities';
|
|
5
4
|
import { AnnotationTool } from '../base';
|
|
6
5
|
import throttle from '../../utilities/throttle';
|
|
7
6
|
import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement/annotation/annotationState';
|
|
@@ -9,7 +8,7 @@ import { isAnnotationLocked } from '../../stateManagement/annotation/annotationL
|
|
|
9
8
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
10
9
|
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
11
10
|
import { drawLine as drawLineSvg, drawHandles as drawHandlesSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, } from '../../drawingSvg';
|
|
12
|
-
import { state } from '../../store';
|
|
11
|
+
import { state } from '../../store/state';
|
|
13
12
|
import { Events } from '../../enums';
|
|
14
13
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
15
14
|
import * as lineSegment from '../../utilities/math/line';
|
|
@@ -721,7 +720,7 @@ function defaultGetTextLines(data, targetId) {
|
|
|
721
720
|
if (length === undefined) {
|
|
722
721
|
return textLines;
|
|
723
722
|
}
|
|
724
|
-
textLines.push(`L: ${roundNumber(length)} ${lengthUnits || unit}`, `W: ${roundNumber(width)} ${widthUnit || unit}`);
|
|
723
|
+
textLines.push(`L: ${csUtils.roundNumber(length)} ${lengthUnits || unit}`, `W: ${csUtils.roundNumber(width)} ${widthUnit || unit}`);
|
|
725
724
|
return textLines;
|
|
726
725
|
}
|
|
727
726
|
BidirectionalTool.toolName = 'Bidirectional';
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { AnnotationTool } from '../base';
|
|
2
2
|
import { getEnabledElement, VolumeViewport, utilities as csUtils, } from '@cornerstonejs/core';
|
|
3
|
-
import { getCalibratedAspect } from '../../utilities/getCalibratedUnits';
|
|
4
|
-
import { getCalibratedLengthUnitsAndScale, roundNumber } from '../../utilities';
|
|
3
|
+
import { getCalibratedAspect, getCalibratedLengthUnitsAndScale, } from '../../utilities/getCalibratedUnits';
|
|
5
4
|
import throttle from '../../utilities/throttle';
|
|
6
5
|
import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement/annotation/annotationState';
|
|
7
6
|
import { isAnnotationLocked } from '../../stateManagement/annotation/annotationLocking';
|
|
8
7
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
9
8
|
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
10
9
|
import { drawCircle as drawCircleSvg, drawHandles as drawHandlesSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, } from '../../drawingSvg';
|
|
11
|
-
import { state } from '../../store';
|
|
10
|
+
import { state } from '../../store/state';
|
|
12
11
|
import { Events } from '../../enums';
|
|
13
12
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
14
13
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
@@ -566,23 +565,23 @@ function defaultGetTextLines(data, targetId) {
|
|
|
566
565
|
if (radius) {
|
|
567
566
|
const radiusLine = isEmptyArea
|
|
568
567
|
? `Radius: Oblique not supported`
|
|
569
|
-
: `Radius: ${roundNumber(radius)} ${radiusUnit}`;
|
|
568
|
+
: `Radius: ${csUtils.roundNumber(radius)} ${radiusUnit}`;
|
|
570
569
|
textLines.push(radiusLine);
|
|
571
570
|
}
|
|
572
571
|
if (area) {
|
|
573
572
|
const areaLine = isEmptyArea
|
|
574
573
|
? `Area: Oblique not supported`
|
|
575
|
-
: `Area: ${roundNumber(area)} ${areaUnits}`;
|
|
574
|
+
: `Area: ${csUtils.roundNumber(area)} ${areaUnits}`;
|
|
576
575
|
textLines.push(areaLine);
|
|
577
576
|
}
|
|
578
577
|
if (mean) {
|
|
579
|
-
textLines.push(`Mean: ${roundNumber(mean)} ${pixelValueUnits}`);
|
|
578
|
+
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${pixelValueUnits}`);
|
|
580
579
|
}
|
|
581
580
|
if (max) {
|
|
582
|
-
textLines.push(`Max: ${roundNumber(max)} ${pixelValueUnits}`);
|
|
581
|
+
textLines.push(`Max: ${csUtils.roundNumber(max)} ${pixelValueUnits}`);
|
|
583
582
|
}
|
|
584
583
|
if (stdDev) {
|
|
585
|
-
textLines.push(`Std Dev: ${roundNumber(stdDev)} ${pixelValueUnits}`);
|
|
584
|
+
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${pixelValueUnits}`);
|
|
586
585
|
}
|
|
587
586
|
return textLines;
|
|
588
587
|
}
|
|
@@ -10,7 +10,7 @@ import * as lineSegment from '../../utilities/math/line';
|
|
|
10
10
|
import angleBetweenLines from '../../utilities/math/angle/angleBetweenLines';
|
|
11
11
|
import { midPoint2 } from '../../utilities/math/midPoint';
|
|
12
12
|
import { drawHandles as drawHandlesSvg, drawLine as drawLineSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, drawTextBox as drawTextBoxSvg, } from '../../drawingSvg';
|
|
13
|
-
import { state } from '../../store';
|
|
13
|
+
import { state } from '../../store/state';
|
|
14
14
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
15
15
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
16
16
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { AnnotationTool } from '../base';
|
|
2
2
|
import { getEnabledElement, VolumeViewport, utilities as csUtils, } from '@cornerstonejs/core';
|
|
3
3
|
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
4
|
-
import { roundNumber } from '../../utilities';
|
|
5
4
|
import throttle from '../../utilities/throttle';
|
|
6
5
|
import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement/annotation/annotationState';
|
|
7
6
|
import { isAnnotationLocked } from '../../stateManagement/annotation/annotationLocking';
|
|
8
7
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
9
8
|
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
10
9
|
import { drawCircle as drawCircleSvg, drawEllipseByCoordinates as drawEllipseSvg, drawHandles as drawHandlesSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, } from '../../drawingSvg';
|
|
11
|
-
import { state } from '../../store';
|
|
10
|
+
import { state } from '../../store/state';
|
|
12
11
|
import { Events } from '../../enums';
|
|
13
12
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
14
13
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
@@ -657,17 +656,17 @@ function defaultGetTextLines(data, targetId) {
|
|
|
657
656
|
if (area) {
|
|
658
657
|
const areaLine = isEmptyArea
|
|
659
658
|
? `Area: Oblique not supported`
|
|
660
|
-
: `Area: ${roundNumber(area)} ${areaUnits}`;
|
|
659
|
+
: `Area: ${csUtils.roundNumber(area)} ${areaUnits}`;
|
|
661
660
|
textLines.push(areaLine);
|
|
662
661
|
}
|
|
663
662
|
if (mean) {
|
|
664
|
-
textLines.push(`Mean: ${roundNumber(mean)} ${pixelValueUnits}`);
|
|
663
|
+
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${pixelValueUnits}`);
|
|
665
664
|
}
|
|
666
665
|
if (max) {
|
|
667
|
-
textLines.push(`Max: ${roundNumber(max)} ${pixelValueUnits}`);
|
|
666
|
+
textLines.push(`Max: ${csUtils.roundNumber(max)} ${pixelValueUnits}`);
|
|
668
667
|
}
|
|
669
668
|
if (stdDev) {
|
|
670
|
-
textLines.push(`Std Dev: ${roundNumber(stdDev)} ${pixelValueUnits}`);
|
|
669
|
+
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${pixelValueUnits}`);
|
|
671
670
|
}
|
|
672
671
|
return textLines;
|
|
673
672
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Events } from '../../enums';
|
|
2
2
|
import { getEnabledElement, utilities as csUtils } from '@cornerstonejs/core';
|
|
3
3
|
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
4
|
-
import { roundNumber } from '../../utilities';
|
|
5
4
|
import { AnnotationTool } from '../base';
|
|
6
5
|
import throttle from '../../utilities/throttle';
|
|
7
6
|
import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement/annotation/annotationState';
|
|
@@ -10,7 +9,7 @@ import { isAnnotationVisible } from '../../stateManagement/annotation/annotation
|
|
|
10
9
|
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
11
10
|
import * as lineSegment from '../../utilities/math/line';
|
|
12
11
|
import { drawHandles as drawHandlesSvg, drawHeight as drawHeightSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, } from '../../drawingSvg';
|
|
13
|
-
import { state } from '../../store';
|
|
12
|
+
import { state } from '../../store/state';
|
|
14
13
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
15
14
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
16
15
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
@@ -428,7 +427,7 @@ function defaultGetTextLines(data, targetId) {
|
|
|
428
427
|
if (height === undefined || height === null || isNaN(height)) {
|
|
429
428
|
return;
|
|
430
429
|
}
|
|
431
|
-
const textLines = [`${roundNumber(height)} ${lengthUnits}`];
|
|
430
|
+
const textLines = [`${csUtils.roundNumber(height)} ${lengthUnits}`];
|
|
432
431
|
return textLines;
|
|
433
432
|
}
|
|
434
433
|
HeightTool.toolName = 'Height';
|
|
@@ -4,7 +4,7 @@ import { AnnotationTool } from '../base';
|
|
|
4
4
|
import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement/annotation/annotationState';
|
|
5
5
|
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
6
6
|
import { drawArrow as drawArrowSvg } from '../../drawingSvg';
|
|
7
|
-
import { state } from '../../store';
|
|
7
|
+
import { state } from '../../store/state';
|
|
8
8
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
9
9
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
10
10
|
import { resetElementCursor } from '../../cursors/elementCursor';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Events } from '../../enums';
|
|
2
2
|
import { getEnabledElement, utilities as csUtils } from '@cornerstonejs/core';
|
|
3
3
|
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
4
|
-
import { roundNumber } from '../../utilities';
|
|
5
4
|
import { AnnotationTool } from '../base';
|
|
6
5
|
import throttle from '../../utilities/throttle';
|
|
7
6
|
import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement/annotation/annotationState';
|
|
@@ -10,7 +9,7 @@ import { isAnnotationVisible } from '../../stateManagement/annotation/annotation
|
|
|
10
9
|
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
11
10
|
import * as lineSegment from '../../utilities/math/line';
|
|
12
11
|
import { drawHandles as drawHandlesSvg, drawLine as drawLineSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, } from '../../drawingSvg';
|
|
13
|
-
import { state } from '../../store';
|
|
12
|
+
import { state } from '../../store/state';
|
|
14
13
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
15
14
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
16
15
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
@@ -420,7 +419,7 @@ function defaultGetTextLines(data, targetId) {
|
|
|
420
419
|
if (length === undefined || length === null || isNaN(length)) {
|
|
421
420
|
return;
|
|
422
421
|
}
|
|
423
|
-
const textLines = [`${roundNumber(length)} ${lengthUnits}`];
|
|
422
|
+
const textLines = [`${csUtils.roundNumber(length)} ${lengthUnits}`];
|
|
424
423
|
return textLines;
|
|
425
424
|
}
|
|
426
425
|
LengthTool.toolName = 'Length';
|
|
@@ -2,11 +2,12 @@ import { vec3 } from 'gl-matrix';
|
|
|
2
2
|
import { getEnabledElement, utilities as csUtils, VolumeViewport, } from '@cornerstonejs/core';
|
|
3
3
|
import { removeAnnotation } from '../../stateManagement/annotation/annotationState';
|
|
4
4
|
import { drawHandles as drawHandlesSvg } from '../../drawingSvg';
|
|
5
|
-
import { state } from '../../store';
|
|
5
|
+
import { state } from '../../store/state';
|
|
6
6
|
import { Events, KeyboardBindings, ChangeTypes } from '../../enums';
|
|
7
7
|
import { resetElementCursor } from '../../cursors/elementCursor';
|
|
8
8
|
import getMouseModifierKey from '../../eventDispatchers/shared/getMouseModifier';
|
|
9
|
-
import
|
|
9
|
+
import * as math from '../../utilities/math';
|
|
10
|
+
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
10
11
|
import findHandlePolylineIndex from '../../utilities/contours/findHandlePolylineIndex';
|
|
11
12
|
import { ContourWindingDirection } from '../../types/ContourAnnotation';
|
|
12
13
|
import { triggerAnnotationModified, triggerContourAnnotationCompleted, } from '../../stateManagement/annotation/helpers/state';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { PublicToolProps } from '../../types';
|
|
2
|
-
import type { AnnotationRenderContext } from '../../types';
|
|
1
|
+
import type { AnnotationRenderContext, PublicToolProps } from '../../types';
|
|
3
2
|
import PlanarFreehandROITool from './PlanarFreehandROITool';
|
|
4
3
|
declare class PlanarFreehandContourSegmentationTool extends PlanarFreehandROITool {
|
|
5
4
|
static toolName: any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CONSTANTS, getEnabledElement, VolumeViewport, utilities as csUtils, } from '@cornerstonejs/core';
|
|
2
2
|
import { vec3 } from 'gl-matrix';
|
|
3
3
|
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
4
|
-
import
|
|
4
|
+
import * as math from '../../utilities/math';
|
|
5
5
|
import { polyline } from '../../utilities/math';
|
|
6
6
|
import { filterAnnotationsForDisplay } from '../../utilities/planar';
|
|
7
7
|
import throttle from '../../utilities/throttle';
|
|
@@ -506,23 +506,23 @@ function defaultGetTextLines(data, targetId) {
|
|
|
506
506
|
if (area) {
|
|
507
507
|
const areaLine = isEmptyArea
|
|
508
508
|
? `Area: Oblique not supported`
|
|
509
|
-
: `Area: ${roundNumber(area)} ${areaUnits}`;
|
|
509
|
+
: `Area: ${csUtils.roundNumber(area)} ${areaUnits}`;
|
|
510
510
|
textLines.push(areaLine);
|
|
511
511
|
}
|
|
512
512
|
if (mean) {
|
|
513
|
-
textLines.push(`Mean: ${roundNumber(mean)} ${pixelValueUnits}`);
|
|
513
|
+
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${pixelValueUnits}`);
|
|
514
514
|
}
|
|
515
515
|
if (Number.isFinite(max)) {
|
|
516
|
-
textLines.push(`Max: ${roundNumber(max)} ${pixelValueUnits}`);
|
|
516
|
+
textLines.push(`Max: ${csUtils.roundNumber(max)} ${pixelValueUnits}`);
|
|
517
517
|
}
|
|
518
518
|
if (stdDev) {
|
|
519
|
-
textLines.push(`Std Dev: ${roundNumber(stdDev)} ${pixelValueUnits}`);
|
|
519
|
+
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${pixelValueUnits}`);
|
|
520
520
|
}
|
|
521
521
|
if (perimeter) {
|
|
522
|
-
textLines.push(`Perimeter: ${roundNumber(perimeter)} ${lengthUnits}`);
|
|
522
|
+
textLines.push(`Perimeter: ${csUtils.roundNumber(perimeter)} ${lengthUnits}`);
|
|
523
523
|
}
|
|
524
524
|
if (length) {
|
|
525
|
-
textLines.push(`${roundNumber(length)} ${lengthUnits}`);
|
|
525
|
+
textLines.push(`${csUtils.roundNumber(length)} ${lengthUnits}`);
|
|
526
526
|
}
|
|
527
527
|
return textLines;
|
|
528
528
|
}
|
|
@@ -5,10 +5,9 @@ import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateMan
|
|
|
5
5
|
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
6
6
|
import { getCalibratedProbeUnitsAndValue } from '../../utilities/getCalibratedUnits';
|
|
7
7
|
import { drawHandles as drawHandlesSvg, drawTextBox as drawTextBoxSvg, } from '../../drawingSvg';
|
|
8
|
-
import { state } from '../../store';
|
|
8
|
+
import { state } from '../../store/state';
|
|
9
9
|
import { Events } from '../../enums';
|
|
10
10
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
11
|
-
import { roundNumber } from '../../utilities';
|
|
12
11
|
import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
|
|
13
12
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
14
13
|
import { getPixelValueUnits } from '../../utilities/getPixelValueUnits';
|
|
@@ -323,11 +322,11 @@ function defaultGetTextLines(data, targetId) {
|
|
|
323
322
|
textLines.push(`(${index[0]}, ${index[1]}, ${index[2]})`);
|
|
324
323
|
if (value instanceof Array && pixelValueUnits instanceof Array) {
|
|
325
324
|
for (let i = 0; i < value.length; i++) {
|
|
326
|
-
textLines.push(`${roundNumber(value[i])} ${pixelValueUnits[i]}`);
|
|
325
|
+
textLines.push(`${csUtils.roundNumber(value[i])} ${pixelValueUnits[i]}`);
|
|
327
326
|
}
|
|
328
327
|
}
|
|
329
328
|
else {
|
|
330
|
-
textLines.push(`${roundNumber(value)} ${pixelValueUnits}`);
|
|
329
|
+
textLines.push(`${csUtils.roundNumber(value)} ${pixelValueUnits}`);
|
|
331
330
|
}
|
|
332
331
|
return textLines;
|
|
333
332
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { AnnotationTool } from '../base';
|
|
2
2
|
import { getEnabledElement, VolumeViewport, utilities as csUtils, } from '@cornerstonejs/core';
|
|
3
3
|
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
4
|
-
import { roundNumber } from '../../utilities';
|
|
5
4
|
import throttle from '../../utilities/throttle';
|
|
6
5
|
import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement';
|
|
7
6
|
import { isAnnotationLocked } from '../../stateManagement/annotation/annotationLocking';
|
|
8
7
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
9
8
|
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
10
9
|
import { drawHandles as drawHandlesSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, drawRectByCoordinates as drawRectSvg, } from '../../drawingSvg';
|
|
11
|
-
import { state } from '../../store';
|
|
10
|
+
import { state } from '../../store/state';
|
|
12
11
|
import { Events } from '../../enums';
|
|
13
12
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
14
13
|
import * as rectangle from '../../utilities/math/rectangle';
|
|
@@ -538,10 +537,10 @@ function defaultGetTextLines(data, targetId) {
|
|
|
538
537
|
return;
|
|
539
538
|
}
|
|
540
539
|
const textLines = [];
|
|
541
|
-
textLines.push(`Area: ${roundNumber(area)} ${areaUnits}`);
|
|
542
|
-
textLines.push(`Mean: ${roundNumber(mean)} ${pixelValueUnits}`);
|
|
543
|
-
textLines.push(`Max: ${roundNumber(max)} ${pixelValueUnits}`);
|
|
544
|
-
textLines.push(`Std Dev: ${roundNumber(stdDev)} ${pixelValueUnits}`);
|
|
540
|
+
textLines.push(`Area: ${csUtils.roundNumber(area)} ${areaUnits}`);
|
|
541
|
+
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${pixelValueUnits}`);
|
|
542
|
+
textLines.push(`Max: ${csUtils.roundNumber(max)} ${pixelValueUnits}`);
|
|
543
|
+
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${pixelValueUnits}`);
|
|
545
544
|
return textLines;
|
|
546
545
|
}
|
|
547
546
|
RectangleROITool.toolName = 'RectangleROI';
|
|
@@ -2,19 +2,22 @@ import { getEnabledElement, eventTarget, triggerEvent, utilities, } from '@corne
|
|
|
2
2
|
import { vec3 } from 'gl-matrix';
|
|
3
3
|
import { getChildAnnotations, removeAnnotation, } from '../../stateManagement/annotation/annotationState';
|
|
4
4
|
import { drawHandles as drawHandlesSvg, drawPolyline as drawPolylineSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, } from '../../drawingSvg';
|
|
5
|
-
import { state } from '../../store';
|
|
5
|
+
import { state } from '../../store/state';
|
|
6
6
|
import { Events, MouseBindings, KeyboardBindings, ChangeTypes, } from '../../enums';
|
|
7
7
|
import { resetElementCursor } from '../../cursors/elementCursor';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import * as math from '../../utilities/math';
|
|
9
|
+
import throttle from '../../utilities/throttle';
|
|
10
10
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
11
11
|
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
12
|
+
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
13
|
+
import getMouseModifierKey from '../../eventDispatchers/shared/getMouseModifier';
|
|
12
14
|
import { ContourWindingDirection } from '../../types/ContourAnnotation';
|
|
13
15
|
import { CardinalSpline } from './splines/CardinalSpline';
|
|
14
16
|
import { LinearSpline } from './splines/LinearSpline';
|
|
15
17
|
import { CatmullRomSpline } from './splines/CatmullRomSpline';
|
|
16
18
|
import { BSpline } from './splines/BSpline';
|
|
17
19
|
import ContourSegmentationBaseTool from '../base/ContourSegmentationBaseTool';
|
|
20
|
+
import { triggerAnnotationRenderForViewportIds } from '../../utilities';
|
|
18
21
|
const SPLINE_MIN_POINTS = 3;
|
|
19
22
|
const SPLINE_CLICK_CLOSE_CURVE_DIST = 10;
|
|
20
23
|
const DEFAULT_SPLINE_CONFIG = {
|
|
@@ -717,7 +720,7 @@ function defaultGetTextLines(data, targetId) {
|
|
|
717
720
|
if (area) {
|
|
718
721
|
const areaLine = isEmptyArea
|
|
719
722
|
? `Area: Oblique not supported`
|
|
720
|
-
: `Area: ${roundNumber(area)} ${areaUnits}`;
|
|
723
|
+
: `Area: ${utilities.roundNumber(area)} ${areaUnits}`;
|
|
721
724
|
textLines.push(areaLine);
|
|
722
725
|
}
|
|
723
726
|
return textLines;
|
|
@@ -5,9 +5,8 @@ import throttle from '../../utilities/throttle';
|
|
|
5
5
|
import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement/annotation/annotationState';
|
|
6
6
|
import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
|
|
7
7
|
import { drawHandle as drawHandleSvg, drawLine as drawLineSvg, drawLinkedTextBox as drawLinkedTextBoxSvg, } from '../../drawingSvg';
|
|
8
|
-
import { state } from '../../store';
|
|
8
|
+
import { state } from '../../store/state';
|
|
9
9
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
10
|
-
import { roundNumber } from '../../utilities';
|
|
11
10
|
import { distanceToPoint } from '../../utilities/math/point';
|
|
12
11
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
13
12
|
import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
|
|
@@ -439,23 +438,23 @@ function defaultGetTextLines(data, targetId, configuration) {
|
|
|
439
438
|
const cachedStats = data.cachedStats[targetId];
|
|
440
439
|
const { xValues, yValues, units, isUnitless, isHorizontal } = cachedStats;
|
|
441
440
|
if (isUnitless) {
|
|
442
|
-
return [`${roundNumber(xValues[0])} px`];
|
|
441
|
+
return [`${csUtils.roundNumber(xValues[0])} px`];
|
|
443
442
|
}
|
|
444
443
|
if (configuration.displayBothAxesDistances) {
|
|
445
444
|
const dist1 = Math.abs(xValues[1] - xValues[0]);
|
|
446
445
|
const dist2 = Math.abs(yValues[1] - yValues[0]);
|
|
447
446
|
return [
|
|
448
|
-
`${roundNumber(dist1)} ${units[0]}`,
|
|
449
|
-
`${roundNumber(dist2)} ${units[1]}`,
|
|
447
|
+
`${csUtils.roundNumber(dist1)} ${units[0]}`,
|
|
448
|
+
`${csUtils.roundNumber(dist2)} ${units[1]}`,
|
|
450
449
|
];
|
|
451
450
|
}
|
|
452
451
|
if (isHorizontal) {
|
|
453
452
|
const dist = Math.abs(xValues[1] - xValues[0]);
|
|
454
|
-
return [`${roundNumber(dist)} ${units[0]}`];
|
|
453
|
+
return [`${csUtils.roundNumber(dist)} ${units[0]}`];
|
|
455
454
|
}
|
|
456
455
|
else {
|
|
457
456
|
const dist = Math.abs(yValues[1] - yValues[0]);
|
|
458
|
-
return [`${roundNumber(dist)} ${units[1]}`];
|
|
457
|
+
return [`${csUtils.roundNumber(dist)} ${units[1]}`];
|
|
459
458
|
}
|
|
460
459
|
}
|
|
461
460
|
UltrasoundDirectionalTool.toolName = 'UltrasoundDirectionalTool';
|
|
@@ -4,7 +4,7 @@ import { AnnotationTool } from '../base';
|
|
|
4
4
|
import throttle from '../../utilities/throttle';
|
|
5
5
|
import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement';
|
|
6
6
|
import { drawHandles as drawHandlesSvg, drawRedactionRect as drawRedactionRectSvg, } from '../../drawingSvg';
|
|
7
|
-
import { state } from '../../store';
|
|
7
|
+
import { state } from '../../store/state';
|
|
8
8
|
import { Events } from '../../enums';
|
|
9
9
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
10
10
|
import * as rectangle from '../../utilities/math/rectangle';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { vec3, vec2 } from 'gl-matrix';
|
|
2
2
|
import { getEnabledElement } from '@cornerstonejs/core';
|
|
3
|
-
import { state } from '../../../store';
|
|
3
|
+
import { state } from '../../../store/state';
|
|
4
4
|
import { Events } from '../../../enums';
|
|
5
5
|
import { resetElementCursor, hideElementCursor, } from '../../../cursors/elementCursor';
|
|
6
6
|
import { polyline } from '../../../utilities/math';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getEnabledElement, utilities } from '@cornerstonejs/core';
|
|
2
2
|
import { resetElementCursor, hideElementCursor, } from '../../../cursors/elementCursor';
|
|
3
3
|
import { Events } from '../../../enums';
|
|
4
|
-
import { state } from '../../../store';
|
|
4
|
+
import { state } from '../../../store/state';
|
|
5
5
|
import { vec3 } from 'gl-matrix';
|
|
6
6
|
import { shouldSmooth, getInterpolatedPoints, } from '../../../utilities/planarFreehandROITool/smoothPoints';
|
|
7
7
|
import getMouseModifierKey from '../../../eventDispatchers/shared/getMouseModifier';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { vec3, vec2 } from 'gl-matrix';
|
|
2
2
|
import { getEnabledElement } from '@cornerstonejs/core';
|
|
3
|
-
import { state } from '../../../store';
|
|
3
|
+
import { state } from '../../../store/state';
|
|
4
4
|
import { Events } from '../../../enums';
|
|
5
5
|
import { resetElementCursor, hideElementCursor, } from '../../../cursors/elementCursor';
|
|
6
6
|
import { polyline } from '../../../utilities/math';
|
|
7
7
|
import { shouldSmooth, getInterpolatedPoints, } from '../../../utilities/planarFreehandROITool/smoothPoints';
|
|
8
8
|
import triggerAnnotationRenderForViewportIds from '../../../utilities/triggerAnnotationRenderForViewportIds';
|
|
9
|
-
import
|
|
9
|
+
import updateContourPolyline from '../../../utilities/contours/updateContourPolyline';
|
|
10
10
|
import findOpenUShapedContourVectorToPeak from './findOpenUShapedContourVectorToPeak';
|
|
11
11
|
import { triggerAnnotationModified } from '../../../stateManagement/annotation/helpers/state';
|
|
12
12
|
const { addCanvasPointsToArray, getSubPixelSpacingAndXYDirections } = polyline;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getEnabledElement } from '@cornerstonejs/core';
|
|
2
|
-
import { state } from '../../../store';
|
|
2
|
+
import { state } from '../../../store/state';
|
|
3
3
|
import { Events } from '../../../enums';
|
|
4
4
|
import { hideElementCursor } from '../../../cursors/elementCursor';
|
|
5
5
|
import { polyline } from '../../../utilities/math';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { drawHandles as drawHandlesSvg, drawPolyline as drawPolylineSvg, drawPath as drawPathSvg, } from '../../../drawingSvg';
|
|
2
2
|
import { polyline } from '../../../utilities/math';
|
|
3
3
|
import { findOpenUShapedContourVectorToPeakOnRender } from './findOpenUShapedContourVectorToPeak';
|
|
4
|
-
import
|
|
4
|
+
import getContourHolesDataCanvas from '../../../utilities/contours/getContourHolesDataCanvas';
|
|
5
5
|
const { pointsAreWithinCloseContourProximity } = polyline;
|
|
6
6
|
function _getRenderingOptions(enabledElement, annotation) {
|
|
7
7
|
const styleSpecifier = {
|
|
@@ -2,8 +2,8 @@ import { getEnabledElement } from '@cornerstonejs/core';
|
|
|
2
2
|
import { addAnnotation, getAnnotations, getChildAnnotations, } from '../../stateManagement/annotation/annotationState';
|
|
3
3
|
import { drawPath as drawPathSvg } from '../../drawingSvg';
|
|
4
4
|
import AnnotationTool from './AnnotationTool';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import updateContourPolyline from '../../utilities/contours/updateContourPolyline';
|
|
6
|
+
import getContourHolesDataCanvas from '../../utilities/contours/getContourHolesDataCanvas';
|
|
7
7
|
class ContourBaseTool extends AnnotationTool {
|
|
8
8
|
constructor(toolProps, defaultToolProps) {
|
|
9
9
|
super(toolProps, defaultToolProps);
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { getEnabledElement, utilities } from '@cornerstonejs/core';
|
|
2
|
-
import {
|
|
2
|
+
import { getGlobalConfig, getSegmentationRepresentationConfig, getSegmentIndexConfig, } from '../../stateManagement/segmentation/config/segmentationConfig';
|
|
3
|
+
import { getSegmentation } from '../../stateManagement/segmentation/getSegmentation';
|
|
3
4
|
import { SegmentationRepresentations } from '../../enums';
|
|
4
5
|
import ContourBaseTool from './ContourBaseTool';
|
|
5
6
|
import { triggerSegmentationDataModified } from '../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
6
|
-
import
|
|
7
|
+
import InterpolationManager from '../../utilities/segmentation/InterpolationManager/InterpolationManager';
|
|
7
8
|
import { addContourSegmentationAnnotation, removeContourSegmentationAnnotation, } from '../../utilities/contourSegmentation';
|
|
8
|
-
import { triggerAnnotationRenderForToolGroupIds } from '../../utilities';
|
|
9
|
-
import { getActiveSegmentationRepresentation, getSegmentationRepresentationsForSegmentation, getSegmentationRepresentations, getViewportIdsWithSegmentation, } from '../../stateManagement/segmentation/segmentationState';
|
|
9
|
+
import { triggerAnnotationRenderForToolGroupIds } from '../../utilities/triggerAnnotationRenderForToolGroupIds';
|
|
10
10
|
import { getToolGroupForViewport } from '../../store/ToolGroupManager';
|
|
11
|
+
import { getSegmentIndexColor } from '../../stateManagement/segmentation/config/segmentationColor';
|
|
12
|
+
import { getSegmentationRepresentations } from '../../stateManagement/segmentation/getSegmentationRepresentations';
|
|
13
|
+
import { getSegmentationRepresentationsForSegmentation } from '../../stateManagement/segmentation/getSegmentationRepresentationsForSegmentation';
|
|
14
|
+
import { getActiveSegmentationRepresentation } from '../../stateManagement/segmentation/getActiveSegmentationRepresentation';
|
|
15
|
+
import { getSegmentationRepresentationVisibility } from '../../stateManagement/segmentation/getSegmentationRepresentationVisibility';
|
|
16
|
+
import { getViewportIdsWithSegmentation } from '../../stateManagement/segmentation/getViewportIdsWithSegmentation';
|
|
17
|
+
import { getActiveSegmentIndex } from '../../stateManagement/segmentation/getActiveSegmentIndex';
|
|
18
|
+
import { getLockedSegmentIndices } from '../../stateManagement/segmentation/segmentLocking';
|
|
19
|
+
import { getSegmentIndexVisibility } from '../../stateManagement/segmentation/config/segmentationVisibility';
|
|
11
20
|
class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
12
21
|
constructor(toolProps, defaultToolProps) {
|
|
13
22
|
super(toolProps, defaultToolProps);
|
|
@@ -30,7 +39,7 @@ class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
|
30
39
|
if (!this.isContourSegmentationTool()) {
|
|
31
40
|
return contourAnnotation;
|
|
32
41
|
}
|
|
33
|
-
const activeSeg =
|
|
42
|
+
const activeSeg = getActiveSegmentationRepresentation(viewport.id);
|
|
34
43
|
if (!activeSeg) {
|
|
35
44
|
throw new Error('No active segmentation detected, create one before using scissors tool');
|
|
36
45
|
}
|
|
@@ -39,7 +48,7 @@ class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
|
39
48
|
throw new Error(`A contour segmentation must be active`);
|
|
40
49
|
}
|
|
41
50
|
const { segmentationId } = activeSeg;
|
|
42
|
-
const segmentIndex =
|
|
51
|
+
const segmentIndex = getActiveSegmentIndex(segmentationId);
|
|
43
52
|
return utilities.deepMerge(contourAnnotation, {
|
|
44
53
|
data: {
|
|
45
54
|
segmentation: {
|
|
@@ -90,7 +99,7 @@ class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
|
90
99
|
_getContourSegmentationStyle(context) {
|
|
91
100
|
const annotation = context.annotation;
|
|
92
101
|
const { segmentationId, segmentIndex } = annotation.data.segmentation;
|
|
93
|
-
const segmentation =
|
|
102
|
+
const segmentation = getSegmentation(segmentationId);
|
|
94
103
|
const segmentationRepresentations = getSegmentationRepresentationsForSegmentation(segmentationId);
|
|
95
104
|
if (!segmentationRepresentations?.length) {
|
|
96
105
|
return {};
|
|
@@ -107,19 +116,19 @@ class ContourSegmentationBaseTool extends ContourBaseTool {
|
|
|
107
116
|
}
|
|
108
117
|
const { segmentationRepresentationUID } = segmentationRepresentation;
|
|
109
118
|
const { autoGenerated } = annotation;
|
|
110
|
-
const segmentsLocked =
|
|
119
|
+
const segmentsLocked = getLockedSegmentIndices(segmentationId);
|
|
111
120
|
const annotationLocked = segmentsLocked.includes(segmentIndex);
|
|
112
|
-
const segmentColor =
|
|
121
|
+
const segmentColor = getSegmentIndexColor(segmentationRepresentationUID, segmentIndex);
|
|
113
122
|
const viewportId = context.styleSpecifier.viewportId;
|
|
114
|
-
const segmentationVisible =
|
|
115
|
-
const globalConfig =
|
|
116
|
-
const
|
|
117
|
-
const segmentConfig =
|
|
118
|
-
const segmentVisible =
|
|
123
|
+
const segmentationVisible = getSegmentationRepresentationVisibility(viewportId, segmentationRepresentationUID);
|
|
124
|
+
const globalConfig = getGlobalConfig();
|
|
125
|
+
const segmentationRepresentationConfig = getSegmentationRepresentationConfig(segmentationRepresentationUID);
|
|
126
|
+
const segmentConfig = getSegmentIndexConfig(segmentationRepresentationUID, segmentIndex);
|
|
127
|
+
const segmentVisible = getSegmentIndexVisibility(viewportId, segmentationRepresentationUID, segmentIndex);
|
|
119
128
|
const activeSegRep = getActiveSegmentationRepresentation(viewportId);
|
|
120
129
|
const isActive = activeSegRep.segmentationRepresentationUID ===
|
|
121
130
|
segmentationRepresentationUID;
|
|
122
|
-
const mergedConfig = Object.assign({}, globalConfig?.representations?.CONTOUR ?? {},
|
|
131
|
+
const mergedConfig = Object.assign({}, globalConfig?.representations?.CONTOUR ?? {}, segmentationRepresentationConfig?.CONTOUR ?? {}, segmentConfig?.CONTOUR ?? {});
|
|
123
132
|
let lineWidth = 1;
|
|
124
133
|
let lineDash = undefined;
|
|
125
134
|
let lineOpacity = 1;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getEnabledElementByViewportId } from '@cornerstonejs/core';
|
|
2
2
|
import Representations from '../../../enums/SegmentationRepresentations';
|
|
3
|
-
import * as SegmentationState from '../../../stateManagement/segmentation/segmentationState';
|
|
4
|
-
import removeContourFromElement from './removeContourFromElement';
|
|
5
3
|
import { deleteConfigCache } from './contourHandler/contourConfigCache';
|
|
6
|
-
import { polySeg } from '../../../stateManagement/segmentation';
|
|
7
4
|
import { handleContourSegmentation } from './contourHandler/handleContourSegmentation';
|
|
5
|
+
import { removeRepresentation as _removeRepresentation } from '../../../stateManagement/segmentation/removeRepresentation';
|
|
6
|
+
import { getSegmentation } from '../../../stateManagement/segmentation/getSegmentation';
|
|
7
|
+
import { canComputeRequestedRepresentation } from '../../../stateManagement/segmentation/polySeg/canComputeRequestedRepresentation';
|
|
8
|
+
import { computeAndAddContourRepresentation } from '../../../stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation';
|
|
8
9
|
let polySegConversionInProgress = false;
|
|
9
10
|
function removeRepresentation(viewportId, segmentationRepresentationUID, renderImmediate = false) {
|
|
10
11
|
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
@@ -12,7 +13,7 @@ function removeRepresentation(viewportId, segmentationRepresentationUID, renderI
|
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
15
|
const { viewport } = enabledElement;
|
|
15
|
-
|
|
16
|
+
_removeRepresentation(segmentationRepresentationUID);
|
|
16
17
|
deleteConfigCache(segmentationRepresentationUID);
|
|
17
18
|
if (!renderImmediate) {
|
|
18
19
|
return;
|
|
@@ -21,16 +22,16 @@ function removeRepresentation(viewportId, segmentationRepresentationUID, renderI
|
|
|
21
22
|
}
|
|
22
23
|
async function render(viewport, contourRepresentation) {
|
|
23
24
|
const { segmentationId } = contourRepresentation;
|
|
24
|
-
const segmentation =
|
|
25
|
+
const segmentation = getSegmentation(segmentationId);
|
|
25
26
|
if (!segmentation) {
|
|
26
27
|
return;
|
|
27
28
|
}
|
|
28
29
|
let contourData = segmentation.representationData[Representations.Contour];
|
|
29
30
|
if (!contourData &&
|
|
30
|
-
|
|
31
|
+
canComputeRequestedRepresentation(contourRepresentation.segmentationRepresentationUID) &&
|
|
31
32
|
!polySegConversionInProgress) {
|
|
32
33
|
polySegConversionInProgress = true;
|
|
33
|
-
contourData = await
|
|
34
|
+
contourData = await computeAndAddContourRepresentation(segmentationId, {
|
|
34
35
|
segmentationRepresentationUID: contourRepresentation.segmentationRepresentationUID,
|
|
35
36
|
viewport,
|
|
36
37
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { addAnnotation } from '../../../../stateManagement';
|
|
1
|
+
import { addAnnotation } from '../../../../stateManagement/annotation/annotationState';
|
|
2
2
|
import { cache, utilities } from '@cornerstonejs/core';
|
|
3
3
|
import { getClosestImageIdForStackViewport } from '../../../../utilities/annotationHydration';
|
|
4
4
|
import { getConfigCache, setConfigCache } from './contourConfigCache';
|
|
5
5
|
import { addContourSegmentationAnnotation } from '../../../../utilities/contourSegmentation';
|
|
6
6
|
import { validateGeometry } from './utils';
|
|
7
|
-
import { getGlobalConfig
|
|
7
|
+
import { getGlobalConfig } from '../../../../stateManagement/segmentation/getGlobalConfig';
|
|
8
8
|
import { getHiddenSegmentIndices } from '../../../../stateManagement/segmentation/config/segmentationVisibility';
|
|
9
|
-
import { getSegmentIndexConfig } from '../../../../stateManagement/segmentation/config';
|
|
9
|
+
import { getSegmentIndexConfig } from '../../../../stateManagement/segmentation/config/segmentationConfig';
|
|
10
10
|
function handleContourSegmentation(viewport, geometryIds, annotationUIDsMap, contourRepresentation) {
|
|
11
11
|
const addOrUpdateFn = annotationUIDsMap.size
|
|
12
12
|
? updateContourSets
|