@cornerstonejs/tools 4.22.13 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/config.d.ts +4 -0
- package/dist/esm/drawingSvg/drawPath.d.ts +3 -0
- package/dist/esm/drawingSvg/drawPath.js +4 -1
- package/dist/esm/eventListeners/keyboard/keyDownListener.js +2 -2
- package/dist/esm/eventListeners/mouse/getMouseEventPoints.d.ts +1 -1
- package/dist/esm/eventListeners/mouse/getMouseEventPoints.js +19 -1
- package/dist/esm/eventListeners/mouse/mouseDoubleClickListener.js +8 -1
- package/dist/esm/eventListeners/mouse/mouseDownListener.js +37 -5
- package/dist/esm/eventListeners/mouse/mouseMoveListener.js +3 -0
- package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js +60 -92
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +49 -21
- package/dist/esm/eventListeners/segmentation/labelmap/performStackLabelmapUpdate.js +7 -13
- package/dist/esm/eventListeners/segmentation/labelmap/performVolumeLabelmapUpdate.js +44 -18
- package/dist/esm/eventListeners/touch/getTouchEventPoints.js +27 -4
- package/dist/esm/eventListeners/touch/touchStartListener.js +27 -9
- package/dist/esm/eventListeners/wheel/wheelListener.js +5 -1
- package/dist/esm/init.js +2 -0
- package/dist/esm/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js +10 -4
- package/dist/esm/stateManagement/segmentation/SegmentationRenderingEngine.js +23 -20
- package/dist/esm/stateManagement/segmentation/SegmentationRepresentationDisplayRegistry.d.ts +12 -0
- package/dist/esm/stateManagement/segmentation/SegmentationRepresentationDisplayRegistry.js +7 -0
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.d.ts +1 -11
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +28 -166
- package/dist/esm/stateManagement/segmentation/addColorLUT.js +7 -1
- package/dist/esm/stateManagement/segmentation/getCurrentLabelmapImageIdForViewport.js +16 -1
- package/dist/esm/stateManagement/segmentation/helpers/clearSegmentValue.js +9 -7
- package/dist/esm/stateManagement/segmentation/helpers/getSegmentationActor.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/helpers/getSegmentationActor.js +3 -2
- package/dist/esm/stateManagement/segmentation/helpers/getViewportLabelmapRenderMode.d.ts +5 -0
- package/dist/esm/stateManagement/segmentation/helpers/getViewportLabelmapRenderMode.js +58 -0
- package/dist/esm/stateManagement/segmentation/helpers/labelmapImageMapperSupport.d.ts +52 -0
- package/dist/esm/stateManagement/segmentation/helpers/labelmapImageMapperSupport.js +246 -0
- package/dist/esm/stateManagement/segmentation/helpers/labelmapSegmentationState.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/helpers/labelmapSegmentationState.js +1 -0
- package/dist/esm/stateManagement/segmentation/helpers/normalizeSegmentationInput.js +11 -1
- package/dist/esm/stateManagement/segmentation/internalAddSegmentationRepresentation.js +3 -3
- package/dist/esm/stateManagement/segmentation/labelmapModel/index.d.ts +9 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/index.js +7 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapEditTransaction.d.ts +54 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapEditTransaction.js +224 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageIdMapping.d.ts +6 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageIdMapping.js +39 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageReferenceResolver.d.ts +23 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageReferenceResolver.js +269 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLayerStore.d.ts +15 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLayerStore.js +160 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLegacyAdapter.d.ts +4 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLegacyAdapter.js +42 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapSegmentBindings.d.ts +11 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapSegmentBindings.js +73 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/normalizeLabelmapSegmentationData.d.ts +17 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/normalizeLabelmapSegmentationData.js +75 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/privateLabelmap.d.ts +5 -0
- package/dist/esm/stateManagement/segmentation/labelmapModel/privateLabelmap.js +106 -0
- package/dist/esm/stateManagement/segmentation/models/SegmentModel.d.ts +11 -0
- package/dist/esm/stateManagement/segmentation/models/SegmentModel.js +19 -0
- package/dist/esm/stateManagement/segmentation/models/SegmentationModel.d.ts +12 -0
- package/dist/esm/stateManagement/segmentation/models/SegmentationModel.js +23 -0
- package/dist/esm/stateManagement/segmentation/removeSegmentationRepresentations.js +6 -10
- package/dist/esm/stateManagement/segmentation/segmentIndex.js +24 -0
- package/dist/esm/stateManagement/segmentation/segmentationEventManager.js +2 -9
- package/dist/esm/stateManagement/segmentation/segmentationState.d.ts +2 -1
- package/dist/esm/stateManagement/segmentation/segmentationState.js +4 -1
- package/dist/esm/store/state.js +2 -1
- package/dist/esm/synchronizers/callbacks/imageSliceSyncCallback.js +12 -3
- package/dist/esm/synchronizers/callbacks/presentationViewSyncCallback.js +5 -2
- package/dist/esm/synchronizers/callbacks/zoomPanSyncCallback.js +51 -3
- package/dist/esm/tools/AdvancedMagnifyTool.js +1 -1
- package/dist/esm/tools/CrosshairsTool.js +5 -5
- package/dist/esm/tools/OrientationControllerTool.js +1 -1
- package/dist/esm/tools/OrientationMarkerTool.js +4 -4
- package/dist/esm/tools/PanTool.js +26 -3
- package/dist/esm/tools/PlanarRotateTool.js +19 -4
- package/dist/esm/tools/ReferenceCursors.js +7 -1
- package/dist/esm/tools/SculptorTool/CircleSculptCursor.js +1 -1
- package/dist/esm/tools/TrackballRotateTool.js +3 -2
- package/dist/esm/tools/VolumeCroppingTool.js +3 -2
- package/dist/esm/tools/WindowLevelTool.d.ts +2 -1
- package/dist/esm/tools/WindowLevelTool.js +48 -4
- package/dist/esm/tools/ZoomTool.d.ts +8 -0
- package/dist/esm/tools/ZoomTool.js +92 -11
- package/dist/esm/tools/annotation/AngleTool.js +33 -31
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js +30 -28
- package/dist/esm/tools/annotation/BidirectionalTool.js +51 -49
- package/dist/esm/tools/annotation/CircleROITool.js +49 -44
- package/dist/esm/tools/annotation/CobbAngleTool.js +1 -1
- package/dist/esm/tools/annotation/DragProbeTool.js +1 -1
- package/dist/esm/tools/annotation/ETDRSGridTool.js +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js +42 -37
- package/dist/esm/tools/annotation/HeightTool.js +1 -1
- package/dist/esm/tools/annotation/KeyImageTool.js +11 -11
- package/dist/esm/tools/annotation/LabelTool.js +37 -35
- package/dist/esm/tools/annotation/LengthTool.js +35 -33
- package/dist/esm/tools/annotation/LivewireContourSegmentationTool.js +6 -4
- package/dist/esm/tools/annotation/LivewireContourTool.js +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js +6 -4
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +1 -1
- package/dist/esm/tools/annotation/ProbeTool.js +51 -46
- package/dist/esm/tools/annotation/RectangleROITool.js +42 -37
- package/dist/esm/tools/annotation/RegionSegmentPlusTool.js +1 -1
- package/dist/esm/tools/annotation/RegionSegmentTool.js +1 -1
- package/dist/esm/tools/annotation/SplineContourSegmentationTool.js +1 -1
- package/dist/esm/tools/annotation/SplineROITool.js +51 -49
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js +1 -1
- package/dist/esm/tools/annotation/UltrasoundPleuraBLineTool/UltrasoundPleuraBLineTool.js +57 -55
- package/dist/esm/tools/annotation/VideoRedactionTool.js +1 -1
- package/dist/esm/tools/base/AnnotationDisplayTool.js +9 -6
- package/dist/esm/tools/base/AnnotationTool.js +2 -1
- package/dist/esm/tools/base/BaseTool.js +16 -10
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js +1 -1
- package/dist/esm/tools/base/GrowCutBaseTool.js +2 -2
- package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.d.ts +2 -4
- package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.js +15 -85
- package/dist/esm/tools/displayTools/Labelmap/labelmapActorStyle.d.ts +5 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapActorStyle.js +191 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.d.ts +4 -3
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +48 -209
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/createLabelmapRenderPlan.d.ts +3 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/createLabelmapRenderPlan.js +51 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/index.d.ts +4 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/index.js +3 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/legacyVolumePlan.d.ts +14 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/legacyVolumePlan.js +143 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/planarGenericVolumeLabelmap.d.ts +40 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/planarGenericVolumeLabelmap.js +79 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/removeLabelmapRepresentationFromViewport.d.ts +3 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/removeLabelmapRepresentationFromViewport.js +18 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/resolveLabelmapRenderPlan.d.ts +9 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/resolveLabelmapRenderPlan.js +56 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/stackImagePlan.d.ts +11 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/stackImagePlan.js +35 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/types.d.ts +48 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/types.js +0 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/volumeSliceImageMapperPlan.d.ts +13 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/volumeSliceImageMapperPlan.js +34 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan.d.ts +2 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan.js +1 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRepresentationUID.d.ts +8 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapRepresentationUID.js +18 -0
- package/dist/esm/tools/displayTools/Labelmap/removeLabelmapFromElement.js +2 -5
- package/dist/esm/tools/displayTools/Labelmap/removeLabelmapRepresentationData.d.ts +3 -0
- package/dist/esm/tools/displayTools/Labelmap/removeLabelmapRepresentationData.js +16 -0
- package/dist/esm/tools/displayTools/Labelmap/syncStackLabelmapActors.d.ts +2 -0
- package/dist/esm/tools/displayTools/Labelmap/syncStackLabelmapActors.js +135 -0
- package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapImageMapper.d.ts +16 -0
- package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapImageMapper.js +267 -0
- package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapSliceData.d.ts +27 -0
- package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapSliceData.js +185 -0
- package/dist/esm/tools/displayTools/registerBuiltInSegmentationRepresentationDisplays.d.ts +1 -0
- package/dist/esm/tools/displayTools/registerBuiltInSegmentationRepresentationDisplays.js +16 -0
- package/dist/esm/tools/segmentation/BrushTool.d.ts +9 -2
- package/dist/esm/tools/segmentation/BrushTool.js +109 -25
- package/dist/esm/tools/segmentation/CircleScissorsTool.js +13 -6
- package/dist/esm/tools/segmentation/LabelmapBaseTool.d.ts +2 -3
- package/dist/esm/tools/segmentation/LabelmapBaseTool.js +77 -38
- package/dist/esm/tools/segmentation/LabelmapEditWithContour.js +3 -3
- package/dist/esm/tools/segmentation/PaintFillTool.js +11 -4
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.d.ts +2 -0
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +16 -8
- package/dist/esm/tools/segmentation/RectangleScissorsTool.js +13 -6
- package/dist/esm/tools/segmentation/SegmentBidirectionalTool.js +63 -61
- package/dist/esm/tools/segmentation/SegmentSelectTool.js +4 -4
- package/dist/esm/tools/segmentation/SphereScissorsTool.js +5 -1
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.d.ts +7 -0
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.js +47 -24
- package/dist/esm/tools/segmentation/strategies/compositions/circularCursor.js +49 -15
- package/dist/esm/tools/segmentation/strategies/compositions/determineSegmentIndex.js +2 -2
- package/dist/esm/tools/segmentation/strategies/compositions/dynamicThreshold.js +5 -1
- package/dist/esm/tools/segmentation/strategies/compositions/islandRemovalComposition.js +2 -2
- package/dist/esm/tools/segmentation/strategies/compositions/preview.js +2 -2
- package/dist/esm/tools/segmentation/strategies/compositions/setValue.js +14 -6
- package/dist/esm/tools/segmentation/strategies/utils/crossLayerErase.d.ts +4 -0
- package/dist/esm/tools/segmentation/strategies/utils/crossLayerErase.js +23 -0
- package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js +1 -1
- package/dist/esm/tools/segmentation/strategies/utils/handleUseSegmentCenterIndex.js +12 -11
- package/dist/esm/tools/segmentation/strategies/utils/labelmapOverlap.d.ts +4 -0
- package/dist/esm/tools/segmentation/strategies/utils/labelmapOverlap.js +41 -0
- package/dist/esm/tools/segmentation/strategies/utils/overwritePolicy.d.ts +3 -0
- package/dist/esm/tools/segmentation/strategies/utils/overwritePolicy.js +31 -0
- package/dist/esm/tools/segmentation/strategies/utils/segmentSeparation.d.ts +3 -0
- package/dist/esm/tools/segmentation/strategies/utils/segmentSeparation.js +38 -0
- package/dist/esm/tools/segmentation/utils/LazyBrushEditController.d.ts +19 -0
- package/dist/esm/tools/segmentation/utils/LazyBrushEditController.js +55 -0
- package/dist/esm/tools/segmentation/utils/lazyBrushPreview.d.ts +3 -0
- package/dist/esm/tools/segmentation/utils/lazyBrushPreview.js +34 -0
- package/dist/esm/tools/segmentation/utils/shouldUseLazyLabelmapEditing.d.ts +3 -0
- package/dist/esm/tools/segmentation/utils/shouldUseLazyLabelmapEditing.js +42 -0
- package/dist/esm/types/LabelmapToolOperationData.d.ts +5 -0
- package/dist/esm/types/LabelmapTypes.d.ts +29 -6
- package/dist/esm/types/SegmentationStateTypes.d.ts +4 -0
- package/dist/esm/utilities/calibrateImageSpacing.js +17 -2
- package/dist/esm/utilities/contours/AnnotationToPointData.js +1 -1
- package/dist/esm/utilities/getSphereBoundsInfo.js +5 -1
- package/dist/esm/utilities/getViewportICamera.d.ts +4 -0
- package/dist/esm/utilities/getViewportICamera.js +23 -0
- package/dist/esm/utilities/getViewportsForAnnotation.js +5 -1
- package/dist/esm/utilities/math/basic/BasicStatsCalculator.js +9 -7
- package/dist/esm/utilities/pointInSurroundingSphereCallback.js +8 -1
- package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js +121 -118
- package/dist/esm/utilities/segmentation/SegmentStatsCalculator.js +5 -4
- package/dist/esm/utilities/segmentation/VolumetricCalculator.js +1 -1
- package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.js +1 -1
- package/dist/esm/utilities/segmentation/getReferenceVolumeForSegmentation.js +1 -1
- package/dist/esm/utilities/segmentation/getReferenceVolumeForSegmentationVolume.js +11 -2
- package/dist/esm/utilities/segmentation/getSegmentIndexAtLabelmapBorder.js +36 -17
- package/dist/esm/utilities/segmentation/getSegmentIndexAtWorldPoint.js +42 -25
- package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js +3 -30
- package/dist/esm/utilities/segmentation/index.d.ts +2 -1
- package/dist/esm/utilities/segmentation/index.js +2 -1
- package/dist/esm/utilities/segmentation/utilsForWorker.js +2 -2
- package/dist/esm/utilities/segmentation/validateLabelmap.js +1 -1
- package/dist/esm/utilities/stackPrefetch/stackPrefetch.js +0 -1
- package/dist/esm/utilities/touch/index.js +3 -2
- package/dist/esm/utilities/viewportCapabilities.d.ts +16 -0
- package/dist/esm/utilities/viewportCapabilities.js +18 -0
- package/dist/esm/utilities/viewportFilters/filterViewportsWithParallelNormals.d.ts +1 -1
- package/dist/esm/utilities/viewportFilters/filterViewportsWithParallelNormals.js +12 -4
- package/dist/esm/utilities/viewportFilters/filterViewportsWithSameOrientation.d.ts +1 -1
- package/dist/esm/utilities/viewportFilters/filterViewportsWithSameOrientation.js +11 -4
- package/dist/esm/utilities/viewportFilters/getViewportIdsWithToolToRender.js +1 -1
- package/dist/esm/utilities/viewportPresentation.d.ts +3 -0
- package/dist/esm/utilities/viewportPresentation.js +26 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +10 -10
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { AnnotationTool } from '../base';
|
|
2
3
|
import { getEnabledElement, VolumeViewport, utilities as csUtils, getEnabledElementByViewportId, EPSILON, } from '@cornerstonejs/core';
|
|
3
4
|
import { getCalibratedAspect, getCalibratedLengthUnitsAndScale, } from '../../utilities/getCalibratedUnits';
|
|
@@ -15,13 +16,13 @@ import { pointInEllipse, getCanvasEllipseCorners, } from '../../utilities/math/e
|
|
|
15
16
|
import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
|
|
16
17
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
17
18
|
import { getPixelValueUnits } from '../../utilities/getPixelValueUnits';
|
|
19
|
+
import { viewportSupportsImageSlices } from '../../utilities/viewportCapabilities';
|
|
18
20
|
import { isViewportPreScaled } from '../../utilities/viewport/isViewportPreScaled';
|
|
19
21
|
import { BasicStatsCalculator } from '../../utilities/math/basic';
|
|
20
22
|
import { vec2 } from 'gl-matrix';
|
|
21
23
|
import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
|
|
22
24
|
const { transformWorldToIndex } = csUtils;
|
|
23
25
|
class EllipticalROITool extends AnnotationTool {
|
|
24
|
-
static { this.toolName = 'EllipticalROI'; }
|
|
25
26
|
constructor(toolProps = {}, defaultToolProps = {
|
|
26
27
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
27
28
|
configuration: {
|
|
@@ -417,7 +418,9 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
417
418
|
const { referencedImageId } = annotation.metadata;
|
|
418
419
|
for (const targetId in data.cachedStats) {
|
|
419
420
|
if (targetId.startsWith('imageId')) {
|
|
420
|
-
const viewports = renderingEngine
|
|
421
|
+
const viewports = renderingEngine
|
|
422
|
+
.getViewports()
|
|
423
|
+
.filter(viewportSupportsImageSlices);
|
|
421
424
|
const invalidatedStack = viewports.find((vp) => {
|
|
422
425
|
const referencedImageURI = csUtils.imageIdToURI(referencedImageId);
|
|
423
426
|
const hasImageURI = vp.hasImageURI(referencedImageURI);
|
|
@@ -552,8 +555,8 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
552
555
|
const { areaUnit } = calibrate;
|
|
553
556
|
const aspect = getCalibratedAspect(image);
|
|
554
557
|
const indexHandles = points.map((p) => imageData.worldToIndex(p));
|
|
555
|
-
const width =
|
|
556
|
-
const height =
|
|
558
|
+
const width = _a.calculateLengthInIndex(calibrate, indexHandles.slice(2, 4));
|
|
559
|
+
const height = _a.calculateLengthInIndex(calibrate, indexHandles.slice(0, 2));
|
|
557
560
|
const area = Math.abs(Math.PI * (width / 2) * (height / aspect / 2));
|
|
558
561
|
const pixelUnitsOptions = {
|
|
559
562
|
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
@@ -604,39 +607,6 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
604
607
|
};
|
|
605
608
|
this._throttledCalculateCachedStats = throttle(this._calculateCachedStats, 100, { trailing: true });
|
|
606
609
|
}
|
|
607
|
-
static { this.hydrate = (viewportId, points, options) => {
|
|
608
|
-
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
609
|
-
if (!enabledElement) {
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(EllipticalROITool, enabledElement, points, options);
|
|
613
|
-
const { toolInstance, ...serializableOptions } = options || {};
|
|
614
|
-
const annotation = {
|
|
615
|
-
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
616
|
-
data: {
|
|
617
|
-
handles: {
|
|
618
|
-
points,
|
|
619
|
-
activeHandleIndex: null,
|
|
620
|
-
},
|
|
621
|
-
label: '',
|
|
622
|
-
cachedStats: {},
|
|
623
|
-
},
|
|
624
|
-
highlighted: false,
|
|
625
|
-
autoGenerated: false,
|
|
626
|
-
invalidated: false,
|
|
627
|
-
isLocked: false,
|
|
628
|
-
isVisible: true,
|
|
629
|
-
metadata: {
|
|
630
|
-
toolName: instance.getToolName(),
|
|
631
|
-
viewPlaneNormal,
|
|
632
|
-
FrameOfReferenceUID,
|
|
633
|
-
referencedImageId,
|
|
634
|
-
...serializableOptions,
|
|
635
|
-
},
|
|
636
|
-
};
|
|
637
|
-
addAnnotation(annotation, viewport.element);
|
|
638
|
-
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
639
|
-
}; }
|
|
640
610
|
_pointInEllipseCanvas(ellipse, location) {
|
|
641
611
|
const { xRadius, yRadius, center, angle } = ellipse;
|
|
642
612
|
const rotLocation = vec2.rotate(vec2.create(), location, center, -angle);
|
|
@@ -659,6 +629,41 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
659
629
|
];
|
|
660
630
|
}
|
|
661
631
|
}
|
|
632
|
+
_a = EllipticalROITool;
|
|
633
|
+
EllipticalROITool.toolName = 'EllipticalROI';
|
|
634
|
+
EllipticalROITool.hydrate = (viewportId, points, options) => {
|
|
635
|
+
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
636
|
+
if (!enabledElement) {
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
|
|
640
|
+
const { toolInstance, ...serializableOptions } = options || {};
|
|
641
|
+
const annotation = {
|
|
642
|
+
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
643
|
+
data: {
|
|
644
|
+
handles: {
|
|
645
|
+
points,
|
|
646
|
+
activeHandleIndex: null,
|
|
647
|
+
},
|
|
648
|
+
label: '',
|
|
649
|
+
cachedStats: {},
|
|
650
|
+
},
|
|
651
|
+
highlighted: false,
|
|
652
|
+
autoGenerated: false,
|
|
653
|
+
invalidated: false,
|
|
654
|
+
isLocked: false,
|
|
655
|
+
isVisible: true,
|
|
656
|
+
metadata: {
|
|
657
|
+
toolName: instance.getToolName(),
|
|
658
|
+
viewPlaneNormal,
|
|
659
|
+
FrameOfReferenceUID,
|
|
660
|
+
referencedImageId,
|
|
661
|
+
...serializableOptions,
|
|
662
|
+
},
|
|
663
|
+
};
|
|
664
|
+
addAnnotation(annotation, viewport.element);
|
|
665
|
+
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
666
|
+
};
|
|
662
667
|
function defaultGetTextLines(data, targetId) {
|
|
663
668
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
664
669
|
const { area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit, min } = cachedVolumeStats;
|
|
@@ -16,7 +16,6 @@ import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCur
|
|
|
16
16
|
import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
|
|
17
17
|
const { transformWorldToIndex } = csUtils;
|
|
18
18
|
class HeightTool extends AnnotationTool {
|
|
19
|
-
static { this.toolName = 'Height'; }
|
|
20
19
|
constructor(toolProps = {}, defaultToolProps = {
|
|
21
20
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
22
21
|
configuration: {
|
|
@@ -380,6 +379,7 @@ class HeightTool extends AnnotationTool {
|
|
|
380
379
|
csUtils.indexWithinDimensions(index2, dimensions));
|
|
381
380
|
}
|
|
382
381
|
}
|
|
382
|
+
HeightTool.toolName = 'Height';
|
|
383
383
|
function defaultGetTextLines(data, targetId) {
|
|
384
384
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
385
385
|
const { height, unit } = cachedVolumeStats;
|
|
@@ -9,17 +9,6 @@ import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters'
|
|
|
9
9
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
10
10
|
import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
|
|
11
11
|
class KeyImageTool extends AnnotationTool {
|
|
12
|
-
static { this.toolName = 'KeyImage'; }
|
|
13
|
-
static { this.dataSeries = {
|
|
14
|
-
data: {
|
|
15
|
-
seriesLevel: true,
|
|
16
|
-
},
|
|
17
|
-
}; }
|
|
18
|
-
static { this.dataPoint = {
|
|
19
|
-
data: {
|
|
20
|
-
isPoint: true,
|
|
21
|
-
},
|
|
22
|
-
}; }
|
|
23
12
|
constructor(toolProps = {}, defaultToolProps = {
|
|
24
13
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
25
14
|
configuration: {
|
|
@@ -260,6 +249,17 @@ class KeyImageTool extends AnnotationTool {
|
|
|
260
249
|
csUtils.indexWithinDimensions(index2, dimensions));
|
|
261
250
|
}
|
|
262
251
|
}
|
|
252
|
+
KeyImageTool.toolName = 'KeyImage';
|
|
253
|
+
KeyImageTool.dataSeries = {
|
|
254
|
+
data: {
|
|
255
|
+
seriesLevel: true,
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
KeyImageTool.dataPoint = {
|
|
259
|
+
data: {
|
|
260
|
+
isPoint: true,
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
263
|
function getTextCallback(doneChangingTextCallback) {
|
|
264
264
|
return doneChangingTextCallback(prompt('Enter your annotation:'));
|
|
265
265
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { vec2 } from 'gl-matrix';
|
|
2
3
|
import { ChangeTypes, Events } from '../../enums';
|
|
3
4
|
import { getEnabledElement, utilities as csUtils, getEnabledElementByViewportId, } from '@cornerstonejs/core';
|
|
@@ -11,7 +12,6 @@ import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../st
|
|
|
11
12
|
import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
|
|
12
13
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
13
14
|
class LabelTool extends AnnotationTool {
|
|
14
|
-
static { this.toolName = 'Label'; }
|
|
15
15
|
constructor(toolProps = {}, defaultToolProps = {
|
|
16
16
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
17
17
|
configuration: {
|
|
@@ -257,40 +257,6 @@ class LabelTool extends AnnotationTool {
|
|
|
257
257
|
return renderStatus;
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
|
-
static { this.hydrate = (viewportId, position, label, options) => {
|
|
261
|
-
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
262
|
-
if (!enabledElement) {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
const { viewport } = enabledElement;
|
|
266
|
-
const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
|
|
267
|
-
const { viewPlaneNormal, viewUp } = viewport.getCamera();
|
|
268
|
-
const instance = new this();
|
|
269
|
-
const referencedImageId = instance.getReferencedImageId(viewport, position, viewPlaneNormal, viewUp);
|
|
270
|
-
const annotation = {
|
|
271
|
-
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
272
|
-
data: {
|
|
273
|
-
label,
|
|
274
|
-
handles: {
|
|
275
|
-
points: [position],
|
|
276
|
-
},
|
|
277
|
-
},
|
|
278
|
-
highlighted: false,
|
|
279
|
-
autoGenerated: false,
|
|
280
|
-
invalidated: false,
|
|
281
|
-
isLocked: false,
|
|
282
|
-
isVisible: true,
|
|
283
|
-
metadata: {
|
|
284
|
-
toolName: instance.getToolName(),
|
|
285
|
-
viewPlaneNormal,
|
|
286
|
-
FrameOfReferenceUID,
|
|
287
|
-
referencedImageId,
|
|
288
|
-
...options,
|
|
289
|
-
},
|
|
290
|
-
};
|
|
291
|
-
addAnnotation(annotation, viewport.element);
|
|
292
|
-
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
293
|
-
}; }
|
|
294
260
|
handleSelectedCallback(_evt, _annotation, _handle, _interactionType) { }
|
|
295
261
|
_doneChangingTextCallback(element, annotation, updatedLabel) {
|
|
296
262
|
annotation.data.label = updatedLabel;
|
|
@@ -303,6 +269,42 @@ class LabelTool extends AnnotationTool {
|
|
|
303
269
|
csUtils.indexWithinDimensions(index2, dimensions));
|
|
304
270
|
}
|
|
305
271
|
}
|
|
272
|
+
_a = LabelTool;
|
|
273
|
+
LabelTool.toolName = 'Label';
|
|
274
|
+
LabelTool.hydrate = (viewportId, position, label, options) => {
|
|
275
|
+
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
276
|
+
if (!enabledElement) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
const { viewport } = enabledElement;
|
|
280
|
+
const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
|
|
281
|
+
const { viewPlaneNormal, viewUp } = viewport.getCamera();
|
|
282
|
+
const instance = new _a();
|
|
283
|
+
const referencedImageId = instance.getReferencedImageId(viewport, position, viewPlaneNormal, viewUp);
|
|
284
|
+
const annotation = {
|
|
285
|
+
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
286
|
+
data: {
|
|
287
|
+
label,
|
|
288
|
+
handles: {
|
|
289
|
+
points: [position],
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
highlighted: false,
|
|
293
|
+
autoGenerated: false,
|
|
294
|
+
invalidated: false,
|
|
295
|
+
isLocked: false,
|
|
296
|
+
isVisible: true,
|
|
297
|
+
metadata: {
|
|
298
|
+
toolName: instance.getToolName(),
|
|
299
|
+
viewPlaneNormal,
|
|
300
|
+
FrameOfReferenceUID,
|
|
301
|
+
referencedImageId,
|
|
302
|
+
...options,
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
addAnnotation(annotation, viewport.element);
|
|
306
|
+
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
307
|
+
};
|
|
306
308
|
function getTextCallback(doneChangingTextCallback) {
|
|
307
309
|
return doneChangingTextCallback(prompt('Enter your annotation:'));
|
|
308
310
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { Events, ChangeTypes, MeasurementType } from '../../enums';
|
|
2
3
|
import { getEnabledElement, utilities as csUtils, utilities, getEnabledElementByViewportId, } from '@cornerstonejs/core';
|
|
3
4
|
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
@@ -15,7 +16,6 @@ import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnota
|
|
|
15
16
|
import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
|
|
16
17
|
import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
|
|
17
18
|
class LengthTool extends AnnotationTool {
|
|
18
|
-
static { this.toolName = 'Length'; }
|
|
19
19
|
constructor(toolProps = {}, defaultToolProps = {
|
|
20
20
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
21
21
|
configuration: {
|
|
@@ -308,36 +308,6 @@ class LengthTool extends AnnotationTool {
|
|
|
308
308
|
};
|
|
309
309
|
this._throttledCalculateCachedStats = throttle(this._calculateCachedStats, 100, { trailing: true });
|
|
310
310
|
}
|
|
311
|
-
static { this.hydrate = (viewportId, points, options) => {
|
|
312
|
-
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
313
|
-
if (!enabledElement) {
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(LengthTool, enabledElement, points, options);
|
|
317
|
-
const { toolInstance, ...serializableOptions } = options || {};
|
|
318
|
-
const annotation = {
|
|
319
|
-
annotationUID: options?.annotationUID || utilities.uuidv4(),
|
|
320
|
-
data: {
|
|
321
|
-
handles: {
|
|
322
|
-
points,
|
|
323
|
-
},
|
|
324
|
-
},
|
|
325
|
-
highlighted: false,
|
|
326
|
-
autoGenerated: false,
|
|
327
|
-
invalidated: false,
|
|
328
|
-
isLocked: false,
|
|
329
|
-
isVisible: true,
|
|
330
|
-
metadata: {
|
|
331
|
-
toolName: instance.getToolName(),
|
|
332
|
-
viewPlaneNormal,
|
|
333
|
-
FrameOfReferenceUID,
|
|
334
|
-
referencedImageId,
|
|
335
|
-
...serializableOptions,
|
|
336
|
-
},
|
|
337
|
-
};
|
|
338
|
-
addAnnotation(annotation, viewport.element);
|
|
339
|
-
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
340
|
-
}; }
|
|
341
311
|
handleSelectedCallback(evt, annotation, handle) {
|
|
342
312
|
const eventDetail = evt.detail;
|
|
343
313
|
const { element } = eventDetail;
|
|
@@ -378,8 +348,8 @@ class LengthTool extends AnnotationTool {
|
|
|
378
348
|
const handles = data.handles.points.map((point) => imageData.worldToIndex(point));
|
|
379
349
|
const calibrate = getCalibratedLengthUnitsAndScale(image, handles);
|
|
380
350
|
const { unit } = calibrate;
|
|
381
|
-
const length =
|
|
382
|
-
this.isHandleOutsideImage = !
|
|
351
|
+
const length = _a.calculateLengthInIndex(calibrate, handles);
|
|
352
|
+
this.isHandleOutsideImage = !_a.isInsideVolume(dimensions, handles);
|
|
383
353
|
const namedLength = {
|
|
384
354
|
name: 'length',
|
|
385
355
|
value: length,
|
|
@@ -400,6 +370,38 @@ class LengthTool extends AnnotationTool {
|
|
|
400
370
|
return cachedStats;
|
|
401
371
|
}
|
|
402
372
|
}
|
|
373
|
+
_a = LengthTool;
|
|
374
|
+
LengthTool.toolName = 'Length';
|
|
375
|
+
LengthTool.hydrate = (viewportId, points, options) => {
|
|
376
|
+
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
377
|
+
if (!enabledElement) {
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
|
|
381
|
+
const { toolInstance, ...serializableOptions } = options || {};
|
|
382
|
+
const annotation = {
|
|
383
|
+
annotationUID: options?.annotationUID || utilities.uuidv4(),
|
|
384
|
+
data: {
|
|
385
|
+
handles: {
|
|
386
|
+
points,
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
highlighted: false,
|
|
390
|
+
autoGenerated: false,
|
|
391
|
+
invalidated: false,
|
|
392
|
+
isLocked: false,
|
|
393
|
+
isVisible: true,
|
|
394
|
+
metadata: {
|
|
395
|
+
toolName: instance.getToolName(),
|
|
396
|
+
viewPlaneNormal,
|
|
397
|
+
FrameOfReferenceUID,
|
|
398
|
+
referencedImageId,
|
|
399
|
+
...serializableOptions,
|
|
400
|
+
},
|
|
401
|
+
};
|
|
402
|
+
addAnnotation(annotation, viewport.element);
|
|
403
|
+
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
404
|
+
};
|
|
403
405
|
function defaultGetTextLines(data, targetId) {
|
|
404
406
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
405
407
|
const { length, unit } = cachedVolumeStats;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { utilities as csUtils } from '@cornerstonejs/core';
|
|
2
3
|
import LivewireContourTool from './LivewireContourTool';
|
|
3
4
|
import { LivewirePath } from '../../utilities/livewire/LiveWirePath';
|
|
@@ -6,7 +7,6 @@ import { ChangeTypes } from '../../enums';
|
|
|
6
7
|
import { drawPolyline as drawPolylineSvg } from '../../drawingSvg';
|
|
7
8
|
import AnnotationToPointData from '../../utilities/contours/AnnotationToPointData';
|
|
8
9
|
class LivewireContourSegmentationTool extends LivewireContourTool {
|
|
9
|
-
static { this.toolName = 'LivewireContourSegmentationTool'; }
|
|
10
10
|
updateInterpolatedAnnotation(annotation, enabledElement) {
|
|
11
11
|
if (this.editData ||
|
|
12
12
|
!annotation.invalidated ||
|
|
@@ -86,8 +86,10 @@ class LivewireContourSegmentationTool extends LivewireContourTool {
|
|
|
86
86
|
isContourSegmentationTool() {
|
|
87
87
|
return true;
|
|
88
88
|
}
|
|
89
|
-
static {
|
|
90
|
-
AnnotationToPointData.register(this);
|
|
91
|
-
}
|
|
92
89
|
}
|
|
90
|
+
_a = LivewireContourSegmentationTool;
|
|
91
|
+
LivewireContourSegmentationTool.toolName = 'LivewireContourSegmentationTool';
|
|
92
|
+
(() => {
|
|
93
|
+
AnnotationToPointData.register(_a);
|
|
94
|
+
})();
|
|
93
95
|
export default LivewireContourSegmentationTool;
|
|
@@ -17,7 +17,6 @@ import ContourSegmentationBaseTool from '../base/ContourSegmentationBaseTool';
|
|
|
17
17
|
import { getCalibratedLengthUnitsAndScale, throttle } from '../../utilities';
|
|
18
18
|
const CLICK_CLOSE_CURVE_SQR_DIST = 10 ** 2;
|
|
19
19
|
class LivewireContourTool extends ContourSegmentationBaseTool {
|
|
20
|
-
static { this.toolName = 'LivewireContour'; }
|
|
21
20
|
constructor(toolProps = {}, defaultToolProps = {
|
|
22
21
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
23
22
|
configuration: {
|
|
@@ -637,6 +636,7 @@ class LivewireContourTool extends ContourSegmentationBaseTool {
|
|
|
637
636
|
});
|
|
638
637
|
}
|
|
639
638
|
}
|
|
639
|
+
LivewireContourTool.toolName = 'LivewireContour';
|
|
640
640
|
export default LivewireContourTool;
|
|
641
641
|
function defaultGetTextLines(data, targetId) {
|
|
642
642
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { utilities } from '@cornerstonejs/core';
|
|
2
3
|
import { triggerSegmentationDataModified } from '../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
3
4
|
import PlanarFreehandROITool from './PlanarFreehandROITool';
|
|
4
5
|
import AnnotationToPointData from '../../utilities/contours/AnnotationToPointData';
|
|
5
6
|
export class PlanarFreehandContourSegmentationTool extends PlanarFreehandROITool {
|
|
6
|
-
static { this.toolName = 'PlanarFreehandContourSegmentationTool'; }
|
|
7
7
|
constructor(toolProps) {
|
|
8
8
|
const initialProps = utilities.deepMerge({
|
|
9
9
|
configuration: {
|
|
@@ -13,9 +13,6 @@ export class PlanarFreehandContourSegmentationTool extends PlanarFreehandROITool
|
|
|
13
13
|
}, toolProps);
|
|
14
14
|
super(initialProps);
|
|
15
15
|
}
|
|
16
|
-
static {
|
|
17
|
-
AnnotationToPointData.register(this);
|
|
18
|
-
}
|
|
19
16
|
isContourSegmentationTool() {
|
|
20
17
|
return true;
|
|
21
18
|
}
|
|
@@ -30,4 +27,9 @@ export class PlanarFreehandContourSegmentationTool extends PlanarFreehandROITool
|
|
|
30
27
|
return renderResult;
|
|
31
28
|
}
|
|
32
29
|
}
|
|
30
|
+
_a = PlanarFreehandContourSegmentationTool;
|
|
31
|
+
PlanarFreehandContourSegmentationTool.toolName = 'PlanarFreehandContourSegmentationTool';
|
|
32
|
+
(() => {
|
|
33
|
+
AnnotationToPointData.register(_a);
|
|
34
|
+
})();
|
|
33
35
|
export default PlanarFreehandContourSegmentationTool;
|
|
@@ -24,7 +24,6 @@ const { pointCanProjectOnLine } = polyline;
|
|
|
24
24
|
const { EPSILON } = CONSTANTS;
|
|
25
25
|
const PARALLEL_THRESHOLD = 1 - EPSILON;
|
|
26
26
|
class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
27
|
-
static { this.toolName = 'PlanarFreehandROI'; }
|
|
28
27
|
constructor(toolProps = {}, defaultToolProps = {
|
|
29
28
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
30
29
|
configuration: {
|
|
@@ -529,6 +528,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
529
528
|
};
|
|
530
529
|
}
|
|
531
530
|
}
|
|
531
|
+
PlanarFreehandROITool.toolName = 'PlanarFreehandROI';
|
|
532
532
|
function defaultGetTextLines(data, targetId) {
|
|
533
533
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
534
534
|
const { area, mean, stdDev, length, perimeter, max, min, isEmptyArea, unit, areaUnit, modalityUnit, } = cachedVolumeStats || {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { vec2, vec3 } from 'gl-matrix';
|
|
2
3
|
import { getEnabledElement, VolumeViewport, utilities as csUtils, getEnabledElementByViewportId, } from '@cornerstonejs/core';
|
|
3
4
|
import { AnnotationTool } from '../base';
|
|
@@ -13,25 +14,12 @@ import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCur
|
|
|
13
14
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
14
15
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
15
16
|
import { getPixelValueUnits } from '../../utilities/getPixelValueUnits';
|
|
17
|
+
import { viewportSupportsImageSlices } from '../../utilities/viewportCapabilities';
|
|
16
18
|
import { isViewportPreScaled } from '../../utilities/viewport/isViewportPreScaled';
|
|
17
19
|
const { transformWorldToIndex } = csUtils;
|
|
18
20
|
class ProbeTool extends AnnotationTool {
|
|
19
|
-
static { this.toolName = 'Probe'; }
|
|
20
|
-
static { this.probeDefaults = {
|
|
21
|
-
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
22
|
-
configuration: {
|
|
23
|
-
shadow: true,
|
|
24
|
-
preventHandleOutsideImage: false,
|
|
25
|
-
getTextLines: defaultGetTextLines,
|
|
26
|
-
handleRadius: '6',
|
|
27
|
-
textCanvasOffset: {
|
|
28
|
-
x: 6,
|
|
29
|
-
y: -6,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
}; }
|
|
33
21
|
constructor(toolProps = {}, defaultToolProps) {
|
|
34
|
-
super(toolProps, AnnotationTool.mergeDefaultProps(
|
|
22
|
+
super(toolProps, AnnotationTool.mergeDefaultProps(_a.probeDefaults, defaultToolProps));
|
|
35
23
|
this.addNewAnnotation = (evt) => {
|
|
36
24
|
const eventDetail = evt.detail;
|
|
37
25
|
const { currentPoints, element } = eventDetail;
|
|
@@ -179,7 +167,9 @@ class ProbeTool extends AnnotationTool {
|
|
|
179
167
|
if (referencedImageId) {
|
|
180
168
|
for (const targetId in data.cachedStats) {
|
|
181
169
|
if (targetId.startsWith('imageId')) {
|
|
182
|
-
const viewports = renderingEngine
|
|
170
|
+
const viewports = renderingEngine
|
|
171
|
+
.getViewports()
|
|
172
|
+
.filter(viewportSupportsImageSlices);
|
|
183
173
|
const invalidatedStack = viewports.find((vp) => {
|
|
184
174
|
const currentImageId = vp.getCurrentImageId();
|
|
185
175
|
if (!currentImageId)
|
|
@@ -230,36 +220,6 @@ class ProbeTool extends AnnotationTool {
|
|
|
230
220
|
return vec2.distance(canvasCoords, annotationCanvasCoordinate) < proximity;
|
|
231
221
|
}
|
|
232
222
|
toolSelectedCallback() { }
|
|
233
|
-
static { this.hydrate = (viewportId, points, options) => {
|
|
234
|
-
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
235
|
-
if (!enabledElement) {
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, viewUp, instance, viewport, } = this.hydrateBase(ProbeTool, enabledElement, points, options);
|
|
239
|
-
const { toolInstance, ...serializableOptions } = options || {};
|
|
240
|
-
const annotation = {
|
|
241
|
-
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
242
|
-
data: {
|
|
243
|
-
handles: {
|
|
244
|
-
points,
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
highlighted: false,
|
|
248
|
-
autoGenerated: false,
|
|
249
|
-
invalidated: false,
|
|
250
|
-
isLocked: false,
|
|
251
|
-
isVisible: true,
|
|
252
|
-
metadata: {
|
|
253
|
-
toolName: instance.getToolName(),
|
|
254
|
-
viewPlaneNormal,
|
|
255
|
-
FrameOfReferenceUID,
|
|
256
|
-
referencedImageId,
|
|
257
|
-
...serializableOptions,
|
|
258
|
-
},
|
|
259
|
-
};
|
|
260
|
-
addAnnotation(annotation, viewport.element);
|
|
261
|
-
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
262
|
-
}; }
|
|
263
223
|
getHandleNearImagePoint(element, annotation, canvasCoords, proximity) {
|
|
264
224
|
const enabledElement = getEnabledElement(element);
|
|
265
225
|
const { viewport } = enabledElement;
|
|
@@ -363,6 +323,51 @@ class ProbeTool extends AnnotationTool {
|
|
|
363
323
|
return cachedStats;
|
|
364
324
|
}
|
|
365
325
|
}
|
|
326
|
+
_a = ProbeTool;
|
|
327
|
+
ProbeTool.toolName = 'Probe';
|
|
328
|
+
ProbeTool.probeDefaults = {
|
|
329
|
+
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
330
|
+
configuration: {
|
|
331
|
+
shadow: true,
|
|
332
|
+
preventHandleOutsideImage: false,
|
|
333
|
+
getTextLines: defaultGetTextLines,
|
|
334
|
+
handleRadius: '6',
|
|
335
|
+
textCanvasOffset: {
|
|
336
|
+
x: 6,
|
|
337
|
+
y: -6,
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
};
|
|
341
|
+
ProbeTool.hydrate = (viewportId, points, options) => {
|
|
342
|
+
const enabledElement = getEnabledElementByViewportId(viewportId);
|
|
343
|
+
if (!enabledElement) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, viewUp, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
|
|
347
|
+
const { toolInstance, ...serializableOptions } = options || {};
|
|
348
|
+
const annotation = {
|
|
349
|
+
annotationUID: options?.annotationUID || csUtils.uuidv4(),
|
|
350
|
+
data: {
|
|
351
|
+
handles: {
|
|
352
|
+
points,
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
highlighted: false,
|
|
356
|
+
autoGenerated: false,
|
|
357
|
+
invalidated: false,
|
|
358
|
+
isLocked: false,
|
|
359
|
+
isVisible: true,
|
|
360
|
+
metadata: {
|
|
361
|
+
toolName: instance.getToolName(),
|
|
362
|
+
viewPlaneNormal,
|
|
363
|
+
FrameOfReferenceUID,
|
|
364
|
+
referencedImageId,
|
|
365
|
+
...serializableOptions,
|
|
366
|
+
},
|
|
367
|
+
};
|
|
368
|
+
addAnnotation(annotation, viewport.element);
|
|
369
|
+
triggerAnnotationRenderForViewportIds([viewport.id]);
|
|
370
|
+
};
|
|
366
371
|
function defaultGetTextLines(data, targetId) {
|
|
367
372
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
368
373
|
const { index, value, modalityUnit } = cachedVolumeStats;
|