@ohif/extension-cornerstone 3.14.0-beta.12 → 3.14.0-beta.120
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 +2970 -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/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 +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 +350 -0
- package/src/init.tsx +450 -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 +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
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useActiveViewportDisplaySets, useSystem } from '@ohif/core';
|
|
3
|
+
|
|
4
|
+
import AccordionGroup from './AccordionGroup';
|
|
5
|
+
import PanelAccordionTrigger from './PanelAccordionTrigger';
|
|
6
|
+
import MeasurementItems from './MeasurementItems';
|
|
7
|
+
import MeasurementsMenu from './MeasurementsMenu';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Groups measurements by study in order to allow display and saving by study
|
|
11
|
+
* @param {Object} servicesManager
|
|
12
|
+
*/
|
|
13
|
+
export const groupByDisplaySet = (items, grouping, childProps) => {
|
|
14
|
+
const groups = new Map();
|
|
15
|
+
const { displaySetService } = childProps.servicesManager.services;
|
|
16
|
+
const { activeDisplaySetInstanceUID } = grouping;
|
|
17
|
+
|
|
18
|
+
items.forEach(item => {
|
|
19
|
+
const { displaySetInstanceUID } = item;
|
|
20
|
+
|
|
21
|
+
if (!groups.has(displaySetInstanceUID)) {
|
|
22
|
+
const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);
|
|
23
|
+
groups.set(displaySetInstanceUID, {
|
|
24
|
+
header: null,
|
|
25
|
+
isSelected: displaySetInstanceUID == activeDisplaySetInstanceUID,
|
|
26
|
+
...grouping,
|
|
27
|
+
items: [],
|
|
28
|
+
key: displaySetInstanceUID,
|
|
29
|
+
title: 'Series Measurements',
|
|
30
|
+
displaySet,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
groups.get(displaySetInstanceUID).items.push(item);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return groups;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export function SeriesMeasurementTrigger(props) {
|
|
40
|
+
const { group, isSelected, displaySet, menu } = props;
|
|
41
|
+
const { SeriesNumber = 1, SeriesDescription } = displaySet;
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<PanelAccordionTrigger
|
|
45
|
+
text={`Series #${SeriesNumber} ${SeriesDescription}`}
|
|
46
|
+
count={group.items.length}
|
|
47
|
+
isActive={isSelected}
|
|
48
|
+
group={group}
|
|
49
|
+
menu={menu}
|
|
50
|
+
marginLeft="0"
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function SeriesMeasurements(props): React.ReactNode {
|
|
56
|
+
const { items, grouping = {}, children } = props;
|
|
57
|
+
const system = useSystem();
|
|
58
|
+
const activeDisplaySets = useActiveViewportDisplaySets(system);
|
|
59
|
+
const activeDisplaySetInstanceUID = activeDisplaySets?.[0]?.displaySetInstanceUID;
|
|
60
|
+
const onClick = (_e, group) => {
|
|
61
|
+
const { items } = group;
|
|
62
|
+
system.commandsManager.run('jumpToMeasurement', {
|
|
63
|
+
uid: items[0].uid,
|
|
64
|
+
displayMeasurements: items,
|
|
65
|
+
group,
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// The content of the accordion group will default to the children of the
|
|
70
|
+
// parent declaration if present, otherwise to MeasurementItems
|
|
71
|
+
return (
|
|
72
|
+
<AccordionGroup
|
|
73
|
+
grouping={{
|
|
74
|
+
groupingFunction: groupByDisplaySet,
|
|
75
|
+
activeDisplaySetInstanceUID,
|
|
76
|
+
...grouping,
|
|
77
|
+
onClick,
|
|
78
|
+
}}
|
|
79
|
+
items={items}
|
|
80
|
+
sourceChildren={children}
|
|
81
|
+
>
|
|
82
|
+
<AccordionGroup.Trigger asChild={true}>
|
|
83
|
+
<SeriesMeasurementTrigger menu={MeasurementsMenu} />
|
|
84
|
+
</AccordionGroup.Trigger>
|
|
85
|
+
<MeasurementItems />
|
|
86
|
+
</AccordionGroup>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default SeriesMeasurements;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { utils } from '@ohif/core';
|
|
3
|
+
|
|
4
|
+
const { formatDate } = utils;
|
|
5
|
+
|
|
6
|
+
export function SeriesSummaryFromDisplaySet({ displaySet }) {
|
|
7
|
+
if (!displaySet) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { SeriesDate, SeriesDescription, SeriesNumber = 1 } = displaySet;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div className="mx-2 my-0">
|
|
15
|
+
<div className="text-foreground pb-1 text-sm">
|
|
16
|
+
Series #{SeriesNumber} {SeriesDescription}
|
|
17
|
+
</div>
|
|
18
|
+
<div className="text-muted-foreground text-sm">{formatDate(SeriesDate)}</div>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useActiveViewportDisplaySets, utils } from '@ohif/core';
|
|
3
|
+
|
|
4
|
+
import { AccordionGroup } from './AccordionGroup';
|
|
5
|
+
import MeasurementsOrAdditionalFindings from './MeasurementsOrAdditionalFindings';
|
|
6
|
+
import StudySummaryWithActions from './StudySummaryWithActions';
|
|
7
|
+
|
|
8
|
+
const { MeasurementFilters } = utils;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Groups measurements by study in order to allow display and saving by study
|
|
12
|
+
* @param {Object} servicesManager
|
|
13
|
+
*/
|
|
14
|
+
export const groupByStudy = (items, grouping, childProps) => {
|
|
15
|
+
const groups = new Map();
|
|
16
|
+
const { activeStudyUID } = grouping;
|
|
17
|
+
const { displaySetService } = childProps.servicesManager.services;
|
|
18
|
+
|
|
19
|
+
const getItemStudyInstanceUID = item => {
|
|
20
|
+
const displaySet = displaySetService.getDisplaySetByUID(item.displaySetInstanceUID);
|
|
21
|
+
return displaySet.instances[0].StudyInstanceUID;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
let firstSelected, firstGroup;
|
|
25
|
+
|
|
26
|
+
items
|
|
27
|
+
.filter(item => item.displaySetInstanceUID)
|
|
28
|
+
.forEach(item => {
|
|
29
|
+
const studyUID = getItemStudyInstanceUID(item);
|
|
30
|
+
if (!groups.has(studyUID)) {
|
|
31
|
+
const items = [];
|
|
32
|
+
const filter = MeasurementFilters.filterAnd(
|
|
33
|
+
MeasurementFilters.filterMeasurementsByStudyUID(studyUID),
|
|
34
|
+
grouping.filter
|
|
35
|
+
);
|
|
36
|
+
const group = {
|
|
37
|
+
...grouping,
|
|
38
|
+
items,
|
|
39
|
+
displayMeasurements: items,
|
|
40
|
+
key: studyUID,
|
|
41
|
+
isSelected: studyUID === activeStudyUID,
|
|
42
|
+
StudyInstanceUID: studyUID,
|
|
43
|
+
filter,
|
|
44
|
+
measurementFilter: filter,
|
|
45
|
+
};
|
|
46
|
+
if (group.isSelected && !firstSelected) {
|
|
47
|
+
firstSelected = group;
|
|
48
|
+
}
|
|
49
|
+
firstGroup ||= group;
|
|
50
|
+
groups.set(studyUID, group);
|
|
51
|
+
}
|
|
52
|
+
if (!firstSelected && firstGroup) {
|
|
53
|
+
firstGroup.isSelected = true;
|
|
54
|
+
}
|
|
55
|
+
const group = groups.get(studyUID);
|
|
56
|
+
group.items.push(item);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return groups;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export function StudyMeasurements(props): React.ReactNode {
|
|
63
|
+
const { items, grouping = {}, children } = props;
|
|
64
|
+
|
|
65
|
+
const activeDisplaySets = useActiveViewportDisplaySets();
|
|
66
|
+
const activeStudyUID = activeDisplaySets?.[0]?.StudyInstanceUID;
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<AccordionGroup
|
|
70
|
+
grouping={{
|
|
71
|
+
name: 'groupByStudy',
|
|
72
|
+
groupingFunction: groupByStudy,
|
|
73
|
+
activeStudyUID,
|
|
74
|
+
...grouping,
|
|
75
|
+
}}
|
|
76
|
+
items={items}
|
|
77
|
+
value={[activeStudyUID]}
|
|
78
|
+
sourceChildren={children}
|
|
79
|
+
>
|
|
80
|
+
<AccordionGroup.Trigger>
|
|
81
|
+
<StudySummaryWithActions />
|
|
82
|
+
</AccordionGroup.Trigger>
|
|
83
|
+
<MeasurementsOrAdditionalFindings activeStudyUID={activeStudyUID} />
|
|
84
|
+
</AccordionGroup>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export default StudyMeasurements;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, Icons } from '@ohif/ui-next';
|
|
3
|
+
import { useSystem } from '@ohif/core';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
|
|
6
|
+
export function StudyMeasurementsActions({ items, StudyInstanceUID, measurementFilter, actions }) {
|
|
7
|
+
const { commandsManager } = useSystem();
|
|
8
|
+
const { t } = useTranslation('MeasurementTable');
|
|
9
|
+
const disabled = !items?.length;
|
|
10
|
+
|
|
11
|
+
if (disabled) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div className="bg-background flex h-9 w-full items-center rounded pr-0.5">
|
|
17
|
+
<div className="flex space-x-1">
|
|
18
|
+
<Button
|
|
19
|
+
size="sm"
|
|
20
|
+
variant="ghost"
|
|
21
|
+
className="pl-1.5"
|
|
22
|
+
onClick={() => {
|
|
23
|
+
commandsManager.runCommand('downloadCSVMeasurementsReport', {
|
|
24
|
+
StudyInstanceUID,
|
|
25
|
+
measurementFilter,
|
|
26
|
+
});
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
<Icons.Download className="h-5 w-5" />
|
|
30
|
+
<span className="pl-1">CSV</span>
|
|
31
|
+
</Button>
|
|
32
|
+
|
|
33
|
+
<Button
|
|
34
|
+
size="sm"
|
|
35
|
+
variant="ghost"
|
|
36
|
+
className="pl-0.5"
|
|
37
|
+
onClick={e => {
|
|
38
|
+
e.stopPropagation();
|
|
39
|
+
if (actions?.createSR) {
|
|
40
|
+
actions.createSR({ StudyInstanceUID, measurementFilter });
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
commandsManager.run('promptSaveReport', {
|
|
44
|
+
StudyInstanceUID,
|
|
45
|
+
measurementFilter,
|
|
46
|
+
});
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<Icons.Add />
|
|
50
|
+
{t('Save')}
|
|
51
|
+
</Button>
|
|
52
|
+
<Button
|
|
53
|
+
size="sm"
|
|
54
|
+
variant="ghost"
|
|
55
|
+
className="pl-0.5"
|
|
56
|
+
onClick={e => {
|
|
57
|
+
e.stopPropagation();
|
|
58
|
+
if (actions?.onDelete) {
|
|
59
|
+
actions.onDelete();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
commandsManager.runCommand('clearMeasurements', {
|
|
63
|
+
measurementFilter,
|
|
64
|
+
});
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<Icons.Delete />
|
|
68
|
+
{t('Delete')}
|
|
69
|
+
</Button>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default StudyMeasurementsActions;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The study summary reads the study date and description from an instance in the metadata store.
|
|
3
|
+
* A series can sit in the store with no instances (its summary arrives before its instances, and a
|
|
4
|
+
* series whose metadata comes back empty never gets any), so the summary must not depend on the
|
|
5
|
+
* first series having one.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { createElement } from 'react';
|
|
9
|
+
import { render, screen } from '@testing-library/react';
|
|
10
|
+
|
|
11
|
+
const mockStudy = { current: null };
|
|
12
|
+
|
|
13
|
+
jest.mock('@ohif/core', () => ({
|
|
14
|
+
DicomMetadataStore: { getStudy: () => mockStudy.current },
|
|
15
|
+
utils: { formatDate: (date: string) => `formatted ${date}` },
|
|
16
|
+
}));
|
|
17
|
+
jest.mock('@ohif/ui-next', () => {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
19
|
+
const React = require('react');
|
|
20
|
+
return {
|
|
21
|
+
StudySummary: ({ date, description }) =>
|
|
22
|
+
React.createElement('div', { 'data-testid': 'summary' }, `${date} | ${description}`),
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
import { StudySummaryFromMetadata } from './StudySummaryFromMetadata';
|
|
27
|
+
|
|
28
|
+
const instance = { StudyDate: '20000102', StudyDescription: 'NLST-ACRIN' };
|
|
29
|
+
|
|
30
|
+
const renderSummary = series => {
|
|
31
|
+
mockStudy.current = { series };
|
|
32
|
+
return render(createElement(StudySummaryFromMetadata, { StudyInstanceUID: '1.2.3' }));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
describe('StudySummaryFromMetadata', () => {
|
|
36
|
+
it('reads the summary from the first series that has an instance', () => {
|
|
37
|
+
renderSummary([{ instances: [] }, { instances: [instance] }]);
|
|
38
|
+
|
|
39
|
+
expect(screen.getByTestId('summary').textContent).toBe('formatted 20000102 | NLST-ACRIN');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('renders nothing while no series has an instance yet', () => {
|
|
43
|
+
const { container } = renderSummary([{ instances: [] }, {}]);
|
|
44
|
+
|
|
45
|
+
expect(container.innerHTML).toBe('');
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DicomMetadataStore, utils } from '@ohif/core';
|
|
3
|
+
import { StudySummary } from '@ohif/ui-next';
|
|
4
|
+
|
|
5
|
+
const { formatDate } = utils;
|
|
6
|
+
|
|
7
|
+
export function StudySummaryFromMetadata(props) {
|
|
8
|
+
const { StudyInstanceUID } = props;
|
|
9
|
+
if (!StudyInstanceUID) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const studyMeta = DicomMetadataStore.getStudy(StudyInstanceUID);
|
|
13
|
+
if (!studyMeta?.series?.length) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// A series can be in the store with no instances: its summary arrives before its instances, and
|
|
18
|
+
// a series whose metadata comes back empty never gets any. Read the first series that has one.
|
|
19
|
+
const instanceMeta = studyMeta.series.find(series => series.instances?.length)?.instances[0];
|
|
20
|
+
if (!instanceMeta) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const { StudyDate, StudyDescription } = instanceMeta;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<StudySummary
|
|
27
|
+
date={formatDate(StudyDate)}
|
|
28
|
+
description={StudyDescription}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StudySummaryFromMetadata } from './StudySummaryFromMetadata';
|
|
3
|
+
import StudyMeasurementsActions from './StudyMeasurementsActions';
|
|
4
|
+
|
|
5
|
+
export function StudySummaryWithActions(props) {
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<StudySummaryFromMetadata {...props} />
|
|
9
|
+
<StudyMeasurementsActions {...props} />
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default StudySummaryWithActions;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Numeric,
|
|
4
|
+
Select,
|
|
5
|
+
SelectTrigger,
|
|
6
|
+
SelectValue,
|
|
7
|
+
SelectContent,
|
|
8
|
+
SelectItem,
|
|
9
|
+
Button,
|
|
10
|
+
} from '@ohif/ui-next';
|
|
11
|
+
import { useViewportRendering } from '../../hooks';
|
|
12
|
+
import { useViewportDisplaySets } from '../../hooks/useViewportDisplaySets';
|
|
13
|
+
import SelectItemWithModality from '../SelectItemWithModality';
|
|
14
|
+
|
|
15
|
+
interface ThresholdMenuProps {
|
|
16
|
+
viewportId: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function ThresholdMenu({ viewportId, className }: ThresholdMenuProps) {
|
|
21
|
+
const { viewportDisplaySets, foregroundDisplaySets } = useViewportDisplaySets(viewportId);
|
|
22
|
+
const [selectedDisplaySetUID, setSelectedDisplaySetUID] = useState<string | undefined>(
|
|
23
|
+
foregroundDisplaySets.length > 0 ? foregroundDisplaySets[0].displaySetInstanceUID : undefined
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const { threshold, setThreshold, pixelValueRange } = useViewportRendering(viewportId, {
|
|
27
|
+
displaySetInstanceUID: selectedDisplaySetUID,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const { min, max } = pixelValueRange;
|
|
31
|
+
const thresholdValue = threshold ?? min;
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (foregroundDisplaySets.length > 0 && !selectedDisplaySetUID) {
|
|
35
|
+
setSelectedDisplaySetUID(foregroundDisplaySets[0].displaySetInstanceUID);
|
|
36
|
+
}
|
|
37
|
+
}, [foregroundDisplaySets, selectedDisplaySetUID]);
|
|
38
|
+
|
|
39
|
+
const selectedDisplaySet = viewportDisplaySets.find(
|
|
40
|
+
ds => ds.displaySetInstanceUID === selectedDisplaySetUID
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div className={className}>
|
|
45
|
+
<div className="bg-popover w-72 rounded-lg p-4 shadow-md">
|
|
46
|
+
<div className="mb-4 flex items-center justify-between">
|
|
47
|
+
<div className="flex items-center space-x-2">
|
|
48
|
+
<span className="text-muted-foreground text-base">Threshold</span>
|
|
49
|
+
{viewportDisplaySets.length > 1 && (
|
|
50
|
+
<div className="w-32">
|
|
51
|
+
<Select
|
|
52
|
+
value={selectedDisplaySetUID}
|
|
53
|
+
onValueChange={setSelectedDisplaySetUID}
|
|
54
|
+
>
|
|
55
|
+
<SelectTrigger>
|
|
56
|
+
<SelectValue>{selectedDisplaySet?.label || 'Select Display Set'}</SelectValue>
|
|
57
|
+
</SelectTrigger>
|
|
58
|
+
<SelectContent>
|
|
59
|
+
{viewportDisplaySets.map(ds => (
|
|
60
|
+
<SelectItem
|
|
61
|
+
key={ds.displaySetInstanceUID}
|
|
62
|
+
value={ds.displaySetInstanceUID}
|
|
63
|
+
>
|
|
64
|
+
<SelectItemWithModality displaySet={ds} />
|
|
65
|
+
</SelectItem>
|
|
66
|
+
))}
|
|
67
|
+
</SelectContent>
|
|
68
|
+
</Select>
|
|
69
|
+
</div>
|
|
70
|
+
)}
|
|
71
|
+
</div>
|
|
72
|
+
<Button
|
|
73
|
+
size="sm"
|
|
74
|
+
variant="ghost"
|
|
75
|
+
onClick={() => setThreshold(min)}
|
|
76
|
+
className="text-sm"
|
|
77
|
+
>
|
|
78
|
+
Reset
|
|
79
|
+
</Button>
|
|
80
|
+
</div>
|
|
81
|
+
<Numeric.Container
|
|
82
|
+
mode="singleRange"
|
|
83
|
+
value={thresholdValue}
|
|
84
|
+
onChange={(val: number | [number, number]) => {
|
|
85
|
+
if (typeof val === 'number') {
|
|
86
|
+
setThreshold(val);
|
|
87
|
+
}
|
|
88
|
+
}}
|
|
89
|
+
min={min}
|
|
90
|
+
max={max}
|
|
91
|
+
step={0.01}
|
|
92
|
+
>
|
|
93
|
+
<Numeric.SingleRange />
|
|
94
|
+
<div className="mt-1 flex justify-between">
|
|
95
|
+
<span className="text-muted-foreground text-sm">{min.toFixed(0)}</span>
|
|
96
|
+
<span className="text-muted-foreground text-sm">{max.toFixed(0)}</span>
|
|
97
|
+
</div>
|
|
98
|
+
</Numeric.Container>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export default ThresholdMenu;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { useSystem } from '@ohif/core';
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
Icons,
|
|
6
|
+
Popover,
|
|
7
|
+
PopoverContent,
|
|
8
|
+
PopoverTrigger,
|
|
9
|
+
useIconPresentation,
|
|
10
|
+
} from '@ohif/ui-next';
|
|
11
|
+
import ThresholdMenu from './ThresholdMenu';
|
|
12
|
+
|
|
13
|
+
type ThresholdMenuWrapperProps = {
|
|
14
|
+
viewportId: string;
|
|
15
|
+
location: string;
|
|
16
|
+
isOpen?: boolean;
|
|
17
|
+
onOpen?: () => void;
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export function ThresholdMenuWrapper(props: ThresholdMenuWrapperProps): ReactNode {
|
|
23
|
+
const { viewportId, location, isOpen = false, onOpen, onClose, disabled, ...rest } = props;
|
|
24
|
+
const { IconContainer, className: iconClassName, containerProps } = useIconPresentation();
|
|
25
|
+
|
|
26
|
+
const handleOpenChange = (openState: boolean) => {
|
|
27
|
+
if (openState) {
|
|
28
|
+
onOpen?.();
|
|
29
|
+
} else {
|
|
30
|
+
onClose?.();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const { servicesManager } = useSystem();
|
|
35
|
+
const { toolbarService } = servicesManager.services;
|
|
36
|
+
|
|
37
|
+
const { align, side } = toolbarService.getAlignAndSide(location);
|
|
38
|
+
|
|
39
|
+
const Icon = <Icons.Threshold className={iconClassName} />;
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Popover
|
|
43
|
+
open={isOpen}
|
|
44
|
+
onOpenChange={handleOpenChange}
|
|
45
|
+
>
|
|
46
|
+
<PopoverTrigger
|
|
47
|
+
asChild
|
|
48
|
+
className="flex items-center justify-center"
|
|
49
|
+
>
|
|
50
|
+
<div>
|
|
51
|
+
{IconContainer ? (
|
|
52
|
+
<IconContainer
|
|
53
|
+
disabled={disabled}
|
|
54
|
+
icon="Threshold"
|
|
55
|
+
{...rest}
|
|
56
|
+
{...containerProps}
|
|
57
|
+
>
|
|
58
|
+
{Icon}
|
|
59
|
+
</IconContainer>
|
|
60
|
+
) : (
|
|
61
|
+
<Button
|
|
62
|
+
variant="ghost"
|
|
63
|
+
size="icon"
|
|
64
|
+
disabled={disabled}
|
|
65
|
+
>
|
|
66
|
+
{Icon}
|
|
67
|
+
</Button>
|
|
68
|
+
)}
|
|
69
|
+
</div>
|
|
70
|
+
</PopoverTrigger>
|
|
71
|
+
<PopoverContent
|
|
72
|
+
className="border-none bg-transparent p-0 shadow-none"
|
|
73
|
+
side={side}
|
|
74
|
+
align={align}
|
|
75
|
+
alignOffset={0}
|
|
76
|
+
sideOffset={5}
|
|
77
|
+
>
|
|
78
|
+
<ThresholdMenu
|
|
79
|
+
className="w-full"
|
|
80
|
+
viewportId={viewportId}
|
|
81
|
+
/>
|
|
82
|
+
</PopoverContent>
|
|
83
|
+
</Popover>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Icons, Tooltip, TooltipTrigger, TooltipContent } from '@ohif/ui-next';
|
|
3
|
+
import { useMeasurementTracking } from '../../hooks/useMeasurementTracking';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* TrackingStatus displays an indicator icon for viewports that have
|
|
7
|
+
* tracked measurements
|
|
8
|
+
*/
|
|
9
|
+
function TrackingStatus({ viewportId }: { viewportId: string }) {
|
|
10
|
+
const { isTracked } = useMeasurementTracking({ viewportId });
|
|
11
|
+
|
|
12
|
+
if (!isTracked) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<Tooltip>
|
|
19
|
+
<TooltipTrigger asChild>
|
|
20
|
+
<span>
|
|
21
|
+
<Icons.StatusTracking className="h-4 w-4 text-highlight" />
|
|
22
|
+
</span>
|
|
23
|
+
</TooltipTrigger>
|
|
24
|
+
<TooltipContent side="bottom">
|
|
25
|
+
<div>Tracking</div>
|
|
26
|
+
</TooltipContent>
|
|
27
|
+
</Tooltip>
|
|
28
|
+
</>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default TrackingStatus;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TrackingStatus';
|