@ohif/extension-cornerstone 3.14.0-beta.1 → 3.14.0-beta.100
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/915.ohif-extension-cornerstone.umd.js +1 -1
- package/dist/ohif-extension-cornerstone.umd.js +1 -5
- package/package.json +33 -25
- package/src/Viewport/OHIFCornerstoneViewport.css +46 -0
- package/src/Viewport/OHIFCornerstoneViewport.tsx +502 -0
- package/src/Viewport/Overlays/CornerstoneOverlays.tsx +103 -0
- package/src/Viewport/Overlays/CustomizableViewportOverlay.css +25 -0
- package/src/Viewport/Overlays/CustomizableViewportOverlay.tsx +469 -0
- package/src/Viewport/Overlays/ViewportImageScrollbar.tsx +106 -0
- package/src/Viewport/Overlays/ViewportImageSliceLoadingIndicator.tsx +87 -0
- package/src/Viewport/Overlays/ViewportOrientationMarkers.css +41 -0
- package/src/Viewport/Overlays/ViewportOrientationMarkers.tsx +136 -0
- package/src/Viewport/Overlays/ViewportSliceProgressScrollbar/ViewportSliceProgressScrollbar.tsx +195 -0
- package/src/Viewport/Overlays/ViewportSliceProgressScrollbar/helpers.ts +46 -0
- package/src/Viewport/Overlays/ViewportSliceProgressScrollbar/hooks.ts +383 -0
- package/src/Viewport/Overlays/ViewportSliceProgressScrollbar/index.ts +1 -0
- package/src/Viewport/Overlays/ViewportSliceProgressScrollbar/types.ts +17 -0
- package/src/Viewport/Overlays/utils.ts +66 -0
- package/src/commandsModule.ts +2951 -0
- package/src/components/AccordionGroup/AccordionGroup.tsx +195 -0
- package/src/components/AccordionGroup/index.ts +4 -0
- package/src/components/ActiveViewportWindowLevel/ActiveViewportWindowLevel.tsx +23 -0
- package/src/components/ActiveViewportWindowLevel/index.js +1 -0
- package/src/components/AdvancedRenderingControls/AdvancedRenderingControls.tsx +149 -0
- package/src/components/AdvancedRenderingControls/index.ts +1 -0
- package/src/components/CinePlayer/CinePlayer.tsx +247 -0
- package/src/components/CinePlayer/index.ts +3 -0
- package/src/components/DicomUpload/DicomUpload.tsx +111 -0
- package/src/components/DicomUpload/DicomUploadProgress.tsx +396 -0
- package/src/components/DicomUpload/DicomUploadProgressItem.tsx +119 -0
- package/src/components/ExportSegmentationSubMenuItem.tsx +75 -0
- package/src/components/MeasurementItems.tsx +70 -0
- package/src/components/MeasurementTableNested.tsx +30 -0
- package/src/components/MeasurementsMenu.tsx +84 -0
- package/src/components/MeasurementsOrAdditionalFindings.tsx +82 -0
- package/src/components/ModalityLoadBadge/ModalityLoadBadge.tsx +171 -0
- package/src/components/ModalityLoadBadge/index.ts +1 -0
- package/src/components/NavigationComponent/NavigationComponent.tsx +138 -0
- package/src/components/NavigationComponent/index.ts +3 -0
- package/src/components/OHIFViewportActionCorners.tsx +94 -0
- package/src/components/OpacityMenu/OpacityMenu.tsx +54 -0
- package/src/components/OpacityMenu/OpacityMenuWrapper.tsx +85 -0
- package/src/components/OpacityMenu/index.ts +2 -0
- package/src/components/PanelAccordionTrigger.tsx +48 -0
- package/src/components/SegmentationToolConfig.tsx +71 -0
- package/src/components/SegmentationUtilityButton.tsx +61 -0
- package/src/components/SelectItemWithModality.tsx +29 -0
- package/src/components/SeriesMeasurements.tsx +90 -0
- package/src/components/SeriesSummaryFromDisplaySet.tsx +21 -0
- package/src/components/StudyMeasurements.tsx +88 -0
- package/src/components/StudyMeasurementsActions.tsx +75 -0
- package/src/components/StudySummaryFromMetadata.test.ts +47 -0
- package/src/components/StudySummaryFromMetadata.tsx +31 -0
- package/src/components/StudySummaryWithActions.tsx +14 -0
- package/src/components/ThresholdMenu/ThresholdMenu.tsx +104 -0
- package/src/components/ThresholdMenu/ThresholdMenuWrapper.tsx +85 -0
- package/src/components/ThresholdMenu/index.ts +2 -0
- package/src/components/TrackingStatus/TrackingStatus.tsx +32 -0
- package/src/components/TrackingStatus/index.ts +1 -0
- package/src/components/VOIManualControlMenu/VOIManualControlMenu.tsx +190 -0
- package/src/components/VOIManualControlMenu/VOIManualControlMenuWrapper.tsx +85 -0
- package/src/components/VOIManualControlMenu/index.ts +2 -0
- package/src/components/ViewportColorbar/ViewportColorbar.tsx +150 -0
- package/src/components/ViewportColorbar/ViewportColorbarsContainer.tsx +125 -0
- package/src/components/ViewportColorbar/index.ts +5 -0
- package/src/components/ViewportDataOverlaySettingMenu/ViewportDataOverlayMenu.tsx +538 -0
- package/src/components/ViewportDataOverlaySettingMenu/ViewportDataOverlayMenuWrapper.tsx +91 -0
- package/src/components/ViewportDataOverlaySettingMenu/utils.ts +118 -0
- package/src/components/ViewportOrientationMenu/ViewportOrientationMenu.tsx +249 -0
- package/src/components/ViewportOrientationMenu/ViewportOrientationMenuWrapper.tsx +29 -0
- package/src/components/ViewportWindowLevel/ViewportWindowLevel.tsx +261 -0
- package/src/components/ViewportWindowLevel/getViewportVolumeHistogram.ts +72 -0
- package/src/components/ViewportWindowLevel/histogramWorker.js +97 -0
- package/src/components/ViewportWindowLevel/index.js +1 -0
- package/src/components/ViewportWindowLevel/utils.ts +176 -0
- package/src/components/WindowLevelActionMenu/Colorbar.tsx +30 -0
- package/src/components/WindowLevelActionMenu/Colormap.tsx +121 -0
- package/src/components/WindowLevelActionMenu/VolumeLighting.tsx +82 -0
- package/src/components/WindowLevelActionMenu/VolumeRenderingOptions.tsx +38 -0
- package/src/components/WindowLevelActionMenu/VolumeRenderingPresets.tsx +36 -0
- package/src/components/WindowLevelActionMenu/VolumeRenderingPresetsContent.tsx +78 -0
- package/src/components/WindowLevelActionMenu/VolumeRenderingQuality.tsx +64 -0
- package/src/components/WindowLevelActionMenu/VolumeShade.tsx +47 -0
- package/src/components/WindowLevelActionMenu/VolumeShift.tsx +92 -0
- package/src/components/WindowLevelActionMenu/WindowLevel.tsx +157 -0
- package/src/components/WindowLevelActionMenu/WindowLevelActionMenu.tsx +102 -0
- package/src/components/WindowLevelActionMenu/WindowLevelActionMenuWrapper.tsx +131 -0
- package/src/components/WindowLevelActionMenu/defaultWindowLevelPresets.ts +23 -0
- package/src/components/WindowLevelActionMenu/index.ts +11 -0
- package/src/components/WindowLevelActionMenu/windowLevelPresetHotkeys.test.ts +19 -0
- package/src/components/index.ts +12 -0
- package/src/constants/index.ts +13 -0
- package/src/customizations/CustomDropdownMenuContent.tsx +106 -0
- package/src/customizations/CustomSegmentStatisticsHeader.tsx +140 -0
- package/src/customizations/captureViewportModalCustomization.tsx +175 -0
- package/src/customizations/colorbarCustomization.ts +93 -0
- package/src/customizations/gpuSettingsPresetCustomization.ts +8 -0
- package/src/customizations/layoutSelectorCustomization.ts +104 -0
- package/src/customizations/measurementsCustomization.ts +124 -0
- package/src/customizations/miscCustomization.ts +22 -0
- package/src/customizations/modalityColorMapCustomization.ts +23 -0
- package/src/customizations/segmentationHydrationCustomization.ts +16 -0
- package/src/customizations/segmentationPanelCustomization.tsx +119 -0
- package/src/customizations/segmentationToolbarCustomization.ts +964 -0
- package/src/customizations/toolGroupToolsCustomization.ts +204 -0
- package/src/customizations/toolbarButtonsCustomization.ts +805 -0
- package/src/customizations/viewportClickCommandsCustomization.ts +15 -0
- package/src/customizations/viewportDownloadWarningCustomization.tsx +6 -0
- package/src/customizations/viewportOverlayCustomization.tsx +46 -0
- package/src/customizations/viewportScrollbarCustomization.tsx +27 -0
- package/src/customizations/viewportToolsCustomization.ts +33 -0
- package/src/customizations/volumeRenderingCustomization.ts +14 -0
- package/src/customizations/windowLevelPresetsCustomization.ts +5 -0
- package/src/enums.ts +9 -0
- package/src/getCustomizationModule.tsx +54 -0
- package/src/getHangingProtocolModule.ts +47 -0
- package/src/getPanelModule.tsx +128 -0
- package/src/getSopClassHandlerModule.js +284 -0
- package/src/getToolbarModule.tsx +622 -0
- package/src/hooks/index.ts +8 -0
- package/src/hooks/useActiveViewportSegmentationRepresentations.ts +14 -0
- package/src/hooks/useMeasurementTracking.ts +132 -0
- package/src/hooks/useMeasurements.ts +104 -0
- package/src/hooks/useSegmentations.ts +147 -0
- package/src/hooks/useViewportDisplaySets.ts +284 -0
- package/src/hooks/useViewportHover.ts +77 -0
- package/src/hooks/useViewportRendering.tsx +868 -0
- package/src/hooks/useViewportSegmentations.ts +245 -0
- package/src/hps/fourUp.ts +117 -0
- package/src/hps/frameView.ts +1581 -0
- package/src/hps/main3D.ts +142 -0
- package/src/hps/mpr.ts +197 -0
- package/src/hps/mprAnd3DVolumeViewport.ts +124 -0
- package/src/hps/only3D.ts +70 -0
- package/src/hps/primary3D.ts +142 -0
- package/src/hps/primaryAxial.ts +114 -0
- package/src/id.js +5 -0
- package/src/index.tsx +350 -0
- package/src/init.tsx +445 -0
- package/src/initCineService.ts +75 -0
- package/src/initContextMenu.ts +94 -0
- package/src/initCornerstoneTools.js +188 -0
- package/src/initDoubleClick.ts +82 -0
- package/src/initMeasurementService.ts +576 -0
- package/src/initStudyPrefetcherService.ts +33 -0
- package/src/initWADOImageLoader.js +56 -0
- package/src/panels/PanelMeasurement.tsx +84 -0
- package/src/panels/PanelSegmentation.tsx +338 -0
- package/src/services/ColorbarService/ColorbarService.ts +242 -0
- package/src/services/ColorbarService/index.ts +2 -0
- package/src/services/CornerstoneCacheService/CornerstoneCacheService.ts +326 -0
- package/src/services/CornerstoneCacheService/index.js +3 -0
- package/src/services/SegmentationService/RTSTRUCT/mapROIContoursToRTStructData.ts +36 -0
- package/src/services/SegmentationService/SegmentationService.test.ts +3698 -0
- package/src/services/SegmentationService/SegmentationService.ts +2376 -0
- package/src/services/SegmentationService/backends/ISegmentationBackend.ts +102 -0
- package/src/services/SegmentationService/backends/ISegmentationServiceInternals.ts +44 -0
- package/src/services/SegmentationService/backends/LegacySegmentationBackend.ts +139 -0
- package/src/services/SegmentationService/backends/NextSegmentationBackend.ts +159 -0
- package/src/services/SegmentationService/backends/index.ts +4 -0
- package/src/services/SegmentationService/index.ts +3 -0
- package/src/services/SyncGroupService/SyncGroupService.ts +264 -0
- package/src/services/SyncGroupService/createHydrateSegmentationSynchronizer.ts +118 -0
- package/src/services/SyncGroupService/index.js +3 -0
- package/src/services/ToolGroupService/ToolGroupService.test.ts +83 -0
- package/src/services/ToolGroupService/ToolGroupService.ts +541 -0
- package/src/services/ToolGroupService/index.js +3 -0
- package/src/services/ViewedDataService/ViewedDataService.ts +58 -0
- package/src/services/ViewedDataService/index.ts +3 -0
- package/src/services/ViewportService/CornerstoneViewportService.ts +1814 -0
- package/src/services/ViewportService/IViewportService.ts +64 -0
- package/src/services/ViewportService/Viewport.ts +372 -0
- package/src/services/ViewportService/adapter/IViewportAdapter.contract.test.ts +467 -0
- package/src/services/ViewportService/adapter/IViewportAdapter.ts +179 -0
- package/src/services/ViewportService/adapter/LegacyViewportAdapter.ts +240 -0
- package/src/services/ViewportService/adapter/NextViewportAdapter.ts +241 -0
- package/src/services/ViewportService/adapter/getViewportAdapter.ts +62 -0
- package/src/services/ViewportService/adapter/index.ts +16 -0
- package/src/services/ViewportService/backends/IViewportBackend.ts +195 -0
- package/src/services/ViewportService/backends/IViewportOperations.ts +98 -0
- package/src/services/ViewportService/backends/IViewportServiceInternals.ts +47 -0
- package/src/services/ViewportService/backends/LegacyViewportBackend.ts +264 -0
- package/src/services/ViewportService/backends/LegacyViewportOperations.ts +272 -0
- package/src/services/ViewportService/backends/NextViewportBackend.ts +671 -0
- package/src/services/ViewportService/backends/NextViewportOperations.ts +169 -0
- package/src/services/ViewportService/backends/README.md +62 -0
- package/src/services/ViewportService/backends/dataIdRegistry.ts +121 -0
- package/src/services/ViewportService/backends/viewportOperations.ts +71 -0
- package/src/services/ViewportService/constants.ts +3 -0
- package/src/state.ts +34 -0
- package/src/stores/index.ts +5 -0
- package/src/stores/presentationUtils.ts +42 -0
- package/src/stores/useLutPresentationStore.ts +166 -0
- package/src/stores/usePositionPresentationStore.ts +172 -0
- package/src/stores/useSegmentationPresentationStore.test.ts +146 -0
- package/src/stores/useSegmentationPresentationStore.ts +417 -0
- package/src/stores/useSelectedSegmentationsForViewportStore.ts +85 -0
- package/src/stores/useSynchronizersStore.ts +84 -0
- package/src/synchronizers/frameViewSynchronizer.ts +52 -0
- package/src/tools/CalibrationLineTool.ts +97 -0
- package/src/tools/ImageOverlayViewerTool.tsx +279 -0
- package/src/tools/OverlayPlaneModuleProvider.ts +40 -0
- package/src/tools/WindowLevelTool.test.ts +55 -0
- package/src/tools/WindowLevelTool.ts +22 -0
- package/src/types/AppTypes.ts +70 -0
- package/src/types/Colorbar.ts +114 -0
- package/src/types/Colormap.ts +16 -0
- package/src/types/CornerstoneCacheService.ts +40 -0
- package/src/types/CornerstoneServices.ts +18 -0
- package/src/types/Presentation.ts +83 -0
- package/src/types/SelectedSegmentationByTypeMap.ts +3 -0
- package/src/types/ViewportPresets.ts +53 -0
- package/src/types/VolumeLighting.ts +7 -0
- package/src/types/VolumeRenderingConfig.ts +8 -0
- package/src/types/WindowLevel.ts +5 -0
- package/src/types/index.ts +10 -0
- package/src/utils/ActiveViewportBehavior.tsx +80 -0
- package/src/utils/CornerstoneViewportDownloadForm.tsx +319 -0
- package/src/utils/DicomFileUploader.ts +204 -0
- package/src/utils/JumpPresets.ts +14 -0
- package/src/utils/autoHydrateViewportTypes.ts +69 -0
- package/src/utils/colormaps.js +1597 -0
- package/src/utils/createSegmentationForViewport.ts +83 -0
- package/src/utils/dicomLoaderService.js +225 -0
- package/src/utils/ecgMetadata.test.ts +137 -0
- package/src/utils/ecgMetadata.ts +109 -0
- package/src/utils/findNearbyToolData.test.ts +125 -0
- package/src/utils/findNearbyToolData.ts +21 -0
- package/src/utils/generateSegmentationCSVReport.test.ts +324 -0
- package/src/utils/generateSegmentationCSVReport.ts +131 -0
- package/src/utils/getActiveViewportEnabledElement.test.ts +70 -0
- package/src/utils/getActiveViewportEnabledElement.ts +8 -0
- package/src/utils/getCenterExtent.test.ts +313 -0
- package/src/utils/getCenterExtent.ts +46 -0
- package/src/utils/getCornerstoneBlendMode.test.ts +59 -0
- package/src/utils/getCornerstoneBlendMode.ts +25 -0
- package/src/utils/getCornerstoneOrientation.test.ts +78 -0
- package/src/utils/getCornerstoneOrientation.ts +31 -0
- package/src/utils/getCornerstoneViewportType.test.ts +169 -0
- package/src/utils/getCornerstoneViewportType.ts +88 -0
- package/src/utils/getInterleavedFrames.test.ts +85 -0
- package/src/utils/getInterleavedFrames.ts +73 -0
- package/src/utils/getLegacyViewportType.ts +64 -0
- package/src/utils/getNthFrames.test.ts +145 -0
- package/src/utils/getNthFrames.ts +31 -0
- package/src/utils/getViewportEnabledElement.test.ts +83 -0
- package/src/utils/getViewportEnabledElement.ts +8 -0
- package/src/utils/getViewportOrientationFromImageOrientationPatient.test.ts +50 -0
- package/src/utils/getViewportOrientationFromImageOrientationPatient.ts +56 -0
- package/src/utils/hydrationUtils.test.ts +572 -0
- package/src/utils/hydrationUtils.ts +197 -0
- package/src/utils/imageSliceSync/calculateViewportRegistrations.ts +28 -0
- package/src/utils/imageSliceSync/toggleImageSliceSync.ts +101 -0
- package/src/utils/index.ts +29 -0
- package/src/utils/initGpuSettingsPreset.ts +51 -0
- package/src/utils/initViewTiming.test.ts +342 -0
- package/src/utils/initViewTiming.ts +52 -0
- package/src/utils/initWebWorkerProgressHandler.test.ts +381 -0
- package/src/utils/initWebWorkerProgressHandler.ts +110 -0
- package/src/utils/interleave.test.ts +304 -0
- package/src/utils/interleave.ts +32 -0
- package/src/utils/interleaveCenterLoader.test.ts +547 -0
- package/src/utils/interleaveCenterLoader.ts +143 -0
- package/src/utils/interleaveTopToBottom.test.ts +487 -0
- package/src/utils/interleaveTopToBottom.ts +132 -0
- package/src/utils/isAnyDisplaySetCommon.ts +18 -0
- package/src/utils/isDisplaySetOverlayable.ts +96 -0
- package/src/utils/isMeasurementWithinViewport.test.ts +340 -0
- package/src/utils/isMeasurementWithinViewport.ts +33 -0
- package/src/utils/isReferenceViewable.test.ts +581 -0
- package/src/utils/isReferenceViewable.ts +95 -0
- package/src/utils/loadDisplaySetData.ts +49 -0
- package/src/utils/measurementServiceMappings/Angle.ts +200 -0
- package/src/utils/measurementServiceMappings/ArrowAnnotate.ts +176 -0
- package/src/utils/measurementServiceMappings/Bidirectional.ts +193 -0
- package/src/utils/measurementServiceMappings/CircleROI.ts +227 -0
- package/src/utils/measurementServiceMappings/CobbAngle.ts +206 -0
- package/src/utils/measurementServiceMappings/EllipticalROI.ts +221 -0
- package/src/utils/measurementServiceMappings/Length.ts +206 -0
- package/src/utils/measurementServiceMappings/LivewireContour.ts +175 -0
- package/src/utils/measurementServiceMappings/PlanarFreehandROI.ts +228 -0
- package/src/utils/measurementServiceMappings/Probe.ts +192 -0
- package/src/utils/measurementServiceMappings/RectangleROI.ts +225 -0
- package/src/utils/measurementServiceMappings/SegmentBidirectional.ts +184 -0
- package/src/utils/measurementServiceMappings/SplineROI.ts +227 -0
- package/src/utils/measurementServiceMappings/UltrasoundDirectional.ts +214 -0
- package/src/utils/measurementServiceMappings/UltrasoundPleuraBLine.ts +179 -0
- package/src/utils/measurementServiceMappings/constants/supportedTools.js +21 -0
- package/src/utils/measurementServiceMappings/index.ts +3 -0
- package/src/utils/measurementServiceMappings/measurementServiceMappingsFactory.ts +324 -0
- package/src/utils/measurementServiceMappings/utils/getDisplayUnit.js +3 -0
- package/src/utils/measurementServiceMappings/utils/getHandlesFromPoints.js +14 -0
- package/src/utils/measurementServiceMappings/utils/getIsLocked.ts +5 -0
- package/src/utils/measurementServiceMappings/utils/getIsVisible.ts +6 -0
- package/src/utils/measurementServiceMappings/utils/getSOPInstanceAttributes.js +66 -0
- package/src/utils/measurementServiceMappings/utils/getValueDisplayString.js +12 -0
- package/src/utils/measurementServiceMappings/utils/index.ts +17 -0
- package/src/utils/measurementServiceMappings/utils/selection.ts +33 -0
- package/src/utils/mpr/getProtocolViewportStructureFromGridViewports.ts +74 -0
- package/src/utils/nextViewportPolicies.ts +41 -0
- package/src/utils/nextViewports.ts +157 -0
- package/src/utils/nthLoader.test.ts +317 -0
- package/src/utils/nthLoader.ts +78 -0
- package/src/utils/presentations/getViewportPresentations.test.ts +280 -0
- package/src/utils/presentations/getViewportPresentations.ts +151 -0
- package/src/utils/promptHydrationDialog.test.ts +490 -0
- package/src/utils/promptHydrationDialog.ts +197 -0
- package/src/utils/removeViewportSegmentationRepresentations.test.ts +129 -0
- package/src/utils/removeViewportSegmentationRepresentations.ts +17 -0
- package/src/utils/segmentUtils.test.ts +515 -0
- package/src/utils/segmentUtils.ts +46 -0
- package/src/utils/segmentationExportUtils.test.ts +100 -0
- package/src/utils/segmentationExportUtils.ts +171 -0
- package/src/utils/segmentationHandlers.test.ts +614 -0
- package/src/utils/segmentationHandlers.ts +164 -0
- package/src/utils/setUpAnnotationEventHandlers.ts +26 -0
- package/src/utils/setUpSegmentationEventHandlers.test.ts +372 -0
- package/src/utils/setUpSegmentationEventHandlers.ts +122 -0
- package/src/utils/toggleVOISliceSync.test.ts +606 -0
- package/src/utils/toggleVOISliceSync.ts +103 -0
- package/src/utils/transitions.test.ts +351 -0
- package/src/utils/transitions.ts +300 -0
- package/src/utils/updateSegmentationStats.test.ts +942 -0
- package/src/utils/updateSegmentationStats.ts +192 -0
- package/src/utils/viewportDataShape.ts +85 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { utilities as csUtils } from '@cornerstonejs/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Modalities that are drawn by a segmentation representation rather than being
|
|
5
|
+
* blended in as a second volume.
|
|
6
|
+
*/
|
|
7
|
+
export const DERIVED_OVERLAY_MODALITIES = ['SEG', 'RTSTRUCT'];
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Decides whether `displaySet` can be shown on top of `backgroundDisplaySet`.
|
|
11
|
+
*
|
|
12
|
+
* This is the single eligibility rule shared by the two places that need it:
|
|
13
|
+
*
|
|
14
|
+
* - the viewport data overlay menu, which asks it about one viewport's current
|
|
15
|
+
* background (see `getEnhancedDisplaySets`), and
|
|
16
|
+
* - hydration, which asks it about candidate backgrounds across the study and
|
|
17
|
+
* must be able to do so with no viewport in existence at all.
|
|
18
|
+
*
|
|
19
|
+
* It therefore takes display sets rather than a viewportId. Hydration is a
|
|
20
|
+
* statement about a display set ("show this wherever it logically belongs"), so
|
|
21
|
+
* anything it depends on has to be answerable from display sets alone.
|
|
22
|
+
*/
|
|
23
|
+
export function isDisplaySetOverlayable({
|
|
24
|
+
displaySet,
|
|
25
|
+
backgroundDisplaySet,
|
|
26
|
+
}: {
|
|
27
|
+
displaySet;
|
|
28
|
+
backgroundDisplaySet;
|
|
29
|
+
}): boolean {
|
|
30
|
+
if (!displaySet || !backgroundDisplaySet) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (displaySet.displaySetInstanceUID === backgroundDisplaySet.displaySetInstanceUID) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (displaySet.unsupported) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// The frames of reference must agree when the candidate declares one. A
|
|
43
|
+
// candidate without one is not rejected here: not every overlayable display
|
|
44
|
+
// set carries a frame of reference.
|
|
45
|
+
if (
|
|
46
|
+
displaySet.FrameOfReferenceUID &&
|
|
47
|
+
displaySet.FrameOfReferenceUID !== backgroundDisplaySet.FrameOfReferenceUID
|
|
48
|
+
) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (DERIVED_OVERLAY_MODALITIES.includes(displaySet.Modality)) {
|
|
53
|
+
// The display set the overlay was made against always qualifies. Note it is
|
|
54
|
+
// not required to be reconstructable: an RTSTRUCT over a stack is exactly
|
|
55
|
+
// the case `getHydrationViewportTypeForModality` pins to 'stack' on
|
|
56
|
+
// hydrate, so the reconstructable gate below must not apply here.
|
|
57
|
+
if (displaySet.referencedDisplaySetInstanceUID === backgroundDisplaySet.displaySetInstanceUID) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Beyond that display set, the frames of reference matching (checked above)
|
|
62
|
+
// is only meaningful when both sides are reconstructable volumes: the
|
|
63
|
+
// segmentation is then defined in world coordinates over that frame, so any
|
|
64
|
+
// co-registered volume in it is a legitimate place to draw it. Two display
|
|
65
|
+
// sets can share a frame of reference while being unrelated series, and a
|
|
66
|
+
// stack's data is bound to specific images, so a non-reconstructable side
|
|
67
|
+
// gets no reach past its own display set.
|
|
68
|
+
//
|
|
69
|
+
// A derived display set copies isReconstructable and FrameOfReferenceUID
|
|
70
|
+
// from the display set it references, so both are answers about the
|
|
71
|
+
// reference (see cornerstone-dicom-seg/getSopClassHandlerModule).
|
|
72
|
+
return Boolean(
|
|
73
|
+
displaySet.isReconstructable &&
|
|
74
|
+
displaySet.FrameOfReferenceUID &&
|
|
75
|
+
backgroundDisplaySet.isReconstructable
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// A colormap overlay is blended in as a second volume, so both sides have to
|
|
80
|
+
// be valid volumes.
|
|
81
|
+
if (!backgroundDisplaySet.isReconstructable) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (!csUtils.isValidVolume(backgroundDisplaySet.imageIds || [])) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const imageIds = displaySet.imageIds || displaySet.images?.map(image => image.imageId);
|
|
90
|
+
|
|
91
|
+
if (!displaySet.isMultiFrame && imageIds?.length > 0 && !csUtils.isValidVolume(imageIds)) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { isMeasurementWithinViewport } from './isMeasurementWithinViewport';
|
|
2
|
+
import { getCenterExtent } from './getCenterExtent';
|
|
3
|
+
|
|
4
|
+
jest.mock('./getCenterExtent', () => ({
|
|
5
|
+
getCenterExtent: jest.fn(),
|
|
6
|
+
}));
|
|
7
|
+
|
|
8
|
+
describe('isMeasurementWithinViewport', () => {
|
|
9
|
+
const mockViewport = {
|
|
10
|
+
getCamera: jest.fn(),
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const mockMeasurement = {
|
|
14
|
+
points: [
|
|
15
|
+
[0, 0, 0],
|
|
16
|
+
[10, 10, 10],
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
jest.clearAllMocks();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should return true when measurement is within viewport extent', () => {
|
|
25
|
+
const mockCamera = {
|
|
26
|
+
focalPoint: [5, 5, 5],
|
|
27
|
+
parallelScale: 15,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const mockExtent = {
|
|
31
|
+
extent: {
|
|
32
|
+
min: [0, 0, 0],
|
|
33
|
+
max: [10, 10, 10],
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
38
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
39
|
+
|
|
40
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
41
|
+
|
|
42
|
+
expect(mockViewport.getCamera).toHaveBeenCalled();
|
|
43
|
+
expect(getCenterExtent).toHaveBeenCalledWith(mockMeasurement);
|
|
44
|
+
expect(result).toBe(true);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should return false when measurement min point is outside viewport extent', () => {
|
|
48
|
+
const mockCamera = {
|
|
49
|
+
focalPoint: [5, 5, 5],
|
|
50
|
+
parallelScale: 4,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const mockExtent = {
|
|
54
|
+
extent: {
|
|
55
|
+
min: [0, 0, 0],
|
|
56
|
+
max: [10, 10, 10],
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
61
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
62
|
+
|
|
63
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
64
|
+
|
|
65
|
+
expect(result).toBe(false);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should return false when measurement max point is outside viewport extent', () => {
|
|
69
|
+
const mockCamera = {
|
|
70
|
+
focalPoint: [5, 5, 5],
|
|
71
|
+
parallelScale: 4,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const mockExtent = {
|
|
75
|
+
extent: {
|
|
76
|
+
min: [1, 1, 1],
|
|
77
|
+
max: [15, 15, 15],
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
82
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
83
|
+
|
|
84
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
85
|
+
|
|
86
|
+
expect(result).toBe(false);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('should return false when min point exceeds parallelScale in first dimension', () => {
|
|
90
|
+
const mockCamera = {
|
|
91
|
+
focalPoint: [10, 5, 5],
|
|
92
|
+
parallelScale: 5,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const mockExtent = {
|
|
96
|
+
extent: {
|
|
97
|
+
min: [0, 0, 0],
|
|
98
|
+
max: [8, 8, 8],
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
103
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
104
|
+
|
|
105
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
106
|
+
|
|
107
|
+
expect(result).toBe(false);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('should return false when max point exceeds parallelScale in second dimension', () => {
|
|
111
|
+
const mockCamera = {
|
|
112
|
+
focalPoint: [5, 5, 5],
|
|
113
|
+
parallelScale: 5,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const mockExtent = {
|
|
117
|
+
extent: {
|
|
118
|
+
min: [3, 3, 3],
|
|
119
|
+
max: [7, 12, 7],
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
124
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
125
|
+
|
|
126
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
127
|
+
|
|
128
|
+
expect(result).toBe(false);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('should return false when max point exceeds parallelScale in third dimension', () => {
|
|
132
|
+
const mockCamera = {
|
|
133
|
+
focalPoint: [5, 5, 5],
|
|
134
|
+
parallelScale: 5,
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const mockExtent = {
|
|
138
|
+
extent: {
|
|
139
|
+
min: [3, 3, 3],
|
|
140
|
+
max: [7, 7, 12],
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
145
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
146
|
+
|
|
147
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
148
|
+
|
|
149
|
+
expect(result).toBe(false);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('should return true when measurement extent exactly matches parallelScale', () => {
|
|
153
|
+
const mockCamera = {
|
|
154
|
+
focalPoint: [5, 5, 5],
|
|
155
|
+
parallelScale: 5,
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const mockExtent = {
|
|
159
|
+
extent: {
|
|
160
|
+
min: [0, 0, 0],
|
|
161
|
+
max: [10, 10, 10],
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
166
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
167
|
+
|
|
168
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
169
|
+
|
|
170
|
+
expect(result).toBe(true);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('should handle negative coordinates correctly', () => {
|
|
174
|
+
const mockCamera = {
|
|
175
|
+
focalPoint: [-5, -5, -5],
|
|
176
|
+
parallelScale: 10,
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const mockExtent = {
|
|
180
|
+
extent: {
|
|
181
|
+
min: [-10, -10, -10],
|
|
182
|
+
max: [0, 0, 0],
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
187
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
188
|
+
|
|
189
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
190
|
+
|
|
191
|
+
expect(result).toBe(true);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
it('should handle zero parallelScale', () => {
|
|
195
|
+
const mockCamera = {
|
|
196
|
+
focalPoint: [0, 0, 0],
|
|
197
|
+
parallelScale: 0,
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const mockExtent = {
|
|
201
|
+
extent: {
|
|
202
|
+
min: [0, 0, 0],
|
|
203
|
+
max: [0, 0, 0],
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
208
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
209
|
+
|
|
210
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
211
|
+
|
|
212
|
+
expect(result).toBe(true);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('should handle zero parallelScale with non-zero extent', () => {
|
|
216
|
+
const mockCamera = {
|
|
217
|
+
focalPoint: [0, 0, 0],
|
|
218
|
+
parallelScale: 0,
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const mockExtent = {
|
|
222
|
+
extent: {
|
|
223
|
+
min: [0, 0, 0],
|
|
224
|
+
max: [1, 1, 1],
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
229
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
230
|
+
|
|
231
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
232
|
+
|
|
233
|
+
expect(result).toBe(false);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it('should handle large parallelScale values', () => {
|
|
237
|
+
const mockCamera = {
|
|
238
|
+
focalPoint: [0, 0, 0],
|
|
239
|
+
parallelScale: 1000000,
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const mockExtent = {
|
|
243
|
+
extent: {
|
|
244
|
+
min: [-500, -500, -500],
|
|
245
|
+
max: [500, 500, 500],
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
250
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
251
|
+
|
|
252
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
253
|
+
|
|
254
|
+
expect(result).toBe(true);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it('should handle floating point coordinates', () => {
|
|
258
|
+
const mockCamera = {
|
|
259
|
+
focalPoint: [1.5, 2.7, 3.1],
|
|
260
|
+
parallelScale: 5.5,
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
const mockExtent = {
|
|
264
|
+
extent: {
|
|
265
|
+
min: [0.1, 0.2, 0.3],
|
|
266
|
+
max: [2.9, 5.2, 5.9],
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
271
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
272
|
+
|
|
273
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
274
|
+
|
|
275
|
+
expect(result).toBe(true);
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
it('should fail when min point distance equals parallelScale plus epsilon', () => {
|
|
279
|
+
const mockCamera = {
|
|
280
|
+
focalPoint: [5, 5, 5],
|
|
281
|
+
parallelScale: 5,
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const mockExtent = {
|
|
285
|
+
extent: {
|
|
286
|
+
min: [-0.1, 0, 0],
|
|
287
|
+
max: [10, 10, 10],
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
292
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
293
|
+
|
|
294
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
295
|
+
|
|
296
|
+
expect(result).toBe(false);
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
it('should pass when extent is within parallelScale boundary', () => {
|
|
300
|
+
const mockCamera = {
|
|
301
|
+
focalPoint: [5, 5, 5],
|
|
302
|
+
parallelScale: 6,
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
const mockExtent = {
|
|
306
|
+
extent: {
|
|
307
|
+
min: [-1, -1, -1],
|
|
308
|
+
max: [11, 11, 11],
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
313
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
314
|
+
|
|
315
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
316
|
+
|
|
317
|
+
expect(result).toBe(true);
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
it('should handle asymmetric extent around focal point', () => {
|
|
321
|
+
const mockCamera = {
|
|
322
|
+
focalPoint: [10, 10, 10],
|
|
323
|
+
parallelScale: 8,
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
const mockExtent = {
|
|
327
|
+
extent: {
|
|
328
|
+
min: [5, 5, 5],
|
|
329
|
+
max: [18, 18, 18],
|
|
330
|
+
},
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
mockViewport.getCamera.mockReturnValue(mockCamera);
|
|
334
|
+
(getCenterExtent as jest.Mock).mockReturnValue(mockExtent);
|
|
335
|
+
|
|
336
|
+
const result = isMeasurementWithinViewport(mockViewport, mockMeasurement);
|
|
337
|
+
|
|
338
|
+
expect(result).toBe(true);
|
|
339
|
+
});
|
|
340
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getCenterExtent } from './getCenterExtent';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Determines if a measurement is within the current viewport extent.
|
|
5
|
+
* Uses the measurement's bounding box extent to efficiently check if the entire
|
|
6
|
+
* measurement fits within the viewport's visible area.
|
|
7
|
+
*
|
|
8
|
+
* @param {Object} viewport - The viewport object containing camera information
|
|
9
|
+
* @param {Object} measurement - The measurement object containing points to check
|
|
10
|
+
* @returns {boolean} True if the measurement extent is within the viewport, false otherwise
|
|
11
|
+
*/
|
|
12
|
+
export const isMeasurementWithinViewport = (viewport, measurement) => {
|
|
13
|
+
const camera = viewport.getCamera();
|
|
14
|
+
const { focalPoint, parallelScale } = camera;
|
|
15
|
+
|
|
16
|
+
// Get the measurement's bounding box extent
|
|
17
|
+
const { extent } = getCenterExtent(measurement);
|
|
18
|
+
const { min, max } = extent;
|
|
19
|
+
|
|
20
|
+
// Check if the entire bounding box fits within the viewport extent
|
|
21
|
+
// We need to check both the min and max corners of the bounding box
|
|
22
|
+
for (let i = 0; i < 3; i++) {
|
|
23
|
+
const minDistance = Math.abs(min[i] - focalPoint[i]);
|
|
24
|
+
const maxDistance = Math.abs(max[i] - focalPoint[i]);
|
|
25
|
+
|
|
26
|
+
// If either the min or max point is outside the viewport extent, return false
|
|
27
|
+
if (minDistance > parallelScale || maxDistance > parallelScale) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return true; // The entire measurement extent is within the viewport
|
|
33
|
+
};
|