@ohif/extension-default 3.14.0-beta.10 → 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/ohif-extension-default.css +1 -1
- package/dist/ohif-extension-default.umd.js +1 -1
- package/package.json +14 -10
- package/src/Actions/createReportAsync.tsx +45 -0
- package/src/Components/DataSourceConfigurationComponent.tsx +142 -0
- package/src/Components/DataSourceConfigurationModalComponent.tsx +200 -0
- package/src/Components/ItemListComponent.tsx +95 -0
- package/src/Components/LineChartViewport/LineChartViewport.tsx +31 -0
- package/src/Components/LineChartViewport/index.ts +1 -0
- package/src/Components/MoreDropdownMenu.tsx +112 -0
- package/src/Components/ProgressDropdownWithService.tsx +101 -0
- package/src/Components/SidePanelWithServices.tsx +122 -0
- package/src/CustomizableContextMenu/ContextMenuController.tsx +216 -0
- package/src/CustomizableContextMenu/ContextMenuItemsBuilder.test.js +29 -0
- package/src/CustomizableContextMenu/ContextMenuItemsBuilder.ts +176 -0
- package/src/CustomizableContextMenu/index.ts +5 -0
- package/src/CustomizableContextMenu/types.ts +126 -0
- package/src/DataSourceConfigurationAPI/GoogleCloudDataSourceConfigurationAPI.ts +236 -0
- package/src/DicomJSONDataSource/index.js +326 -0
- package/src/DicomLocalDataSource/index.js +273 -0
- package/src/DicomTagBrowser/DicomTagBrowser.css +49 -0
- package/src/DicomTagBrowser/DicomTagBrowser.tsx +454 -0
- package/src/DicomTagBrowser/DicomTagTable.tsx +311 -0
- package/src/DicomWebDataSource/dcm4cheeReject.js +45 -0
- package/src/DicomWebDataSource/exampleInstances.js +280 -0
- package/src/DicomWebDataSource/index.ts +808 -0
- package/src/DicomWebDataSource/qido.js +215 -0
- package/src/DicomWebDataSource/retrieveBulkData.test.ts +35 -0
- package/src/DicomWebDataSource/retrieveBulkData.ts +31 -0
- package/src/DicomWebDataSource/retrieveRendered.test.ts +147 -0
- package/src/DicomWebDataSource/retrieveRendered.ts +141 -0
- package/src/DicomWebDataSource/retrieveStudyMetadata.js +108 -0
- package/src/DicomWebDataSource/retrieveStudyMetadata.test.js +75 -0
- package/src/DicomWebDataSource/retrieveThumbnail.ts +346 -0
- package/src/DicomWebDataSource/serviceUrls.test.ts +143 -0
- package/src/DicomWebDataSource/utils/StaticWadoClient.ts +272 -0
- package/src/DicomWebDataSource/utils/cleanDenaturalizedDataset.ts +78 -0
- package/src/DicomWebDataSource/utils/findIndexOfString.ts +47 -0
- package/src/DicomWebDataSource/utils/fixBulkDataURI.test.ts +68 -0
- package/src/DicomWebDataSource/utils/fixBulkDataURI.ts +78 -0
- package/src/DicomWebDataSource/utils/fixMultiValueKeys.ts +12 -0
- package/src/DicomWebDataSource/utils/fixMultipart.ts +70 -0
- package/src/DicomWebDataSource/utils/getImageId.js +54 -0
- package/src/DicomWebDataSource/utils/getWADORSImageId.js +51 -0
- package/src/DicomWebDataSource/utils/index.ts +9 -0
- package/src/DicomWebDataSource/utils/retrieveMetadataFiltered.js +61 -0
- package/src/DicomWebDataSource/wado/retrieveMetadata.js +41 -0
- package/src/DicomWebDataSource/wado/retrieveMetadataLoader.js +64 -0
- package/src/DicomWebDataSource/wado/retrieveMetadataLoaderAsync.js +159 -0
- package/src/DicomWebDataSource/wado/retrieveMetadataLoaderSync.js +58 -0
- package/src/DicomWebProxyDataSource/index.ts +90 -0
- package/src/MergeDataSource/index.test.ts +212 -0
- package/src/MergeDataSource/index.ts +319 -0
- package/src/MergeDataSource/types.ts +46 -0
- package/src/Panels/DataSourceSelector.tsx +55 -0
- package/src/Panels/StudyBrowser/PanelStudyBrowser.tsx +612 -0
- package/src/Panels/StudyBrowser/PanelStudyBrowserHeader.tsx +88 -0
- package/src/Panels/StudyBrowser/constants/actionIcons.ts +12 -0
- package/src/Panels/StudyBrowser/constants/index.ts +4 -0
- package/src/Panels/StudyBrowser/constants/viewPresets.ts +16 -0
- package/src/Panels/StudyBrowser/resolveThumbnailDetails.test.ts +197 -0
- package/src/Panels/StudyBrowser/resolveThumbnailDetails.ts +132 -0
- package/src/Panels/StudyBrowser/types/actionIcon.ts +9 -0
- package/src/Panels/StudyBrowser/types/index.ts +4 -0
- package/src/Panels/StudyBrowser/types/viewPreset.ts +7 -0
- package/src/Panels/WrappedPanelStudyBrowser.tsx +61 -0
- package/src/Panels/createReportDialogPrompt.tsx +128 -0
- package/src/Panels/debounce.js +25 -0
- package/src/Panels/getImageSrcFromImageId.js +16 -0
- package/src/Panels/getStudiesForPatientByMRN.js +19 -0
- package/src/Panels/index.js +5 -0
- package/src/Panels/requestDisplaySetCreationForStudy.js +19 -0
- package/src/SOPClassHandlers/chartSOPClassHandler.test.ts +81 -0
- package/src/SOPClassHandlers/chartSOPClassHandler.ts +127 -0
- package/src/Toolbar/ToolBoxWrapper.tsx +64 -0
- package/src/Toolbar/ToolButtonListWrapper.tsx +77 -0
- package/src/Toolbar/ToolButtonWrapper.tsx +32 -0
- package/src/Toolbar/ToolRowWrapper.tsx +41 -0
- package/src/Toolbar/Toolbar.tsx +98 -0
- package/src/Toolbar/ToolbarDivider.tsx +5 -0
- package/src/Toolbar/ToolbarLayoutSelector.tsx +195 -0
- package/src/Toolbar/index.ts +7 -0
- package/src/ViewerLayout/HeaderPatientInfo/HeaderPatientInfo.tsx +96 -0
- package/src/ViewerLayout/HeaderPatientInfo/index.js +3 -0
- package/src/ViewerLayout/HeaderUndoRedo.tsx +47 -0
- package/src/ViewerLayout/ResizablePanelsHook.tsx +334 -0
- package/src/ViewerLayout/ViewerHeader.tsx +124 -0
- package/src/ViewerLayout/constants/panels.ts +42 -0
- package/src/ViewerLayout/index.tsx +227 -0
- package/src/ViewerLayout/useUndoRedoState.ts +75 -0
- package/src/__tests__/commandsModuleToggleOneUp.test.ts +147 -0
- package/src/commandsModule.ts +970 -0
- package/src/customizations/aboutModalCustomization.tsx +42 -0
- package/src/customizations/appearanceModalCustomization.tsx +143 -0
- package/src/customizations/contextMenuCustomization.ts +25 -0
- package/src/customizations/contextMenuUICustomization.ts +5 -0
- package/src/customizations/customRoutesCustomization.ts +6 -0
- package/src/customizations/dataSourceConfigurationCustomization.ts +19 -0
- package/src/customizations/datasourcesCustomization.tsx +14 -0
- package/src/customizations/defaultContextMenuCustomization.ts +22 -0
- package/src/customizations/hangingProtocolsCustomization.ts +15 -0
- package/src/customizations/headerRightSideCustomization.ts +19 -0
- package/src/customizations/helloPageCustomization.tsx +14 -0
- package/src/customizations/hideHeaderUndoRedoCustomization.ts +22 -0
- package/src/customizations/hotkeyBindingsCustomization.ts +5 -0
- package/src/customizations/instanceSortingCriteriaCustomization.ts +6 -0
- package/src/customizations/labellingFlowCustomization.tsx +5 -0
- package/src/customizations/loadingIndicatorProgressCustomization.tsx +5 -0
- package/src/customizations/loadingIndicatorTotalPercentCustomization.tsx +5 -0
- package/src/customizations/menuContentCustomization.tsx +67 -0
- package/src/customizations/metadataContextCustomization.test.ts +22 -0
- package/src/customizations/metadataContextCustomization.ts +28 -0
- package/src/customizations/metadataDisplaySetCustomization.ts +55 -0
- package/src/customizations/missingReferenceDisplaySetHandler.ts +5 -0
- package/src/customizations/multimonitorCustomization.ts +63 -0
- package/src/customizations/notificationCustomization.ts +29 -0
- package/src/customizations/onDropHandlerCustomization.ts +5 -0
- package/src/customizations/onboardingCustomization.ts +200 -0
- package/src/customizations/overlayItemCustomization.tsx +33 -0
- package/src/customizations/progressDropdownCustomization.ts +5 -0
- package/src/customizations/progressLoadingBarCustomization.tsx +5 -0
- package/src/customizations/reportDialogCustomization.test.ts +701 -0
- package/src/customizations/reportDialogCustomization.tsx +661 -0
- package/src/customizations/sortingCriteriaCustomization.ts +14 -0
- package/src/customizations/studyBrowserCustomization.test.ts +69 -0
- package/src/customizations/studyBrowserCustomization.ts +95 -0
- package/src/customizations/thumbnailDetailsCustomization.ts +91 -0
- package/src/customizations/userPreferencesCustomization.tsx +342 -0
- package/src/customizations/workListCustomization.ts +107 -0
- package/src/displaySetSplitting/makeDisplaySetFromInstanceGroup.test.ts +181 -0
- package/src/displaySetSplitting/makeDisplaySetFromInstanceGroup.ts +240 -0
- package/src/displaySetSplitting/makeImageSetDisplaySet.ts +276 -0
- package/src/displaySetSplitting/stackSopClassUids.ts +60 -0
- package/src/displaySetSplitting/urlSplitModules.test.ts +333 -0
- package/src/findViewportsByPosition.ts +102 -0
- package/src/getCustomizationModule.tsx +109 -0
- package/src/getDataSourcesModule.js +44 -0
- package/src/getDisplaySetMessages.ts +54 -0
- package/src/getDisplaySetsFromUnsupportedSeries.js +63 -0
- package/src/getDisplaySetsFromUnsupportedSeries.test.js +14 -0
- package/src/getHangingProtocolModule.js +155 -0
- package/src/getLayoutTemplateModule.js +28 -0
- package/src/getPTImageIdInstanceMetadata.test.ts +102 -0
- package/src/getPTImageIdInstanceMetadata.ts +124 -0
- package/src/getPanelModule.tsx +29 -0
- package/src/getSopClassHandlerModule.js +152 -0
- package/src/getSopClassHandlerModule.test.js +78 -0
- package/src/getToolbarModule.tsx +63 -0
- package/src/getViewportModule.tsx +12 -0
- package/src/hangingprotocols/hpCompare.ts +189 -0
- package/src/hangingprotocols/hpEcgCustomization.test.ts +104 -0
- package/src/hangingprotocols/hpMNGrid.test.ts +120 -0
- package/src/hangingprotocols/hpMNGrid.ts +419 -0
- package/src/hangingprotocols/hpMammo.ts +202 -0
- package/src/hangingprotocols/hpScale.ts +132 -0
- package/src/hangingprotocols/index.ts +16 -0
- package/src/hangingprotocols/protocolMatchChanges.test.ts +73 -0
- package/src/hangingprotocols/utils/isNewestOfModality.ts +19 -0
- package/src/hangingprotocols/utils/laterality.ts +9 -0
- package/src/hangingprotocols/utils/mammoDisplaySetSelector.ts +214 -0
- package/src/hangingprotocols/utils/registerHangingProtocolAttributes.ts +14 -0
- package/src/hangingprotocols/utils/seriesSelectors.ts +62 -0
- package/src/hangingprotocols/utils/studySelectors.ts +14 -0
- package/src/hangingprotocols/utils/viewCode.test.js +25 -0
- package/src/hangingprotocols/utils/viewCode.ts +17 -0
- package/src/hangingprotocols/utils/viewportOptions.ts +18 -0
- package/src/hooks/usePatientInfo.tsx +63 -0
- package/src/id.js +5 -0
- package/src/index.ts +113 -0
- package/src/init.ts +169 -0
- package/src/stores/index.ts +7 -0
- package/src/stores/useDisplaySetSelectorStore.ts +83 -0
- package/src/stores/useHangingProtocolStageIndexStore.ts +76 -0
- package/src/stores/useToggleHangingProtocolStore.ts +76 -0
- package/src/stores/useToggleOneUpViewportGridStore.ts +19 -0
- package/src/stores/useUIStateStore.ts +87 -0
- package/src/stores/useViewportGridStore.ts +89 -0
- package/src/stores/useViewportsByPositionStore.ts +100 -0
- package/src/types/AppTypes.ts +20 -0
- package/src/types/commandModuleTypes.tsx +6 -0
- package/src/utils/Toolbox.tsx +123 -0
- package/src/utils/_shared/PROMPT_RESPONSES.ts +10 -0
- package/src/utils/addIcon.ts +6 -0
- package/src/utils/appendFrameQueryToImageId.js +9 -0
- package/src/utils/callInputDialog.tsx +126 -0
- package/src/utils/colorPickerDialog.css +4 -0
- package/src/utils/colorPickerDialog.tsx +45 -0
- package/src/utils/createRenderedRetrieve.js +32 -0
- package/src/utils/createRenderedRetrieve.test.js +46 -0
- package/src/utils/dicomWriter.test.ts +228 -0
- package/src/utils/dicomWriter.ts +110 -0
- package/src/utils/getBulkdataValue.js +45 -0
- package/src/utils/getBulkdataValue.test.js +105 -0
- package/src/utils/getDirectURL.test.ts +207 -0
- package/src/utils/getDirectURL.ts +65 -0
- package/src/utils/getSRSeriesAndInstanceNumber.js +48 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/layerConfigurationUtils.ts +202 -0
- package/src/utils/promptLabelAnnotation.js +47 -0
- package/src/utils/promptSaveReport.test.ts +106 -0
- package/src/utils/promptSaveReport.tsx +117 -0
- package/src/utils/registerNaturalizedDatasetForLocalWadouri.js +146 -0
- package/src/utils/registerNaturalizedDatasetForLocalWadouri.test.js +177 -0
- package/src/utils/registerStoredInstanceImageId.test.ts +73 -0
- package/src/utils/registerStoredInstanceImageId.ts +66 -0
- package/src/utils/reuseCachedLayouts.ts +92 -0
- package/src/utils/secureConfigFetch.js +115 -0
- package/src/utils/secureConfigFetch.test.js +163 -0
- package/src/utils/seriesDescriptionHistory.ts +83 -0
- package/src/utils/validations/areAllImageComponentsEqual.ts +24 -0
- package/src/utils/validations/areAllImageDimensionsEqual.test.ts +41 -0
- package/src/utils/validations/areAllImageDimensionsEqual.ts +27 -0
- package/src/utils/validations/areAllImagePositionsEqual.ts +75 -0
- package/src/utils/validations/areAllImageSpacingEqual.ts +66 -0
- package/src/utils/validations/checkMultiframe.ts +25 -0
- package/src/utils/validations/checkSingleFrames.ts +36 -0
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
// 'use no memo' - this component triggers a runtime hook-order error when the
|
|
2
|
+
// React Compiler processes it:
|
|
3
|
+
// "React has detected a change in the order of Hooks called by PanelStudyBrowser"
|
|
4
|
+
//
|
|
5
|
+
// Ruled out, each by testing the built app:
|
|
6
|
+
// - hot-module reload (survives a hard reload and a fresh tab)
|
|
7
|
+
// - the hook count (occurs whether the double-click useCallback is kept or not)
|
|
8
|
+
// - the dependency contents (occurs with extensionManager.appConfig or useAppConfig)
|
|
9
|
+
// - a stale prebuilt dist/ copy of this extension (renaming it changes nothing)
|
|
10
|
+
//
|
|
11
|
+
// The emitted output is structurally sound - 24 hooks, all top level, one return
|
|
12
|
+
// at the end - and 46 other files compiled without this. The cause is unknown and
|
|
13
|
+
// narrowing it needs runtime bisection, not reading.
|
|
14
|
+
'use no memo';
|
|
15
|
+
|
|
16
|
+
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
17
|
+
import { useImageViewer } from '@ohif/ui-next';
|
|
18
|
+
import { useSystem, utils } from '@ohif/core';
|
|
19
|
+
import { useNavigate } from 'react-router-dom';
|
|
20
|
+
import { useViewportGrid, StudyBrowser, Separator } from '@ohif/ui-next';
|
|
21
|
+
import { PanelStudyBrowserHeader } from './PanelStudyBrowserHeader';
|
|
22
|
+
import { defaultActionIcons } from './constants';
|
|
23
|
+
import MoreDropdownMenu from '../../Components/MoreDropdownMenu';
|
|
24
|
+
import { CallbackCustomization } from 'platform/core/src/types';
|
|
25
|
+
import { type TabsProps } from '@ohif/core/src/utils/createStudyBrowserTabs';
|
|
26
|
+
import { thumbnailNoImageModalities } from '@ohif/core/src/utils/thumbnailNoImageModalities';
|
|
27
|
+
import { resolveThumbnailDetails } from './resolveThumbnailDetails';
|
|
28
|
+
|
|
29
|
+
const { sortStudyInstances, formatDate, formatTime, createStudyBrowserTabs } = utils;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Study Browser component that displays and manages studies and their display sets
|
|
33
|
+
*/
|
|
34
|
+
function PanelStudyBrowser({
|
|
35
|
+
getImageSrc,
|
|
36
|
+
getStudiesForPatientByMRN,
|
|
37
|
+
requestDisplaySetCreationForStudy,
|
|
38
|
+
dataSource,
|
|
39
|
+
customMapDisplaySets,
|
|
40
|
+
onClickUntrack,
|
|
41
|
+
onDoubleClickThumbnailHandlerCallBack,
|
|
42
|
+
}) {
|
|
43
|
+
const { servicesManager, commandsManager, extensionManager } = useSystem();
|
|
44
|
+
const { displaySetService, customizationService } = servicesManager.services;
|
|
45
|
+
const navigate = useNavigate();
|
|
46
|
+
const studyMode =
|
|
47
|
+
(customizationService.getCustomization('studyBrowser.studyMode') as string) || 'all';
|
|
48
|
+
|
|
49
|
+
const internalImageViewer = useImageViewer();
|
|
50
|
+
const StudyInstanceUIDs = internalImageViewer.StudyInstanceUIDs;
|
|
51
|
+
const fetchedStudiesRef = useRef(new Set());
|
|
52
|
+
|
|
53
|
+
const [{ activeViewportId, viewports, isHangingProtocolLayout }] = useViewportGrid();
|
|
54
|
+
const [activeTabName, setActiveTabName] = useState(studyMode);
|
|
55
|
+
const [expandedStudyInstanceUIDs, setExpandedStudyInstanceUIDs] = useState(
|
|
56
|
+
studyMode === 'primary' && StudyInstanceUIDs.length > 0
|
|
57
|
+
? [StudyInstanceUIDs[0]]
|
|
58
|
+
: [...StudyInstanceUIDs]
|
|
59
|
+
);
|
|
60
|
+
const [hasLoadedViewports, setHasLoadedViewports] = useState(false);
|
|
61
|
+
const [studyDisplayList, setStudyDisplayList] = useState([]);
|
|
62
|
+
const [displaySets, setDisplaySets] = useState([]);
|
|
63
|
+
const [displaySetsLoadingState, setDisplaySetsLoadingState] = useState({});
|
|
64
|
+
const [thumbnailImageSrcMap, setThumbnailImageSrcMap] = useState({});
|
|
65
|
+
const [jumpToDisplaySet, setJumpToDisplaySet] = useState(null);
|
|
66
|
+
|
|
67
|
+
const [viewPresets, setViewPresets] = useState(
|
|
68
|
+
customizationService.getCustomization('studyBrowser.viewPresets')
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const [actionIcons, setActionIcons] = useState(defaultActionIcons);
|
|
72
|
+
|
|
73
|
+
// multiple can be true or false
|
|
74
|
+
const updateActionIconValue = actionIcon => {
|
|
75
|
+
actionIcon.value = !actionIcon.value;
|
|
76
|
+
const newActionIcons = [...actionIcons];
|
|
77
|
+
setActionIcons(newActionIcons);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// only one is true at a time
|
|
81
|
+
const updateViewPresetValue = viewPreset => {
|
|
82
|
+
if (!viewPreset) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const newViewPresets = viewPresets.map(preset => {
|
|
86
|
+
preset.selected = preset.id === viewPreset.id;
|
|
87
|
+
return preset;
|
|
88
|
+
});
|
|
89
|
+
setViewPresets(newViewPresets);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const mapDisplaySets = customMapDisplaySets || _mapDisplaySets;
|
|
93
|
+
|
|
94
|
+
// The detail line of each thumbnail is customizable, and is added to whatever
|
|
95
|
+
// the mapping produced so that a panel supplying its own mapping - the
|
|
96
|
+
// measurement tracking one does - gets it too.
|
|
97
|
+
const mapDisplaySetsWithState = useCallback(
|
|
98
|
+
(displaySetsToMap, ...args) => {
|
|
99
|
+
const mapped = mapDisplaySets(displaySetsToMap, ...args);
|
|
100
|
+
const items = customizationService.getCustomization('studyBrowser.thumbnailDetails');
|
|
101
|
+
const sources = customizationService.getCustomization('studyBrowser.thumbnailDetailSources');
|
|
102
|
+
const tests = customizationService.getCustomization('studyBrowser.thumbnailDetailTests');
|
|
103
|
+
|
|
104
|
+
return mapped.map(thumbnail => {
|
|
105
|
+
const displaySet = displaySetService.getDisplaySetByUID(thumbnail.displaySetInstanceUID);
|
|
106
|
+
if (!displaySet) {
|
|
107
|
+
// Leave `details` unset so the thumbnail keeps showing the series
|
|
108
|
+
// number and instance count it was given.
|
|
109
|
+
return thumbnail;
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
...thumbnail,
|
|
113
|
+
details: resolveThumbnailDetails({
|
|
114
|
+
items,
|
|
115
|
+
displaySet,
|
|
116
|
+
sources,
|
|
117
|
+
tests,
|
|
118
|
+
formatters: { formatDate, formatTime },
|
|
119
|
+
}),
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
[mapDisplaySets, customizationService, displaySetService]
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const onDoubleClickThumbnailHandler = useCallback(
|
|
127
|
+
async displaySetInstanceUID => {
|
|
128
|
+
const customHandler = customizationService.getCustomization(
|
|
129
|
+
'studyBrowser.thumbnailDoubleClickCallback'
|
|
130
|
+
) as CallbackCustomization;
|
|
131
|
+
|
|
132
|
+
const setupArgs = {
|
|
133
|
+
activeViewportId,
|
|
134
|
+
commandsManager,
|
|
135
|
+
servicesManager,
|
|
136
|
+
isHangingProtocolLayout,
|
|
137
|
+
appConfig: extensionManager.appConfig,
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const handlers = customHandler?.callbacks.map(callback => callback(setupArgs));
|
|
141
|
+
|
|
142
|
+
for (const handler of handlers) {
|
|
143
|
+
await handler(displaySetInstanceUID);
|
|
144
|
+
}
|
|
145
|
+
onDoubleClickThumbnailHandlerCallBack?.(displaySetInstanceUID);
|
|
146
|
+
},
|
|
147
|
+
[
|
|
148
|
+
activeViewportId,
|
|
149
|
+
commandsManager,
|
|
150
|
+
servicesManager,
|
|
151
|
+
isHangingProtocolLayout,
|
|
152
|
+
customizationService,
|
|
153
|
+
extensionManager.appConfig,
|
|
154
|
+
onDoubleClickThumbnailHandlerCallBack,
|
|
155
|
+
]
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
// ~~ studyDisplayList
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
// Fetch all studies for the patient in each primary study
|
|
161
|
+
async function fetchStudiesForPatient(StudyInstanceUID) {
|
|
162
|
+
// Skip fetching if we've already fetched this study
|
|
163
|
+
if (fetchedStudiesRef.current.has(StudyInstanceUID)) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
fetchedStudiesRef.current.add(StudyInstanceUID);
|
|
168
|
+
|
|
169
|
+
// current study qido
|
|
170
|
+
const qidoForStudyUID = await dataSource.query.studies.search({
|
|
171
|
+
studyInstanceUid: StudyInstanceUID,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
let qidoStudiesForPatient = qidoForStudyUID;
|
|
175
|
+
|
|
176
|
+
// try to fetch the prior studies based on the patientID if the
|
|
177
|
+
// server can respond.
|
|
178
|
+
try {
|
|
179
|
+
qidoStudiesForPatient = await getStudiesForPatientByMRN(qidoForStudyUID);
|
|
180
|
+
} catch (error) {
|
|
181
|
+
console.warn(error);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const mappedStudies = _mapDataSourceStudies(qidoStudiesForPatient);
|
|
185
|
+
const actuallyMappedStudies = mappedStudies.map(qidoStudy => {
|
|
186
|
+
return {
|
|
187
|
+
studyInstanceUid: qidoStudy.StudyInstanceUID,
|
|
188
|
+
date: formatDate(qidoStudy.StudyDate) || '',
|
|
189
|
+
description: qidoStudy.StudyDescription,
|
|
190
|
+
modalities: qidoStudy.ModalitiesInStudy,
|
|
191
|
+
numInstances: Number(qidoStudy.NumInstances),
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
setStudyDisplayList(prevArray => {
|
|
196
|
+
const ret = [...prevArray];
|
|
197
|
+
for (const study of actuallyMappedStudies) {
|
|
198
|
+
if (!prevArray.find(it => it.studyInstanceUid === study.studyInstanceUid)) {
|
|
199
|
+
ret.push(study);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return ret;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
StudyInstanceUIDs.forEach(sid => fetchStudiesForPatient(sid));
|
|
207
|
+
}, [StudyInstanceUIDs, dataSource, getStudiesForPatientByMRN, navigate]);
|
|
208
|
+
|
|
209
|
+
// ~~ Initial Thumbnails
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
if (!hasLoadedViewports) {
|
|
212
|
+
if (activeViewportId) {
|
|
213
|
+
// Once there is an active viewport id, it means the layout is ready
|
|
214
|
+
// so wait a bit of time to allow the viewports preferential loading
|
|
215
|
+
// which improves user experience of responsiveness significantly on slower
|
|
216
|
+
// systems.
|
|
217
|
+
const delayMs = 250 + displaySetService.getActiveDisplaySets().length * 10;
|
|
218
|
+
window.setTimeout(() => setHasLoadedViewports(true), delayMs);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
let currentDisplaySets = displaySetService.activeDisplaySets;
|
|
225
|
+
// filter non based on the list of modalities that are supported by cornerstone
|
|
226
|
+
currentDisplaySets = currentDisplaySets.filter(
|
|
227
|
+
ds => !thumbnailNoImageModalities.includes(ds.Modality) || ds.thumbnailSrc === null
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
if (!currentDisplaySets.length) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
currentDisplaySets.forEach(async dSet => {
|
|
235
|
+
const newImageSrcEntry = {};
|
|
236
|
+
const displaySet = displaySetService.getDisplaySetByUID(dSet.displaySetInstanceUID);
|
|
237
|
+
const imageIds = dataSource.getImageIdsForDisplaySet(dSet);
|
|
238
|
+
|
|
239
|
+
const imageId = getImageIdForThumbnail(displaySet, imageIds);
|
|
240
|
+
|
|
241
|
+
// TODO: Is it okay that imageIds are not returned here for SR displaySets?
|
|
242
|
+
if (displaySet?.unsupported) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
// When the image arrives, render it and store the result in the thumbnailImgSrcMap
|
|
246
|
+
let { thumbnailSrc } = displaySet;
|
|
247
|
+
if (!thumbnailSrc && displaySet.getThumbnailSrc) {
|
|
248
|
+
thumbnailSrc = await displaySet.getThumbnailSrc({ getImageSrc });
|
|
249
|
+
}
|
|
250
|
+
if (!thumbnailSrc && imageId) {
|
|
251
|
+
const thumbnailSrc = await getImageSrc(imageId);
|
|
252
|
+
displaySet.thumbnailSrc = thumbnailSrc;
|
|
253
|
+
}
|
|
254
|
+
newImageSrcEntry[dSet.displaySetInstanceUID] = thumbnailSrc;
|
|
255
|
+
|
|
256
|
+
setThumbnailImageSrcMap(prevState => {
|
|
257
|
+
return { ...prevState, ...newImageSrcEntry };
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
}, [displaySetService, dataSource, getImageSrc, activeViewportId, hasLoadedViewports]);
|
|
261
|
+
|
|
262
|
+
// ~~ displaySets
|
|
263
|
+
useEffect(() => {
|
|
264
|
+
const currentDisplaySets = displaySetService.activeDisplaySets;
|
|
265
|
+
|
|
266
|
+
if (!currentDisplaySets.length) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const mappedDisplaySets = mapDisplaySetsWithState(
|
|
271
|
+
currentDisplaySets,
|
|
272
|
+
displaySetsLoadingState,
|
|
273
|
+
thumbnailImageSrcMap,
|
|
274
|
+
viewports
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
if (!customMapDisplaySets) {
|
|
278
|
+
sortStudyInstances(mappedDisplaySets);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
setDisplaySets(mappedDisplaySets);
|
|
282
|
+
}, [
|
|
283
|
+
displaySetService.activeDisplaySets,
|
|
284
|
+
displaySetsLoadingState,
|
|
285
|
+
viewports,
|
|
286
|
+
thumbnailImageSrcMap,
|
|
287
|
+
customMapDisplaySets,
|
|
288
|
+
mapDisplaySetsWithState,
|
|
289
|
+
]);
|
|
290
|
+
|
|
291
|
+
// ~~ subscriptions --> displaySets
|
|
292
|
+
useEffect(() => {
|
|
293
|
+
// DISPLAY_SETS_ADDED returns an array of DisplaySets that were added
|
|
294
|
+
const SubscriptionDisplaySetsAdded = displaySetService.subscribe(
|
|
295
|
+
displaySetService.EVENTS.DISPLAY_SETS_ADDED,
|
|
296
|
+
data => {
|
|
297
|
+
if (!hasLoadedViewports) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const { displaySetsAdded, options } = data;
|
|
301
|
+
displaySetsAdded.forEach(async dSet => {
|
|
302
|
+
const displaySetInstanceUID = dSet.displaySetInstanceUID;
|
|
303
|
+
const newImageSrcEntry = {};
|
|
304
|
+
const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);
|
|
305
|
+
if (displaySet?.unsupported) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
if (options?.madeInClient) {
|
|
309
|
+
setJumpToDisplaySet(displaySetInstanceUID);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const imageIds = dataSource.getImageIdsForDisplaySet(displaySet);
|
|
313
|
+
const imageId = getImageIdForThumbnail(displaySet, imageIds);
|
|
314
|
+
|
|
315
|
+
// TODO: Is it okay that imageIds are not returned here for SR displaysets?
|
|
316
|
+
if (!imageId) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// When the image arrives, render it and store the result in the thumbnailImgSrcMap
|
|
321
|
+
let { thumbnailSrc } = displaySet;
|
|
322
|
+
if (!thumbnailSrc && displaySet.getThumbnailSrc) {
|
|
323
|
+
thumbnailSrc = await displaySet.getThumbnailSrc({ getImageSrc });
|
|
324
|
+
}
|
|
325
|
+
if (!thumbnailSrc) {
|
|
326
|
+
thumbnailSrc = await getImageSrc(imageId);
|
|
327
|
+
displaySet.thumbnailSrc = thumbnailSrc;
|
|
328
|
+
}
|
|
329
|
+
newImageSrcEntry[displaySetInstanceUID] = thumbnailSrc;
|
|
330
|
+
|
|
331
|
+
setThumbnailImageSrcMap(prevState => {
|
|
332
|
+
return { ...prevState, ...newImageSrcEntry };
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
return () => {
|
|
339
|
+
SubscriptionDisplaySetsAdded.unsubscribe();
|
|
340
|
+
};
|
|
341
|
+
}, [displaySetService, dataSource, getImageSrc, hasLoadedViewports]);
|
|
342
|
+
|
|
343
|
+
useEffect(() => {
|
|
344
|
+
// TODO: Will this always hold _all_ the displaySets we care about?
|
|
345
|
+
// DISPLAY_SETS_CHANGED returns `DisplaySerService.activeDisplaySets`
|
|
346
|
+
const SubscriptionDisplaySetsChanged = displaySetService.subscribe(
|
|
347
|
+
displaySetService.EVENTS.DISPLAY_SETS_CHANGED,
|
|
348
|
+
changedDisplaySets => {
|
|
349
|
+
const mappedDisplaySets = mapDisplaySetsWithState(
|
|
350
|
+
changedDisplaySets,
|
|
351
|
+
displaySetsLoadingState,
|
|
352
|
+
thumbnailImageSrcMap,
|
|
353
|
+
viewports
|
|
354
|
+
);
|
|
355
|
+
|
|
356
|
+
if (!customMapDisplaySets) {
|
|
357
|
+
sortStudyInstances(mappedDisplaySets);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
setDisplaySets(mappedDisplaySets);
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
|
|
364
|
+
const SubscriptionDisplaySetMetaDataInvalidated = displaySetService.subscribe(
|
|
365
|
+
displaySetService.EVENTS.DISPLAY_SET_SERIES_METADATA_INVALIDATED,
|
|
366
|
+
() => {
|
|
367
|
+
const mappedDisplaySets = mapDisplaySetsWithState(
|
|
368
|
+
displaySetService.getActiveDisplaySets(),
|
|
369
|
+
displaySetsLoadingState,
|
|
370
|
+
thumbnailImageSrcMap,
|
|
371
|
+
viewports
|
|
372
|
+
);
|
|
373
|
+
|
|
374
|
+
if (!customMapDisplaySets) {
|
|
375
|
+
sortStudyInstances(mappedDisplaySets);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
setDisplaySets(mappedDisplaySets);
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
return () => {
|
|
383
|
+
SubscriptionDisplaySetsChanged.unsubscribe();
|
|
384
|
+
SubscriptionDisplaySetMetaDataInvalidated.unsubscribe();
|
|
385
|
+
};
|
|
386
|
+
}, [
|
|
387
|
+
displaySetsLoadingState,
|
|
388
|
+
thumbnailImageSrcMap,
|
|
389
|
+
viewports,
|
|
390
|
+
displaySetService,
|
|
391
|
+
customMapDisplaySets,
|
|
392
|
+
mapDisplaySetsWithState,
|
|
393
|
+
]);
|
|
394
|
+
|
|
395
|
+
const tabs = createStudyBrowserTabs(
|
|
396
|
+
StudyInstanceUIDs,
|
|
397
|
+
studyDisplayList,
|
|
398
|
+
displaySets,
|
|
399
|
+
undefined,
|
|
400
|
+
displaySetService
|
|
401
|
+
);
|
|
402
|
+
|
|
403
|
+
// TODO: Should not fire this on "close"
|
|
404
|
+
function _handleStudyClick(StudyInstanceUID) {
|
|
405
|
+
const shouldCollapseStudy = expandedStudyInstanceUIDs.includes(StudyInstanceUID);
|
|
406
|
+
const updatedExpandedStudyInstanceUIDs = shouldCollapseStudy
|
|
407
|
+
? [...expandedStudyInstanceUIDs.filter(stdyUid => stdyUid !== StudyInstanceUID)]
|
|
408
|
+
: [...expandedStudyInstanceUIDs, StudyInstanceUID];
|
|
409
|
+
|
|
410
|
+
setExpandedStudyInstanceUIDs(updatedExpandedStudyInstanceUIDs);
|
|
411
|
+
|
|
412
|
+
if (!shouldCollapseStudy) {
|
|
413
|
+
const madeInClient = true;
|
|
414
|
+
requestDisplaySetCreationForStudy(displaySetService, StudyInstanceUID, madeInClient);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
useEffect(() => {
|
|
419
|
+
if (jumpToDisplaySet) {
|
|
420
|
+
// Get element by displaySetInstanceUID
|
|
421
|
+
const displaySetInstanceUID = jumpToDisplaySet;
|
|
422
|
+
const element = document.getElementById(`thumbnail-${displaySetInstanceUID}`);
|
|
423
|
+
|
|
424
|
+
if (element && typeof element.scrollIntoView === 'function') {
|
|
425
|
+
// TODO: Any way to support IE here?
|
|
426
|
+
element.scrollIntoView({ behavior: 'smooth' });
|
|
427
|
+
|
|
428
|
+
setJumpToDisplaySet(null);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}, [jumpToDisplaySet, expandedStudyInstanceUIDs, activeTabName]);
|
|
432
|
+
|
|
433
|
+
useEffect(() => {
|
|
434
|
+
if (!jumpToDisplaySet) {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
const displaySetInstanceUID = jumpToDisplaySet;
|
|
439
|
+
// It is possible to navigate to a study not currently in view
|
|
440
|
+
const thumbnailLocation = _findTabAndStudyOfDisplaySet(
|
|
441
|
+
displaySetInstanceUID,
|
|
442
|
+
tabs,
|
|
443
|
+
activeTabName
|
|
444
|
+
);
|
|
445
|
+
if (!thumbnailLocation) {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
const { tabName, StudyInstanceUID } = thumbnailLocation;
|
|
449
|
+
setActiveTabName(tabName);
|
|
450
|
+
const studyExpanded = expandedStudyInstanceUIDs.includes(StudyInstanceUID);
|
|
451
|
+
if (!studyExpanded) {
|
|
452
|
+
const updatedExpandedStudyInstanceUIDs = [...expandedStudyInstanceUIDs, StudyInstanceUID];
|
|
453
|
+
setExpandedStudyInstanceUIDs(updatedExpandedStudyInstanceUIDs);
|
|
454
|
+
}
|
|
455
|
+
}, [expandedStudyInstanceUIDs, jumpToDisplaySet, tabs]);
|
|
456
|
+
|
|
457
|
+
const activeDisplaySetInstanceUIDs = viewports.get(activeViewportId)?.displaySetInstanceUIDs;
|
|
458
|
+
|
|
459
|
+
return (
|
|
460
|
+
<>
|
|
461
|
+
<>
|
|
462
|
+
<PanelStudyBrowserHeader
|
|
463
|
+
viewPresets={viewPresets}
|
|
464
|
+
updateViewPresetValue={updateViewPresetValue}
|
|
465
|
+
actionIcons={actionIcons}
|
|
466
|
+
updateActionIconValue={updateActionIconValue}
|
|
467
|
+
/>
|
|
468
|
+
<Separator
|
|
469
|
+
orientation="horizontal"
|
|
470
|
+
className="bg-background"
|
|
471
|
+
thickness="2px"
|
|
472
|
+
/>
|
|
473
|
+
</>
|
|
474
|
+
|
|
475
|
+
<StudyBrowser
|
|
476
|
+
tabs={tabs}
|
|
477
|
+
servicesManager={servicesManager}
|
|
478
|
+
activeTabName={activeTabName}
|
|
479
|
+
expandedStudyInstanceUIDs={expandedStudyInstanceUIDs}
|
|
480
|
+
onClickStudy={_handleStudyClick}
|
|
481
|
+
onClickTab={clickedTabName => {
|
|
482
|
+
setActiveTabName(clickedTabName);
|
|
483
|
+
}}
|
|
484
|
+
onClickUntrack={onClickUntrack}
|
|
485
|
+
onClickThumbnail={() => {}}
|
|
486
|
+
onDoubleClickThumbnail={onDoubleClickThumbnailHandler}
|
|
487
|
+
activeDisplaySetInstanceUIDs={activeDisplaySetInstanceUIDs}
|
|
488
|
+
showSettings={actionIcons.find(icon => icon.id === 'settings')?.value}
|
|
489
|
+
viewPresets={viewPresets}
|
|
490
|
+
ThumbnailMenuItems={MoreDropdownMenu({
|
|
491
|
+
commandsManager,
|
|
492
|
+
servicesManager,
|
|
493
|
+
menuItemsKey: 'studyBrowser.thumbnailMenuItems',
|
|
494
|
+
})}
|
|
495
|
+
StudyMenuItems={MoreDropdownMenu({
|
|
496
|
+
commandsManager,
|
|
497
|
+
servicesManager,
|
|
498
|
+
menuItemsKey: 'studyBrowser.studyMenuItems',
|
|
499
|
+
})}
|
|
500
|
+
/>
|
|
501
|
+
</>
|
|
502
|
+
);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
export default PanelStudyBrowser;
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Maps from the DataSource's format to a naturalized object
|
|
509
|
+
*
|
|
510
|
+
* @param {*} studies
|
|
511
|
+
*/
|
|
512
|
+
function _mapDataSourceStudies(studies) {
|
|
513
|
+
return studies.map(study => {
|
|
514
|
+
// TODO: Why does the data source return in this format?
|
|
515
|
+
return {
|
|
516
|
+
AccessionNumber: study.accession,
|
|
517
|
+
StudyDate: study.date,
|
|
518
|
+
StudyDescription: study.description,
|
|
519
|
+
NumInstances: study.instances,
|
|
520
|
+
ModalitiesInStudy: study.modalities,
|
|
521
|
+
PatientID: study.mrn,
|
|
522
|
+
PatientName: study.patientName,
|
|
523
|
+
StudyInstanceUID: study.studyInstanceUid,
|
|
524
|
+
StudyTime: study.time,
|
|
525
|
+
};
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
function _mapDisplaySets(displaySets, displaySetLoadingState, thumbnailImageSrcMap, viewports) {
|
|
530
|
+
const thumbnailDisplaySets = [];
|
|
531
|
+
const thumbnailNoImageDisplaySets = [];
|
|
532
|
+
displaySets
|
|
533
|
+
.filter(ds => !ds.excludeFromThumbnailBrowser)
|
|
534
|
+
.forEach(ds => {
|
|
535
|
+
const { thumbnailSrc, displaySetInstanceUID } = ds;
|
|
536
|
+
const componentType = _getComponentType(ds);
|
|
537
|
+
|
|
538
|
+
const array =
|
|
539
|
+
componentType === 'thumbnail' ? thumbnailDisplaySets : thumbnailNoImageDisplaySets;
|
|
540
|
+
|
|
541
|
+
const loadingProgress = displaySetLoadingState?.[displaySetInstanceUID];
|
|
542
|
+
|
|
543
|
+
array.push({
|
|
544
|
+
displaySetInstanceUID,
|
|
545
|
+
description: ds.SeriesDescription || '',
|
|
546
|
+
seriesNumber: ds.SeriesNumber,
|
|
547
|
+
modality: ds.Modality,
|
|
548
|
+
seriesDate: formatDate(ds.SeriesDate),
|
|
549
|
+
numInstances: ds.numImageFrames ?? ds.instances?.length,
|
|
550
|
+
loadingProgress,
|
|
551
|
+
countIcon: ds.countIcon,
|
|
552
|
+
messages: ds.messages,
|
|
553
|
+
StudyInstanceUID: ds.StudyInstanceUID,
|
|
554
|
+
componentType,
|
|
555
|
+
imageSrc: thumbnailSrc || thumbnailImageSrcMap[displaySetInstanceUID],
|
|
556
|
+
dragData: {
|
|
557
|
+
type: 'displayset',
|
|
558
|
+
displaySetInstanceUID,
|
|
559
|
+
// .. Any other data to pass
|
|
560
|
+
},
|
|
561
|
+
isHydratedForDerivedDisplaySet: ds.isHydrated,
|
|
562
|
+
});
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
return [...thumbnailDisplaySets, ...thumbnailNoImageDisplaySets];
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
function _getComponentType(ds) {
|
|
569
|
+
if (
|
|
570
|
+
thumbnailNoImageModalities.includes(ds.Modality) ||
|
|
571
|
+
ds?.unsupported ||
|
|
572
|
+
ds.thumbnailSrc === null
|
|
573
|
+
) {
|
|
574
|
+
return 'thumbnailNoImage';
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
return 'thumbnail';
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
function getImageIdForThumbnail(displaySet, imageIds) {
|
|
581
|
+
let imageId;
|
|
582
|
+
if (displaySet.isDynamicVolume) {
|
|
583
|
+
const timePoints = displaySet.dynamicVolumeInfo.timePoints;
|
|
584
|
+
const middleIndex = Math.floor(timePoints.length / 2);
|
|
585
|
+
const middleTimePointImageIds = timePoints[middleIndex];
|
|
586
|
+
imageId = middleTimePointImageIds[Math.floor(middleTimePointImageIds.length / 2)];
|
|
587
|
+
} else {
|
|
588
|
+
imageId = imageIds[Math.floor(imageIds.length / 2)];
|
|
589
|
+
}
|
|
590
|
+
return imageId;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
function _findTabAndStudyOfDisplaySet(
|
|
594
|
+
displaySetInstanceUID: string,
|
|
595
|
+
tabs: TabsProps,
|
|
596
|
+
currentTabName: string
|
|
597
|
+
) {
|
|
598
|
+
const current = tabs.find(tab => tab.name === currentTabName) || tabs[0];
|
|
599
|
+
const biasedTabs = [current, ...tabs];
|
|
600
|
+
|
|
601
|
+
for (let t = 0; t < biasedTabs.length; t++) {
|
|
602
|
+
const study = biasedTabs[t].studies.find(study =>
|
|
603
|
+
study.displaySets.find(ds => ds.displaySetInstanceUID === displaySetInstanceUID)
|
|
604
|
+
);
|
|
605
|
+
if (study) {
|
|
606
|
+
return {
|
|
607
|
+
tabName: biasedTabs[t].name,
|
|
608
|
+
StudyInstanceUID: study.studyInstanceUid,
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import {
|
|
4
|
+
ToggleGroup,
|
|
5
|
+
ToggleGroupItem,
|
|
6
|
+
Tooltip,
|
|
7
|
+
TooltipContent,
|
|
8
|
+
TooltipTrigger,
|
|
9
|
+
} from '@ohif/ui-next';
|
|
10
|
+
import { Icons } from '@ohif/ui-next';
|
|
11
|
+
import { actionIcon, viewPreset } from './types';
|
|
12
|
+
|
|
13
|
+
function PanelStudyBrowserHeader({
|
|
14
|
+
viewPresets,
|
|
15
|
+
updateViewPresetValue,
|
|
16
|
+
actionIcons,
|
|
17
|
+
updateActionIconValue,
|
|
18
|
+
}: {
|
|
19
|
+
viewPresets: viewPreset[];
|
|
20
|
+
updateViewPresetValue: (viewPreset: viewPreset) => void;
|
|
21
|
+
actionIcons: actionIcon[];
|
|
22
|
+
updateActionIconValue: (actionIcon: actionIcon) => void;
|
|
23
|
+
}) {
|
|
24
|
+
const { t } = useTranslation('StudyBrowser');
|
|
25
|
+
|
|
26
|
+
// Button order: Settings button then List view mode (thumbnails vs. list)
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
<div className="bg-muted flex h-[40px] select-none rounded-t p-2">
|
|
30
|
+
<div className={'flex h-[24px] w-full select-none justify-center self-center text-[14px]'}>
|
|
31
|
+
<div className="flex w-full items-center gap-[10px]">
|
|
32
|
+
<div className="flex items-center justify-center">
|
|
33
|
+
<div className="text-primary flex items-center space-x-1">
|
|
34
|
+
{actionIcons.map((icon: actionIcon, index) => {
|
|
35
|
+
const iconElement = React.createElement(
|
|
36
|
+
Icons[icon.iconName] || Icons.MissingIcon,
|
|
37
|
+
{
|
|
38
|
+
key: index,
|
|
39
|
+
onClick: () => updateActionIconValue(icon),
|
|
40
|
+
className: `cursor-pointer`,
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
if (!icon.label) {
|
|
44
|
+
return iconElement;
|
|
45
|
+
}
|
|
46
|
+
return (
|
|
47
|
+
<Tooltip key={index}>
|
|
48
|
+
<TooltipTrigger
|
|
49
|
+
asChild
|
|
50
|
+
aria-label={t(icon.label)}
|
|
51
|
+
>
|
|
52
|
+
<span className="flex">{iconElement}</span>
|
|
53
|
+
</TooltipTrigger>
|
|
54
|
+
<TooltipContent>{t(icon.label)}</TooltipContent>
|
|
55
|
+
</Tooltip>
|
|
56
|
+
);
|
|
57
|
+
})}
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
<div className="ml-auto flex h-full items-center justify-center">
|
|
61
|
+
<ToggleGroup
|
|
62
|
+
type="single"
|
|
63
|
+
value={viewPresets.filter(preset => preset.selected)[0].id}
|
|
64
|
+
onValueChange={value => {
|
|
65
|
+
const selectedViewPreset = viewPresets.find(preset => preset.id === value);
|
|
66
|
+
updateViewPresetValue(selectedViewPreset);
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
{viewPresets.map((viewPreset: viewPreset, index) => (
|
|
70
|
+
<ToggleGroupItem
|
|
71
|
+
key={index}
|
|
72
|
+
aria-label={viewPreset.id}
|
|
73
|
+
value={viewPreset.id}
|
|
74
|
+
className="text-primary"
|
|
75
|
+
>
|
|
76
|
+
{React.createElement(Icons[viewPreset.iconName] || Icons.MissingIcon)}
|
|
77
|
+
</ToggleGroupItem>
|
|
78
|
+
))}
|
|
79
|
+
</ToggleGroup>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { PanelStudyBrowserHeader };
|