@cornerstonejs/tools 2.0.0-beta.21 → 2.0.0-beta.23
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 +4 -3
- package/dist/esm/index.js +4 -3
- 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 +2 -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 +7 -8
- package/dist/esm/tools/annotation/CircleROITool.js +15 -16
- package/dist/esm/tools/annotation/CobbAngleTool.js +1 -1
- package/dist/esm/tools/annotation/DragProbeTool.js +2 -2
- package/dist/esm/tools/annotation/EllipticalROITool.js +12 -13
- package/dist/esm/tools/annotation/HeightTool.js +5 -6
- package/dist/esm/tools/annotation/KeyImageTool.js +1 -1
- package/dist/esm/tools/annotation/LengthTool.js +5 -6
- 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.d.ts +4 -4
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +20 -20
- package/dist/esm/tools/annotation/ProbeTool.js +9 -10
- package/dist/esm/tools/annotation/RectangleROITool.js +12 -13
- package/dist/esm/tools/annotation/SplineROITool.js +12 -9
- 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/index.d.ts +1 -3
- package/dist/esm/tools/index.js +1 -3
- package/dist/esm/tools/segmentation/BrushTool.js +10 -8
- package/dist/esm/tools/segmentation/CircleROIStartEndThresholdTool.js +8 -9
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +11 -13
- package/dist/esm/tools/segmentation/SegmentSelectTool.js +1 -1
- package/dist/esm/tools/segmentation/strategies/compositions/preview.js +4 -4
- package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +2 -2
- 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/getCalibratedUnits.d.ts +2 -2
- package/dist/esm/utilities/getCalibratedUnits.js +13 -13
- 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/tools/StackScrollToolMouseWheelTool.d.ts +0 -16
- package/dist/esm/tools/StackScrollToolMouseWheelTool.js +0 -33
- 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';
|
|
@@ -609,13 +608,13 @@ class BidirectionalTool extends AnnotationTool {
|
|
|
609
608
|
const index4 = transformWorldToIndex(imageData, worldPos4);
|
|
610
609
|
const handles1 = [index1, index2];
|
|
611
610
|
const handles2 = [index3, index4];
|
|
612
|
-
const { scale: scale1,
|
|
613
|
-
const { scale: scale2,
|
|
611
|
+
const { scale: scale1, unit: units1 } = getCalibratedLengthUnitsAndScale(image, handles1);
|
|
612
|
+
const { scale: scale2, unit: units2 } = getCalibratedLengthUnitsAndScale(image, handles2);
|
|
614
613
|
const dist1 = this._calculateLength(worldPos1, worldPos2) / scale1;
|
|
615
614
|
const dist2 = this._calculateLength(worldPos3, worldPos4) / scale2;
|
|
616
615
|
const length = dist1 > dist2 ? dist1 : dist2;
|
|
617
616
|
const width = dist1 > dist2 ? dist2 : dist1;
|
|
618
|
-
const
|
|
617
|
+
const unit = dist1 > dist2 ? units1 : units2;
|
|
619
618
|
const widthUnit = dist1 > dist2 ? units2 : units1;
|
|
620
619
|
this._isInsideVolume(index1, index2, index3, index4, dimensions)
|
|
621
620
|
? (this.isHandleOutsideImage = false)
|
|
@@ -623,7 +622,7 @@ class BidirectionalTool extends AnnotationTool {
|
|
|
623
622
|
cachedStats[targetId] = {
|
|
624
623
|
length,
|
|
625
624
|
width,
|
|
626
|
-
|
|
625
|
+
unit,
|
|
627
626
|
widthUnit,
|
|
628
627
|
};
|
|
629
628
|
}
|
|
@@ -713,7 +712,7 @@ class BidirectionalTool extends AnnotationTool {
|
|
|
713
712
|
}
|
|
714
713
|
function defaultGetTextLines(data, targetId) {
|
|
715
714
|
const { cachedStats, label } = data;
|
|
716
|
-
const { length, width, unit
|
|
715
|
+
const { length, width, unit } = cachedStats[targetId];
|
|
717
716
|
const textLines = [];
|
|
718
717
|
if (label) {
|
|
719
718
|
textLines.push(label);
|
|
@@ -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)} ${
|
|
723
|
+
textLines.push(`L: ${csUtils.roundNumber(length)} ${unit || unit}`, `W: ${csUtils.roundNumber(width)} ${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';
|
|
@@ -347,14 +346,14 @@ class CircleROITool extends AnnotationTool {
|
|
|
347
346
|
const canvasCorners = getCanvasCircleCorners(canvasCoordinates);
|
|
348
347
|
const { centerPointRadius } = this.configuration;
|
|
349
348
|
if (!data.cachedStats[targetId] ||
|
|
350
|
-
data.cachedStats[targetId].
|
|
349
|
+
data.cachedStats[targetId].areaUnit == null) {
|
|
351
350
|
data.cachedStats[targetId] = {
|
|
352
351
|
Modality: null,
|
|
353
352
|
area: null,
|
|
354
353
|
max: null,
|
|
355
354
|
mean: null,
|
|
356
355
|
stdDev: null,
|
|
357
|
-
|
|
356
|
+
areaUnit: null,
|
|
358
357
|
radius: null,
|
|
359
358
|
radiusUnit: null,
|
|
360
359
|
perimeter: null,
|
|
@@ -508,7 +507,7 @@ class CircleROITool extends AnnotationTool {
|
|
|
508
507
|
const { worldWidth, worldHeight } = getWorldWidthAndHeightFromTwoPoints(viewPlaneNormal, viewUp, worldPos1, worldPos2);
|
|
509
508
|
const isEmptyArea = worldWidth === 0 && worldHeight === 0;
|
|
510
509
|
const handles = [pos1Index, pos2Index];
|
|
511
|
-
const { scale,
|
|
510
|
+
const { scale, unit, areaUnit } = getCalibratedLengthUnitsAndScale(image, handles);
|
|
512
511
|
const aspect = getCalibratedAspect(image);
|
|
513
512
|
const area = Math.abs(Math.PI *
|
|
514
513
|
(worldWidth / scale / 2) *
|
|
@@ -517,7 +516,7 @@ class CircleROITool extends AnnotationTool {
|
|
|
517
516
|
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
518
517
|
isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
|
|
519
518
|
};
|
|
520
|
-
const
|
|
519
|
+
const modalityUnit = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
|
|
521
520
|
const pointsInShape = voxelManager.forEach(this.configuration.statsCalculator.statsCallback, {
|
|
522
521
|
isInObject: (pointLPS) => pointInEllipse(ellipseObj, pointLPS, { fast: true }),
|
|
523
522
|
boundsIJK,
|
|
@@ -534,11 +533,11 @@ class CircleROITool extends AnnotationTool {
|
|
|
534
533
|
statsArray: stats.array,
|
|
535
534
|
pointsInShape: pointsInShape,
|
|
536
535
|
isEmptyArea,
|
|
537
|
-
|
|
536
|
+
areaUnit,
|
|
538
537
|
radius: worldWidth / 2 / scale,
|
|
539
|
-
radiusUnit:
|
|
538
|
+
radiusUnit: unit,
|
|
540
539
|
perimeter: (2 * Math.PI * (worldWidth / 2)) / scale,
|
|
541
|
-
|
|
540
|
+
modalityUnit,
|
|
542
541
|
};
|
|
543
542
|
}
|
|
544
543
|
else {
|
|
@@ -561,28 +560,28 @@ class CircleROITool extends AnnotationTool {
|
|
|
561
560
|
}
|
|
562
561
|
function defaultGetTextLines(data, targetId) {
|
|
563
562
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
564
|
-
const { radius, radiusUnit, area, mean, stdDev, max, isEmptyArea,
|
|
563
|
+
const { radius, radiusUnit, area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit, } = cachedVolumeStats;
|
|
565
564
|
const textLines = [];
|
|
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)} ${
|
|
574
|
+
: `Area: ${csUtils.roundNumber(area)} ${areaUnit}`;
|
|
576
575
|
textLines.push(areaLine);
|
|
577
576
|
}
|
|
578
577
|
if (mean) {
|
|
579
|
-
textLines.push(`Mean: ${roundNumber(mean)} ${
|
|
578
|
+
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`);
|
|
580
579
|
}
|
|
581
580
|
if (max) {
|
|
582
|
-
textLines.push(`Max: ${roundNumber(max)} ${
|
|
581
|
+
textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`);
|
|
583
582
|
}
|
|
584
583
|
if (stdDev) {
|
|
585
|
-
textLines.push(`Std Dev: ${roundNumber(stdDev)} ${
|
|
584
|
+
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`);
|
|
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';
|
|
@@ -117,13 +117,13 @@ class DragProbeTool extends ProbeTool {
|
|
|
117
117
|
}
|
|
118
118
|
function defaultGetTextLines(data, targetId) {
|
|
119
119
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
120
|
-
const { index, value,
|
|
120
|
+
const { index, value, modalityUnit } = cachedVolumeStats;
|
|
121
121
|
if (value === undefined) {
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
124
|
const textLines = [];
|
|
125
125
|
textLines.push(`(${index[0]}, ${index[1]}, ${index[2]})`);
|
|
126
|
-
textLines.push(`${value.toFixed(2)} ${
|
|
126
|
+
textLines.push(`${value.toFixed(2)} ${modalityUnit}`);
|
|
127
127
|
return textLines;
|
|
128
128
|
}
|
|
129
129
|
DragProbeTool.toolName = 'DragProbe';
|
|
@@ -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';
|
|
@@ -428,14 +427,14 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
428
427
|
const canvasCorners = (getCanvasEllipseCorners(canvasCoordinates));
|
|
429
428
|
const { centerPointRadius } = this.configuration;
|
|
430
429
|
if (!data.cachedStats[targetId] ||
|
|
431
|
-
data.cachedStats[targetId].
|
|
430
|
+
data.cachedStats[targetId].areaUnit == null) {
|
|
432
431
|
data.cachedStats[targetId] = {
|
|
433
432
|
Modality: null,
|
|
434
433
|
area: null,
|
|
435
434
|
max: null,
|
|
436
435
|
mean: null,
|
|
437
436
|
stdDev: null,
|
|
438
|
-
|
|
437
|
+
areaUnit: null,
|
|
439
438
|
};
|
|
440
439
|
this._calculateCachedStats(annotation, viewport, renderingEngine);
|
|
441
440
|
}
|
|
@@ -588,7 +587,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
588
587
|
const { worldWidth, worldHeight } = getWorldWidthAndHeightFromTwoPoints(viewPlaneNormal, viewUp, worldPos1, worldPos2);
|
|
589
588
|
const isEmptyArea = worldWidth === 0 && worldHeight === 0;
|
|
590
589
|
const handles = [pos1Index, post2Index];
|
|
591
|
-
const { scale,
|
|
590
|
+
const { scale, areaUnit } = getCalibratedLengthUnitsAndScale(image, handles);
|
|
592
591
|
const area = Math.abs(Math.PI * (worldWidth / 2) * (worldHeight / 2)) /
|
|
593
592
|
scale /
|
|
594
593
|
scale;
|
|
@@ -596,7 +595,7 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
596
595
|
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
597
596
|
isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
|
|
598
597
|
};
|
|
599
|
-
const
|
|
598
|
+
const modalityUnit = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
|
|
600
599
|
const pointsInShape = voxelManager.forEach(this.configuration.statsCalculator.statsCallback, {
|
|
601
600
|
boundsIJK,
|
|
602
601
|
imageData,
|
|
@@ -613,8 +612,8 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
613
612
|
statsArray: stats.array,
|
|
614
613
|
pointsInShape,
|
|
615
614
|
isEmptyArea,
|
|
616
|
-
|
|
617
|
-
|
|
615
|
+
areaUnit,
|
|
616
|
+
modalityUnit,
|
|
618
617
|
};
|
|
619
618
|
}
|
|
620
619
|
annotation.invalidated = false;
|
|
@@ -652,22 +651,22 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
652
651
|
}
|
|
653
652
|
function defaultGetTextLines(data, targetId) {
|
|
654
653
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
655
|
-
const { area, mean, stdDev, max, isEmptyArea,
|
|
654
|
+
const { area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit } = cachedVolumeStats;
|
|
656
655
|
const textLines = [];
|
|
657
656
|
if (area) {
|
|
658
657
|
const areaLine = isEmptyArea
|
|
659
658
|
? `Area: Oblique not supported`
|
|
660
|
-
: `Area: ${roundNumber(area)} ${
|
|
659
|
+
: `Area: ${csUtils.roundNumber(area)} ${areaUnit}`;
|
|
661
660
|
textLines.push(areaLine);
|
|
662
661
|
}
|
|
663
662
|
if (mean) {
|
|
664
|
-
textLines.push(`Mean: ${roundNumber(mean)} ${
|
|
663
|
+
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`);
|
|
665
664
|
}
|
|
666
665
|
if (max) {
|
|
667
|
-
textLines.push(`Max: ${roundNumber(max)} ${
|
|
666
|
+
textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`);
|
|
668
667
|
}
|
|
669
668
|
if (stdDev) {
|
|
670
|
-
textLines.push(`Std Dev: ${roundNumber(stdDev)} ${
|
|
669
|
+
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`);
|
|
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';
|
|
@@ -404,13 +403,13 @@ class HeightTool extends AnnotationTool {
|
|
|
404
403
|
const index1 = transformWorldToIndex(imageData, worldPos1);
|
|
405
404
|
const index2 = transformWorldToIndex(imageData, worldPos2);
|
|
406
405
|
const handles = [index1, index2];
|
|
407
|
-
const { scale,
|
|
406
|
+
const { scale, unit } = getCalibratedLengthUnitsAndScale(image, handles);
|
|
408
407
|
const height = this._calculateHeight(worldPos1, worldPos2) / scale;
|
|
409
408
|
const outside = this._isInsideVolume(index1, index2, dimensions);
|
|
410
409
|
this.isHandleOutsideImage = outside;
|
|
411
410
|
cachedStats[targetId] = {
|
|
412
411
|
height,
|
|
413
|
-
|
|
412
|
+
unit,
|
|
414
413
|
};
|
|
415
414
|
}
|
|
416
415
|
annotation.invalidated = false;
|
|
@@ -424,11 +423,11 @@ class HeightTool extends AnnotationTool {
|
|
|
424
423
|
}
|
|
425
424
|
function defaultGetTextLines(data, targetId) {
|
|
426
425
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
427
|
-
const { height,
|
|
426
|
+
const { height, unit } = cachedVolumeStats;
|
|
428
427
|
if (height === undefined || height === null || isNaN(height)) {
|
|
429
428
|
return;
|
|
430
429
|
}
|
|
431
|
-
const textLines = [`${roundNumber(height)} ${
|
|
430
|
+
const textLines = [`${csUtils.roundNumber(height)} ${unit}`];
|
|
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';
|
|
@@ -395,14 +394,14 @@ class LengthTool extends AnnotationTool {
|
|
|
395
394
|
const index1 = transformWorldToIndex(imageData, worldPos1);
|
|
396
395
|
const index2 = transformWorldToIndex(imageData, worldPos2);
|
|
397
396
|
const handles = [index1, index2];
|
|
398
|
-
const { scale,
|
|
397
|
+
const { scale, unit } = getCalibratedLengthUnitsAndScale(image, handles);
|
|
399
398
|
const length = this._calculateLength(worldPos1, worldPos2) / scale;
|
|
400
399
|
this._isInsideVolume(index1, index2, dimensions)
|
|
401
400
|
? (this.isHandleOutsideImage = false)
|
|
402
401
|
: (this.isHandleOutsideImage = true);
|
|
403
402
|
cachedStats[targetId] = {
|
|
404
403
|
length,
|
|
405
|
-
|
|
404
|
+
unit,
|
|
406
405
|
};
|
|
407
406
|
}
|
|
408
407
|
annotation.invalidated = false;
|
|
@@ -416,11 +415,11 @@ class LengthTool extends AnnotationTool {
|
|
|
416
415
|
}
|
|
417
416
|
function defaultGetTextLines(data, targetId) {
|
|
418
417
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
419
|
-
const { length,
|
|
418
|
+
const { length, unit } = cachedVolumeStats;
|
|
420
419
|
if (length === undefined || length === null || isNaN(length)) {
|
|
421
420
|
return;
|
|
422
421
|
}
|
|
423
|
-
const textLines = [`${roundNumber(length)} ${
|
|
422
|
+
const textLines = [`${csUtils.roundNumber(length)} ${unit}`];
|
|
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;
|
|
@@ -35,23 +35,23 @@ declare class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
35
35
|
protected renderAnnotationInstance(renderContext: AnnotationRenderContext): boolean;
|
|
36
36
|
_calculateStatsIfActive(annotation: PlanarFreehandROIAnnotation, targetId: string, viewport: any, renderingEngine: any, enabledElement: any): void;
|
|
37
37
|
private _calculateCachedStats;
|
|
38
|
-
protected updateClosedCachedStats({ viewport, points, imageData, metadata, cachedStats, targetId,
|
|
38
|
+
protected updateClosedCachedStats({ viewport, points, imageData, metadata, cachedStats, targetId, modalityUnit, canvasCoordinates, calibratedScale, }: {
|
|
39
39
|
viewport: any;
|
|
40
40
|
points: any;
|
|
41
41
|
imageData: any;
|
|
42
42
|
metadata: any;
|
|
43
43
|
cachedStats: any;
|
|
44
44
|
targetId: any;
|
|
45
|
-
|
|
45
|
+
modalityUnit: any;
|
|
46
46
|
canvasCoordinates: any;
|
|
47
47
|
calibratedScale: any;
|
|
48
48
|
}): void;
|
|
49
|
-
protected updateOpenCachedStats({ targetId, metadata, canvasCoordinates, cachedStats,
|
|
49
|
+
protected updateOpenCachedStats({ targetId, metadata, canvasCoordinates, cachedStats, modalityUnit, calibratedScale, }: {
|
|
50
50
|
targetId: any;
|
|
51
51
|
metadata: any;
|
|
52
52
|
canvasCoordinates: any;
|
|
53
53
|
cachedStats: any;
|
|
54
|
-
|
|
54
|
+
modalityUnit: any;
|
|
55
55
|
calibratedScale: any;
|
|
56
56
|
}): void;
|
|
57
57
|
private _renderStats;
|
|
@@ -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';
|
|
@@ -148,7 +148,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
148
148
|
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
149
149
|
isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
|
|
150
150
|
};
|
|
151
|
-
const
|
|
151
|
+
const modalityUnit = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, modalityUnitOptions);
|
|
152
152
|
const calibratedScale = getCalibratedLengthUnitsAndScale(image, () => {
|
|
153
153
|
const polyline = data.contour.polyline;
|
|
154
154
|
const numPoints = polyline.length;
|
|
@@ -175,7 +175,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
175
175
|
imageData,
|
|
176
176
|
metadata,
|
|
177
177
|
cachedStats,
|
|
178
|
-
|
|
178
|
+
modalityUnit,
|
|
179
179
|
calibratedScale,
|
|
180
180
|
});
|
|
181
181
|
}
|
|
@@ -185,7 +185,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
185
185
|
canvasCoordinates,
|
|
186
186
|
targetId,
|
|
187
187
|
cachedStats,
|
|
188
|
-
|
|
188
|
+
modalityUnit,
|
|
189
189
|
calibratedScale,
|
|
190
190
|
});
|
|
191
191
|
}
|
|
@@ -365,14 +365,14 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
365
365
|
if (!this.commonData?.movingTextBox) {
|
|
366
366
|
const { data } = annotation;
|
|
367
367
|
if (!data.cachedStats[targetId] ||
|
|
368
|
-
data.cachedStats[targetId].
|
|
368
|
+
data.cachedStats[targetId].areaUnit == null) {
|
|
369
369
|
data.cachedStats[targetId] = {
|
|
370
370
|
Modality: null,
|
|
371
371
|
area: null,
|
|
372
372
|
max: null,
|
|
373
373
|
mean: null,
|
|
374
374
|
stdDev: null,
|
|
375
|
-
|
|
375
|
+
areaUnit: null,
|
|
376
376
|
};
|
|
377
377
|
this._calculateCachedStats(annotation, viewport, renderingEngine, enabledElement);
|
|
378
378
|
}
|
|
@@ -381,8 +381,8 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
|
-
updateClosedCachedStats({ viewport, points, imageData, metadata, cachedStats, targetId,
|
|
385
|
-
const { scale,
|
|
384
|
+
updateClosedCachedStats({ viewport, points, imageData, metadata, cachedStats, targetId, modalityUnit, canvasCoordinates, calibratedScale, }) {
|
|
385
|
+
const { scale, areaUnit, units } = calibratedScale;
|
|
386
386
|
const { voxelManager } = viewport.getImageData();
|
|
387
387
|
const canvasPoint = canvasCoordinates[0];
|
|
388
388
|
const originalWorldPoint = viewport.canvasToWorld(canvasPoint);
|
|
@@ -484,45 +484,45 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
484
484
|
stdDev: stats.stdDev?.value,
|
|
485
485
|
statsArray: stats.array,
|
|
486
486
|
pointsInShape: pointsInShape,
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
487
|
+
areaUnit,
|
|
488
|
+
modalityUnit,
|
|
489
|
+
unit: units,
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
|
-
updateOpenCachedStats({ targetId, metadata, canvasCoordinates, cachedStats,
|
|
492
|
+
updateOpenCachedStats({ targetId, metadata, canvasCoordinates, cachedStats, modalityUnit, calibratedScale, }) {
|
|
493
493
|
const { scale, units } = calibratedScale;
|
|
494
494
|
cachedStats[targetId] = {
|
|
495
495
|
Modality: metadata.Modality,
|
|
496
496
|
length: calculatePerimeter(canvasCoordinates, false) / scale,
|
|
497
|
-
|
|
497
|
+
modalityUnit,
|
|
498
498
|
getPixelValueUnitunit: units,
|
|
499
499
|
};
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
function defaultGetTextLines(data, targetId) {
|
|
503
503
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
504
|
-
const { area, mean, stdDev, length, perimeter, max, isEmptyArea,
|
|
504
|
+
const { area, mean, stdDev, length, perimeter, max, isEmptyArea, unit, areaUnit, modalityUnit, } = cachedVolumeStats || {};
|
|
505
505
|
const textLines = [];
|
|
506
506
|
if (area) {
|
|
507
507
|
const areaLine = isEmptyArea
|
|
508
508
|
? `Area: Oblique not supported`
|
|
509
|
-
: `Area: ${roundNumber(area)} ${
|
|
509
|
+
: `Area: ${csUtils.roundNumber(area)} ${areaUnit}`;
|
|
510
510
|
textLines.push(areaLine);
|
|
511
511
|
}
|
|
512
512
|
if (mean) {
|
|
513
|
-
textLines.push(`Mean: ${roundNumber(mean)} ${
|
|
513
|
+
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`);
|
|
514
514
|
}
|
|
515
515
|
if (Number.isFinite(max)) {
|
|
516
|
-
textLines.push(`Max: ${roundNumber(max)} ${
|
|
516
|
+
textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`);
|
|
517
517
|
}
|
|
518
518
|
if (stdDev) {
|
|
519
|
-
textLines.push(`Std Dev: ${roundNumber(stdDev)} ${
|
|
519
|
+
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`);
|
|
520
520
|
}
|
|
521
521
|
if (perimeter) {
|
|
522
|
-
textLines.push(`Perimeter: ${roundNumber(perimeter)} ${
|
|
522
|
+
textLines.push(`Perimeter: ${csUtils.roundNumber(perimeter)} ${unit}`);
|
|
523
523
|
}
|
|
524
524
|
if (length) {
|
|
525
|
-
textLines.push(`${roundNumber(length)} ${
|
|
525
|
+
textLines.push(`${csUtils.roundNumber(length)} ${unit}`);
|
|
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';
|
|
@@ -279,25 +278,25 @@ class ProbeTool extends AnnotationTool {
|
|
|
279
278
|
const viewport = viewports[0];
|
|
280
279
|
ijk[2] = viewport.getCurrentImageIdIndex();
|
|
281
280
|
}
|
|
282
|
-
let
|
|
281
|
+
let modalityUnit;
|
|
283
282
|
if (modality === 'US') {
|
|
284
283
|
const calibratedResults = getCalibratedProbeUnitsAndValue(image, [
|
|
285
284
|
ijk,
|
|
286
285
|
]);
|
|
287
286
|
const hasEnhancedRegionValues = calibratedResults.values.every((value) => value !== null);
|
|
288
287
|
value = (hasEnhancedRegionValues ? calibratedResults.values : value);
|
|
289
|
-
|
|
288
|
+
modalityUnit = hasEnhancedRegionValues
|
|
290
289
|
? calibratedResults.units
|
|
291
290
|
: 'raw';
|
|
292
291
|
}
|
|
293
292
|
else {
|
|
294
|
-
|
|
293
|
+
modalityUnit = getPixelValueUnits(modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
|
|
295
294
|
}
|
|
296
295
|
cachedStats[targetId] = {
|
|
297
296
|
index: ijk,
|
|
298
297
|
value,
|
|
299
298
|
Modality: modality,
|
|
300
|
-
|
|
299
|
+
modalityUnit,
|
|
301
300
|
};
|
|
302
301
|
}
|
|
303
302
|
else {
|
|
@@ -315,19 +314,19 @@ class ProbeTool extends AnnotationTool {
|
|
|
315
314
|
}
|
|
316
315
|
function defaultGetTextLines(data, targetId) {
|
|
317
316
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
318
|
-
const { index, value,
|
|
317
|
+
const { index, value, modalityUnit } = cachedVolumeStats;
|
|
319
318
|
if (value === undefined) {
|
|
320
319
|
return;
|
|
321
320
|
}
|
|
322
321
|
const textLines = [];
|
|
323
322
|
textLines.push(`(${index[0]}, ${index[1]}, ${index[2]})`);
|
|
324
|
-
if (value instanceof Array &&
|
|
323
|
+
if (value instanceof Array && modalityUnit instanceof Array) {
|
|
325
324
|
for (let i = 0; i < value.length; i++) {
|
|
326
|
-
textLines.push(`${roundNumber(value[i])} ${
|
|
325
|
+
textLines.push(`${csUtils.roundNumber(value[i])} ${modalityUnit[i]}`);
|
|
327
326
|
}
|
|
328
327
|
}
|
|
329
328
|
else {
|
|
330
|
-
textLines.push(`${roundNumber(value)} ${
|
|
329
|
+
textLines.push(`${csUtils.roundNumber(value)} ${modalityUnit}`);
|
|
331
330
|
}
|
|
332
331
|
return textLines;
|
|
333
332
|
}
|