@ohif/extension-default 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.
Files changed (216) hide show
  1. package/dist/ohif-extension-default.css +1 -1
  2. package/dist/ohif-extension-default.umd.js +1 -1
  3. package/package.json +14 -10
  4. package/src/Actions/createReportAsync.tsx +45 -0
  5. package/src/Components/DataSourceConfigurationComponent.tsx +142 -0
  6. package/src/Components/DataSourceConfigurationModalComponent.tsx +200 -0
  7. package/src/Components/ItemListComponent.tsx +95 -0
  8. package/src/Components/LineChartViewport/LineChartViewport.tsx +31 -0
  9. package/src/Components/LineChartViewport/index.ts +1 -0
  10. package/src/Components/MoreDropdownMenu.tsx +112 -0
  11. package/src/Components/ProgressDropdownWithService.tsx +101 -0
  12. package/src/Components/SidePanelWithServices.tsx +122 -0
  13. package/src/CustomizableContextMenu/ContextMenuController.tsx +216 -0
  14. package/src/CustomizableContextMenu/ContextMenuItemsBuilder.test.js +29 -0
  15. package/src/CustomizableContextMenu/ContextMenuItemsBuilder.ts +176 -0
  16. package/src/CustomizableContextMenu/index.ts +5 -0
  17. package/src/CustomizableContextMenu/types.ts +126 -0
  18. package/src/DataSourceConfigurationAPI/GoogleCloudDataSourceConfigurationAPI.ts +236 -0
  19. package/src/DicomJSONDataSource/index.js +326 -0
  20. package/src/DicomLocalDataSource/index.js +273 -0
  21. package/src/DicomTagBrowser/DicomTagBrowser.css +49 -0
  22. package/src/DicomTagBrowser/DicomTagBrowser.tsx +454 -0
  23. package/src/DicomTagBrowser/DicomTagTable.tsx +311 -0
  24. package/src/DicomWebDataSource/dcm4cheeReject.js +45 -0
  25. package/src/DicomWebDataSource/exampleInstances.js +280 -0
  26. package/src/DicomWebDataSource/index.ts +808 -0
  27. package/src/DicomWebDataSource/qido.js +215 -0
  28. package/src/DicomWebDataSource/retrieveBulkData.test.ts +35 -0
  29. package/src/DicomWebDataSource/retrieveBulkData.ts +31 -0
  30. package/src/DicomWebDataSource/retrieveRendered.test.ts +147 -0
  31. package/src/DicomWebDataSource/retrieveRendered.ts +141 -0
  32. package/src/DicomWebDataSource/retrieveStudyMetadata.js +108 -0
  33. package/src/DicomWebDataSource/retrieveStudyMetadata.test.js +75 -0
  34. package/src/DicomWebDataSource/retrieveThumbnail.ts +346 -0
  35. package/src/DicomWebDataSource/serviceUrls.test.ts +143 -0
  36. package/src/DicomWebDataSource/utils/StaticWadoClient.ts +272 -0
  37. package/src/DicomWebDataSource/utils/cleanDenaturalizedDataset.ts +78 -0
  38. package/src/DicomWebDataSource/utils/findIndexOfString.ts +47 -0
  39. package/src/DicomWebDataSource/utils/fixBulkDataURI.test.ts +68 -0
  40. package/src/DicomWebDataSource/utils/fixBulkDataURI.ts +78 -0
  41. package/src/DicomWebDataSource/utils/fixMultiValueKeys.ts +12 -0
  42. package/src/DicomWebDataSource/utils/fixMultipart.ts +70 -0
  43. package/src/DicomWebDataSource/utils/getImageId.js +54 -0
  44. package/src/DicomWebDataSource/utils/getWADORSImageId.js +51 -0
  45. package/src/DicomWebDataSource/utils/index.ts +9 -0
  46. package/src/DicomWebDataSource/utils/retrieveMetadataFiltered.js +61 -0
  47. package/src/DicomWebDataSource/wado/retrieveMetadata.js +41 -0
  48. package/src/DicomWebDataSource/wado/retrieveMetadataLoader.js +64 -0
  49. package/src/DicomWebDataSource/wado/retrieveMetadataLoaderAsync.js +159 -0
  50. package/src/DicomWebDataSource/wado/retrieveMetadataLoaderSync.js +58 -0
  51. package/src/DicomWebProxyDataSource/index.ts +90 -0
  52. package/src/MergeDataSource/index.test.ts +212 -0
  53. package/src/MergeDataSource/index.ts +319 -0
  54. package/src/MergeDataSource/types.ts +46 -0
  55. package/src/Panels/DataSourceSelector.tsx +55 -0
  56. package/src/Panels/StudyBrowser/PanelStudyBrowser.tsx +612 -0
  57. package/src/Panels/StudyBrowser/PanelStudyBrowserHeader.tsx +88 -0
  58. package/src/Panels/StudyBrowser/constants/actionIcons.ts +12 -0
  59. package/src/Panels/StudyBrowser/constants/index.ts +4 -0
  60. package/src/Panels/StudyBrowser/constants/viewPresets.ts +16 -0
  61. package/src/Panels/StudyBrowser/resolveThumbnailDetails.test.ts +197 -0
  62. package/src/Panels/StudyBrowser/resolveThumbnailDetails.ts +132 -0
  63. package/src/Panels/StudyBrowser/types/actionIcon.ts +9 -0
  64. package/src/Panels/StudyBrowser/types/index.ts +4 -0
  65. package/src/Panels/StudyBrowser/types/viewPreset.ts +7 -0
  66. package/src/Panels/WrappedPanelStudyBrowser.tsx +61 -0
  67. package/src/Panels/createReportDialogPrompt.tsx +128 -0
  68. package/src/Panels/debounce.js +25 -0
  69. package/src/Panels/getImageSrcFromImageId.js +16 -0
  70. package/src/Panels/getStudiesForPatientByMRN.js +19 -0
  71. package/src/Panels/index.js +5 -0
  72. package/src/Panels/requestDisplaySetCreationForStudy.js +19 -0
  73. package/src/SOPClassHandlers/chartSOPClassHandler.test.ts +81 -0
  74. package/src/SOPClassHandlers/chartSOPClassHandler.ts +127 -0
  75. package/src/Toolbar/ToolBoxWrapper.tsx +64 -0
  76. package/src/Toolbar/ToolButtonListWrapper.tsx +77 -0
  77. package/src/Toolbar/ToolButtonWrapper.tsx +32 -0
  78. package/src/Toolbar/ToolRowWrapper.tsx +41 -0
  79. package/src/Toolbar/Toolbar.tsx +98 -0
  80. package/src/Toolbar/ToolbarDivider.tsx +5 -0
  81. package/src/Toolbar/ToolbarLayoutSelector.tsx +195 -0
  82. package/src/Toolbar/index.ts +7 -0
  83. package/src/ViewerLayout/HeaderPatientInfo/HeaderPatientInfo.tsx +96 -0
  84. package/src/ViewerLayout/HeaderPatientInfo/index.js +3 -0
  85. package/src/ViewerLayout/HeaderUndoRedo.tsx +47 -0
  86. package/src/ViewerLayout/ResizablePanelsHook.tsx +334 -0
  87. package/src/ViewerLayout/ViewerHeader.tsx +124 -0
  88. package/src/ViewerLayout/constants/panels.ts +42 -0
  89. package/src/ViewerLayout/index.tsx +227 -0
  90. package/src/ViewerLayout/useUndoRedoState.ts +75 -0
  91. package/src/__tests__/commandsModuleToggleOneUp.test.ts +147 -0
  92. package/src/commandsModule.ts +970 -0
  93. package/src/customizations/aboutModalCustomization.tsx +42 -0
  94. package/src/customizations/appearanceModalCustomization.tsx +143 -0
  95. package/src/customizations/contextMenuCustomization.ts +25 -0
  96. package/src/customizations/contextMenuUICustomization.ts +5 -0
  97. package/src/customizations/customRoutesCustomization.ts +6 -0
  98. package/src/customizations/dataSourceConfigurationCustomization.ts +19 -0
  99. package/src/customizations/datasourcesCustomization.tsx +14 -0
  100. package/src/customizations/defaultContextMenuCustomization.ts +22 -0
  101. package/src/customizations/hangingProtocolsCustomization.ts +15 -0
  102. package/src/customizations/headerRightSideCustomization.ts +19 -0
  103. package/src/customizations/helloPageCustomization.tsx +14 -0
  104. package/src/customizations/hideHeaderUndoRedoCustomization.ts +22 -0
  105. package/src/customizations/hotkeyBindingsCustomization.ts +5 -0
  106. package/src/customizations/instanceSortingCriteriaCustomization.ts +6 -0
  107. package/src/customizations/labellingFlowCustomization.tsx +5 -0
  108. package/src/customizations/loadingIndicatorProgressCustomization.tsx +5 -0
  109. package/src/customizations/loadingIndicatorTotalPercentCustomization.tsx +5 -0
  110. package/src/customizations/menuContentCustomization.tsx +67 -0
  111. package/src/customizations/metadataContextCustomization.test.ts +22 -0
  112. package/src/customizations/metadataContextCustomization.ts +28 -0
  113. package/src/customizations/metadataDisplaySetCustomization.ts +55 -0
  114. package/src/customizations/missingReferenceDisplaySetHandler.ts +5 -0
  115. package/src/customizations/multimonitorCustomization.ts +63 -0
  116. package/src/customizations/notificationCustomization.ts +29 -0
  117. package/src/customizations/onDropHandlerCustomization.ts +5 -0
  118. package/src/customizations/onboardingCustomization.ts +200 -0
  119. package/src/customizations/overlayItemCustomization.tsx +33 -0
  120. package/src/customizations/progressDropdownCustomization.ts +5 -0
  121. package/src/customizations/progressLoadingBarCustomization.tsx +5 -0
  122. package/src/customizations/reportDialogCustomization.test.ts +701 -0
  123. package/src/customizations/reportDialogCustomization.tsx +661 -0
  124. package/src/customizations/sortingCriteriaCustomization.ts +14 -0
  125. package/src/customizations/studyBrowserCustomization.test.ts +69 -0
  126. package/src/customizations/studyBrowserCustomization.ts +95 -0
  127. package/src/customizations/thumbnailDetailsCustomization.ts +91 -0
  128. package/src/customizations/userPreferencesCustomization.tsx +342 -0
  129. package/src/customizations/workListCustomization.ts +107 -0
  130. package/src/displaySetSplitting/makeDisplaySetFromInstanceGroup.test.ts +181 -0
  131. package/src/displaySetSplitting/makeDisplaySetFromInstanceGroup.ts +240 -0
  132. package/src/displaySetSplitting/makeImageSetDisplaySet.ts +276 -0
  133. package/src/displaySetSplitting/stackSopClassUids.ts +60 -0
  134. package/src/displaySetSplitting/urlSplitModules.test.ts +333 -0
  135. package/src/findViewportsByPosition.ts +102 -0
  136. package/src/getCustomizationModule.tsx +109 -0
  137. package/src/getDataSourcesModule.js +44 -0
  138. package/src/getDisplaySetMessages.ts +54 -0
  139. package/src/getDisplaySetsFromUnsupportedSeries.js +63 -0
  140. package/src/getDisplaySetsFromUnsupportedSeries.test.js +14 -0
  141. package/src/getHangingProtocolModule.js +155 -0
  142. package/src/getLayoutTemplateModule.js +28 -0
  143. package/src/getPTImageIdInstanceMetadata.test.ts +102 -0
  144. package/src/getPTImageIdInstanceMetadata.ts +124 -0
  145. package/src/getPanelModule.tsx +29 -0
  146. package/src/getSopClassHandlerModule.js +152 -0
  147. package/src/getSopClassHandlerModule.test.js +78 -0
  148. package/src/getToolbarModule.tsx +63 -0
  149. package/src/getViewportModule.tsx +12 -0
  150. package/src/hangingprotocols/hpCompare.ts +189 -0
  151. package/src/hangingprotocols/hpEcgCustomization.test.ts +104 -0
  152. package/src/hangingprotocols/hpMNGrid.test.ts +120 -0
  153. package/src/hangingprotocols/hpMNGrid.ts +419 -0
  154. package/src/hangingprotocols/hpMammo.ts +202 -0
  155. package/src/hangingprotocols/hpScale.ts +132 -0
  156. package/src/hangingprotocols/index.ts +16 -0
  157. package/src/hangingprotocols/protocolMatchChanges.test.ts +73 -0
  158. package/src/hangingprotocols/utils/isNewestOfModality.ts +19 -0
  159. package/src/hangingprotocols/utils/laterality.ts +9 -0
  160. package/src/hangingprotocols/utils/mammoDisplaySetSelector.ts +214 -0
  161. package/src/hangingprotocols/utils/registerHangingProtocolAttributes.ts +14 -0
  162. package/src/hangingprotocols/utils/seriesSelectors.ts +62 -0
  163. package/src/hangingprotocols/utils/studySelectors.ts +14 -0
  164. package/src/hangingprotocols/utils/viewCode.test.js +25 -0
  165. package/src/hangingprotocols/utils/viewCode.ts +17 -0
  166. package/src/hangingprotocols/utils/viewportOptions.ts +18 -0
  167. package/src/hooks/usePatientInfo.tsx +63 -0
  168. package/src/id.js +5 -0
  169. package/src/index.ts +113 -0
  170. package/src/init.ts +169 -0
  171. package/src/stores/index.ts +7 -0
  172. package/src/stores/useDisplaySetSelectorStore.ts +83 -0
  173. package/src/stores/useHangingProtocolStageIndexStore.ts +76 -0
  174. package/src/stores/useToggleHangingProtocolStore.ts +76 -0
  175. package/src/stores/useToggleOneUpViewportGridStore.ts +19 -0
  176. package/src/stores/useUIStateStore.ts +87 -0
  177. package/src/stores/useViewportGridStore.ts +89 -0
  178. package/src/stores/useViewportsByPositionStore.ts +100 -0
  179. package/src/types/AppTypes.ts +20 -0
  180. package/src/types/commandModuleTypes.tsx +6 -0
  181. package/src/utils/Toolbox.tsx +123 -0
  182. package/src/utils/_shared/PROMPT_RESPONSES.ts +10 -0
  183. package/src/utils/addIcon.ts +6 -0
  184. package/src/utils/appendFrameQueryToImageId.js +9 -0
  185. package/src/utils/callInputDialog.tsx +126 -0
  186. package/src/utils/colorPickerDialog.css +4 -0
  187. package/src/utils/colorPickerDialog.tsx +45 -0
  188. package/src/utils/createRenderedRetrieve.js +32 -0
  189. package/src/utils/createRenderedRetrieve.test.js +46 -0
  190. package/src/utils/dicomWriter.test.ts +228 -0
  191. package/src/utils/dicomWriter.ts +110 -0
  192. package/src/utils/getBulkdataValue.js +45 -0
  193. package/src/utils/getBulkdataValue.test.js +105 -0
  194. package/src/utils/getDirectURL.test.ts +207 -0
  195. package/src/utils/getDirectURL.ts +65 -0
  196. package/src/utils/getSRSeriesAndInstanceNumber.js +48 -0
  197. package/src/utils/index.ts +2 -0
  198. package/src/utils/layerConfigurationUtils.ts +202 -0
  199. package/src/utils/promptLabelAnnotation.js +47 -0
  200. package/src/utils/promptSaveReport.test.ts +106 -0
  201. package/src/utils/promptSaveReport.tsx +117 -0
  202. package/src/utils/registerNaturalizedDatasetForLocalWadouri.js +146 -0
  203. package/src/utils/registerNaturalizedDatasetForLocalWadouri.test.js +177 -0
  204. package/src/utils/registerStoredInstanceImageId.test.ts +73 -0
  205. package/src/utils/registerStoredInstanceImageId.ts +66 -0
  206. package/src/utils/reuseCachedLayouts.ts +92 -0
  207. package/src/utils/secureConfigFetch.js +115 -0
  208. package/src/utils/secureConfigFetch.test.js +163 -0
  209. package/src/utils/seriesDescriptionHistory.ts +83 -0
  210. package/src/utils/validations/areAllImageComponentsEqual.ts +24 -0
  211. package/src/utils/validations/areAllImageDimensionsEqual.test.ts +41 -0
  212. package/src/utils/validations/areAllImageDimensionsEqual.ts +27 -0
  213. package/src/utils/validations/areAllImagePositionsEqual.ts +75 -0
  214. package/src/utils/validations/areAllImageSpacingEqual.ts +66 -0
  215. package/src/utils/validations/checkMultiframe.ts +25 -0
  216. package/src/utils/validations/checkSingleFrames.ts +36 -0
