@cornerstonejs/tools 0.56.1 → 0.56.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/tools/CrosshairsTool.d.ts +1 -0
- package/dist/cjs/tools/CrosshairsTool.js +4 -1
- package/dist/cjs/tools/CrosshairsTool.js.map +1 -1
- package/dist/esm/tools/CrosshairsTool.d.ts +1 -0
- package/dist/esm/tools/CrosshairsTool.js +4 -1
- package/dist/esm/tools/CrosshairsTool.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +5 -4
- package/src/constants/COLOR_LUT.ts +262 -0
- package/src/constants/index.ts +3 -0
- package/src/cursors/ImageMouseCursor.ts +39 -0
- package/src/cursors/MouseCursor.ts +114 -0
- package/src/cursors/SVGCursorDescriptor.ts +462 -0
- package/src/cursors/SVGMouseCursor.ts +145 -0
- package/src/cursors/elementCursor.ts +69 -0
- package/src/cursors/index.ts +24 -0
- package/src/cursors/setCursorForElement.ts +33 -0
- package/src/drawingSvg/_getHash.ts +9 -0
- package/src/drawingSvg/_setAttributesIfNecessary.ts +13 -0
- package/src/drawingSvg/_setNewAttributesIfValid.ts +10 -0
- package/src/drawingSvg/clearByToolType.ts +26 -0
- package/src/drawingSvg/draw.ts +16 -0
- package/src/drawingSvg/drawArrow.ts +82 -0
- package/src/drawingSvg/drawCircle.ts +62 -0
- package/src/drawingSvg/drawEllipse.ts +71 -0
- package/src/drawingSvg/drawHandles.ts +87 -0
- package/src/drawingSvg/drawLine.ts +70 -0
- package/src/drawingSvg/drawLink.ts +76 -0
- package/src/drawingSvg/drawLinkedTextBox.ts +64 -0
- package/src/drawingSvg/drawPolyline.ts +80 -0
- package/src/drawingSvg/drawRect.ts +70 -0
- package/src/drawingSvg/drawTextBox.ts +213 -0
- package/src/drawingSvg/getSvgDrawingHelper.ts +98 -0
- package/src/drawingSvg/index.ts +23 -0
- package/src/enums/AnnotationStyleStates.ts +22 -0
- package/src/enums/Events.ts +242 -0
- package/src/enums/SegmentationRepresentations.ts +12 -0
- package/src/enums/ToolBindings.ts +37 -0
- package/src/enums/ToolModes.ts +31 -0
- package/src/enums/Touch.ts +8 -0
- package/src/enums/index.js +16 -0
- package/src/eventDispatchers/annotationModifiedEventDispatcher.ts +41 -0
- package/src/eventDispatchers/cameraModifiedEventDispatcher.ts +41 -0
- package/src/eventDispatchers/imageRenderedEventDispatcher.ts +37 -0
- package/src/eventDispatchers/imageSpacingCalibratedEventDispatcher.ts +50 -0
- package/src/eventDispatchers/index.js +15 -0
- package/src/eventDispatchers/keyboardEventHandlers/index.js +4 -0
- package/src/eventDispatchers/keyboardEventHandlers/keyDown.ts +29 -0
- package/src/eventDispatchers/keyboardEventHandlers/keyUp.ts +33 -0
- package/src/eventDispatchers/keyboardToolEventDispatcher.ts +28 -0
- package/src/eventDispatchers/mouseEventHandlers/index.js +19 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseClick.ts +13 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDoubleClick.ts +13 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDown.ts +196 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDownActivate.ts +35 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseDrag.ts +25 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseMove.ts +70 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseUp.ts +9 -0
- package/src/eventDispatchers/mouseEventHandlers/mouseWheel.ts +13 -0
- package/src/eventDispatchers/mouseToolEventDispatcher.ts +64 -0
- package/src/eventDispatchers/shared/customCallbackHandler.ts +73 -0
- package/src/eventDispatchers/shared/getActiveToolForKeyboardEvent.ts +58 -0
- package/src/eventDispatchers/shared/getActiveToolForMouseEvent.ts +61 -0
- package/src/eventDispatchers/shared/getActiveToolForTouchEvent.ts +64 -0
- package/src/eventDispatchers/shared/getMouseModifier.ts +30 -0
- package/src/eventDispatchers/shared/getToolsWithModesForMouseEvent.ts +56 -0
- package/src/eventDispatchers/shared/getToolsWithModesForTouchEvent.ts +54 -0
- package/src/eventDispatchers/touchEventHandlers/index.js +15 -0
- package/src/eventDispatchers/touchEventHandlers/touchDrag.ts +23 -0
- package/src/eventDispatchers/touchEventHandlers/touchEnd.ts +9 -0
- package/src/eventDispatchers/touchEventHandlers/touchPress.ts +13 -0
- package/src/eventDispatchers/touchEventHandlers/touchStart.ts +174 -0
- package/src/eventDispatchers/touchEventHandlers/touchStartActivate.ts +36 -0
- package/src/eventDispatchers/touchEventHandlers/touchTap.ts +9 -0
- package/src/eventDispatchers/touchToolEventDispatcher.ts +51 -0
- package/src/eventListeners/annotations/annotationModifiedListener.ts +22 -0
- package/src/eventListeners/annotations/annotationSelectionListener.ts +29 -0
- package/src/eventListeners/annotations/index.ts +4 -0
- package/src/eventListeners/index.ts +28 -0
- package/src/eventListeners/keyboard/index.ts +16 -0
- package/src/eventListeners/keyboard/keyDownListener.ts +99 -0
- package/src/eventListeners/mouse/getMouseEventPoints.ts +66 -0
- package/src/eventListeners/mouse/index.ts +55 -0
- package/src/eventListeners/mouse/mouseDoubleClickListener.ts +55 -0
- package/src/eventListeners/mouse/mouseDownListener.ts +519 -0
- package/src/eventListeners/mouse/mouseMoveListener.ts +33 -0
- package/src/eventListeners/segmentation/index.ts +11 -0
- package/src/eventListeners/segmentation/segmentationDataModifiedEventListener.ts +61 -0
- package/src/eventListeners/segmentation/segmentationModifiedEventListener.ts +32 -0
- package/src/eventListeners/segmentation/segmentationRepresentationModifiedEventListener.ts +15 -0
- package/src/eventListeners/segmentation/segmentationRepresentationRemovedEventListener.ts +16 -0
- package/src/eventListeners/touch/getTouchEventPoints.ts +75 -0
- package/src/eventListeners/touch/index.ts +37 -0
- package/src/eventListeners/touch/preventGhostClick.js +72 -0
- package/src/eventListeners/touch/touchStartListener.ts +499 -0
- package/src/eventListeners/wheel/index.ts +27 -0
- package/src/eventListeners/wheel/normalizeWheel.ts +69 -0
- package/src/eventListeners/wheel/wheelListener.ts +51 -0
- package/src/index.ts +133 -0
- package/src/init.ts +187 -0
- package/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts +399 -0
- package/src/stateManagement/annotation/annotationLocking.ts +178 -0
- package/src/stateManagement/annotation/annotationSelection.ts +163 -0
- package/src/stateManagement/annotation/annotationState.ts +180 -0
- package/src/stateManagement/annotation/annotationVisibility.ts +156 -0
- package/src/stateManagement/annotation/config/ToolStyle.ts +265 -0
- package/src/stateManagement/annotation/config/getFont.ts +36 -0
- package/src/stateManagement/annotation/config/getState.ts +26 -0
- package/src/stateManagement/annotation/config/helpers.ts +55 -0
- package/src/stateManagement/annotation/config/index.ts +5 -0
- package/src/stateManagement/annotation/helpers/state.ts +83 -0
- package/src/stateManagement/annotation/index.ts +15 -0
- package/src/stateManagement/index.js +40 -0
- package/src/stateManagement/segmentation/SegmentationStateManager.ts +491 -0
- package/src/stateManagement/segmentation/activeSegmentation.ts +60 -0
- package/src/stateManagement/segmentation/addSegmentationRepresentations.ts +77 -0
- package/src/stateManagement/segmentation/addSegmentations.ts +27 -0
- package/src/stateManagement/segmentation/config/index.ts +29 -0
- package/src/stateManagement/segmentation/config/segmentationColor.ts +132 -0
- package/src/stateManagement/segmentation/config/segmentationConfig.ts +195 -0
- package/src/stateManagement/segmentation/config/segmentationVisibility.ts +171 -0
- package/src/stateManagement/segmentation/helpers/index.ts +3 -0
- package/src/stateManagement/segmentation/helpers/normalizeSegmentationInput.ts +35 -0
- package/src/stateManagement/segmentation/helpers/validateSegmentationInput.ts +41 -0
- package/src/stateManagement/segmentation/index.ts +22 -0
- package/src/stateManagement/segmentation/removeSegmentationsFromToolGroup.ts +85 -0
- package/src/stateManagement/segmentation/segmentIndex.ts +38 -0
- package/src/stateManagement/segmentation/segmentLocking.ts +72 -0
- package/src/stateManagement/segmentation/segmentationState.ts +429 -0
- package/src/stateManagement/segmentation/triggerSegmentationEvents.ts +157 -0
- package/src/store/SynchronizerManager/Synchronizer.ts +344 -0
- package/src/store/SynchronizerManager/createSynchronizer.ts +41 -0
- package/src/store/SynchronizerManager/destroy.ts +14 -0
- package/src/store/SynchronizerManager/destroySynchronizer.ts +25 -0
- package/src/store/SynchronizerManager/getAllSynchronizers.ts +12 -0
- package/src/store/SynchronizerManager/getSynchronizer.ts +13 -0
- package/src/store/SynchronizerManager/getSynchronizersForViewport.ts +44 -0
- package/src/store/SynchronizerManager/index.js +15 -0
- package/src/store/ToolGroupManager/ToolGroup.ts +679 -0
- package/src/store/ToolGroupManager/createToolGroup.ts +33 -0
- package/src/store/ToolGroupManager/destroy.ts +24 -0
- package/src/store/ToolGroupManager/destroyToolGroup.ts +26 -0
- package/src/store/ToolGroupManager/getAllToolGroups.ts +12 -0
- package/src/store/ToolGroupManager/getToolGroup.ts +14 -0
- package/src/store/ToolGroupManager/getToolGroupForViewport.ts +44 -0
- package/src/store/ToolGroupManager/getToolGroupsWithToolName.ts +33 -0
- package/src/store/ToolGroupManager/index.ts +17 -0
- package/src/store/addEnabledElement.ts +137 -0
- package/src/store/addTool.ts +56 -0
- package/src/store/cancelActiveManipulations.ts +30 -0
- package/src/store/filterMoveableAnnotationTools.ts +61 -0
- package/src/store/filterToolsWithAnnotationsForElement.ts +51 -0
- package/src/store/filterToolsWithMoveableHandles.ts +51 -0
- package/src/store/index.ts +29 -0
- package/src/store/removeEnabledElement.ts +132 -0
- package/src/store/state.ts +57 -0
- package/src/store/svgNodeCache.ts +7 -0
- package/src/synchronizers/callbacks/areViewportsCoplanar .ts +12 -0
- package/src/synchronizers/callbacks/cameraSyncCallback.ts +33 -0
- package/src/synchronizers/callbacks/stackImageSyncCallback.ts +157 -0
- package/src/synchronizers/callbacks/voiSyncCallback.ts +51 -0
- package/src/synchronizers/callbacks/zoomPanSyncCallback.ts +43 -0
- package/src/synchronizers/index.ts +11 -0
- package/src/synchronizers/synchronizers/createCameraPositionSynchronizer.ts +25 -0
- package/src/synchronizers/synchronizers/createStackImageSynchronizer.ts +25 -0
- package/src/synchronizers/synchronizers/createVOISynchronizer.ts +24 -0
- package/src/synchronizers/synchronizers/createZoomPanSynchronizer.ts +25 -0
- package/src/synchronizers/synchronizers/index.ts +11 -0
- package/src/tools/CrosshairsTool.ts +2693 -0
- package/src/tools/MIPJumpToClickTool.ts +99 -0
- package/src/tools/MagnifyTool.ts +319 -0
- package/src/tools/PanTool.ts +58 -0
- package/src/tools/PlanarRotateTool.ts +77 -0
- package/src/tools/ReferenceCursors.ts +466 -0
- package/src/tools/ReferenceLinesTool.ts +279 -0
- package/src/tools/ScaleOverlayTool.ts +685 -0
- package/src/tools/StackScrollTool.ts +97 -0
- package/src/tools/StackScrollToolMouseWheelTool.ts +58 -0
- package/src/tools/TrackballRotateTool.ts +141 -0
- package/src/tools/VolumeRotateMouseWheelTool.ts +86 -0
- package/src/tools/WindowLevelTool.ts +260 -0
- package/src/tools/ZoomTool.ts +293 -0
- package/src/tools/annotation/AngleTool.ts +835 -0
- package/src/tools/annotation/ArrowAnnotateTool.ts +820 -0
- package/src/tools/annotation/BidirectionalTool.ts +1350 -0
- package/src/tools/annotation/CircleROITool.ts +1070 -0
- package/src/tools/annotation/CobbAngleTool.ts +815 -0
- package/src/tools/annotation/DragProbeTool.ts +213 -0
- package/src/tools/annotation/EllipticalROITool.ts +1223 -0
- package/src/tools/annotation/LengthTool.ts +861 -0
- package/src/tools/annotation/PlanarFreehandROITool.ts +636 -0
- package/src/tools/annotation/ProbeTool.ts +681 -0
- package/src/tools/annotation/RectangleROITool.ts +1028 -0
- package/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts +488 -0
- package/src/tools/annotation/planarFreehandROITool/drawLoop.ts +462 -0
- package/src/tools/annotation/planarFreehandROITool/editLoopCommon.ts +331 -0
- package/src/tools/annotation/planarFreehandROITool/findOpenUShapedContourVectorToPeak.ts +74 -0
- package/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts +612 -0
- package/src/tools/annotation/planarFreehandROITool/openContourEndEditLoop.ts +74 -0
- package/src/tools/annotation/planarFreehandROITool/renderMethods.ts +407 -0
- package/src/tools/base/AnnotationDisplayTool.ts +228 -0
- package/src/tools/base/AnnotationTool.ts +307 -0
- package/src/tools/base/BaseTool.ts +215 -0
- package/src/tools/base/index.ts +4 -0
- package/src/tools/displayTools/Contour/addContourToElement.ts +135 -0
- package/src/tools/displayTools/Contour/contourDisplay.ts +252 -0
- package/src/tools/displayTools/Contour/index.ts +3 -0
- package/src/tools/displayTools/Contour/removeContourFromElement.ts +35 -0
- package/src/tools/displayTools/Labelmap/addLabelmapToElement.ts +57 -0
- package/src/tools/displayTools/Labelmap/index.ts +4 -0
- package/src/tools/displayTools/Labelmap/labelmapConfig.ts +37 -0
- package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +461 -0
- package/src/tools/displayTools/Labelmap/removeLabelmapFromElement.ts +27 -0
- package/src/tools/displayTools/Labelmap/validateRepresentationData.ts +30 -0
- package/src/tools/displayTools/SegmentationDisplayTool.ts +198 -0
- package/src/tools/index.ts +84 -0
- package/src/tools/segmentation/BrushTool.ts +474 -0
- package/src/tools/segmentation/CircleScissorsTool.ts +365 -0
- package/src/tools/segmentation/PaintFillTool.ts +370 -0
- package/src/tools/segmentation/RectangleROIStartEndThresholdTool.ts +471 -0
- package/src/tools/segmentation/RectangleROIThresholdTool.ts +281 -0
- package/src/tools/segmentation/RectangleScissorsTool.ts +382 -0
- package/src/tools/segmentation/SphereScissorsTool.ts +368 -0
- package/src/tools/segmentation/strategies/eraseCircle.ts +30 -0
- package/src/tools/segmentation/strategies/eraseRectangle.ts +81 -0
- package/src/tools/segmentation/strategies/eraseSphere.ts +27 -0
- package/src/tools/segmentation/strategies/fillCircle.ts +185 -0
- package/src/tools/segmentation/strategies/fillRectangle.ts +110 -0
- package/src/tools/segmentation/strategies/fillSphere.ts +88 -0
- package/src/tools/segmentation/strategies/index.ts +9 -0
- package/src/types/AnnotationGroupSelector.ts +7 -0
- package/src/types/AnnotationStyle.ts +42 -0
- package/src/types/AnnotationTypes.ts +109 -0
- package/src/types/BoundsIJK.ts +5 -0
- package/src/types/CINETypes.ts +32 -0
- package/src/types/ContourTypes.ts +26 -0
- package/src/types/CursorTypes.ts +12 -0
- package/src/types/EventTypes.ts +657 -0
- package/src/types/FloodFillTypes.ts +19 -0
- package/src/types/IAnnotationManager.ts +89 -0
- package/src/types/IDistance.ts +16 -0
- package/src/types/IPoints.ts +18 -0
- package/src/types/ISetToolModeOptions.ts +29 -0
- package/src/types/ISynchronizerEventHandler.ts +11 -0
- package/src/types/IToolClassReference.ts +5 -0
- package/src/types/IToolGroup.ts +72 -0
- package/src/types/ITouchPoints.ts +14 -0
- package/src/types/InteractionTypes.ts +6 -0
- package/src/types/InternalToolTypes.ts +19 -0
- package/src/types/JumpToSliceOptions.ts +7 -0
- package/src/types/LabelmapTypes.ts +41 -0
- package/src/types/PlanarBoundingBox.ts +8 -0
- package/src/types/SVGDrawingHelper.ts +10 -0
- package/src/types/ScrollOptions.ts +9 -0
- package/src/types/SegmentationStateTypes.ts +248 -0
- package/src/types/ToolHandle.ts +26 -0
- package/src/types/ToolProps.ts +16 -0
- package/src/types/ToolSpecificAnnotationTypes.ts +311 -0
- package/src/types/index.ts +115 -0
- package/src/utilities/boundingBox/extend2DBoundingBoxInViewAxis.ts +29 -0
- package/src/utilities/boundingBox/getBoundingBoxAroundShape.ts +57 -0
- package/src/utilities/boundingBox/index.ts +4 -0
- package/src/utilities/calibrateImageSpacing.ts +46 -0
- package/src/utilities/cine/events.ts +9 -0
- package/src/utilities/cine/index.ts +5 -0
- package/src/utilities/cine/playClip.ts +435 -0
- package/src/utilities/cine/state.ts +18 -0
- package/src/utilities/clip.js +30 -0
- package/src/utilities/debounce.js +217 -0
- package/src/utilities/drawing/getTextBoxCoordsCanvas.ts +45 -0
- package/src/utilities/drawing/index.ts +3 -0
- package/src/utilities/dynamicVolume/getDataInTime.ts +110 -0
- package/src/utilities/dynamicVolume/index.ts +2 -0
- package/src/utilities/getAnnotationNearPoint.ts +130 -0
- package/src/utilities/getModalityUnit.ts +11 -0
- package/src/utilities/getToolsWithModesForElement.ts +52 -0
- package/src/utilities/index.ts +68 -0
- package/src/utilities/isObject.js +29 -0
- package/src/utilities/math/angle/angleBetweenLines.ts +29 -0
- package/src/utilities/math/circle/_types.ts +6 -0
- package/src/utilities/math/circle/getCanvasCircleCorners.ts +23 -0
- package/src/utilities/math/circle/getCanvasCircleRadius.ts +16 -0
- package/src/utilities/math/circle/index.ts +4 -0
- package/src/utilities/math/ellipse/getCanvasEllipseCorners.ts +26 -0
- package/src/utilities/math/ellipse/index.ts +4 -0
- package/src/utilities/math/ellipse/pointInEllipse.ts +38 -0
- package/src/utilities/math/ellipse/pointInEllipsoidWithConstraint.ts +35 -0
- package/src/utilities/math/index.ts +8 -0
- package/src/utilities/math/line/distanceToPoint.ts +24 -0
- package/src/utilities/math/line/distanceToPointSquared.ts +44 -0
- package/src/utilities/math/line/index.ts +5 -0
- package/src/utilities/math/line/intersectLine.ts +92 -0
- package/src/utilities/math/midPoint.ts +24 -0
- package/src/utilities/math/point/distanceToPoint.ts +22 -0
- package/src/utilities/math/point/index.ts +3 -0
- package/src/utilities/math/polyline/addCanvasPointsToArray.ts +62 -0
- package/src/utilities/math/polyline/calculateAreaOfPoints.ts +23 -0
- package/src/utilities/math/polyline/getIntersectionWithPolyline.ts +182 -0
- package/src/utilities/math/polyline/getSubPixelSpacingAndXYDirections.ts +99 -0
- package/src/utilities/math/polyline/index.ts +19 -0
- package/src/utilities/math/polyline/planarFreehandROIInternalTypes.ts +36 -0
- package/src/utilities/math/polyline/pointCanProjectOnLine.ts +57 -0
- package/src/utilities/math/polyline/pointsAreWithinCloseContourProximity.ts +15 -0
- package/src/utilities/math/rectangle/distanceToPoint.ts +82 -0
- package/src/utilities/math/rectangle/index.ts +3 -0
- package/src/utilities/math/sphere/index.ts +3 -0
- package/src/utilities/math/sphere/pointInSphere.ts +31 -0
- package/src/utilities/math/vec2/findClosestPoint.ts +40 -0
- package/src/utilities/math/vec2/index.ts +4 -0
- package/src/utilities/math/vec2/liangBarksyClip.ts +84 -0
- package/src/utilities/orientation/getOrientationStringLPS.ts +52 -0
- package/src/utilities/orientation/index.ts +4 -0
- package/src/utilities/orientation/invertOrientationStringLPS.ts +21 -0
- package/src/utilities/planar/filterAnnotationsForDisplay.ts +68 -0
- package/src/utilities/planar/filterAnnotationsWithinSlice.ts +85 -0
- package/src/utilities/planar/getPointInLineOfSightWithCriteria.ts +104 -0
- package/src/utilities/planar/getWorldWidthAndHeightFromCorners.ts +51 -0
- package/src/utilities/planar/getWorldWidthAndHeightFromTwoPoints.ts +51 -0
- package/src/utilities/planar/index.ts +18 -0
- package/src/utilities/planarFreehandROITool/index.ts +7 -0
- package/src/utilities/planarFreehandROITool/interpolateAnnotation.ts +87 -0
- package/src/utilities/planarFreehandROITool/interpolatePoints.ts +214 -0
- package/src/utilities/planarFreehandROITool/interpolation/algorithms/bspline.ts +55 -0
- package/src/utilities/planarFreehandROITool/interpolation/interpolateSegmentPoints.ts +90 -0
- package/src/utilities/pointInShapeCallback.ts +138 -0
- package/src/utilities/pointInSurroundingSphereCallback.ts +188 -0
- package/src/utilities/rectangleROITool/getBoundsIJKFromRectangleAnnotations.ts +76 -0
- package/src/utilities/rectangleROITool/index.ts +3 -0
- package/src/utilities/scroll.ts +62 -0
- package/src/utilities/segmentation/brushSizeForToolGroup.ts +72 -0
- package/src/utilities/segmentation/brushThresholdForToolGroup.ts +65 -0
- package/src/utilities/segmentation/createLabelmapVolumeForViewport.ts +74 -0
- package/src/utilities/segmentation/createMergedLabelmapForIndex.ts +65 -0
- package/src/utilities/segmentation/floodFill.ts +194 -0
- package/src/utilities/segmentation/getDefaultRepresentationConfig.ts +20 -0
- package/src/utilities/segmentation/index.ts +33 -0
- package/src/utilities/segmentation/isValidRepresentationConfig.ts +22 -0
- package/src/utilities/segmentation/rectangleROIThresholdVolumeByRange.ts +91 -0
- package/src/utilities/segmentation/thresholdSegmentationByRange.ts +129 -0
- package/src/utilities/segmentation/thresholdVolumeByRange.ts +150 -0
- package/src/utilities/segmentation/triggerSegmentationRender.ts +206 -0
- package/src/utilities/segmentation/utilities.ts +116 -0
- package/src/utilities/stackPrefetch/index.ts +8 -0
- package/src/utilities/stackPrefetch/stackPrefetch.ts +405 -0
- package/src/utilities/stackPrefetch/state.ts +17 -0
- package/src/utilities/throttle.js +69 -0
- package/src/utilities/touch/index.ts +246 -0
- package/src/utilities/triggerAnnotationRender.ts +237 -0
- package/src/utilities/triggerAnnotationRenderForViewportIds.ts +18 -0
- package/src/utilities/viewport/index.ts +5 -0
- package/src/utilities/viewport/isViewportPreScaled.ts +24 -0
- package/src/utilities/viewport/jumpToSlice.ts +73 -0
- package/src/utilities/viewport/jumpToWorld.ts +58 -0
- package/src/utilities/viewportFilters/filterViewportsWithFrameOfReferenceUID.ts +28 -0
- package/src/utilities/viewportFilters/filterViewportsWithParallelNormals.ts +26 -0
- package/src/utilities/viewportFilters/filterViewportsWithSameOrientation.ts +15 -0
- package/src/utilities/viewportFilters/filterViewportsWithToolEnabled.ts +72 -0
- package/src/utilities/viewportFilters/getViewportIdsWithToolToRender.ts +45 -0
- package/src/utilities/viewportFilters/index.ts +11 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getRenderingEngine,
|
|
3
|
+
getEnabledElement,
|
|
4
|
+
Enums,
|
|
5
|
+
Types,
|
|
6
|
+
} from '@cornerstonejs/core';
|
|
7
|
+
|
|
8
|
+
import { ISynchronizerEventHandler } from '../../types';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Synchronizer is a class that listens to a specific event on a specific source
|
|
12
|
+
* targets and fires a specific event on a specific target elements. Use cases
|
|
13
|
+
* include: synchronizing a camera between two viewports, synchronizing a
|
|
14
|
+
* windowLevel between various viewports.
|
|
15
|
+
*/
|
|
16
|
+
class Synchronizer {
|
|
17
|
+
//
|
|
18
|
+
private _enabled: boolean;
|
|
19
|
+
private _eventName: string;
|
|
20
|
+
private _eventHandler: ISynchronizerEventHandler;
|
|
21
|
+
private _ignoreFiredEvents: boolean;
|
|
22
|
+
private _sourceViewports: Array<Types.IViewportId>;
|
|
23
|
+
private _targetViewports: Array<Types.IViewportId>;
|
|
24
|
+
private _viewportOptions: Record<string, Record<string, unknown>> = {};
|
|
25
|
+
public id: string;
|
|
26
|
+
|
|
27
|
+
constructor(
|
|
28
|
+
synchronizerId: string,
|
|
29
|
+
eventName: string,
|
|
30
|
+
eventHandler: ISynchronizerEventHandler
|
|
31
|
+
) {
|
|
32
|
+
this._enabled = true;
|
|
33
|
+
this._eventName = eventName;
|
|
34
|
+
this._eventHandler = eventHandler;
|
|
35
|
+
this._ignoreFiredEvents = false;
|
|
36
|
+
this._sourceViewports = [];
|
|
37
|
+
this._targetViewports = [];
|
|
38
|
+
|
|
39
|
+
//
|
|
40
|
+
this.id = synchronizerId;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* "Returns true if the synchronizer is disabled."
|
|
45
|
+
* @returns A boolean value.
|
|
46
|
+
*/
|
|
47
|
+
public isDisabled(): boolean {
|
|
48
|
+
return !this._enabled || !this._hasSourceElements();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Sets the options for the viewport id. This can be used to
|
|
53
|
+
* provide configuration on a viewport basis for things like offsets
|
|
54
|
+
* to the general synchronization, or turn on/off synchronization of certain
|
|
55
|
+
* attributes.
|
|
56
|
+
*/
|
|
57
|
+
public setOptions(
|
|
58
|
+
viewportId: string,
|
|
59
|
+
options: Record<string, unknown> = {}
|
|
60
|
+
): void {
|
|
61
|
+
this._viewportOptions[viewportId] = options;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Gets the options for the given viewport id */
|
|
65
|
+
public getOptions(viewportId: string): Record<string, unknown> | undefined {
|
|
66
|
+
return this._viewportOptions[viewportId];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Add a viewport to the list of targets and sources both.
|
|
71
|
+
* @param viewportInfo - The viewportId and its renderingEngineId to add to the list of targets and sources.
|
|
72
|
+
*/
|
|
73
|
+
public add(viewportInfo: Types.IViewportId): void {
|
|
74
|
+
this.addTarget(viewportInfo);
|
|
75
|
+
this.addSource(viewportInfo);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Add a viewport to the list of sources (source ONLY)
|
|
80
|
+
* @param viewportInfo - The viewportId and its renderingEngineId to add to the list of targets and sources.
|
|
81
|
+
*/
|
|
82
|
+
public addSource(viewportInfo: Types.IViewportId): void {
|
|
83
|
+
if (_containsViewport(this._sourceViewports, viewportInfo)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const { renderingEngineId, viewportId } = viewportInfo;
|
|
88
|
+
|
|
89
|
+
const { element } =
|
|
90
|
+
getRenderingEngine(renderingEngineId).getViewport(viewportId);
|
|
91
|
+
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
element.addEventListener(this._eventName, this._onEvent.bind(this));
|
|
94
|
+
this._updateDisableHandlers();
|
|
95
|
+
|
|
96
|
+
this._sourceViewports.push(viewportInfo);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Add a viewport to the list of viewports that will get the eventHandler
|
|
101
|
+
* executed when the event is fired on the source viewport.
|
|
102
|
+
* @param viewportInfo - The viewportId and its renderingEngineId to add to the list of targets and sources.
|
|
103
|
+
*/
|
|
104
|
+
public addTarget(viewportInfo: Types.IViewportId): void {
|
|
105
|
+
if (_containsViewport(this._targetViewports, viewportInfo)) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
this._targetViewports.push(viewportInfo);
|
|
110
|
+
this._updateDisableHandlers();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Get the list of source viewports (as {viewportId, renderingEngineId} objects)
|
|
115
|
+
* @returns An array of {viewportId, renderingEngineId} objects.
|
|
116
|
+
*/
|
|
117
|
+
public getSourceViewports(): Array<Types.IViewportId> {
|
|
118
|
+
return this._sourceViewports;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Get the list of target viewports (as {viewportId, renderingEngineId} objects)
|
|
123
|
+
* @returns An array of {viewportId, renderingEngineId} objects.
|
|
124
|
+
*/
|
|
125
|
+
public getTargetViewports(): Array<Types.IViewportId> {
|
|
126
|
+
return this._targetViewports;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
public destroy(): void {
|
|
130
|
+
this._sourceViewports.forEach((s) => this.removeSource(s));
|
|
131
|
+
this._targetViewports.forEach((t) => this.removeTarget(t));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Remove the viewport from the list of targets and sources
|
|
136
|
+
* @param viewportInfo - The viewport info including viewportId and renderingEngineId.
|
|
137
|
+
*/
|
|
138
|
+
public remove(viewportInfo: Types.IViewportId): void {
|
|
139
|
+
this.removeTarget(viewportInfo);
|
|
140
|
+
this.removeSource(viewportInfo);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Remove the viewport from the list of source viewports
|
|
145
|
+
* @param viewportInfo - The viewport info including viewportId and renderingEngineId.
|
|
146
|
+
*/
|
|
147
|
+
public removeSource(viewportInfo: Types.IViewportId): void {
|
|
148
|
+
const index = _getViewportIndex(this._sourceViewports, viewportInfo);
|
|
149
|
+
|
|
150
|
+
if (index === -1) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const element = _getViewportElement(viewportInfo);
|
|
155
|
+
|
|
156
|
+
this._sourceViewports.splice(index, 1);
|
|
157
|
+
// @ts-ignore
|
|
158
|
+
element.removeEventListener(this._eventName, this._eventHandler);
|
|
159
|
+
this._updateDisableHandlers();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Remove the viewport from the list of viewports that are currently targeted by
|
|
164
|
+
* this handler
|
|
165
|
+
* @param viewportInfo - The viewport info including viewportId and renderingEngineId.
|
|
166
|
+
*
|
|
167
|
+
*/
|
|
168
|
+
public removeTarget(viewportInfo: Types.IViewportId): void {
|
|
169
|
+
const index = _getViewportIndex(this._targetViewports, viewportInfo);
|
|
170
|
+
|
|
171
|
+
if (index === -1) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
this._targetViewports.splice(index, 1);
|
|
176
|
+
this._updateDisableHandlers();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
public hasSourceViewport(
|
|
180
|
+
renderingEngineId: string,
|
|
181
|
+
viewportId: string
|
|
182
|
+
): boolean {
|
|
183
|
+
return _containsViewport(this._sourceViewports, {
|
|
184
|
+
renderingEngineId,
|
|
185
|
+
viewportId,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
public hasTargetViewport(
|
|
190
|
+
renderingEngineId: string,
|
|
191
|
+
viewportId: string
|
|
192
|
+
): boolean {
|
|
193
|
+
return _containsViewport(this._targetViewports, {
|
|
194
|
+
renderingEngineId,
|
|
195
|
+
viewportId,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
private fireEvent(sourceViewport: Types.IViewportId, sourceEvent: any): void {
|
|
200
|
+
if (this.isDisabled() || this._ignoreFiredEvents) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
this._ignoreFiredEvents = true;
|
|
205
|
+
try {
|
|
206
|
+
for (let i = 0; i < this._targetViewports.length; i++) {
|
|
207
|
+
const targetViewport = this._targetViewports[i];
|
|
208
|
+
const targetIsSource =
|
|
209
|
+
sourceViewport.viewportId === targetViewport.viewportId;
|
|
210
|
+
|
|
211
|
+
if (targetIsSource) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
this._eventHandler(this, sourceViewport, targetViewport, sourceEvent);
|
|
216
|
+
}
|
|
217
|
+
} catch (ex) {
|
|
218
|
+
console.warn(`Synchronizer, for: ${this._eventName}`, ex);
|
|
219
|
+
} finally {
|
|
220
|
+
this._ignoreFiredEvents = false;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
private _onEvent = (evt: any): void => {
|
|
225
|
+
if (this._ignoreFiredEvents === true) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// If no target viewports, then return immediately, this is useful
|
|
230
|
+
// when switching between layouts, when previous layout has disabled
|
|
231
|
+
// its viewports, and the new layout has not yet enabled them.
|
|
232
|
+
// Right now we don't "delete" the synchronizer if all source and targets
|
|
233
|
+
// are removed, but we may want to do that in the future.
|
|
234
|
+
if (!this._targetViewports.length) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const enabledElement = getEnabledElement(evt.currentTarget);
|
|
239
|
+
|
|
240
|
+
if (!enabledElement) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const { renderingEngineId, viewportId } = enabledElement;
|
|
245
|
+
|
|
246
|
+
// If the viewport has been removed from the synchronizer before the event is
|
|
247
|
+
// fired, then return immediately.
|
|
248
|
+
if (!this._sourceViewports.find((s) => s.viewportId === viewportId)) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
this.fireEvent(
|
|
253
|
+
{
|
|
254
|
+
renderingEngineId,
|
|
255
|
+
viewportId,
|
|
256
|
+
},
|
|
257
|
+
evt
|
|
258
|
+
);
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
private _hasSourceElements(): boolean {
|
|
262
|
+
return this._sourceViewports.length !== 0;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
private _updateDisableHandlers(): void {
|
|
266
|
+
const viewports = _getUniqueViewports(
|
|
267
|
+
this._sourceViewports,
|
|
268
|
+
this._targetViewports
|
|
269
|
+
);
|
|
270
|
+
const _remove = this.remove;
|
|
271
|
+
const disableHandler = (elementDisabledEvent) => {
|
|
272
|
+
_remove(elementDisabledEvent.detail.element);
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
viewports.forEach(function (vUid) {
|
|
276
|
+
const { element } = getRenderingEngine(
|
|
277
|
+
vUid.renderingEngineId
|
|
278
|
+
).getViewport(vUid.viewportId);
|
|
279
|
+
|
|
280
|
+
element.removeEventListener(
|
|
281
|
+
Enums.Events.ELEMENT_DISABLED,
|
|
282
|
+
disableHandler
|
|
283
|
+
);
|
|
284
|
+
element.addEventListener(Enums.Events.ELEMENT_DISABLED, disableHandler);
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function _getUniqueViewports(
|
|
290
|
+
vp1: Array<Types.IViewportId>,
|
|
291
|
+
vp2: Array<Types.IViewportId>
|
|
292
|
+
): Array<Types.IViewportId> {
|
|
293
|
+
const unique = [];
|
|
294
|
+
|
|
295
|
+
const vps = vp1.concat(vp2);
|
|
296
|
+
|
|
297
|
+
for (let i = 0; i < vps.length; i++) {
|
|
298
|
+
const vp = vps[i];
|
|
299
|
+
if (
|
|
300
|
+
!unique.some(
|
|
301
|
+
(u) =>
|
|
302
|
+
vp.renderingEngineId === u.renderingEngineId &&
|
|
303
|
+
vp.viewportId === u.viewportId
|
|
304
|
+
)
|
|
305
|
+
) {
|
|
306
|
+
unique.push(vp);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return unique;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function _getViewportIndex(
|
|
314
|
+
arr: Array<Types.IViewportId>,
|
|
315
|
+
vp: Types.IViewportId
|
|
316
|
+
): number {
|
|
317
|
+
return arr.findIndex(
|
|
318
|
+
(ar) =>
|
|
319
|
+
vp.renderingEngineId === ar.renderingEngineId &&
|
|
320
|
+
vp.viewportId === ar.viewportId
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function _containsViewport(
|
|
325
|
+
arr: Array<Types.IViewportId>,
|
|
326
|
+
vp: Types.IViewportId
|
|
327
|
+
) {
|
|
328
|
+
return arr.some(
|
|
329
|
+
(ar) =>
|
|
330
|
+
ar.renderingEngineId === vp.renderingEngineId &&
|
|
331
|
+
ar.viewportId === vp.viewportId
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function _getViewportElement(vp: Types.IViewportId): HTMLDivElement {
|
|
336
|
+
const renderingEngine = getRenderingEngine(vp.renderingEngineId);
|
|
337
|
+
if (!renderingEngine) {
|
|
338
|
+
throw new Error(`No RenderingEngine for Id: ${vp.renderingEngineId}`);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return renderingEngine.getViewport(vp.viewportId).element;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export default Synchronizer;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { state } from '../index';
|
|
2
|
+
import Synchronizer from './Synchronizer';
|
|
3
|
+
import { ISynchronizerEventHandler } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Create a new synchronizer instance from Synchronizer class
|
|
7
|
+
* @param synchronizerId - The id of the synchronizer.
|
|
8
|
+
* @param eventName - The name of the event that will be emitted by the
|
|
9
|
+
* synchronizer.
|
|
10
|
+
* @param eventHandler - The event handler that will be
|
|
11
|
+
* called when the event is emitted.
|
|
12
|
+
* @returns A reference to the synchronizer.
|
|
13
|
+
*/
|
|
14
|
+
function createSynchronizer(
|
|
15
|
+
synchronizerId: string,
|
|
16
|
+
eventName: string,
|
|
17
|
+
eventHandler: ISynchronizerEventHandler
|
|
18
|
+
): Synchronizer {
|
|
19
|
+
const synchronizerWithSameIdExists = state.synchronizers.some(
|
|
20
|
+
(sync) => sync.id === synchronizerId
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
if (synchronizerWithSameIdExists) {
|
|
24
|
+
throw new Error(`Synchronizer with id '${synchronizerId}' already exists.`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Create
|
|
28
|
+
const synchronizer = new Synchronizer(
|
|
29
|
+
synchronizerId,
|
|
30
|
+
eventName,
|
|
31
|
+
eventHandler
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// Update state
|
|
35
|
+
state.synchronizers.push(synchronizer);
|
|
36
|
+
|
|
37
|
+
// Return reference
|
|
38
|
+
return synchronizer;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default createSynchronizer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { state } from '../index';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* "Destroy all synchronizers."
|
|
5
|
+
*/
|
|
6
|
+
function destroy(): void {
|
|
7
|
+
while (state.synchronizers.length > 0) {
|
|
8
|
+
const synchronizer = state.synchronizers.pop();
|
|
9
|
+
|
|
10
|
+
synchronizer.destroy();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default destroy;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { state } from '../index';
|
|
2
|
+
|
|
3
|
+
// Synchronizers are a bit more tenacious. We need to make sure we remove
|
|
4
|
+
// any attached events
|
|
5
|
+
// We should probably just have a destroySynchronizer call
|
|
6
|
+
// then use getByX to allow versatility in how we can call destroy
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Destroy a synchronizer by its ID.
|
|
10
|
+
* @param synchronizerId - The id of the synchronizer to destroy.
|
|
11
|
+
*/
|
|
12
|
+
function destroySynchronizer(synchronizerId: string): void {
|
|
13
|
+
const synchronizerIndex = state.synchronizers.findIndex(
|
|
14
|
+
(sync) => sync.id === synchronizerId
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
if (synchronizerIndex > -1) {
|
|
18
|
+
const synchronizer = state.synchronizers[synchronizerIndex];
|
|
19
|
+
|
|
20
|
+
synchronizer.destroy();
|
|
21
|
+
state.synchronizers.splice(synchronizerIndex, 1);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default destroySynchronizer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { state } from '../index';
|
|
2
|
+
import Synchronizer from './Synchronizer';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Return the array of synchronizers
|
|
6
|
+
* @returns An array of synchronizers.
|
|
7
|
+
*/
|
|
8
|
+
function getAllSynchronizers(): Array<Synchronizer> {
|
|
9
|
+
return state.synchronizers;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default getAllSynchronizers;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { state } from '../index';
|
|
2
|
+
import Synchronizer from './Synchronizer';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get the synchronizer with the given id from the state.
|
|
6
|
+
* @param synchronizerId - The id of the synchronizer to be retrieved.
|
|
7
|
+
* @returns A synchronizer object.
|
|
8
|
+
*/
|
|
9
|
+
function getSynchronizer(synchronizerId: string): Synchronizer | void {
|
|
10
|
+
return state.synchronizers.find((s) => s.id === synchronizerId);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default getSynchronizer;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { state } from '../index';
|
|
2
|
+
import Synchronizer from './Synchronizer';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* It returns all synchronizers that are not disabled and have a source viewport
|
|
6
|
+
* with the given rendering engine Id and viewport Id
|
|
7
|
+
* @param renderingEngineId - The Id of the rendering engine
|
|
8
|
+
* @param viewportId - The Id of the viewport
|
|
9
|
+
* @returns An array of synchronizers
|
|
10
|
+
*/
|
|
11
|
+
function getSynchronizersForViewport(
|
|
12
|
+
viewportId: string,
|
|
13
|
+
renderingEngineId: string
|
|
14
|
+
): Array<Synchronizer> {
|
|
15
|
+
const synchronizersFilteredByIds = [];
|
|
16
|
+
|
|
17
|
+
if (!renderingEngineId && !viewportId) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
'At least one of renderingEngineId or viewportId should be given'
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
for (let i = 0; i < state.synchronizers.length; i++) {
|
|
24
|
+
const synchronizer = state.synchronizers[i];
|
|
25
|
+
const notDisabled = !synchronizer.isDisabled();
|
|
26
|
+
const hasSourceViewport = synchronizer.hasSourceViewport(
|
|
27
|
+
renderingEngineId,
|
|
28
|
+
viewportId
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const hasTargetViewport = synchronizer.hasTargetViewport(
|
|
32
|
+
renderingEngineId,
|
|
33
|
+
viewportId
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
if (notDisabled && (hasSourceViewport || hasTargetViewport)) {
|
|
37
|
+
synchronizersFilteredByIds.push(synchronizer);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return synchronizersFilteredByIds;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default getSynchronizersForViewport;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import createSynchronizer from './createSynchronizer';
|
|
2
|
+
import destroy from './destroy';
|
|
3
|
+
import getSynchronizersForViewport from './getSynchronizersForViewport';
|
|
4
|
+
import getSynchronizer from './getSynchronizer';
|
|
5
|
+
import getAllSynchronizers from './getAllSynchronizers';
|
|
6
|
+
import destroySynchronizer from './destroySynchronizer';
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
createSynchronizer,
|
|
10
|
+
destroy,
|
|
11
|
+
getSynchronizer,
|
|
12
|
+
getSynchronizersForViewport,
|
|
13
|
+
getAllSynchronizers,
|
|
14
|
+
destroySynchronizer,
|
|
15
|
+
};
|