@ohif/extension-default 3.14.0-beta.97 → 3.14.0-beta.99

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 (215) hide show
  1. package/dist/ohif-extension-default.umd.js +1 -1
  2. package/package.json +9 -6
  3. package/src/Actions/createReportAsync.tsx +45 -0
  4. package/src/Components/DataSourceConfigurationComponent.tsx +142 -0
  5. package/src/Components/DataSourceConfigurationModalComponent.tsx +200 -0
  6. package/src/Components/ItemListComponent.tsx +95 -0
  7. package/src/Components/LineChartViewport/LineChartViewport.tsx +31 -0
  8. package/src/Components/LineChartViewport/index.ts +1 -0
  9. package/src/Components/MoreDropdownMenu.tsx +112 -0
  10. package/src/Components/ProgressDropdownWithService.tsx +101 -0
  11. package/src/Components/SidePanelWithServices.tsx +122 -0
  12. package/src/CustomizableContextMenu/ContextMenuController.tsx +216 -0
  13. package/src/CustomizableContextMenu/ContextMenuItemsBuilder.test.js +29 -0
  14. package/src/CustomizableContextMenu/ContextMenuItemsBuilder.ts +176 -0
  15. package/src/CustomizableContextMenu/index.ts +5 -0
  16. package/src/CustomizableContextMenu/types.ts +126 -0
  17. package/src/DataSourceConfigurationAPI/GoogleCloudDataSourceConfigurationAPI.ts +236 -0
  18. package/src/DicomJSONDataSource/index.js +326 -0
  19. package/src/DicomLocalDataSource/index.js +273 -0
  20. package/src/DicomTagBrowser/DicomTagBrowser.css +49 -0
  21. package/src/DicomTagBrowser/DicomTagBrowser.tsx +454 -0
  22. package/src/DicomTagBrowser/DicomTagTable.tsx +311 -0
  23. package/src/DicomWebDataSource/dcm4cheeReject.js +45 -0
  24. package/src/DicomWebDataSource/exampleInstances.js +280 -0
  25. package/src/DicomWebDataSource/index.ts +808 -0
  26. package/src/DicomWebDataSource/qido.js +215 -0
  27. package/src/DicomWebDataSource/retrieveBulkData.test.ts +35 -0
  28. package/src/DicomWebDataSource/retrieveBulkData.ts +31 -0
  29. package/src/DicomWebDataSource/retrieveRendered.test.ts +147 -0
  30. package/src/DicomWebDataSource/retrieveRendered.ts +141 -0
  31. package/src/DicomWebDataSource/retrieveStudyMetadata.js +108 -0
  32. package/src/DicomWebDataSource/retrieveStudyMetadata.test.js +75 -0
  33. package/src/DicomWebDataSource/retrieveThumbnail.ts +346 -0
  34. package/src/DicomWebDataSource/serviceUrls.test.ts +143 -0
  35. package/src/DicomWebDataSource/utils/StaticWadoClient.ts +272 -0
  36. package/src/DicomWebDataSource/utils/cleanDenaturalizedDataset.ts +78 -0
  37. package/src/DicomWebDataSource/utils/findIndexOfString.ts +47 -0
  38. package/src/DicomWebDataSource/utils/fixBulkDataURI.test.ts +68 -0
  39. package/src/DicomWebDataSource/utils/fixBulkDataURI.ts +78 -0
  40. package/src/DicomWebDataSource/utils/fixMultiValueKeys.ts +12 -0
  41. package/src/DicomWebDataSource/utils/fixMultipart.ts +70 -0
  42. package/src/DicomWebDataSource/utils/getImageId.js +54 -0
  43. package/src/DicomWebDataSource/utils/getWADORSImageId.js +51 -0
  44. package/src/DicomWebDataSource/utils/index.ts +9 -0
  45. package/src/DicomWebDataSource/utils/retrieveMetadataFiltered.js +61 -0
  46. package/src/DicomWebDataSource/wado/retrieveMetadata.js +41 -0
  47. package/src/DicomWebDataSource/wado/retrieveMetadataLoader.js +64 -0
  48. package/src/DicomWebDataSource/wado/retrieveMetadataLoaderAsync.js +159 -0
  49. package/src/DicomWebDataSource/wado/retrieveMetadataLoaderSync.js +58 -0
  50. package/src/DicomWebProxyDataSource/index.ts +90 -0
  51. package/src/MergeDataSource/index.test.ts +212 -0
  52. package/src/MergeDataSource/index.ts +319 -0
  53. package/src/MergeDataSource/types.ts +46 -0
  54. package/src/Panels/DataSourceSelector.tsx +55 -0
  55. package/src/Panels/StudyBrowser/PanelStudyBrowser.tsx +612 -0
  56. package/src/Panels/StudyBrowser/PanelStudyBrowserHeader.tsx +88 -0
  57. package/src/Panels/StudyBrowser/constants/actionIcons.ts +12 -0
  58. package/src/Panels/StudyBrowser/constants/index.ts +4 -0
  59. package/src/Panels/StudyBrowser/constants/viewPresets.ts +16 -0
  60. package/src/Panels/StudyBrowser/resolveThumbnailDetails.test.ts +197 -0
  61. package/src/Panels/StudyBrowser/resolveThumbnailDetails.ts +132 -0
  62. package/src/Panels/StudyBrowser/types/actionIcon.ts +9 -0
  63. package/src/Panels/StudyBrowser/types/index.ts +4 -0
  64. package/src/Panels/StudyBrowser/types/viewPreset.ts +7 -0
  65. package/src/Panels/WrappedPanelStudyBrowser.tsx +61 -0
  66. package/src/Panels/createReportDialogPrompt.tsx +128 -0
  67. package/src/Panels/debounce.js +25 -0
  68. package/src/Panels/getImageSrcFromImageId.js +16 -0
  69. package/src/Panels/getStudiesForPatientByMRN.js +19 -0
  70. package/src/Panels/index.js +5 -0
  71. package/src/Panels/requestDisplaySetCreationForStudy.js +19 -0
  72. package/src/SOPClassHandlers/chartSOPClassHandler.test.ts +81 -0
  73. package/src/SOPClassHandlers/chartSOPClassHandler.ts +127 -0
  74. package/src/Toolbar/ToolBoxWrapper.tsx +64 -0
  75. package/src/Toolbar/ToolButtonListWrapper.tsx +77 -0
  76. package/src/Toolbar/ToolButtonWrapper.tsx +32 -0
  77. package/src/Toolbar/ToolRowWrapper.tsx +41 -0
  78. package/src/Toolbar/Toolbar.tsx +98 -0
  79. package/src/Toolbar/ToolbarDivider.tsx +5 -0
  80. package/src/Toolbar/ToolbarLayoutSelector.tsx +195 -0
  81. package/src/Toolbar/index.ts +7 -0
  82. package/src/ViewerLayout/HeaderPatientInfo/HeaderPatientInfo.tsx +96 -0
  83. package/src/ViewerLayout/HeaderPatientInfo/index.js +3 -0
  84. package/src/ViewerLayout/HeaderUndoRedo.tsx +47 -0
  85. package/src/ViewerLayout/ResizablePanelsHook.tsx +334 -0
  86. package/src/ViewerLayout/ViewerHeader.tsx +124 -0
  87. package/src/ViewerLayout/constants/panels.ts +42 -0
  88. package/src/ViewerLayout/index.tsx +227 -0
  89. package/src/ViewerLayout/useUndoRedoState.ts +75 -0
  90. package/src/__tests__/commandsModuleToggleOneUp.test.ts +147 -0
  91. package/src/commandsModule.ts +970 -0
  92. package/src/customizations/aboutModalCustomization.tsx +42 -0
  93. package/src/customizations/appearanceModalCustomization.tsx +143 -0
  94. package/src/customizations/contextMenuCustomization.ts +25 -0
  95. package/src/customizations/contextMenuUICustomization.ts +5 -0
  96. package/src/customizations/customRoutesCustomization.ts +6 -0
  97. package/src/customizations/dataSourceConfigurationCustomization.ts +19 -0
  98. package/src/customizations/datasourcesCustomization.tsx +14 -0
  99. package/src/customizations/defaultContextMenuCustomization.ts +22 -0
  100. package/src/customizations/hangingProtocolsCustomization.ts +15 -0
  101. package/src/customizations/headerRightSideCustomization.ts +19 -0
  102. package/src/customizations/helloPageCustomization.tsx +14 -0
  103. package/src/customizations/hideHeaderUndoRedoCustomization.ts +22 -0
  104. package/src/customizations/hotkeyBindingsCustomization.ts +5 -0
  105. package/src/customizations/instanceSortingCriteriaCustomization.ts +6 -0
  106. package/src/customizations/labellingFlowCustomization.tsx +5 -0
  107. package/src/customizations/loadingIndicatorProgressCustomization.tsx +5 -0
  108. package/src/customizations/loadingIndicatorTotalPercentCustomization.tsx +5 -0
  109. package/src/customizations/menuContentCustomization.tsx +67 -0
  110. package/src/customizations/metadataContextCustomization.test.ts +22 -0
  111. package/src/customizations/metadataContextCustomization.ts +28 -0
  112. package/src/customizations/metadataDisplaySetCustomization.ts +55 -0
  113. package/src/customizations/missingReferenceDisplaySetHandler.ts +5 -0
  114. package/src/customizations/multimonitorCustomization.ts +63 -0
  115. package/src/customizations/notificationCustomization.ts +29 -0
  116. package/src/customizations/onDropHandlerCustomization.ts +5 -0
  117. package/src/customizations/onboardingCustomization.ts +200 -0
  118. package/src/customizations/overlayItemCustomization.tsx +33 -0
  119. package/src/customizations/progressDropdownCustomization.ts +5 -0
  120. package/src/customizations/progressLoadingBarCustomization.tsx +5 -0
  121. package/src/customizations/reportDialogCustomization.test.ts +701 -0
  122. package/src/customizations/reportDialogCustomization.tsx +661 -0
  123. package/src/customizations/sortingCriteriaCustomization.ts +14 -0
  124. package/src/customizations/studyBrowserCustomization.test.ts +69 -0
  125. package/src/customizations/studyBrowserCustomization.ts +95 -0
  126. package/src/customizations/thumbnailDetailsCustomization.ts +91 -0
  127. package/src/customizations/userPreferencesCustomization.tsx +342 -0
  128. package/src/customizations/workListCustomization.ts +107 -0
  129. package/src/displaySetSplitting/makeDisplaySetFromInstanceGroup.test.ts +181 -0
  130. package/src/displaySetSplitting/makeDisplaySetFromInstanceGroup.ts +240 -0
  131. package/src/displaySetSplitting/makeImageSetDisplaySet.ts +276 -0
  132. package/src/displaySetSplitting/stackSopClassUids.ts +60 -0
  133. package/src/displaySetSplitting/urlSplitModules.test.ts +333 -0
  134. package/src/findViewportsByPosition.ts +102 -0
  135. package/src/getCustomizationModule.tsx +109 -0
  136. package/src/getDataSourcesModule.js +44 -0
  137. package/src/getDisplaySetMessages.ts +54 -0
  138. package/src/getDisplaySetsFromUnsupportedSeries.js +63 -0
  139. package/src/getDisplaySetsFromUnsupportedSeries.test.js +14 -0
  140. package/src/getHangingProtocolModule.js +155 -0
  141. package/src/getLayoutTemplateModule.js +28 -0
  142. package/src/getPTImageIdInstanceMetadata.test.ts +102 -0
  143. package/src/getPTImageIdInstanceMetadata.ts +124 -0
  144. package/src/getPanelModule.tsx +29 -0
  145. package/src/getSopClassHandlerModule.js +152 -0
  146. package/src/getSopClassHandlerModule.test.js +78 -0
  147. package/src/getToolbarModule.tsx +63 -0
  148. package/src/getViewportModule.tsx +12 -0
  149. package/src/hangingprotocols/hpCompare.ts +189 -0
  150. package/src/hangingprotocols/hpEcgCustomization.test.ts +104 -0
  151. package/src/hangingprotocols/hpMNGrid.test.ts +120 -0
  152. package/src/hangingprotocols/hpMNGrid.ts +419 -0
  153. package/src/hangingprotocols/hpMammo.ts +202 -0
  154. package/src/hangingprotocols/hpScale.ts +132 -0
  155. package/src/hangingprotocols/index.ts +16 -0
  156. package/src/hangingprotocols/protocolMatchChanges.test.ts +73 -0
  157. package/src/hangingprotocols/utils/isNewestOfModality.ts +19 -0
  158. package/src/hangingprotocols/utils/laterality.ts +9 -0
  159. package/src/hangingprotocols/utils/mammoDisplaySetSelector.ts +214 -0
  160. package/src/hangingprotocols/utils/registerHangingProtocolAttributes.ts +14 -0
  161. package/src/hangingprotocols/utils/seriesSelectors.ts +62 -0
  162. package/src/hangingprotocols/utils/studySelectors.ts +14 -0
  163. package/src/hangingprotocols/utils/viewCode.test.js +25 -0
  164. package/src/hangingprotocols/utils/viewCode.ts +17 -0
  165. package/src/hangingprotocols/utils/viewportOptions.ts +18 -0
  166. package/src/hooks/usePatientInfo.tsx +63 -0
  167. package/src/id.js +5 -0
  168. package/src/index.ts +113 -0
  169. package/src/init.ts +169 -0
  170. package/src/stores/index.ts +7 -0
  171. package/src/stores/useDisplaySetSelectorStore.ts +83 -0
  172. package/src/stores/useHangingProtocolStageIndexStore.ts +76 -0
  173. package/src/stores/useToggleHangingProtocolStore.ts +76 -0
  174. package/src/stores/useToggleOneUpViewportGridStore.ts +19 -0
  175. package/src/stores/useUIStateStore.ts +87 -0
  176. package/src/stores/useViewportGridStore.ts +89 -0
  177. package/src/stores/useViewportsByPositionStore.ts +100 -0
  178. package/src/types/AppTypes.ts +20 -0
  179. package/src/types/commandModuleTypes.tsx +6 -0
  180. package/src/utils/Toolbox.tsx +123 -0
  181. package/src/utils/_shared/PROMPT_RESPONSES.ts +10 -0
  182. package/src/utils/addIcon.ts +6 -0
  183. package/src/utils/appendFrameQueryToImageId.js +9 -0
  184. package/src/utils/callInputDialog.tsx +126 -0
  185. package/src/utils/colorPickerDialog.css +4 -0
  186. package/src/utils/colorPickerDialog.tsx +45 -0
  187. package/src/utils/createRenderedRetrieve.js +32 -0
  188. package/src/utils/createRenderedRetrieve.test.js +46 -0
  189. package/src/utils/dicomWriter.test.ts +228 -0
  190. package/src/utils/dicomWriter.ts +110 -0
  191. package/src/utils/getBulkdataValue.js +45 -0
  192. package/src/utils/getBulkdataValue.test.js +105 -0
  193. package/src/utils/getDirectURL.test.ts +207 -0
  194. package/src/utils/getDirectURL.ts +65 -0
  195. package/src/utils/getSRSeriesAndInstanceNumber.js +48 -0
  196. package/src/utils/index.ts +2 -0
  197. package/src/utils/layerConfigurationUtils.ts +202 -0
  198. package/src/utils/promptLabelAnnotation.js +47 -0
  199. package/src/utils/promptSaveReport.test.ts +106 -0
  200. package/src/utils/promptSaveReport.tsx +117 -0
  201. package/src/utils/registerNaturalizedDatasetForLocalWadouri.js +146 -0
  202. package/src/utils/registerNaturalizedDatasetForLocalWadouri.test.js +177 -0
  203. package/src/utils/registerStoredInstanceImageId.test.ts +73 -0
  204. package/src/utils/registerStoredInstanceImageId.ts +66 -0
  205. package/src/utils/reuseCachedLayouts.ts +92 -0
  206. package/src/utils/secureConfigFetch.js +115 -0
  207. package/src/utils/secureConfigFetch.test.js +163 -0
  208. package/src/utils/seriesDescriptionHistory.ts +83 -0
  209. package/src/utils/validations/areAllImageComponentsEqual.ts +24 -0
  210. package/src/utils/validations/areAllImageDimensionsEqual.test.ts +41 -0
  211. package/src/utils/validations/areAllImageDimensionsEqual.ts +27 -0
  212. package/src/utils/validations/areAllImagePositionsEqual.ts +75 -0
  213. package/src/utils/validations/areAllImageSpacingEqual.ts +66 -0
  214. package/src/utils/validations/checkMultiframe.ts +25 -0
  215. package/src/utils/validations/checkSingleFrames.ts +36 -0
