@ohif/extension-cornerstone 3.14.0-beta.12 → 3.14.0-beta.121
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 +498 -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 +3008 -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/FidelityIndicator/FidelityIndicator.tsx +152 -0
- package/src/components/FidelityIndicator/index.ts +1 -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 +109 -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/Viewport3DCompassMenu.tsx +261 -0
- package/src/components/ViewportOrientationMenu/ViewportOrientationMenu.tsx +249 -0
- package/src/components/ViewportOrientationMenu/ViewportOrientationMenuWrapper.tsx +40 -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 +13 -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 +9 -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/useViewportFidelity.ts +243 -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 +352 -0
- package/src/init.tsx +450 -0
- package/src/initCineService.ts +75 -0
- package/src/initContextMenu.ts +94 -0
- package/src/initCornerstoneTools.js +191 -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 +3727 -0
- package/src/services/SegmentationService/SegmentationService.ts +2390 -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 +673 -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.test.ts +93 -0
- package/src/utils/createSegmentationForViewport.ts +123 -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/findWindowLevelPreset.test.ts +55 -0
- package/src/utils/findWindowLevelPreset.ts +46 -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 +106 -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/promptTimePointScope.tsx +82 -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
- package/src/utils/volume3dView.test.ts +48 -0
- package/src/utils/volume3dView.ts +113 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Icons, Tooltip, TooltipTrigger, TooltipContent } from '@ohif/ui-next';
|
|
5
|
+
import { useViewportFidelity, type FidelityPresentation } from '../../hooks/useViewportFidelity';
|
|
6
|
+
import type { Types } from '@cornerstonejs/core';
|
|
7
|
+
|
|
8
|
+
function labelKeyOf(presentation: FidelityPresentation): string | null {
|
|
9
|
+
if (presentation === 'transient') {
|
|
10
|
+
return 'TransientLowFidelity';
|
|
11
|
+
}
|
|
12
|
+
if (presentation === 'standing') {
|
|
13
|
+
return 'LowFidelity';
|
|
14
|
+
}
|
|
15
|
+
if (presentation === 'recovered') {
|
|
16
|
+
return 'FullFidelity';
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function ariaKeyOf(presentation: FidelityPresentation): string {
|
|
22
|
+
if (presentation === 'transient') {
|
|
23
|
+
return 'AriaTransient';
|
|
24
|
+
}
|
|
25
|
+
if (presentation === 'standing') {
|
|
26
|
+
return 'AriaStanding';
|
|
27
|
+
}
|
|
28
|
+
if (presentation === 'recovered') {
|
|
29
|
+
return 'AriaRecovered';
|
|
30
|
+
}
|
|
31
|
+
return 'AriaIdle';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function causeSummary(
|
|
35
|
+
state: Types.ViewportFidelityState | null,
|
|
36
|
+
t: (key: string) => string
|
|
37
|
+
): string | null {
|
|
38
|
+
if (!state?.cause) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const known: Record<string, string> = {
|
|
42
|
+
deviceTextureLimit: t('CauseDeviceLimit'),
|
|
43
|
+
memoryBudget: t('CauseMemoryBudget'),
|
|
44
|
+
performanceTarget: t('CausePerformance'),
|
|
45
|
+
incompleteLoad: t('CauseIncompleteLoad'),
|
|
46
|
+
missingFrames: t('CauseMissingFrames'),
|
|
47
|
+
lossyDecode: t('CauseLossyDecode'),
|
|
48
|
+
displayIssue: t('CauseDisplayIssue'),
|
|
49
|
+
};
|
|
50
|
+
return known[state.cause] ?? t('CauseUnknown');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** `icon`: glyph only (default). `text`: label only. `both`: glyph and label. */
|
|
54
|
+
export type FidelityIndicatorDisplay = 'icon' | 'text' | 'both';
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Per-viewport fidelity indicator for OHIF (#6256 / VF-VIS), rendered last in the
|
|
58
|
+
* top-right viewport action corner.
|
|
59
|
+
* Consumes Cornerstone3D `VIEWPORT_FIDELITY_CHANGED` / `getFidelityState()`.
|
|
60
|
+
* Glyph is a fixed yellow warning triangle; transient vs standing is carried by
|
|
61
|
+
* label / aria / tooltip. No customization sets `display` yet; that comes with
|
|
62
|
+
* `Replaceable` (OHIF/Viewers#6452).
|
|
63
|
+
*/
|
|
64
|
+
function FidelityIndicator({
|
|
65
|
+
viewportId,
|
|
66
|
+
display = 'icon',
|
|
67
|
+
}: {
|
|
68
|
+
viewportId: string;
|
|
69
|
+
display?: FidelityIndicatorDisplay;
|
|
70
|
+
}) {
|
|
71
|
+
const { t } = useTranslation('FidelityIndicator');
|
|
72
|
+
const { presentation, wasLossy, state, revealRecovered, hideRecoveredReveal } =
|
|
73
|
+
useViewportFidelity({ viewportId });
|
|
74
|
+
|
|
75
|
+
const idleRevealer = presentation === 'none' && wasLossy;
|
|
76
|
+
const showIcon = display === 'icon' || display === 'both';
|
|
77
|
+
const showText = display === 'text' || display === 'both';
|
|
78
|
+
// Yellow triangle while lossy; green check for the recovered hold and its hover reveal.
|
|
79
|
+
const showWarningGlyph =
|
|
80
|
+
showIcon && (presentation === 'transient' || presentation === 'standing');
|
|
81
|
+
const showRecoveredGlyph = showIcon && presentation === 'recovered';
|
|
82
|
+
|
|
83
|
+
if (presentation === 'none' && !idleRevealer) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// text-only mode: nothing to show while idle (no invisible icon hit target needed for text)
|
|
88
|
+
if (presentation === 'none' && idleRevealer && display === 'text') {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const labelKey = labelKeyOf(presentation);
|
|
93
|
+
const cause = causeSummary(state, t);
|
|
94
|
+
const ariaPresentation = presentation === 'none' ? 'recovered' : presentation;
|
|
95
|
+
const isIdle = presentation === 'none' && idleRevealer;
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<Tooltip>
|
|
99
|
+
<TooltipTrigger asChild>
|
|
100
|
+
<button
|
|
101
|
+
type="button"
|
|
102
|
+
data-cy="fidelity-indicator"
|
|
103
|
+
className={classNames('inline-flex cursor-default items-center gap-1.5 leading-none', {
|
|
104
|
+
// Invisible hover target after the recovered hold (VF-VIS-1d).
|
|
105
|
+
'h-3 w-3 opacity-0': isIdle,
|
|
106
|
+
})}
|
|
107
|
+
aria-label={t(ariaKeyOf(ariaPresentation))}
|
|
108
|
+
onMouseEnter={revealRecovered}
|
|
109
|
+
onMouseLeave={hideRecoveredReveal}
|
|
110
|
+
onFocus={revealRecovered}
|
|
111
|
+
onBlur={hideRecoveredReveal}
|
|
112
|
+
>
|
|
113
|
+
{showWarningGlyph ? (
|
|
114
|
+
<Icons.StatusWarning
|
|
115
|
+
className="h-6 w-6 shrink-0"
|
|
116
|
+
aria-hidden="true"
|
|
117
|
+
/>
|
|
118
|
+
) : null}
|
|
119
|
+
{showRecoveredGlyph ? (
|
|
120
|
+
<Icons.StatusSuccess
|
|
121
|
+
className="h-6 w-6 shrink-0 text-green-500"
|
|
122
|
+
aria-hidden="true"
|
|
123
|
+
/>
|
|
124
|
+
) : null}
|
|
125
|
+
{showText && labelKey ? (
|
|
126
|
+
<span className="whitespace-nowrap text-xs font-semibold leading-tight [text-shadow:0_0_2px_rgb(0_0_0/70%)]">
|
|
127
|
+
{t(labelKey)}
|
|
128
|
+
</span>
|
|
129
|
+
) : null}
|
|
130
|
+
</button>
|
|
131
|
+
</TooltipTrigger>
|
|
132
|
+
<TooltipContent
|
|
133
|
+
side="bottom"
|
|
134
|
+
className="max-w-[16rem]"
|
|
135
|
+
>
|
|
136
|
+
<div>{t(ariaKeyOf(ariaPresentation))}</div>
|
|
137
|
+
{cause ? <div className="mt-1 opacity-[.85]">{cause}</div> : null}
|
|
138
|
+
{/* VF-INFO-11: Cornerstone3D gives the issue messages in English only. */}
|
|
139
|
+
{state?.issues?.map(issue => (
|
|
140
|
+
<div
|
|
141
|
+
key={issue.code}
|
|
142
|
+
className="mt-1 opacity-[.85]"
|
|
143
|
+
>
|
|
144
|
+
{issue.message}
|
|
145
|
+
</div>
|
|
146
|
+
))}
|
|
147
|
+
</TooltipContent>
|
|
148
|
+
</Tooltip>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export default FidelityIndicator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FidelityIndicator';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Accordion, AccordionContent, AccordionItem } from '@ohif/ui-next';
|
|
3
|
+
|
|
4
|
+
import PanelAccordionTrigger from './PanelAccordionTrigger';
|
|
5
|
+
import MeasurementsMenu from './MeasurementsMenu';
|
|
6
|
+
import { useSystem } from '@ohif/core';
|
|
7
|
+
|
|
8
|
+
export function MeasurementItem(props) {
|
|
9
|
+
const { index, item } = props;
|
|
10
|
+
return (
|
|
11
|
+
<PanelAccordionTrigger
|
|
12
|
+
count={index + 1}
|
|
13
|
+
text={item.toolName || item.label || item.title}
|
|
14
|
+
colorHex="#f00"
|
|
15
|
+
isActive={item.isSelected}
|
|
16
|
+
menu={MeasurementsMenu}
|
|
17
|
+
group={{ items: [item], onClick: props.onClick }}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default function MeasurementAccordion(props) {
|
|
23
|
+
const { items } = props;
|
|
24
|
+
const system = useSystem();
|
|
25
|
+
|
|
26
|
+
const onClick = (e, group) => {
|
|
27
|
+
const { items } = group;
|
|
28
|
+
// Just jump to the first measurement in the set, and mark that one as active
|
|
29
|
+
// with the set of items.
|
|
30
|
+
system.commandsManager.run('jumpToMeasurement', {
|
|
31
|
+
uid: items[0].uid,
|
|
32
|
+
displayMeasurements: items,
|
|
33
|
+
group,
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Accordion
|
|
39
|
+
type="multiple"
|
|
40
|
+
className="flex-shrink-0 overflow-hidden"
|
|
41
|
+
>
|
|
42
|
+
{items.map((item, index) => {
|
|
43
|
+
const { displayText: details = {} } = item;
|
|
44
|
+
return (
|
|
45
|
+
<AccordionItem
|
|
46
|
+
key={`measurementAccordion:${item.uid}`}
|
|
47
|
+
value={item.uid}
|
|
48
|
+
>
|
|
49
|
+
<MeasurementItem
|
|
50
|
+
item={item}
|
|
51
|
+
key={`measurementItem:${item.uid}`}
|
|
52
|
+
index={index}
|
|
53
|
+
onClick={onClick}
|
|
54
|
+
/>
|
|
55
|
+
<AccordionContent key={`measurementContent:${item.uid}`}>
|
|
56
|
+
<div className="ml-7 px-2 py-2">
|
|
57
|
+
<div className="text-secondary-foreground flex items-center gap-1 text-base leading-normal">
|
|
58
|
+
{details.primary?.length > 0 &&
|
|
59
|
+
details.primary.map((detail, index) => (
|
|
60
|
+
<span key={`details:${item.uid}:${index}`}>{detail}</span>
|
|
61
|
+
))}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</AccordionContent>
|
|
65
|
+
</AccordionItem>
|
|
66
|
+
);
|
|
67
|
+
})}
|
|
68
|
+
</Accordion>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MeasurementTable } from '@ohif/ui-next';
|
|
3
|
+
import { useSystem } from '@ohif/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This is a measurement table that is designed to be nested inside
|
|
7
|
+
* the accordion groups.
|
|
8
|
+
*/
|
|
9
|
+
export default function MeasurementTableNested(props) {
|
|
10
|
+
const { title, items, group, customHeader } = props;
|
|
11
|
+
const { commandsManager } = useSystem();
|
|
12
|
+
const onAction = (e, command, uid) => {
|
|
13
|
+
commandsManager.run(command, { uid, annotationUID: uid, displayMeasurements: items });
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<MeasurementTable
|
|
18
|
+
title={title ? title : `Measurements`}
|
|
19
|
+
data={items}
|
|
20
|
+
onAction={onAction}
|
|
21
|
+
{...group}
|
|
22
|
+
key={group.key}
|
|
23
|
+
>
|
|
24
|
+
<MeasurementTable.Header key="measurementTableHeader">
|
|
25
|
+
{customHeader && group.isFirst && customHeader({ ...props, items: props.allItems })}
|
|
26
|
+
</MeasurementTable.Header>
|
|
27
|
+
<MeasurementTable.Body key="measurementTableBody" />
|
|
28
|
+
</MeasurementTable>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useSystem } from '@ohif/core';
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
DropdownMenu,
|
|
6
|
+
DropdownMenuTrigger,
|
|
7
|
+
DropdownMenuContent,
|
|
8
|
+
DropdownMenuItem,
|
|
9
|
+
Icons,
|
|
10
|
+
} from '@ohif/ui-next';
|
|
11
|
+
import { useTranslation } from 'react-i18next';
|
|
12
|
+
|
|
13
|
+
export function MeasumentsMenu(props) {
|
|
14
|
+
const { group, classNames } = props;
|
|
15
|
+
const { t } = useTranslation('MeasurementTable');
|
|
16
|
+
const system = useSystem();
|
|
17
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
18
|
+
|
|
19
|
+
// Hooks must run before this guard, or the hook count changes with the group.
|
|
20
|
+
if (!group.items?.length) {
|
|
21
|
+
console.log('No items to iterate', group.items);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { items } = group;
|
|
26
|
+
const [item] = items;
|
|
27
|
+
const { isSelected, isVisible } = item;
|
|
28
|
+
|
|
29
|
+
const onAction = (event, command, args?) => {
|
|
30
|
+
const uid = items.map(item => item.uid);
|
|
31
|
+
// Some commands use displayMeasurements and some use items
|
|
32
|
+
system.commandsManager.run(command, {
|
|
33
|
+
...args,
|
|
34
|
+
uid,
|
|
35
|
+
displayMeasurements: items,
|
|
36
|
+
items,
|
|
37
|
+
event,
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div className={`relative ml-2 inline-flex items-center space-x-1 ${classNames}`}>
|
|
43
|
+
{/* Visibility Toggle Icon */}
|
|
44
|
+
<Button
|
|
45
|
+
size="icon"
|
|
46
|
+
variant="ghost"
|
|
47
|
+
className={`h-6 w-6 transition-opacity ${
|
|
48
|
+
isSelected || !isVisible ? 'opacity-100' : 'opacity-50 group-hover:opacity-100'
|
|
49
|
+
}`}
|
|
50
|
+
aria-label={isVisible ? t('Hide') : t('Show')}
|
|
51
|
+
onClick={e => {
|
|
52
|
+
e.stopPropagation();
|
|
53
|
+
onAction(e, ['jumpToMeasurement', 'toggleVisibilityMeasurement']);
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
{isVisible ? <Icons.Hide className="h-6 w-6" /> : <Icons.Show className="h-6 w-6" />}
|
|
57
|
+
</Button>
|
|
58
|
+
{/* Actions Dropdown Menu */}
|
|
59
|
+
<DropdownMenu onOpenChange={open => setIsDropdownOpen(open)}>
|
|
60
|
+
<DropdownMenuTrigger asChild>
|
|
61
|
+
<Button
|
|
62
|
+
size="icon"
|
|
63
|
+
variant="ghost"
|
|
64
|
+
className={`h-6 w-6 transition-opacity ${
|
|
65
|
+
isSelected || isDropdownOpen ? 'opacity-100' : 'opacity-50 group-hover:opacity-100'
|
|
66
|
+
}`}
|
|
67
|
+
aria-label="Actions"
|
|
68
|
+
onClick={e => e.stopPropagation()} // Prevent row selection on button click
|
|
69
|
+
>
|
|
70
|
+
<Icons.More className="h-6 w-6" />
|
|
71
|
+
</Button>
|
|
72
|
+
</DropdownMenuTrigger>
|
|
73
|
+
<DropdownMenuContent align="end">
|
|
74
|
+
<DropdownMenuItem onClick={e => onAction(e, 'removeMeasurement')}>
|
|
75
|
+
<Icons.Delete className="text-foreground" />
|
|
76
|
+
<span className="pl-2">{t('Delete')}</span>
|
|
77
|
+
</DropdownMenuItem>
|
|
78
|
+
</DropdownMenuContent>
|
|
79
|
+
</DropdownMenu>
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export default MeasumentsMenu;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import AccordionGroup from './AccordionGroup';
|
|
3
|
+
import { utils } from '@ohif/core';
|
|
4
|
+
import MeasurementTableNested from './MeasurementTableNested';
|
|
5
|
+
|
|
6
|
+
const { filterNot, filterAdditionalFindings } = utils.MeasurementFilters;
|
|
7
|
+
|
|
8
|
+
export const MeasurementOrAdditionalFindingSets = [
|
|
9
|
+
{
|
|
10
|
+
title: 'Measurements',
|
|
11
|
+
filter: filterNot(filterAdditionalFindings),
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
title: 'Additional Findings',
|
|
15
|
+
filter: filterAdditionalFindings,
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Groups measurements by study in order to allow display and saving by study
|
|
21
|
+
* @param {Object} servicesManager
|
|
22
|
+
*/
|
|
23
|
+
export const groupByNamedSets = (items, grouping) => {
|
|
24
|
+
const groups = new Map();
|
|
25
|
+
const { namedSets } = grouping;
|
|
26
|
+
|
|
27
|
+
for (const namedSet of namedSets) {
|
|
28
|
+
const name = namedSet.id || namedSet.title;
|
|
29
|
+
groups.set(name, {
|
|
30
|
+
...grouping,
|
|
31
|
+
...namedSet,
|
|
32
|
+
items: [],
|
|
33
|
+
isFirst: groups.size === 0,
|
|
34
|
+
title: name,
|
|
35
|
+
key: name,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
items.forEach(item => {
|
|
39
|
+
for (const namedSet of namedSets) {
|
|
40
|
+
if (namedSet.filter(item)) {
|
|
41
|
+
const name = namedSet.id || namedSet.title;
|
|
42
|
+
groups.get(name).items.push(item);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
for (const namedSet of namedSets) {
|
|
48
|
+
const name = namedSet.id || namedSet.title;
|
|
49
|
+
if (!groups.get(name).items.length) {
|
|
50
|
+
groups.delete(name);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return groups;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export function MeasurementsOrAdditionalFindings(props): React.ReactNode {
|
|
57
|
+
const { items, children, grouping = {}, customHeader, group, actions } = props;
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<AccordionGroup
|
|
61
|
+
grouping={{
|
|
62
|
+
groupingFunction: groupByNamedSets,
|
|
63
|
+
name: 'measurementsOrAdditional',
|
|
64
|
+
namedSets: MeasurementOrAdditionalFindingSets,
|
|
65
|
+
StudyInstanceUID: group?.StudyInstanceUID,
|
|
66
|
+
...grouping,
|
|
67
|
+
}}
|
|
68
|
+
items={items}
|
|
69
|
+
sourceChildren={children}
|
|
70
|
+
>
|
|
71
|
+
<AccordionGroup.Accordion noWrapper="true">
|
|
72
|
+
<MeasurementTableNested
|
|
73
|
+
customHeader={customHeader}
|
|
74
|
+
allItems={items}
|
|
75
|
+
actions={actions}
|
|
76
|
+
/>
|
|
77
|
+
</AccordionGroup.Accordion>
|
|
78
|
+
</AccordionGroup>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export default MeasurementsOrAdditionalFindings;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import React, { useMemo, useState, useEffect } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { ViewportActionButton } from '@ohif/ui-next';
|
|
4
|
+
import { Icons, Tooltip, TooltipTrigger, TooltipContent } from '@ohif/ui-next';
|
|
5
|
+
import { useSystem } from '@ohif/core/src';
|
|
6
|
+
import { useViewportDisplaySets } from '../../hooks/useViewportDisplaySets';
|
|
7
|
+
import { useMeasurementTracking } from '../../hooks/useMeasurementTracking';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* ModalityLoadBadge displays the status and actionable buttons for viewports containing
|
|
11
|
+
* special displaySets (SR, SEG, RTSTRUCT) or when tracking measurements
|
|
12
|
+
*/
|
|
13
|
+
function ModalityLoadBadge({ viewportId }: { viewportId: string }) {
|
|
14
|
+
const { commandsManager } = useSystem();
|
|
15
|
+
const { t } = useTranslation('Common');
|
|
16
|
+
const loadStr = t('LOAD');
|
|
17
|
+
|
|
18
|
+
const { isTracked, isLocked } = useMeasurementTracking({ viewportId });
|
|
19
|
+
|
|
20
|
+
const { backgroundDisplaySet } = useViewportDisplaySets(viewportId);
|
|
21
|
+
|
|
22
|
+
const [specialDisplaySet, setSpecialDisplaySet] = useState(null);
|
|
23
|
+
|
|
24
|
+
const allDisplaySets = useMemo(() => {
|
|
25
|
+
return [backgroundDisplaySet].filter(Boolean);
|
|
26
|
+
}, [backgroundDisplaySet]);
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const displaySet = allDisplaySets.find(ds => ds.isOverlayDisplaySet || ds?.Modality === 'SR');
|
|
30
|
+
|
|
31
|
+
setSpecialDisplaySet(displaySet || null);
|
|
32
|
+
}, [allDisplaySets]);
|
|
33
|
+
|
|
34
|
+
const statusInfo = useMemo(() => {
|
|
35
|
+
if (isTracked && !specialDisplaySet) {
|
|
36
|
+
return {
|
|
37
|
+
type: 'SR',
|
|
38
|
+
isHydrated: true,
|
|
39
|
+
isTracked,
|
|
40
|
+
displaySet: null,
|
|
41
|
+
tooltip: 'Currently tracking measurements in this viewport',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!specialDisplaySet) {
|
|
46
|
+
return {
|
|
47
|
+
type: null,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const type = specialDisplaySet.Modality;
|
|
52
|
+
const isHydrated = specialDisplaySet.isHydrated || false;
|
|
53
|
+
let tooltip = null;
|
|
54
|
+
const isRehydratable = specialDisplaySet.isRehydratable || false;
|
|
55
|
+
|
|
56
|
+
if (type === 'SEG') {
|
|
57
|
+
tooltip = isHydrated
|
|
58
|
+
? 'This Segmentation is loaded in the segmentation panel'
|
|
59
|
+
: 'Click LOAD to load segmentation.';
|
|
60
|
+
} else if (type === 'RTSTRUCT') {
|
|
61
|
+
tooltip = isHydrated
|
|
62
|
+
? 'This RTSTRUCT is loaded in the segmentation panel'
|
|
63
|
+
: 'Click LOAD to load RTSTRUCT.';
|
|
64
|
+
} else if (type === 'SR') {
|
|
65
|
+
if (!isRehydratable) {
|
|
66
|
+
tooltip = 'This structured report is not compatible with this application.';
|
|
67
|
+
} else if (isRehydratable && isLocked) {
|
|
68
|
+
tooltip =
|
|
69
|
+
'This structured report is currently read-only because you are tracking measurements in another viewport.';
|
|
70
|
+
} else {
|
|
71
|
+
tooltip = `Click ${loadStr} to restore measurements.`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
type,
|
|
77
|
+
isHydrated,
|
|
78
|
+
displaySet: specialDisplaySet,
|
|
79
|
+
isRehydratable,
|
|
80
|
+
tooltip,
|
|
81
|
+
};
|
|
82
|
+
}, [specialDisplaySet, loadStr, isLocked, isTracked]);
|
|
83
|
+
|
|
84
|
+
// Nothing to show if there's no special display set type or tracking
|
|
85
|
+
if (!statusInfo.type && !isTracked) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const StatusIcon = () => {
|
|
90
|
+
if (statusInfo.type === 'SR') {
|
|
91
|
+
if (statusInfo.isRehydratable && !isLocked) {
|
|
92
|
+
return (
|
|
93
|
+
<Icons.ByName
|
|
94
|
+
className="text-muted-foreground h-4 w-4"
|
|
95
|
+
name="status-untracked"
|
|
96
|
+
/>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (statusInfo.isRehydratable && isLocked) {
|
|
101
|
+
return (
|
|
102
|
+
<Icons.ByName
|
|
103
|
+
name="status-locked"
|
|
104
|
+
className="h-4 w-4"
|
|
105
|
+
/>
|
|
106
|
+
);
|
|
107
|
+
} else {
|
|
108
|
+
return (
|
|
109
|
+
<Icons.ByName
|
|
110
|
+
name="status-alert"
|
|
111
|
+
className="h-4 w-4"
|
|
112
|
+
/>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
return <Icons.StatusUntracked className="h-4 w-4" />;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const StatusArea = () => {
|
|
121
|
+
if (!statusInfo.isHydrated) {
|
|
122
|
+
return (
|
|
123
|
+
<div
|
|
124
|
+
data-cy={`ModalityLoadBadge-${viewportId}`}
|
|
125
|
+
className="text-foreground flex h-6 cursor-default text-sm leading-6"
|
|
126
|
+
>
|
|
127
|
+
<div className="bg-popover flex min-w-[45px] items-center rounded-l-xl rounded-r p-1">
|
|
128
|
+
<StatusIcon />
|
|
129
|
+
<span className="ml-1">{statusInfo.type}</span>
|
|
130
|
+
</div>
|
|
131
|
+
{/* We don't show the load button for SRs because we handle it in the SR extension
|
|
132
|
+
via the tracked measurement context that works with state machine, this is not a regression right now */}
|
|
133
|
+
{statusInfo.type !== 'SR' && (
|
|
134
|
+
<ViewportActionButton
|
|
135
|
+
onInteraction={() => {
|
|
136
|
+
commandsManager.runCommand('hydrateSecondaryDisplaySet', {
|
|
137
|
+
displaySet: statusInfo.displaySet,
|
|
138
|
+
viewportId,
|
|
139
|
+
});
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
{loadStr}
|
|
143
|
+
</ViewportActionButton>
|
|
144
|
+
)}
|
|
145
|
+
</div>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return null;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<>
|
|
154
|
+
{statusInfo.tooltip && (
|
|
155
|
+
<Tooltip>
|
|
156
|
+
<TooltipTrigger asChild>
|
|
157
|
+
<span>
|
|
158
|
+
<StatusArea />
|
|
159
|
+
</span>
|
|
160
|
+
</TooltipTrigger>
|
|
161
|
+
<TooltipContent side="bottom">
|
|
162
|
+
<div>{statusInfo.tooltip}</div>
|
|
163
|
+
</TooltipContent>
|
|
164
|
+
</Tooltip>
|
|
165
|
+
)}
|
|
166
|
+
{!statusInfo.tooltip && <StatusArea />}
|
|
167
|
+
</>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export default ModalityLoadBadge;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ModalityLoadBadge';
|