@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,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Numeric } from '@ohif/ui-next';
|
|
3
|
+
import { useViewportDisplaySets, useViewportRendering } from '../../hooks';
|
|
4
|
+
|
|
5
|
+
interface OpacityMenuProps {
|
|
6
|
+
viewportId: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function OpacityMenu({ viewportId, className }: OpacityMenuProps) {
|
|
11
|
+
const { backgroundDisplaySet, foregroundDisplaySets } = useViewportDisplaySets(viewportId, {
|
|
12
|
+
includeForeground: true,
|
|
13
|
+
includeBackground: true,
|
|
14
|
+
});
|
|
15
|
+
const { opacityLinear, setOpacityLinear } = useViewportRendering(viewportId, {
|
|
16
|
+
displaySetInstanceUID: foregroundDisplaySets[0].displaySetInstanceUID,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const opacityValue = opacityLinear !== undefined ? opacityLinear : 0;
|
|
20
|
+
const backgroundModality = backgroundDisplaySet?.Modality || '';
|
|
21
|
+
const foregroundModality = foregroundDisplaySets[0]?.Modality || '';
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className={className}>
|
|
25
|
+
<div className="bg-popover w-72 rounded-lg p-3">
|
|
26
|
+
<div className="mb-2 flex items-center justify-center">
|
|
27
|
+
<span className="text-muted-foreground text-base">Opacity</span>
|
|
28
|
+
</div>
|
|
29
|
+
<div className="">
|
|
30
|
+
<Numeric.Container
|
|
31
|
+
mode="singleRange"
|
|
32
|
+
value={opacityValue}
|
|
33
|
+
onChange={(val: number | [number, number]) => {
|
|
34
|
+
if (typeof val === 'number') {
|
|
35
|
+
setOpacityLinear(val);
|
|
36
|
+
}
|
|
37
|
+
}}
|
|
38
|
+
min={0}
|
|
39
|
+
max={1}
|
|
40
|
+
step={0.0001}
|
|
41
|
+
>
|
|
42
|
+
<div className="flex items-center">
|
|
43
|
+
<span className="text-foreground mr-2 text-sm">{backgroundModality}</span>
|
|
44
|
+
<Numeric.SingleRange showNumberInput={false} />
|
|
45
|
+
<span className="text-foreground ml-2 text-sm">{foregroundModality}</span>
|
|
46
|
+
</div>
|
|
47
|
+
</Numeric.Container>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default OpacityMenu;
|
|
@@ -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 OpacityMenu from './OpacityMenu';
|
|
12
|
+
|
|
13
|
+
type OpacityMenuWrapperProps = {
|
|
14
|
+
viewportId: string;
|
|
15
|
+
location: string;
|
|
16
|
+
isOpen?: boolean;
|
|
17
|
+
onOpen?: () => void;
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export function OpacityMenuWrapper(props: OpacityMenuWrapperProps): 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.Opacity 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="Opacity"
|
|
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
|
+
<OpacityMenu
|
|
79
|
+
className="w-full"
|
|
80
|
+
viewportId={viewportId}
|
|
81
|
+
/>
|
|
82
|
+
</PopoverContent>
|
|
83
|
+
</Popover>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AccordionTrigger, ColorCircle } from '@ohif/ui-next';
|
|
3
|
+
import { ChevronDownIcon } from '@radix-ui/react-icons';
|
|
4
|
+
|
|
5
|
+
function onClickDefault(e) {
|
|
6
|
+
const { group, onClick = group?.onClick } = this;
|
|
7
|
+
if (!onClick) {
|
|
8
|
+
console.log('No onClick function', group);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
console.log('onClickDefault');
|
|
12
|
+
e.preventDefault();
|
|
13
|
+
e.stopPropagation();
|
|
14
|
+
|
|
15
|
+
onClick(e, group);
|
|
16
|
+
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function PanelAccordionTrigger(props) {
|
|
21
|
+
const { marginLeft = 8, isActive = false, colorHex, count, text, menu: Menu = null } = props;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<AccordionTrigger
|
|
25
|
+
style={{ marginLeft: `${marginLeft}px`, padding: 0 }}
|
|
26
|
+
asChild={true}
|
|
27
|
+
>
|
|
28
|
+
<div className={`inline-flex text-base ${isActive ? 'bg-popover' : 'bg-muted'} flex-grow`}>
|
|
29
|
+
<button onClick={onClickDefault.bind(props)}>
|
|
30
|
+
<span
|
|
31
|
+
className={`inline-flex rounded-l border-r border-background ${isActive ? 'bg-highlight' : 'bg-muted'}`}
|
|
32
|
+
>
|
|
33
|
+
{count !== undefined ? <span className="px-2">{count}</span> : null}
|
|
34
|
+
{colorHex && <ColorCircle colorHex={colorHex} />}
|
|
35
|
+
</span>
|
|
36
|
+
<span>{text}</span>
|
|
37
|
+
</button>
|
|
38
|
+
{Menu && (
|
|
39
|
+
<Menu
|
|
40
|
+
{...props}
|
|
41
|
+
classNames="justify-end flex-grow"
|
|
42
|
+
/>
|
|
43
|
+
)}
|
|
44
|
+
<ChevronDownIcon className="text-primary h-4 w-4 shrink-0 transition-transform duration-200" />
|
|
45
|
+
</div>
|
|
46
|
+
</AccordionTrigger>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Switch } from '@ohif/ui-next';
|
|
3
|
+
import { useSystem } from '@ohif/core';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
|
|
6
|
+
export default function SegmentationToolConfig() {
|
|
7
|
+
const { commandsManager } = useSystem();
|
|
8
|
+
const { t } = useTranslation('SegmentationPanel');
|
|
9
|
+
|
|
10
|
+
// Get initial states based on current configuration
|
|
11
|
+
const [previewEdits, setPreviewEdits] = useState(false);
|
|
12
|
+
const [segmentLabelEnabled, setSegmentLabelEnabled] = useState(false);
|
|
13
|
+
const [toggleSegmentEnabled, setToggleSegmentEnabled] = useState(false);
|
|
14
|
+
const [useCenterAsSegmentIndex, setUseCenterAsSegmentIndex] = useState(false);
|
|
15
|
+
|
|
16
|
+
const handlePreviewEditsChange = checked => {
|
|
17
|
+
setPreviewEdits(checked);
|
|
18
|
+
commandsManager.run('toggleSegmentPreviewEdit', { toggle: checked });
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const handleToggleSegmentEnabledChange = checked => {
|
|
22
|
+
setToggleSegmentEnabled(checked);
|
|
23
|
+
commandsManager.run('toggleSegmentSelect', { toggle: checked });
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const handleUseCenterAsSegmentIndexChange = checked => {
|
|
27
|
+
setUseCenterAsSegmentIndex(checked);
|
|
28
|
+
commandsManager.run('toggleUseCenterSegmentIndex', { toggle: checked });
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const handleSegmentLabelEnabledChange = checked => {
|
|
32
|
+
setSegmentLabelEnabled(checked);
|
|
33
|
+
commandsManager.run('toggleSegmentLabel', { enabled: checked });
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div className="bg-muted flex flex-col gap-2 border-b border-b-[2px] border-background px-2 py-3">
|
|
38
|
+
<div className="flex items-center gap-2">
|
|
39
|
+
<Switch
|
|
40
|
+
checked={previewEdits}
|
|
41
|
+
onCheckedChange={handlePreviewEditsChange}
|
|
42
|
+
/>
|
|
43
|
+
<span className="text-foreground text-base">{t('Preview edits before creating')}</span>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div className="flex items-center gap-2">
|
|
47
|
+
<Switch
|
|
48
|
+
checked={useCenterAsSegmentIndex}
|
|
49
|
+
onCheckedChange={handleUseCenterAsSegmentIndexChange}
|
|
50
|
+
/>
|
|
51
|
+
<span className="text-foreground text-base">{t('Use center as segment index')}</span>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div className="flex items-center gap-2">
|
|
55
|
+
<Switch
|
|
56
|
+
checked={toggleSegmentEnabled}
|
|
57
|
+
onCheckedChange={handleToggleSegmentEnabledChange}
|
|
58
|
+
/>
|
|
59
|
+
<span className="text-foreground text-base">{t('Hover on segment border to activate')}</span>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div className="flex items-center gap-2">
|
|
63
|
+
<Switch
|
|
64
|
+
checked={segmentLabelEnabled}
|
|
65
|
+
onCheckedChange={handleSegmentLabelEnabledChange}
|
|
66
|
+
/>
|
|
67
|
+
<span className="text-foreground text-base">{t('Show segment name on hover')}</span>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { cn, ToolButton } from '@ohif/ui-next';
|
|
3
|
+
import { useUIStateStore } from '@ohif/extension-default';
|
|
4
|
+
|
|
5
|
+
interface SegmentationUtilityButtonProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
isActive?: boolean;
|
|
8
|
+
id: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A button that represents a segmentation utility.
|
|
13
|
+
* It is implicitly the PopoverTrigger for the options Popover panel that is
|
|
14
|
+
* opened in the PanelSegmentation component. It in essence is the PopoverTrigger
|
|
15
|
+
* because typically this button has the associated options to display in the Popover.
|
|
16
|
+
* Furthermore it also typically has a command for toggling the activeSegmentationUtility
|
|
17
|
+
* value in the UIStateStore that triggers the fetching of its options.
|
|
18
|
+
|
|
19
|
+
* @param props - The props for the button.
|
|
20
|
+
* @param props.className - The class name for the button.
|
|
21
|
+
* @param props.isActive - Whether the button is active
|
|
22
|
+
* @param props.id - The id of the button.
|
|
23
|
+
*/
|
|
24
|
+
function SegmentationUtilityButton(props: SegmentationUtilityButtonProps) {
|
|
25
|
+
const { className, isActive, id } = props;
|
|
26
|
+
|
|
27
|
+
const activeSegmentationUtility = useUIStateStore(
|
|
28
|
+
store => store.uiState.activeSegmentationUtility
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const toolButtonClassName = cn(
|
|
32
|
+
'w-7 h-7 text-primary hover:text-primary hover:!bg-primary/30',
|
|
33
|
+
className,
|
|
34
|
+
isActive && 'bg-primary/30'
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const handleMouseDownCapture = event => {
|
|
38
|
+
if (activeSegmentationUtility === id) {
|
|
39
|
+
// If this active button is clicked, prevent the default Popover
|
|
40
|
+
// behaviour of closing the Popover on a pointer/mouse down.
|
|
41
|
+
// Not doing this will cause the Popover to close and then reopen again.
|
|
42
|
+
// Why? Because propagating this event will cause PanelSegmentation to
|
|
43
|
+
// close the Popover by clearing the activeSegmentationUtility. Then
|
|
44
|
+
// this button will set the activeSegmentationUtility again and the
|
|
45
|
+
// Popover will reopen.
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
event.stopPropagation();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div onPointerDownCapture={handleMouseDownCapture}>
|
|
53
|
+
<ToolButton
|
|
54
|
+
{...props}
|
|
55
|
+
className={toolButtonClassName}
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default SegmentationUtilityButton;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { type JSX } from 'react';
|
|
2
|
+
|
|
3
|
+
// should be used in a Select component
|
|
4
|
+
const defaultDataCY = (displaySet: AppTypes.DisplaySet) =>
|
|
5
|
+
`${displaySet.label}-${displaySet.Modality}`;
|
|
6
|
+
|
|
7
|
+
const SelectItemWithModality = ({
|
|
8
|
+
displaySet,
|
|
9
|
+
showModality = true,
|
|
10
|
+
dataCY = defaultDataCY(displaySet),
|
|
11
|
+
}: {
|
|
12
|
+
displaySet: AppTypes.DisplaySet;
|
|
13
|
+
showModality?: boolean;
|
|
14
|
+
dataCY?: string;
|
|
15
|
+
}): JSX.Element => (
|
|
16
|
+
<div
|
|
17
|
+
className="flex w-[90%] items-center justify-between"
|
|
18
|
+
data-cy={dataCY}
|
|
19
|
+
>
|
|
20
|
+
<span className="text-foreground truncate text-base">{displaySet.label}</span>
|
|
21
|
+
{showModality && displaySet.Modality && (
|
|
22
|
+
<span className="text-muted-foreground flex-shrink-0 whitespace-nowrap text-xs">
|
|
23
|
+
{displaySet.Modality}
|
|
24
|
+
</span>
|
|
25
|
+
)}
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export default SelectItemWithModality;
|
|
@@ -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
|
+
});
|