@@ -0,0 +1,311 @@
1
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
+ import { VariableSizeList as List } from 'react-window';
3
+ import classNames from 'classnames';
4
+ import debounce from 'lodash.debounce';
5
+ import { Row } from './DicomTagBrowser';
6
+ import { Icons } from '@ohif/ui-next';
7
+
8
+ const lineHeightPx = 20;
9
+ const lineHeightClassName = `leading-[${lineHeightPx}px]`;
10
+ const rowVerticalPaddingPx = 10;
11
+ const rowBottomBorderPx = 1;
12
+ const rowVerticalPaddingStyle = { padding: `${rowVerticalPaddingPx}px 0` };
13
+ const rowStyle = {
14
+ borderBottomWidth: `${rowBottomBorderPx}px`,
15
+ ...rowVerticalPaddingStyle,
16
+ };
17
+ const indentationPadding = 8;
18
+
19
+ const RowComponent = ({
20
+ row,
21
+ style,
22
+ keyPrefix,
23
+ onToggle,
24
+ }: {
25
+ row: Row;
26
+ style: any;
27
+ keyPrefix: string;
28
+ onToggle?: (areChildrenVisible: boolean) => void;
29
+ }) => {
30
+ const handleToggle = useCallback(() => {
31
+ onToggle(!row.areChildrenVisible);
32
+ }, [row.areChildrenVisible, onToggle]);
33
+
34
+ const hasChildren = row.children && row.children.length > 0;
35
+ const isChildOrParent = hasChildren || row.depth > 0;
36
+ const padding = indentationPadding * (1 + 2 * row.depth);
37
+
38
+ return (
39
+ <div
40
+ style={{ ...style, ...rowStyle }}
41
+ className={classNames(
42
+ 'hover:bg-primary/25 border-input text-foreground bg-background flex w-full flex-row items-center break-all text-base',
43
+ lineHeightClassName
44
+ )}
45
+ key={keyPrefix}
46
+ >
47
+ {isChildOrParent && (
48
+ <div style={{ paddingLeft: `${padding}px`, opacity: onToggle ? 1 : 0 }}>
49
+ {row.areChildrenVisible ? (
50
+ <div
51
+ className="cursor-pointer p-1"
52
+ onClick={handleToggle}
53
+ >
54
+ <Icons.ChevronDown />
55
+ </div>
56
+ ) : (
57
+ <div
58
+ className="cursor-pointer p-1"
59
+ onClick={handleToggle}
60
+ >
61
+ <Icons.ChevronRight />
62
+ </div>
63
+ )}
64
+ </div>
65
+ )}
66
+ <div className="w-4/24 px-3">{row.tag}</div>
67
+ <div className="w-2/24 px-3">{row.valueRepresentation}</div>
68
+ <div className="w-6/24 px-3">{row.keyword}</div>
69
+ <div className="w-5/24 grow px-3">{row.value}</div>
70
+ </div>
71
+ );
72
+ };
73
+
74
+ function ColumnHeaders({ tagRef, vrRef, keywordRef, valueRef }) {
75
+ return (
76
+ <div
77
+ className={classNames('bg-popover ohif-scrollbar flex w-full flex-row overflow-y-scroll')}
78
+ style={rowVerticalPaddingStyle}
79
+ >
80
+ <div className="w-4/24 px-3">
81
+ <label
82
+ ref={tagRef}
83
+ className="text-foreground flex flex-1 select-none flex-col pl-1 text-lg"
84
+ >
85
+ <span className="flex flex-row items-center focus:outline-none">Tag</span>
86
+ </label>
87
+ </div>
88
+ <div className="w-2/24 px-3">
89
+ <label
90
+ ref={vrRef}
91
+ className="text-foreground flex flex-1 select-none flex-col pl-1 text-lg"
92
+ >
93
+ <span className="flex flex-row items-center focus:outline-none">VR</span>
94
+ </label>
95
+ </div>
96
+ <div className="w-6/24 px-3">
97
+ <label
98
+ ref={keywordRef}
99
+ className="text-foreground flex flex-1 select-none flex-col pl-1 text-lg"
100
+ >
101
+ <span className="flex flex-row items-center focus:outline-none">Keyword</span>
102
+ </label>
103
+ </div>
104
+ <div className="w-5/24 grow px-3">
105
+ <label
106
+ ref={valueRef}
107
+ className="text-foreground flex flex-1 select-none flex-col pl-1 text-lg"
108
+ >
109
+ <span className="flex flex-row items-center focus:outline-none">Value</span>
110
+ </label>
111
+ </div>
112
+ </div>
113
+ );
114
+ }
115
+ /**
116
+ * Measures the tallest column of one row, in pixels, using the header column
117
+ * widths and a canvas for text metrics.
118
+ *
119
+ * Takes the header elements as arguments rather than closing over them: the
120
+ * compiler infers a callback's dependencies from its body, so reading
121
+ * `el.offsetWidth` inside a component-level callback gets hoisted into render,
122
+ * where these are still null. Passing the elements in means the emitted guard
123
+ * compares the references instead, and there is no property path to hoist.
124
+ */
125
+ function measureRowHeight(row, headerElems, canvas) {
126
+ if (!canvas || headerElems.some(elem => !elem)) {
127
+ return 0;
128
+ }
129
+
130
+ const headerWidths = headerElems.map(elem => elem.offsetWidth);
131
+
132
+ const context = canvas.getContext('2d');
133
+ context.font = getComputedStyle(canvas).font;
134
+
135
+ const propertiesToCheck = ['tag', 'valueRepresentation', 'keyword', 'value'];
136
+
137
+ return Object.entries(row)
138
+ .filter(([key]) => propertiesToCheck.includes(key))
139
+ .map(([, colText], index) => {
140
+ const colOneLineWidth = context.measureText(colText).width;
141
+ const numLines = Math.ceil(colOneLineWidth / headerWidths[index]);
142
+ return numLines * lineHeightPx + 2 * rowVerticalPaddingPx + rowBottomBorderPx;
143
+ })
144
+ .reduce((maxHeight, colHeight) => Math.max(maxHeight, colHeight), 0);
145
+ }
146
+
147
+ function DicomTagTable({ rows }: { rows: Row[] }) {
148
+ const listRef = useRef<List | null>(null);
149
+ const canvasRef = useRef<HTMLCanvasElement | null>(null);
150
+
151
+ const [tagHeaderElem, setTagHeaderElem] = useState(null);
152
+ const [vrHeaderElem, setVrHeaderElem] = useState(null);
153
+ const [keywordHeaderElem, setKeywordHeaderElem] = useState(null);
154
+ const [valueHeaderElem, setValueHeaderElem] = useState(null);
155
+ const [internalRows, setInternalRows] = useState(rows);
156
+
157
+ // Here the refs are inturn stored in state to trigger a render of the table.
158
+ // This virtualized table does NOT render until the header is rendered because the header column widths are used to determine the row heights in the table.
159
+ // Therefore whenever the refs change (in particular the first time the refs are set), we want to trigger a render of the table.
160
+ const tagRef = elem => {
161
+ if (elem) {
162
+ setTagHeaderElem(elem);
163
+ }
164
+ };
165
+ const vrRef = elem => {
166
+ if (elem) {
167
+ setVrHeaderElem(elem);
168
+ }
169
+ };
170
+ const keywordRef = elem => {
171
+ if (elem) {
172
+ setKeywordHeaderElem(elem);
173
+ }
174
+ };
175
+ const valueRef = elem => {
176
+ if (elem) {
177
+ setValueHeaderElem(elem);
178
+ }
179
+ };
180
+
181
+ useEffect(() => {
182
+ setInternalRows(rows);
183
+ }, [rows]);
184
+
185
+ const visibleRows = useMemo(() => {
186
+ return internalRows.filter(row => row.isVisible);
187
+ }, [internalRows]);
188
+
189
+ /**
190
+ * When new rows are set, scroll to the top and reset the virtualization.
191
+ */
192
+ useEffect(() => {
193
+ if (!listRef?.current) {
194
+ return;
195
+ }
196
+
197
+ listRef.current.scrollTo(0);
198
+ listRef.current.resetAfterIndex(0);
199
+ }, [rows]);
200
+
201
+ /**
202
+ * When the browser window resizes, update the row virtualization (i.e. row heights)
203
+ */
204
+ useEffect(() => {
205
+ const debouncedResize = debounce(() => listRef.current.resetAfterIndex(0), 100);
206
+
207
+ window.addEventListener('resize', debouncedResize);
208
+
209
+ return () => {
210
+ debouncedResize.cancel();
211
+ window.removeEventListener('resize', debouncedResize);
212
+ };
213
+ }, []);
214
+
215
+ /**
216
+ * Get the item/row size. We use the header column widths to calculate the various row heights.
217
+ * @param index the row index
218
+ * @returns the row height
219
+ */
220
+ const getItemSize = useCallback(
221
+ rows => index =>
222
+ measureRowHeight(
223
+ rows[index],
224
+ [tagHeaderElem, vrHeaderElem, keywordHeaderElem, valueHeaderElem],
225
+ canvasRef.current
226
+ ),
227
+ [tagHeaderElem, vrHeaderElem, keywordHeaderElem, valueHeaderElem]
228
+ );
229
+
230
+ const onToggle = useCallback(
231
+ sourceRow => {
232
+ if (!sourceRow.children) {
233
+ return undefined;
234
+ }
235
+
236
+ return areChildrenVisible => {
237
+ const newInternalRows = internalRows.map(internalRow => {
238
+ if (sourceRow.uid === internalRow.uid) {
239
+ return { ...internalRow, areChildrenVisible };
240
+ }
241
+ if (sourceRow.children.includes(internalRow.uid)) {
242
+ return { ...internalRow, isVisible: areChildrenVisible, areChildrenVisible };
243
+ }
244
+ return internalRow;
245
+ });
246
+ setInternalRows(newInternalRows);
247
+
248
+ listRef?.current?.resetAfterIndex(0);
249
+ };
250
+ },
251
+ [internalRows, listRef]
252
+ );
253
+
254
+ const getRowComponent = useCallback(
255
+ ({ rows }: { rows: Row[] }) =>
256
+ function RowList({ index, style }) {
257
+ const row = rows[index];
258
+
259
+ return (
260
+ <RowComponent
261
+ style={style}
262
+ row={row}
263
+ keyPrefix={`DICOMTagRow-${index}`}
264
+ onToggle={onToggle(row)}
265
+ />
266
+ );
267
+ },
268
+ [onToggle]
269
+ );
270
+
271
+ /**
272
+ * Whenever any one of the column headers is set, then the header is rendered.
273
+ * Here we chose the tag header.
274
+ */
275
+ const isHeaderRendered = useCallback(() => tagHeaderElem !== null, [tagHeaderElem]);
276
+
277
+ return (
278
+ <div>
279
+ <canvas
280
+ style={{ visibility: 'hidden', position: 'absolute' }}
281
+ className="text-base"
282
+ ref={canvasRef}
283
+ />
284
+ <ColumnHeaders
285
+ tagRef={tagRef}
286
+ vrRef={vrRef}
287
+ keywordRef={keywordRef}
288
+ valueRef={valueRef}
289
+ />
290
+ <div
291
+ className="border-background bg-background relative m-auto border-2"
292
+ style={{ height: '32rem' }}
293
+ >
294
+ {isHeaderRendered() && (
295
+ <List
296
+ ref={listRef}
297
+ height={500}
298
+ itemCount={visibleRows.length}
299
+ itemSize={getItemSize(visibleRows)}
300
+ width={'100%'}
301
+ className="ohif-scrollbar text-foreground"
302
+ >
303
+ {getRowComponent({ rows: visibleRows })}
304
+ </List>
305
+ )}
306
+ </div>
307
+ </div>
308
+ );
309
+ }
310
+
311
+ export default React.memo(DicomTagTable);
@@ -0,0 +1,45 @@
1
+ export default function (wadoRoot, getAuthrorizationHeader) {
2
+ return {
3
+ series: (StudyInstanceUID, SeriesInstanceUID) => {
4
+ return new Promise((resolve, reject) => {
5
+ // Reject because of Quality. (Seems the most sensible out of the options)
6
+ const CodeValueAndCodeSchemeDesignator = `113001%5EDCM`;
7
+
8
+ const url = `${wadoRoot}/studies/${StudyInstanceUID}/series/${SeriesInstanceUID}/reject/${CodeValueAndCodeSchemeDesignator}`;
9
+
10
+ const xhr = new XMLHttpRequest();
11
+ xhr.open('POST', url, true);
12
+
13
+ const headers = getAuthrorizationHeader();
14
+
15
+ for (const key in headers) {
16
+ xhr.setRequestHeader(key, headers[key]);
17
+ }
18
+
19
+ //Send the proper header information along with the request
20
+ // TODO -> Auth when we re-add authorization.
21
+
22
+ console.log(xhr);
23
+
24
+ xhr.onreadystatechange = function () {
25
+ //Call a function when the state changes.
26
+ if (xhr.readyState == 4) {
27
+ switch (xhr.status) {
28
+ case 200:
29
+ case 204:
30
+ resolve(xhr.responseText);
31
+
32
+ break;
33
+ case 404:
34
+ reject('Your dataSource does not support reject functionality');
35
+ default:
36
+ reject(`Unexpected status code: ${xhr.status}`);
37
+ break;
38
+ }
39
+ }
40
+ };
41
+ xhr.send();
42
+ });
43
+ },
44
+ };
45
+ }
@@ -0,0 +1,280 @@
1
+ export default [
2
+ {
3
+ '00080005': { vr: 'CS', Value: ['ISO_IR 100'] },
4
+ '00080008': { vr: 'CS', Value: ['ORIGINAL', 'PRIMARY', 'LOCALIZER'] },
5
+ '00080016': { vr: 'UI', Value: ['1.2.840.10008.5.1.4.1.1.2'] },
6
+ '00080018': {
7
+ vr: 'UI',
8
+ Value: ['1.3.6.1.4.1.25403.345050719074.3824.20170126082902.6'],
9
+ },
10
+ '00080020': { vr: 'DA', Value: ['20141125'] },
11
+ '00080021': { vr: 'DA', Value: ['20141125'] },
12
+ '00080022': { vr: 'DA', Value: ['20141125'] },
13
+ '00080023': { vr: 'DA', Value: ['20141125'] },
14
+ '00080030': { vr: 'TM', Value: ['094528.000'] },
15
+ '00080031': { vr: 'TM', Value: ['094604.688'] },
16
+ '00080032': { vr: 'TM', Value: ['094623.600'] },
17
+ '00080033': { vr: 'TM', Value: ['094623.600'] },
18
+ '00080050': { vr: 'SH', Value: ['000092218'] },
19
+ '00080060': { vr: 'CS', Value: ['CT'] },
20
+ '00080070': { vr: 'LO', Value: ['TOSHIBA'] },
21
+ '00080080': { vr: 'LO', Value: ['Precision Imaging Metrics'] },
22
+ '00080090': { vr: 'PN' },
23
+ '00081010': { vr: 'SH' },
24
+ '00081030': { vr: 'LO', Value: ['DFCI CT CHEST W CONTRAST 6023'] },
25
+ '00081032': {
26
+ vr: 'SQ',
27
+ Value: [
28
+ {
29
+ '00080100': { vr: 'SH', Value: ['6023'] },
30
+ '00080102': { vr: 'SH', Value: ['GEIIS'] },
31
+ '00080103': { vr: 'SH', Value: ['0'] },
32
+ '00080104': { vr: 'LO', Value: ['DFCI CT CHEST W CONTRAST 6023'] },
33
+ },
34
+ ],
35
+ },
36
+ '0008103E': { vr: 'LO', Value: ['2.0'] },
37
+ '00081040': { vr: 'LO' },
38
+ '00081070': { vr: 'PN' },
39
+ '00081090': { vr: 'LO', Value: ['Aquilion'] },
40
+ '00081110': {
41
+ vr: 'SQ',
42
+ Value: [
43
+ {
44
+ '00081150': { vr: 'UI', Value: ['1.2.840.100008.3.1.2.3.1'] },
45
+ '00081155': {
46
+ vr: 'UI',
47
+ Value: ['1.3.6.1.4.1.25403.345050719074.3824.20170126082902.4'],
48
+ },
49
+ },
50
+ ],
51
+ },
52
+ '00100010': { vr: 'PN', Value: [{ Alphabetic: 'Venus' }] },
53
+ '00100020': { vr: 'LO', Value: ['0000005'] },
54
+ '00100021': { vr: 'LO', Value: ['001R74:20050625:205502036:195212'] },
55
+ '00100030': { vr: 'DA' },
56
+ '00100040': { vr: 'CS', Value: ['F'] },
57
+ '00101000': { vr: 'LO' },
58
+ '00101010': { vr: 'AS' },
59
+ '00101020': { vr: 'DS' },
60
+ '00101030': { vr: 'DS' },
61
+ '00104000': { vr: 'LT' },
62
+ '00180015': { vr: 'CS', Value: ['CHEST_TO_PELVIS'] },
63
+ '00180022': { vr: 'CS', Value: ['SCANOSCOPE'] },
64
+ '00180050': { vr: 'DS', Value: [2.0] },
65
+ '00180060': { vr: 'DS', Value: [120.0] },
66
+ '00180090': { vr: 'DS', Value: [1000.0] },
67
+ '00181000': { vr: 'LO' },
68
+ '00181020': { vr: 'LO', Value: ['V4.86ER003'] },
69
+ '00181030': { vr: 'LO', Value: ['Chest / Abdomen/Pelvis 5mm'] },
70
+ '00181100': { vr: 'DS', Value: [1000.0] },
71
+ '00181120': { vr: 'DS', Value: [0.0] },
72
+ '00181130': { vr: 'DS', Value: [102.0] },
73
+ '00181140': { vr: 'CS', Value: ['CW'] },
74
+ '00181150': { vr: 'IS', Value: [6840] },
75
+ '00181151': { vr: 'IS', Value: [100] },
76
+ '00181152': { vr: 'IS', Value: [600] },
77
+ '00181160': { vr: 'SH', Value: ['LARGE'] },
78
+ '00181170': { vr: 'IS', Value: [12] },
79
+ '00181190': { vr: 'DS', Value: [1.6, 1.4] },
80
+ '00181210': { vr: 'SH', Value: ['FL03'] },
81
+ '00185100': { vr: 'CS', Value: ['FFS'] },
82
+ '0020000D': {
83
+ vr: 'UI',
84
+ Value: ['1.3.6.1.4.1.25403.345050719074.3824.20170126082902.1'],
85
+ },
86
+ '0020000E': {
87
+ vr: 'UI',
88
+ Value: ['1.3.6.1.4.1.25403.345050719074.3824.20170126082902.2'],
89
+ },
90
+ '00200010': { vr: 'SH' },
91
+ '00200011': { vr: 'IS', Value: [1] },
92
+ '00200012': { vr: 'IS', Value: [2] },
93
+ '00200013': { vr: 'IS', Value: [2] },
94
+ '00200020': { vr: 'CS', Value: ['F', 'P'] },
95
+ '00200032': { vr: 'DS', Value: [-1.7e-4, -512.0, 1925.0] },
96
+ '00200037': { vr: 'DS', Value: [0.0, 0.0, -1.0, 0.0, 1.0, -0.0] },
97
+ '00200052': {
98
+ vr: 'UI',
99
+ Value: ['1.3.6.1.4.1.25403.345050719074.3824.20170126082902.5'],
100
+ },
101
+ '00201040': { vr: 'LO' },
102
+ '00201041': { vr: 'DS', Value: [342.0] },
103
+ '00280002': { vr: 'US', Value: [1] },
104
+ '00280004': { vr: 'CS', Value: ['MONOCHROME2'] },
105
+ '00280010': { vr: 'US', Value: [512] },
106
+ '00280011': { vr: 'US', Value: [512] },
107
+ '00280030': { vr: 'DS', Value: [2.0, 2.0] },
108
+ '00280100': { vr: 'US', Value: [16] },
109
+ '00280101': { vr: 'US', Value: [16] },
110
+ '00280102': { vr: 'US', Value: [15] },
111
+ '00280103': { vr: 'US', Value: [1] },
112
+ '00281050': { vr: 'DS', Value: [110.0] },
113
+ '00281051': { vr: 'DS', Value: [320.0] },
114
+ '00281052': { vr: 'DS', Value: [0.0] },
115
+ '00281053': { vr: 'DS', Value: [1.0] },
116
+ '00321033': { vr: 'LO', Value: ['OUTDFRAD'] },
117
+ '00400002': { vr: 'DA', Value: ['20141125'] },
118
+ '00400003': { vr: 'TM', Value: ['091000'] },
119
+ '00400004': { vr: 'DA', Value: ['20141125'] },
120
+ '00400005': { vr: 'TM', Value: ['094000.000'] },
121
+ '00400244': { vr: 'DA', Value: ['20141125'] },
122
+ '00400245': { vr: 'TM', Value: ['094528.000'] },
123
+ '00400253': { vr: 'SH', Value: ['3708'] },
124
+ '00400260': {
125
+ vr: 'SQ',
126
+ Value: [
127
+ {
128
+ '00080100': { vr: 'SH', Value: ['6035'] },
129
+ '00080102': { vr: 'SH', Value: ['CCG_CSTemp'] },
130
+ '00080104': { vr: 'LO', Value: ['6035/DFCT2 CT 3-SITES W/OC'] },
131
+ },
132
+ ],
133
+ },
134
+ '00402017': { vr: 'LO', Value: ['14159097'] },
135
+ '7FE00010': {
136
+ vr: 'OW',
137
+ BulkDataURI:
138
+ 'http://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs/studies/1.3.6.1.4.1.25403.345050719074.3824.20170126082902.1/series/1.3.6.1.4.1.25403.345050719074.3824.20170126082902.2/instances/1.3.6.1.4.1.25403.345050719074.3824.20170126082902.6',
139
+ },
140
+ },
141
+ {
142
+ '00080005': { vr: 'CS', Value: ['ISO_IR 100'] },
143
+ '00080008': { vr: 'CS', Value: ['ORIGINAL', 'PRIMARY', 'LOCALIZER'] },
144
+ '00080016': { vr: 'UI', Value: ['1.2.840.10008.5.1.4.1.1.2'] },
145
+ '00080018': {
146
+ vr: 'UI',
147
+ Value: ['1.3.6.1.4.1.25403.345050719074.3824.20170126082902.3'],
148
+ },
149
+ '00080020': { vr: 'DA', Value: ['20141125'] },
150
+ '00080021': { vr: 'DA', Value: ['20141125'] },
151
+ '00080022': { vr: 'DA', Value: ['20141125'] },
152
+ '00080023': { vr: 'DA', Value: ['20141125'] },
153
+ '00080030': { vr: 'TM', Value: ['094528.000'] },
154
+ '00080031': { vr: 'TM', Value: ['094604.688'] },
155
+ '00080032': { vr: 'TM', Value: ['094557.250'] },
156
+ '00080033': { vr: 'TM', Value: ['094557.250'] },
157
+ '00080050': { vr: 'SH', Value: ['000092218'] },
158
+ '00080060': { vr: 'CS', Value: ['CT'] },
159
+ '00080070': { vr: 'LO', Value: ['TOSHIBA'] },
160
+ '00080080': { vr: 'LO', Value: ['Precision Imaging Metrics'] },
161
+ '00080090': { vr: 'PN' },
162
+ '00081010': { vr: 'SH' },
163
+ '00081030': { vr: 'LO', Value: ['DFCI CT CHEST W CONTRAST 6023'] },
164
+ '00081032': {
165
+ vr: 'SQ',
166
+ Value: [
167
+ {
168
+ '00080100': { vr: 'SH', Value: ['6023'] },
169
+ '00080102': { vr: 'SH', Value: ['GEIIS'] },
170
+ '00080103': { vr: 'SH', Value: ['0'] },
171
+ '00080104': { vr: 'LO', Value: ['DFCI CT CHEST W CONTRAST 6023'] },
172
+ },
173
+ ],
174
+ },
175
+ '0008103E': { vr: 'LO', Value: ['2.0'] },
176
+ '00081040': { vr: 'LO' },
177
+ '00081070': { vr: 'PN' },
178
+ '00081090': { vr: 'LO', Value: ['Aquilion'] },
179
+ '00081110': {
180
+ vr: 'SQ',
181
+ Value: [
182
+ {
183
+ '00081150': { vr: 'UI', Value: ['1.2.840.100008.3.1.2.3.1'] },
184
+ '00081155': {
185
+ vr: 'UI',
186
+ Value: ['1.3.6.1.4.1.25403.345050719074.3824.20170126082902.4'],
187
+ },
188
+ },
189
+ ],
190
+ },
191
+ '00100010': { vr: 'PN', Value: [{ Alphabetic: 'Venus' }] },
192
+ '00100020': { vr: 'LO', Value: ['0000005'] },
193
+ '00100021': { vr: 'LO', Value: ['001R74:20050625:205502036:195212'] },
194
+ '00100030': { vr: 'DA' },
195
+ '00100040': { vr: 'CS', Value: ['F'] },
196
+ '00101000': { vr: 'LO' },
197
+ '00101010': { vr: 'AS' },
198
+ '00101020': { vr: 'DS' },
199
+ '00101030': { vr: 'DS' },
200
+ '00104000': { vr: 'LT' },
201
+ '00180015': { vr: 'CS', Value: ['CHEST_TO_PELVIS'] },
202
+ '00180022': { vr: 'CS', Value: ['SCANOSCOPE'] },
203
+ '00180050': { vr: 'DS', Value: [2.0] },
204
+ '00180060': { vr: 'DS', Value: [120.0] },
205
+ '00180090': { vr: 'DS', Value: [1000.0] },
206
+ '00181000': { vr: 'LO' },
207
+ '00181020': { vr: 'LO', Value: ['V4.86ER003'] },
208
+ '00181030': { vr: 'LO', Value: ['Chest / Abdomen/Pelvis 5mm'] },
209
+ '00181100': { vr: 'DS', Value: [1000.0] },
210
+ '00181120': { vr: 'DS', Value: [0.0] },
211
+ '00181130': { vr: 'DS', Value: [102.0] },
212
+ '00181140': { vr: 'CS', Value: ['CW'] },
213
+ '00181150': { vr: 'IS', Value: [6857] },
214
+ '00181151': { vr: 'IS', Value: [50] },
215
+ '00181152': { vr: 'IS', Value: [300] },
216
+ '00181160': { vr: 'SH', Value: ['LARGE'] },
217
+ '00181170': { vr: 'IS', Value: [6] },
218
+ '00181190': { vr: 'DS', Value: [1.6, 1.4] },
219
+ '00181210': { vr: 'SH', Value: ['FL03'] },
220
+ '00185100': { vr: 'CS', Value: ['FFS'] },
221
+ '0020000D': {
222
+ vr: 'UI',
223
+ Value: ['1.3.6.1.4.1.25403.345050719074.3824.20170126082902.1'],
224
+ },
225
+ '0020000E': {
226
+ vr: 'UI',
227
+ Value: ['1.3.6.1.4.1.25403.345050719074.3824.20170126082902.2'],
228
+ },
229
+ '00200010': { vr: 'SH' },
230
+ '00200011': { vr: 'IS', Value: [1] },
231
+ '00200012': { vr: 'IS', Value: [1] },
232
+ '00200013': { vr: 'IS', Value: [1] },
233
+ '00200020': { vr: 'CS', Value: ['L', 'F'] },
234
+ '00200032': { vr: 'DS', Value: [-512.0, 1.7e-4, 1925.0] },
235
+ '00200037': { vr: 'DS', Value: [1.0, 0.0, 0.0, 0.0, 0.0, -1.0] },
236
+ '00200052': {
237
+ vr: 'UI',
238
+ Value: ['1.3.6.1.4.1.25403.345050719074.3824.20170126082902.5'],
239
+ },
240
+ '00201040': { vr: 'LO' },
241
+ '00201041': { vr: 'DS', Value: [342.0] },
242
+ '00280002': { vr: 'US', Value: [1] },
243
+ '00280004': { vr: 'CS', Value: ['MONOCHROME2'] },
244
+ '00280010': { vr: 'US', Value: [512] },
245
+ '00280011': { vr: 'US', Value: [512] },
246
+ '00280030': { vr: 'DS', Value: [2.0, 2.0] },
247
+ '00280100': { vr: 'US', Value: [16] },
248
+ '00280101': { vr: 'US', Value: [16] },
249
+ '00280102': { vr: 'US', Value: [15] },
250
+ '00280103': { vr: 'US', Value: [1] },
251
+ '00281050': { vr: 'DS', Value: [100.0] },
252
+ '00281051': { vr: 'DS', Value: [230.0] },
253
+ '00281052': { vr: 'DS', Value: [0.0] },
254
+ '00281053': { vr: 'DS', Value: [1.0] },
255
+ '00321033': { vr: 'LO', Value: ['OUTDFRAD'] },
256
+ '00400002': { vr: 'DA', Value: ['20141125'] },
257
+ '00400003': { vr: 'TM', Value: ['091000'] },
258
+ '00400004': { vr: 'DA', Value: ['20141125'] },
259
+ '00400005': { vr: 'TM', Value: ['094000.000'] },
260
+ '00400244': { vr: 'DA', Value: ['20141125'] },
261
+ '00400245': { vr: 'TM', Value: ['094528.000'] },
262
+ '00400253': { vr: 'SH', Value: ['3708'] },
263
+ '00400260': {
264
+ vr: 'SQ',
265
+ Value: [
266
+ {
267
+ '00080100': { vr: 'SH', Value: ['6035'] },
268
+ '00080102': { vr: 'SH', Value: ['CCG_CSTemp'] },
269
+ '00080104': { vr: 'LO', Value: ['6035/DFCT2 CT 3-SITES W/OC'] },
270
+ },
271
+ ],
272
+ },
273
+ '00402017': { vr: 'LO', Value: ['14159097'] },
274
+ '7FE00010': {
275
+ vr: 'OW',
276
+ BulkDataURI:
277
+ 'http://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs/studies/1.3.6.1.4.1.25403.345050719074.3824.20170126082902.1/series/1.3.6.1.4.1.25403.345050719074.3824.20170126082902.2/instances/1.3.6.1.4.1.25403.345050719074.3824.20170126082902.3',
278
+ },
279
+ },
280
+ ];