@@ -0,0 +1,102 @@
1
+ import { useViewportsByPositionStore } from './stores/useViewportsByPositionStore';
2
+
3
+ /**
4
+ * This find or create viewport is paired with the reduce results from
5
+ * below, and the action of this viewport is to look for previously filled
6
+ * viewports, and to reuse by position id. If there is no filled viewport,
7
+ * then one can be re-used from the display set if it isn't going to be displayed.
8
+ * @param hangingProtocolService - bound parameter supplied before using this
9
+ * @param viewportsByPosition - bound parameter supplied before using this
10
+ * @param position - the position in the grid to retrieve
11
+ * @param positionId - the current position on screen to retrieve
12
+ * @param options - the set of options used, so that subsequent calls can
13
+ * store state that is reset by the setLayout.
14
+ * This class uses the options to store the already viewed
15
+ * display sets, filling it initially with the pre-existing viewports.
16
+ */
17
+ export const findOrCreateViewport = (
18
+ hangingProtocolService,
19
+ isHangingProtocolLayout,
20
+ viewportsByPosition,
21
+ position: number,
22
+ positionId: string,
23
+ options: Record<string, unknown>
24
+ ) => {
25
+ const byPositionViewport = viewportsByPosition?.[positionId];
26
+ if (byPositionViewport) {
27
+ return { ...byPositionViewport };
28
+ }
29
+ const { protocolId, stageIndex } = hangingProtocolService.getState();
30
+
31
+ // Setup the initial in display correctly for initial view/select
32
+ if (!options.inDisplay) {
33
+ options.inDisplay = [...viewportsByPosition.initialInDisplay];
34
+ }
35
+
36
+ // See if there is a default viewport for new views
37
+ const missing = hangingProtocolService.getMissingViewport(
38
+ isHangingProtocolLayout ? protocolId : 'default',
39
+ stageIndex,
40
+ options
41
+ );
42
+ if (missing) {
43
+ const displaySetInstanceUIDs = missing.displaySetsInfo.map(it => it.displaySetInstanceUID);
44
+ options.inDisplay.push(...displaySetInstanceUIDs);
45
+ return {
46
+ displaySetInstanceUIDs,
47
+ displaySetOptions: missing.displaySetsInfo.map(it => it.displaySetOptions),
48
+ viewportOptions: {
49
+ ...missing.viewportOptions,
50
+ },
51
+ };
52
+ }
53
+
54
+ // and lastly if there is no default viewport, then we see if we can grab the
55
+ // viewportsByPosition at the position index and use that
56
+ // const candidate = Object.values(viewportsByPosition)[position];
57
+
58
+ // // if it has something to display, then we can use it
59
+ // return candidate?.displaySetInstanceUIDs ? candidate : {};
60
+ return {};
61
+ };
62
+
63
+ /**
64
+ * Records the information on what viewports are displayed in which position.
65
+ * Also records what instances from the existing positions are going to be in
66
+ * view initially.
67
+ * @param state is the viewport grid state
68
+ * @param syncService is the state sync service to use for getting existing state
69
+ * @returns Set of states that can be applied to the state sync to remember
70
+ * the current view state.
71
+ */
72
+ const findViewportsByPosition = (state, { numRows, numCols }) => {
73
+ const { viewports } = state;
74
+ const { setViewportsByPosition, addInitialInDisplay } = useViewportsByPositionStore.getState();
75
+ const initialInDisplay = [];
76
+
77
+ const viewportsByPosition = {};
78
+ viewports.forEach(viewport => {
79
+ if (viewport.positionId) {
80
+ const storedViewport = {
81
+ ...viewport,
82
+ viewportOptions: { ...viewport.viewportOptions },
83
+ };
84
+ viewportsByPosition[viewport.positionId] = storedViewport;
85
+ setViewportsByPosition(viewport.positionId, storedViewport);
86
+ }
87
+ });
88
+
89
+ for (let row = 0; row < numRows; row++) {
90
+ for (let col = 0; col < numCols; col++) {
91
+ const positionId = `${col}-${row}`;
92
+ const viewport = viewportsByPosition[positionId];
93
+ if (viewport?.displaySetInstanceUIDs) {
94
+ initialInDisplay.push(...viewport.displaySetInstanceUIDs);
95
+ }
96
+ }
97
+ }
98
+
99
+ initialInDisplay.forEach(displaySetInstanceUID => addInitialInDisplay(displaySetInstanceUID));
100
+ };
101
+
102
+ export default findViewportsByPosition;
@@ -0,0 +1,109 @@
1
+ import defaultContextMenuCustomization from './customizations/defaultContextMenuCustomization';
2
+ import helloPageCustomization from './customizations/helloPageCustomization';
3
+ import datasourcesCustomization from './customizations/datasourcesCustomization';
4
+ import multimonitorCustomization from './customizations/multimonitorCustomization';
5
+ import customRoutesCustomization from './customizations/customRoutesCustomization';
6
+ import studyBrowserCustomization from './customizations/studyBrowserCustomization';
7
+ import thumbnailDetailsCustomization from './customizations/thumbnailDetailsCustomization';
8
+ import overlayItemCustomization from './customizations/overlayItemCustomization';
9
+ import contextMenuCustomization from './customizations/contextMenuCustomization';
10
+ import contextMenuUICustomization from './customizations/contextMenuUICustomization';
11
+ import menuContentCustomization from './customizations/menuContentCustomization';
12
+ import getDataSourceConfigurationCustomization from './customizations/dataSourceConfigurationCustomization';
13
+ import progressDropdownCustomization from './customizations/progressDropdownCustomization';
14
+ import sortingCriteriaCustomization from './customizations/sortingCriteriaCustomization';
15
+ import onDropHandlerCustomization from './customizations/onDropHandlerCustomization';
16
+ import loadingIndicatorProgressCustomization from './customizations/loadingIndicatorProgressCustomization';
17
+ import loadingIndicatorTotalPercentCustomization from './customizations/loadingIndicatorTotalPercentCustomization';
18
+ import progressLoadingBarCustomization from './customizations/progressLoadingBarCustomization';
19
+ import labellingFlowCustomization from './customizations/labellingFlowCustomization';
20
+ import viewportNotificationCustomization from './customizations/notificationCustomization';
21
+ import aboutModalCustomization from './customizations/aboutModalCustomization';
22
+ import appearanceModalCustomization from './customizations/appearanceModalCustomization';
23
+ import userPreferencesCustomization from './customizations/userPreferencesCustomization';
24
+ import reportDialogCustomization from './customizations/reportDialogCustomization';
25
+ import hotkeyBindingsCustomization from './customizations/hotkeyBindingsCustomization';
26
+ import onboardingCustomization from './customizations/onboardingCustomization';
27
+ import instanceSortingCriteriaCustomization from './customizations/instanceSortingCriteriaCustomization';
28
+ import getWorkListCustomization from './customizations/workListCustomization';
29
+ import getMetadataDisplaySetCustomization from './customizations/metadataDisplaySetCustomization';
30
+ import getMetadataContextCustomization from './customizations/metadataContextCustomization';
31
+ import headerRightSideCustomization from './customizations/headerRightSideCustomization';
32
+ import hideHeaderUndoRedoCustomization from './customizations/hideHeaderUndoRedoCustomization';
33
+ import hangingProtocolsCustomization from './customizations/hangingProtocolsCustomization';
34
+ /**
35
+ *
36
+ * Note: this is an example of how the customization module can be used
37
+ * using the customization module. Below, we are adding a new custom route
38
+ * to the application at the path /custom and rendering a custom component
39
+ * Real world use cases of the having a custom route would be to add a
40
+ * custom page for the user to view their profile, or to add a custom
41
+ * page for login etc.
42
+ */
43
+ export default function getCustomizationModule({ servicesManager, extensionManager, appConfig }) {
44
+ return [
45
+ {
46
+ name: 'helloPage',
47
+ value: helloPageCustomization,
48
+ },
49
+ {
50
+ // Enables metadata-driven display set splitting when listed in
51
+ // `appConfig.customizationService` (Global scope).
52
+ name: 'metadataDisplaySet',
53
+ value: {
54
+ useMetadataDisplaySet: { enabled: { $set: true } },
55
+ },
56
+ },
57
+ {
58
+ name: 'theme',
59
+ value: appearanceModalCustomization,
60
+ },
61
+ {
62
+ name: 'datasources',
63
+ value: datasourcesCustomization,
64
+ },
65
+ {
66
+ name: 'multimonitor',
67
+ value: multimonitorCustomization,
68
+ },
69
+ {
70
+ // Opt-in: drops the undo/redo buttons from the right side of the
71
+ // header's menu bar, leaving the rest of that list in place.
72
+ name: 'hideHeaderUndoRedo',
73
+ value: hideHeaderUndoRedoCustomization,
74
+ },
75
+ {
76
+ name: 'default',
77
+ value: {
78
+ ...customRoutesCustomization,
79
+ ...studyBrowserCustomization,
80
+ ...thumbnailDetailsCustomization,
81
+ ...overlayItemCustomization,
82
+ ...contextMenuCustomization,
83
+ ...menuContentCustomization,
84
+ ...getDataSourceConfigurationCustomization({ servicesManager, extensionManager }),
85
+ ...progressDropdownCustomization,
86
+ ...sortingCriteriaCustomization,
87
+ ...defaultContextMenuCustomization,
88
+ ...onDropHandlerCustomization,
89
+ ...loadingIndicatorProgressCustomization,
90
+ ...loadingIndicatorTotalPercentCustomization,
91
+ ...progressLoadingBarCustomization,
92
+ ...labellingFlowCustomization,
93
+ ...contextMenuUICustomization,
94
+ ...viewportNotificationCustomization,
95
+ ...aboutModalCustomization,
96
+ ...userPreferencesCustomization,
97
+ ...reportDialogCustomization,
98
+ ...hotkeyBindingsCustomization,
99
+ ...onboardingCustomization,
100
+ ...instanceSortingCriteriaCustomization,
101
+ ...getWorkListCustomization(),
102
+ ...getMetadataDisplaySetCustomization({ servicesManager, extensionManager, appConfig }),
103
+ ...getMetadataContextCustomization(),
104
+ ...headerRightSideCustomization,
105
+ ...hangingProtocolsCustomization,
106
+ },
107
+ },
108
+ ];
109
+ }
@@ -0,0 +1,44 @@
1
+ // TODO: Pull in IWebClientApi from @ohif/core
2
+ // TODO: Use constructor to create an instance of IWebClientApi
3
+ // TODO: Use existing DICOMWeb configuration (previously, appConfig, to configure instance)
4
+
5
+ import { createDicomWebApi } from './DicomWebDataSource/index';
6
+ import { createDicomJSONApi } from './DicomJSONDataSource/index';
7
+ import { createDicomLocalApi } from './DicomLocalDataSource/index';
8
+ import { createDicomWebProxyApi } from './DicomWebProxyDataSource/index';
9
+ import { createMergeDataSourceApi } from './MergeDataSource/index';
10
+
11
+ /**
12
+ *
13
+ */
14
+ function getDataSourcesModule() {
15
+ return [
16
+ {
17
+ name: 'dicomweb',
18
+ type: 'webApi',
19
+ createDataSource: createDicomWebApi,
20
+ },
21
+ {
22
+ name: 'dicomwebproxy',
23
+ type: 'webApi',
24
+ createDataSource: createDicomWebProxyApi,
25
+ },
26
+ {
27
+ name: 'dicomjson',
28
+ type: 'jsonApi',
29
+ createDataSource: createDicomJSONApi,
30
+ },
31
+ {
32
+ name: 'dicomlocal',
33
+ type: 'localApi',
34
+ createDataSource: createDicomLocalApi,
35
+ },
36
+ {
37
+ name: 'merge',
38
+ type: 'mergeApi',
39
+ createDataSource: createMergeDataSourceApi,
40
+ },
41
+ ];
42
+ }
43
+
44
+ export default getDataSourcesModule;
@@ -0,0 +1,54 @@
1
+ import sortInstancesByPosition from '@ohif/core/src/utils/sortInstancesByPosition';
2
+ import { constructableModalities } from '@ohif/core/src/utils/isDisplaySetReconstructable';
3
+ import { DisplaySetMessage, DisplaySetMessageList } from '@ohif/core';
4
+ import checkMultiFrame from './utils/validations/checkMultiframe';
5
+ import checkSingleFrames from './utils/validations/checkSingleFrames';
6
+ /**
7
+ * Checks if a series is reconstructable to a 3D volume.
8
+ *
9
+ * @param {Object[]} instances An array of `OHIFInstanceMetadata` objects.
10
+ */
11
+ export default function getDisplaySetMessages(
12
+ instances: Array<any>,
13
+ isReconstructable: boolean,
14
+ isDynamicVolume: boolean
15
+ ): DisplaySetMessageList {
16
+ const messages = new DisplaySetMessageList();
17
+
18
+ if (isDynamicVolume) {
19
+ return messages;
20
+ }
21
+
22
+ if (!instances.length) {
23
+ messages.addMessage(DisplaySetMessage.CODES.NO_VALID_INSTANCES);
24
+ return;
25
+ }
26
+
27
+ const firstInstance = instances[0];
28
+ const { Modality, ImageType, NumberOfFrames } = firstInstance;
29
+ // Due to current requirements, LOCALIZER series doesn't have any messages
30
+ if (ImageType?.includes('LOCALIZER')) {
31
+ return messages;
32
+ }
33
+
34
+ if (!constructableModalities.includes(Modality)) {
35
+ return messages;
36
+ }
37
+
38
+ const isMultiframe = NumberOfFrames > 1;
39
+ // Can't reconstruct if all instances don't have the ImagePositionPatient.
40
+ if (!isMultiframe && !instances.every(instance => instance.ImagePositionPatient)) {
41
+ messages.addMessage(DisplaySetMessage.CODES.NO_POSITION_INFORMATION);
42
+ }
43
+
44
+ const sortedInstances = sortInstancesByPosition(instances);
45
+
46
+ isMultiframe
47
+ ? checkMultiFrame(sortedInstances[0], messages)
48
+ : checkSingleFrames(sortedInstances, messages);
49
+
50
+ if (!isReconstructable) {
51
+ messages.addMessage(DisplaySetMessage.CODES.NOT_RECONSTRUCTABLE);
52
+ }
53
+ return messages;
54
+ }
@@ -0,0 +1,63 @@
1
+ import ImageSet from '@ohif/core/src/classes/ImageSet';
2
+ import { DisplaySetMessage, DisplaySetMessageList } from '@ohif/core';
3
+
4
+ /** The message that names why the instances are not supported. */
5
+ function getUnsupportedMessages(instances) {
6
+ const messages = new DisplaySetMessageList();
7
+ const instance = instances[0];
8
+
9
+ if (!instances.length) {
10
+ messages.addMessage(DisplaySetMessage.CODES.NO_VALID_INSTANCES);
11
+ } else {
12
+ const sopClassUid = instance.SOPClassUID;
13
+ if (sopClassUid) {
14
+ messages.addMessage(DisplaySetMessage.CODES.UNSUPPORTED_SOP_CLASS_UID, {
15
+ sopClassUid,
16
+ });
17
+ } else {
18
+ messages.addMessage(DisplaySetMessage.CODES.MISSING_SOP_CLASS_UID);
19
+ }
20
+ }
21
+ return messages;
22
+ }
23
+
24
+ /** The fields of an unsupported display set, other than its identity. */
25
+ const getUnsupportedFields = instances => ({
26
+ unsupported: true,
27
+ SOPClassHandlerId: 'unsupported',
28
+ isReconstructable: false,
29
+ messages: getUnsupportedMessages(instances),
30
+ });
31
+
32
+ /**
33
+ * Adds the unsupported fields to a display set that a split rule with the
34
+ * `unsupported` handler made, or that names a handler the mode does not have.
35
+ */
36
+ export function extendUnsupportedDisplaySet(displaySet) {
37
+ Object.assign(displaySet, getUnsupportedFields(displaySet.instances));
38
+ }
39
+
40
+ /**
41
+ * Default handler for a instance list with an unsupported sopClassUID
42
+ */
43
+ export default function getDisplaySetsFromUnsupportedSeries(instances) {
44
+ const imageSet = new ImageSet(instances);
45
+ const instance = instances[0];
46
+
47
+ imageSet.setAttributes({
48
+ displaySetInstanceUID: imageSet.uid, // create a local alias for the imageSet UID
49
+ SeriesDate: instance.SeriesDate,
50
+ SeriesTime: instance.SeriesTime,
51
+ SeriesInstanceUID: instance.SeriesInstanceUID,
52
+ StudyInstanceUID: instance.StudyInstanceUID,
53
+ SeriesNumber: instance.SeriesNumber || 0,
54
+ FrameRate: instance.FrameTime,
55
+ SOPClassUID: instance.SOPClassUID,
56
+ SeriesDescription: instance.SeriesDescription || '',
57
+ Modality: instance.Modality,
58
+ instances,
59
+ instance: instances[instances.length - 1],
60
+ ...getUnsupportedFields(instances),
61
+ });
62
+ return [imageSet];
63
+ }
@@ -0,0 +1,14 @@
1
+ import getDisplaySetsFromUnsupportedSeries from './getDisplaySetsFromUnsupportedSeries';
2
+
3
+ describe('getDisplaySetsFromUnsupportedSeries', () => {
4
+ it('sets the instance of the display set to the last instance', () => {
5
+ const instances = [
6
+ { SOPInstanceUID: '1', SeriesInstanceUID: 's', StudyInstanceUID: 't', SOPClassUID: 'x' },
7
+ { SOPInstanceUID: '2', SeriesInstanceUID: 's', StudyInstanceUID: 't', SOPClassUID: 'x' },
8
+ ];
9
+
10
+ const [displaySet] = getDisplaySetsFromUnsupportedSeries(instances);
11
+
12
+ expect(displaySet.instance).toBe(instances[1]);
13
+ });
14
+ });
@@ -0,0 +1,155 @@
1
+ import { hpMN, hpMN8 } from './hangingprotocols/hpMNGrid';
2
+ import hpMNCompare from './hangingprotocols/hpCompare';
3
+ import hpMammography from './hangingprotocols/hpMammo';
4
+ import hpScale from './hangingprotocols/hpScale';
5
+
6
+ const defaultProtocol = {
7
+ id: 'default',
8
+ locked: true,
9
+ // Don't store this hanging protocol as it applies to the currently active
10
+ // display set by default
11
+ // cacheId: null,
12
+ name: 'Default',
13
+ createdDate: '2021-02-23T19:22:08.894Z',
14
+ modifiedDate: '2023-04-01',
15
+ availableTo: {},
16
+ editableBy: {},
17
+ protocolMatchingRules: [],
18
+ toolGroupIds: ['default'],
19
+ // -1 would be used to indicate active only, whereas other values are
20
+ // the number of required priors referenced - so 0 means active with
21
+ // 0 or more priors.
22
+ numberOfPriorsReferenced: 0,
23
+ // Default viewport is used to define the viewport when
24
+ // additional viewports are added using the layout tool
25
+ defaultViewport: {
26
+ viewportOptions: {
27
+ viewportType: 'stack',
28
+ toolGroupId: 'default',
29
+ allowUnmatchedView: true,
30
+ syncGroups: [
31
+ {
32
+ type: 'hydrateseg',
33
+ id: 'sameFORId',
34
+ source: true,
35
+ target: true,
36
+ options: {
37
+ matchingRules: ['sameFOR'],
38
+ },
39
+ },
40
+ ],
41
+ },
42
+ displaySets: [
43
+ {
44
+ id: 'defaultDisplaySetId',
45
+ matchedDisplaySetsIndex: -1,
46
+ },
47
+ ],
48
+ },
49
+ displaySetSelectors: {
50
+ defaultDisplaySetId: {
51
+ // Matches displaysets, NOT series
52
+ seriesMatchingRules: [
53
+ // Try to match series with images by default, to prevent weird display
54
+ // on SEG/SR containing studies
55
+ {
56
+ weight: 10,
57
+ attribute: 'numImageFrames',
58
+ constraint: {
59
+ greaterThanOrEqual: { value: 0 },
60
+ },
61
+ },
62
+ // This display set will select the specified items by preference
63
+ // It has no affect if nothing is specified in the URL.
64
+ {
65
+ attribute: 'isDisplaySetFromUrl',
66
+ weight: 20,
67
+ constraint: {
68
+ equals: true,
69
+ },
70
+ },
71
+ ],
72
+ },
73
+ },
74
+ stages: [
75
+ {
76
+ name: 'default',
77
+ viewportStructure: {
78
+ layoutType: 'grid',
79
+ properties: {
80
+ rows: 1,
81
+ columns: 1,
82
+ },
83
+ },
84
+ viewports: [
85
+ {
86
+ viewportOptions: {
87
+ viewportType: 'stack',
88
+ viewportId: 'default',
89
+ toolGroupId: 'default',
90
+ // This will specify the initial image options index if it matches in the URL
91
+ // and will otherwise not specify anything.
92
+ initialImageOptions: {
93
+ custom: 'sopInstanceLocation',
94
+ },
95
+ // Other options for initialImageOptions, which can be included in the default
96
+ // custom attribute, or can be provided directly.
97
+ // index: 180,
98
+ // preset: 'middle', // 'first', 'last', 'middle'
99
+ // },
100
+ syncGroups: [
101
+ {
102
+ type: 'hydrateseg',
103
+ id: 'sameFORId',
104
+ source: true,
105
+ target: true,
106
+ // options: {
107
+ // matchingRules: ['sameFOR'],
108
+ // },
109
+ },
110
+ ],
111
+ },
112
+ displaySets: [
113
+ {
114
+ id: 'defaultDisplaySetId',
115
+ },
116
+ ],
117
+ },
118
+ ],
119
+ createdDate: '2021-02-23T18:32:42.850Z',
120
+ },
121
+ ],
122
+ };
123
+
124
+ function getHangingProtocolModule() {
125
+ return [
126
+ {
127
+ name: defaultProtocol.id,
128
+ protocol: defaultProtocol,
129
+ },
130
+ // Create a MxN comparison hanging protocol available by default
131
+ {
132
+ name: hpMNCompare.id,
133
+ protocol: hpMNCompare,
134
+ },
135
+ {
136
+ name: hpMammography.id,
137
+ protocol: hpMammography,
138
+ },
139
+ {
140
+ name: hpScale.id,
141
+ protocol: hpScale,
142
+ },
143
+ // Create a MxN hanging protocol available by default
144
+ {
145
+ name: hpMN.id,
146
+ protocol: hpMN,
147
+ },
148
+ {
149
+ name: hpMN8.id,
150
+ protocol: hpMN8,
151
+ },
152
+ ];
153
+ }
154
+
155
+ export default getHangingProtocolModule;
@@ -0,0 +1,28 @@
1
+ import ViewerLayout from './ViewerLayout';
2
+ /*
3
+ - Define layout for the viewer in mode configuration.
4
+ - Pass in the viewport types that can populate the viewer.
5
+ - Init layout based on the displaySets and the objects.
6
+ */
7
+
8
+ export default function ({ servicesManager, extensionManager, commandsManager, hotkeysManager }) {
9
+ function ViewerLayoutWithServices(props) {
10
+ return ViewerLayout({
11
+ servicesManager,
12
+ extensionManager,
13
+ commandsManager,
14
+ hotkeysManager,
15
+ ...props,
16
+ });
17
+ }
18
+
19
+ return [
20
+ // Layout Template Definition
21
+ // TODO: this is weird naming
22
+ {
23
+ name: 'viewerLayout',
24
+ id: 'viewerLayout',
25
+ component: ViewerLayoutWithServices,
26
+ },
27
+ ];
28
+ }
@@ -0,0 +1,102 @@
1
+ const mockGet = jest.fn();
2
+
3
+ // Minimal @ohif/core mock: the real utils.toNumber (used by coerceNumber) and a
4
+ // stubbed MetadataProvider.get.
5
+ jest.mock('@ohif/core', () => {
6
+ const toNumber = (val: unknown) =>
7
+ Array.isArray(val)
8
+ ? val.map(v => (v !== undefined ? Number(v) : v))
9
+ : val !== undefined
10
+ ? Number(val)
11
+ : val;
12
+ const core = {
13
+ classes: { MetadataProvider: { get: (...args: unknown[]) => mockGet(...args) } },
14
+ utils: { toNumber },
15
+ };
16
+ return { __esModule: true, default: core, utils: core.utils };
17
+ });
18
+
19
+ import getPTImageIdInstanceMetadata from './getPTImageIdInstanceMetadata';
20
+
21
+ // A valid PT instance with the radiopharmaceutical sequence in dcmjs array form.
22
+ const baseInstance = () => ({
23
+ Modality: 'PT',
24
+ Units: 'CNTS',
25
+ CorrectedImage: ['DECY', 'ATTN'],
26
+ SeriesDate: '20130606',
27
+ SeriesTime: '120000',
28
+ AcquisitionDate: '20130606',
29
+ AcquisitionTime: '120000',
30
+ DecayCorrection: 'START',
31
+ PatientWeight: 70,
32
+ RadiopharmaceuticalInformationSequence: [
33
+ {
34
+ RadionuclideHalfLife: 6586.2,
35
+ RadionuclideTotalDose: 370000000,
36
+ RadiopharmaceuticalStartTime: '110000',
37
+ },
38
+ ],
39
+ });
40
+
41
+ afterEach(() => mockGet.mockReset());
42
+
43
+ describe('getPTImageIdInstanceMetadata', () => {
44
+ it('throws when no metadata is available', () => {
45
+ mockGet.mockReturnValue(undefined);
46
+ expect(() => getPTImageIdInstanceMetadata('img:1')).toThrow('dicom metadata are required');
47
+ });
48
+
49
+ it('throws when required metadata is missing', () => {
50
+ const inst = baseInstance();
51
+ delete inst.Units;
52
+ mockGet.mockReturnValue(inst);
53
+ expect(() => getPTImageIdInstanceMetadata('img:1')).toThrow('required metadata are missing');
54
+ });
55
+
56
+ it('reads RadionuclideHalfLife/TotalDose from the array-shaped sequence (firstSequenceItem)', () => {
57
+ mockGet.mockReturnValue(baseInstance());
58
+ const result = getPTImageIdInstanceMetadata('img:1');
59
+ expect(result.RadionuclideHalfLife).toBe(6586.2);
60
+ expect(result.RadionuclideTotalDose).toBe(370000000);
61
+ });
62
+
63
+ it('still reads the sequence when flattened to a single object', () => {
64
+ const inst = baseInstance();
65
+ // some servers/paths deliver a flattened (non-array) sequence
66
+ inst.RadiopharmaceuticalInformationSequence =
67
+ inst.RadiopharmaceuticalInformationSequence[0];
68
+ mockGet.mockReturnValue(inst);
69
+ expect(getPTImageIdInstanceMetadata('img:1').RadionuclideHalfLife).toBe(6586.2);
70
+ });
71
+
72
+ it('populates PhilipsPETPrivateGroup when the private tags are numbers', () => {
73
+ const inst = baseInstance();
74
+ inst['70531000'] = 0.00038;
75
+ inst['70531009'] = 1.881732;
76
+ mockGet.mockReturnValue(inst);
77
+ const result = getPTImageIdInstanceMetadata('img:1');
78
+ expect(result.PhilipsPETPrivateGroup).toEqual({
79
+ SUVScaleFactor: 0.00038,
80
+ ActivityConcentrationScaleFactor: 1.881732,
81
+ });
82
+ });
83
+
84
+ it('drops an unresolved bulkdata { BulkDataURI } private tag (coerceNumber backstop)', () => {
85
+ const inst = baseInstance();
86
+ inst['70531000'] = { BulkDataURI: 'http://x/bulk/70531000' };
87
+ inst['70531009'] = { BulkDataURI: 'http://x/bulk/70531009' };
88
+ mockGet.mockReturnValue(inst);
89
+ // Neither tag coerces to a number, so the group is not attached at all -
90
+ // an object can never reach calculate-suv.
91
+ expect(getPTImageIdInstanceMetadata('img:1').PhilipsPETPrivateGroup).toBeUndefined();
92
+ });
93
+
94
+ it('coerces a numeric DS string private tag to a number', () => {
95
+ const inst = baseInstance();
96
+ inst['70531000'] = '0.00038';
97
+ mockGet.mockReturnValue(inst);
98
+ expect(getPTImageIdInstanceMetadata('img:1').PhilipsPETPrivateGroup.SUVScaleFactor).toBe(
99
+ 0.00038
100
+ );
101
+ });
102
+ });