@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,202 @@
1
+ import {
2
+ RCC,
3
+ RMLO,
4
+ LCC,
5
+ LMLO,
6
+ RCCPrior,
7
+ LCCPrior,
8
+ RMLOPrior,
9
+ LMLOPrior,
10
+ } from './utils/mammoDisplaySetSelector';
11
+ import i18n from 'i18next';
12
+
13
+ const rightDisplayArea = {
14
+ storeAsInitialCamera: true,
15
+ imageArea: [0.8, 0.8],
16
+ imageCanvasPoint: {
17
+ imagePoint: [0, 0.5],
18
+ canvasPoint: [0, 0.5],
19
+ },
20
+ };
21
+
22
+ const leftDisplayArea = {
23
+ storeAsInitialCamera: true,
24
+ imageArea: [0.8, 0.8],
25
+ imageCanvasPoint: {
26
+ imagePoint: [1, 0.5],
27
+ canvasPoint: [1, 0.5],
28
+ },
29
+ };
30
+
31
+ const hpMammography = {
32
+ id: '@ohif/hpMammo',
33
+ hasUpdatedPriorsInformation: false,
34
+ name: i18n.t('Hps:Mammography Breast Screening'),
35
+ protocolMatchingRules: [
36
+ {
37
+ id: 'Mammography',
38
+ weight: 150,
39
+ attribute: 'ModalitiesInStudy',
40
+ constraint: {
41
+ contains: 'MG',
42
+ },
43
+ required: true,
44
+ },
45
+ {
46
+ id: 'numberOfImages',
47
+ attribute: 'numberOfDisplaySetsWithImages',
48
+ constraint: {
49
+ greaterThanOrEqual: 2,
50
+ },
51
+ required: true,
52
+ },
53
+ ],
54
+ toolGroupIds: ['default'],
55
+ displaySetSelectors: {
56
+ RCC,
57
+ LCC,
58
+ RMLO,
59
+ LMLO,
60
+ RCCPrior,
61
+ LCCPrior,
62
+ RMLOPrior,
63
+ LMLOPrior,
64
+ },
65
+
66
+ stages: [
67
+ {
68
+ name: 'CC/MLO',
69
+ viewportStructure: {
70
+ type: 'grid',
71
+ layoutType: 'grid',
72
+ properties: {
73
+ rows: 2,
74
+ columns: 2,
75
+ },
76
+ },
77
+ viewports: [
78
+ {
79
+ viewportOptions: {
80
+ toolGroupId: 'default',
81
+ displayArea: leftDisplayArea,
82
+ // flipHorizontal: true,
83
+ // rotation: 180,
84
+ allowUnmatchedView: true,
85
+ },
86
+ displaySets: [
87
+ {
88
+ id: 'RCC',
89
+ },
90
+ ],
91
+ },
92
+ {
93
+ viewportOptions: {
94
+ toolGroupId: 'default',
95
+ // flipHorizontal: true,
96
+ displayArea: rightDisplayArea,
97
+ allowUnmatchedView: true,
98
+ },
99
+ displaySets: [
100
+ {
101
+ id: 'LCC',
102
+ },
103
+ ],
104
+ },
105
+ {
106
+ viewportOptions: {
107
+ toolGroupId: 'default',
108
+ displayArea: leftDisplayArea,
109
+ // rotation: 180,
110
+ // flipHorizontal: true,
111
+ allowUnmatchedView: true,
112
+ },
113
+ displaySets: [
114
+ {
115
+ id: 'RMLO',
116
+ },
117
+ ],
118
+ },
119
+ {
120
+ viewportOptions: {
121
+ toolGroupId: 'default',
122
+ displayArea: rightDisplayArea,
123
+ // flipHorizontal: true,
124
+ allowUnmatchedView: true,
125
+ },
126
+ displaySets: [
127
+ {
128
+ id: 'LMLO',
129
+ },
130
+ ],
131
+ },
132
+ ],
133
+ },
134
+
135
+ // Compare CC current/prior top/bottom
136
+ {
137
+ name: 'CC compare',
138
+ viewportStructure: {
139
+ type: 'grid',
140
+ layoutType: 'grid',
141
+ properties: {
142
+ rows: 2,
143
+ columns: 2,
144
+ },
145
+ },
146
+ viewports: [
147
+ {
148
+ viewportOptions: {
149
+ toolGroupId: 'default',
150
+ displayArea: leftDisplayArea,
151
+ flipHorizontal: true,
152
+ rotation: 180,
153
+ },
154
+ displaySets: [
155
+ {
156
+ id: 'RCC',
157
+ },
158
+ ],
159
+ },
160
+ {
161
+ viewportOptions: {
162
+ toolGroupId: 'default',
163
+ flipHorizontal: true,
164
+ displayArea: rightDisplayArea,
165
+ },
166
+ displaySets: [
167
+ {
168
+ id: 'LCC',
169
+ },
170
+ ],
171
+ },
172
+ {
173
+ viewportOptions: {
174
+ toolGroupId: 'default',
175
+ displayArea: leftDisplayArea,
176
+ flipHorizontal: true,
177
+ },
178
+ displaySets: [
179
+ {
180
+ id: 'RCCPrior',
181
+ },
182
+ ],
183
+ },
184
+ {
185
+ viewportOptions: {
186
+ toolGroupId: 'default',
187
+ displayArea: rightDisplayArea,
188
+ },
189
+ displaySets: [
190
+ {
191
+ id: 'LCCPrior',
192
+ },
193
+ ],
194
+ },
195
+ ],
196
+ },
197
+ ],
198
+ // Indicates it is prior aware, but will work with no priors
199
+ numberOfPriorsReferenced: 0,
200
+ };
201
+
202
+ export default hpMammography;
@@ -0,0 +1,132 @@
1
+ import { Types } from '@ohif/core';
2
+
3
+ const displayAreaScale1: Types.HangingProtocol.DisplayArea = {
4
+ type: 'SCALE',
5
+ scale: 1,
6
+ storeAsInitialCamera: true,
7
+ };
8
+ const displayAreaScale15: Types.HangingProtocol.DisplayArea = { ...displayAreaScale1, scale: 15 };
9
+
10
+ /**
11
+ * This hanging protocol can be activated on the primary mode by directly
12
+ * referencing it in a URL or by directly including it within a mode, e.g.:
13
+ * `&hangingProtocolId=@ohif/mnGrid` added to the viewer URL
14
+ * It is not included in the viewer mode by default.
15
+ */
16
+ const hpScale: Types.HangingProtocol.Protocol = {
17
+ id: '@ohif/hpScale',
18
+ description: 'Has various hanging protocol grid layouts',
19
+ name: 'Scale Images',
20
+ protocolMatchingRules: [
21
+ {
22
+ id: 'OneOrMoreSeries',
23
+ weight: 25,
24
+ attribute: 'numberOfDisplaySetsWithImages',
25
+ constraint: {
26
+ greaterThan: 0,
27
+ },
28
+ },
29
+ ],
30
+ toolGroupIds: ['default'],
31
+ displaySetSelectors: {
32
+ defaultDisplaySetId: {
33
+ seriesMatchingRules: [
34
+ {
35
+ weight: 1,
36
+ attribute: 'numImageFrames',
37
+ constraint: {
38
+ greaterThanOrEqual: { value: 0 },
39
+ },
40
+ required: true,
41
+ },
42
+ // This display set will select the specified items by preference
43
+ // It has no affect if nothing is specified in the URL.
44
+ {
45
+ attribute: 'isDisplaySetFromUrl',
46
+ weight: 20,
47
+ constraint: {
48
+ equals: true,
49
+ },
50
+ },
51
+ ],
52
+ },
53
+ },
54
+ defaultViewport: {
55
+ viewportOptions: {
56
+ viewportType: 'stack',
57
+ toolGroupId: 'default',
58
+ displayArea: displayAreaScale1,
59
+ allowUnmatchedView: true,
60
+ },
61
+ displaySets: [
62
+ {
63
+ id: 'defaultDisplaySetId',
64
+ matchedDisplaySetsIndex: -1,
65
+ },
66
+ ],
67
+ },
68
+ stages: [
69
+ // A 1x1 stage - should be automatically activated if there is only 1 viewable instance
70
+ {
71
+ name: 'Scale 1:1',
72
+ stageActivation: {
73
+ enabled: {
74
+ minViewportsMatched: 1,
75
+ },
76
+ },
77
+ viewportStructure: {
78
+ layoutType: 'grid',
79
+ properties: {
80
+ rows: 1,
81
+ columns: 1,
82
+ },
83
+ },
84
+ viewports: [
85
+ {
86
+ viewportOptions: {
87
+ toolGroupId: 'default',
88
+ allowUnmatchedView: true,
89
+ displayArea: displayAreaScale1,
90
+ },
91
+ displaySets: [
92
+ {
93
+ id: 'defaultDisplaySetId',
94
+ },
95
+ ],
96
+ },
97
+ ],
98
+ },
99
+ {
100
+ name: 'Scale 1:15',
101
+ stageActivation: {
102
+ enabled: {
103
+ minViewportsMatched: 1,
104
+ },
105
+ },
106
+ viewportStructure: {
107
+ layoutType: 'grid',
108
+ properties: {
109
+ rows: 1,
110
+ columns: 1,
111
+ },
112
+ },
113
+ viewports: [
114
+ {
115
+ viewportOptions: {
116
+ toolGroupId: 'default',
117
+ allowUnmatchedView: true,
118
+ displayArea: displayAreaScale15,
119
+ },
120
+ displaySets: [
121
+ {
122
+ id: 'defaultDisplaySetId',
123
+ },
124
+ ],
125
+ },
126
+ ],
127
+ },
128
+ ],
129
+ numberOfPriorsReferenced: -1,
130
+ };
131
+
132
+ export default hpScale;
@@ -0,0 +1,16 @@
1
+ import viewCodeAttribute from './utils/viewCode';
2
+ import lateralityAttribute from './utils/laterality';
3
+ import registerHangingProtocolAttributes from './utils/registerHangingProtocolAttributes';
4
+ import hpMammography from './hpMammo';
5
+ import hpMNGrid from './hpMNGrid';
6
+ import hpCompare from './hpCompare';
7
+ export * from './hpMNGrid';
8
+
9
+ export {
10
+ viewCodeAttribute,
11
+ lateralityAttribute,
12
+ hpMammography as hpMammo,
13
+ hpMNGrid,
14
+ hpCompare,
15
+ registerHangingProtocolAttributes,
16
+ };
@@ -0,0 +1,73 @@
1
+ import { HPMatcher } from '@ohif/core/src/services/HangingProtocolService/HPMatcher';
2
+ import { RMLO } from './utils/mammoDisplaySetSelector';
3
+ import { seriesViewable, seriesWithImages } from './utils/seriesSelectors';
4
+ import { studyWithImages } from './utils/studySelectors';
5
+
6
+ const match = (displaySet, rules) => HPMatcher.match(displaySet, rules, {}, {});
7
+
8
+ // A stack display set has SeriesDescription '' when the instance has none, and no
9
+ // PatientOrientation, so the rules read PatientOrientation from the first instance.
10
+ describe('hanging protocol matches with a missing text value', () => {
11
+ const rightMlo = (patientOrientation?) => ({
12
+ ViewCode: 'SCT:399368009',
13
+ SeriesDescription: '',
14
+ instances: [{ PatientOrientation: patientOrientation }],
15
+ });
16
+
17
+ it('hpMammo RMLO accepts a display set with an empty SeriesDescription', () => {
18
+ expect(match(rightMlo(['A', 'FR']), RMLO.seriesMatchingRules).requiredFailed).toBe(false);
19
+ });
20
+
21
+ it('hpMammo RMLO accepts an instance with no PatientOrientation', () => {
22
+ expect(match(rightMlo(), RMLO.seriesMatchingRules).requiredFailed).toBe(false);
23
+ expect(match(rightMlo(null), RMLO.seriesMatchingRules).requiredFailed).toBe(false);
24
+ });
25
+
26
+ it('hpMammo RMLO still rejects a CC series description', () => {
27
+ const result = match(
28
+ { ...rightMlo(['A', 'FR']), SeriesDescription: 'R CC' },
29
+ RMLO.seriesMatchingRules
30
+ );
31
+ expect(result.requiredFailed).toBe(true);
32
+ });
33
+
34
+ // The ptDisplaySet rules of the tmtv protocol (extensions/tmtv), which has no jest project.
35
+ const ptRules = [
36
+ { attribute: 'Modality', constraint: { equals: 'PT' }, required: true },
37
+ { attribute: 'SeriesDescription', constraint: { contains: 'Corrected' } },
38
+ {
39
+ weight: 2,
40
+ attribute: 'SeriesDescription',
41
+ constraint: { doesNotContain: { value: 'Uncorrected' } },
42
+ },
43
+ ];
44
+ const ptScore = seriesDescription =>
45
+ match({ Modality: 'PT', SeriesDescription: seriesDescription }, ptRules).score;
46
+
47
+ it('the copied tmtv PT rule scores a PT with no description as one with no correction named', () => {
48
+ expect(ptScore('')).toBe(ptScore('PET WB'));
49
+ expect(ptScore(undefined)).toBe(ptScore('PET WB'));
50
+ expect(ptScore('PET WB')).toBeGreaterThan(ptScore('PET Uncorrected'));
51
+ expect(ptScore('PET Attenuation Corrected')).toBeGreaterThan(ptScore('PET WB'));
52
+ });
53
+ });
54
+
55
+ describe('hanging protocol matches with a numeric string', () => {
56
+ it('seriesWithImages accepts numImageFrames as text, as a number', () => {
57
+ expect(match({ numImageFrames: '30' }, seriesWithImages).requiredFailed).toBe(false);
58
+ expect(match({ numImageFrames: 30 }, seriesWithImages).requiredFailed).toBe(false);
59
+ });
60
+ });
61
+
62
+ describe('hanging protocol matches with 0 image frames or 0 display sets', () => {
63
+ it('seriesViewable, not seriesWithImages, accepts a whole slide display set with 0 image frames', () => {
64
+ expect(match({ numImageFrames: 0 }, seriesViewable).requiredFailed).toBe(false);
65
+ expect(match({ numImageFrames: 0 }, seriesWithImages).requiredFailed).toBe(true);
66
+ });
67
+
68
+ it('studyWithImages gives no OneOrMoreSeries weight to a study with 0 display sets with images', () => {
69
+ const none = match({ numberOfDisplaySetsWithImages: 0 }, studyWithImages).score;
70
+ const one = match({ numberOfDisplaySetsWithImages: 1 }, studyWithImages).score;
71
+ expect(none).toBeLessThan(one);
72
+ });
73
+ });
@@ -0,0 +1,19 @@
1
+ import { utils } from '@ohif/core';
2
+
3
+ const { getLatestInstanceDateTimeSortKey } = utils;
4
+
5
+ const sortKey = displaySet => getLatestInstanceDateTimeSortKey(displaySet.instance ?? displaySet);
6
+
7
+ /**
8
+ * True when no other display set of the study with the same Modality is newer,
9
+ * by the date/time of the instance that each display set shows. A protocol
10
+ * gives this a weight to put the newest display set first, because display
11
+ * sets with the same score otherwise sort by SeriesNumber.
12
+ */
13
+ export default function isNewestOfModality(displaySet, options): boolean {
14
+ const key = sortKey(displaySet);
15
+ return !options?.displaySets?.some(
16
+ other =>
17
+ other !== displaySet && other.Modality === displaySet.Modality && sortKey(other) > key
18
+ );
19
+ }
@@ -0,0 +1,9 @@
1
+ export default displaySet => {
2
+ const frameAnatomy =
3
+ displaySet?.images?.[0]?.SharedFunctionalGroupsSequence?.[0]?.FrameAnatomySequence?.[0];
4
+ if (!frameAnatomy) {
5
+ return undefined;
6
+ }
7
+ const laterality = frameAnatomy?.FrameLaterality;
8
+ return laterality;
9
+ };
@@ -0,0 +1,214 @@
1
+ const priorStudyMatchingRules = [
2
+ {
3
+ // The priorInstance is a study counter that indicates what position this study is in
4
+ // and the value comes from the options parameter.
5
+ attribute: 'studyInstanceUIDsIndex',
6
+ from: 'options',
7
+ required: true,
8
+ constraint: {
9
+ equals: { value: 1 },
10
+ },
11
+ },
12
+ ];
13
+
14
+ const currentStudyMatchingRules = [
15
+ {
16
+ // The priorInstance is a study counter that indicates what position this study is in
17
+ // and the value comes from the options parameter.
18
+ attribute: 'studyInstanceUIDsIndex',
19
+ from: 'options',
20
+ required: true,
21
+ constraint: {
22
+ equals: { value: 0 },
23
+ },
24
+ },
25
+ ];
26
+
27
+ const LCCSeriesMatchingRules = [
28
+ {
29
+ weight: 10,
30
+ attribute: 'ViewCode',
31
+ constraint: {
32
+ contains: 'SCT:399162004',
33
+ },
34
+ },
35
+ {
36
+ weight: 5,
37
+ attribute: 'PatientOrientation',
38
+ constraint: {
39
+ contains: 'L',
40
+ },
41
+ },
42
+ {
43
+ weight: 20,
44
+ attribute: 'SeriesDescription',
45
+ constraint: {
46
+ contains: 'L CC',
47
+ },
48
+ },
49
+ ];
50
+
51
+ const RCCSeriesMatchingRules = [
52
+ {
53
+ weight: 10,
54
+ attribute: 'ViewCode',
55
+ constraint: {
56
+ contains: 'SCT:399162004',
57
+ },
58
+ },
59
+ {
60
+ weight: 5,
61
+ attribute: 'PatientOrientation',
62
+ constraint: {
63
+ equals: ['P', 'L'],
64
+ },
65
+ },
66
+ {
67
+ attribute: 'PatientOrientation',
68
+ constraint: {
69
+ doesNotEqual: ['A', 'R'],
70
+ },
71
+ required: true,
72
+ },
73
+ {
74
+ weight: 20,
75
+ attribute: 'SeriesDescription',
76
+ constraint: {
77
+ contains: 'CC',
78
+ },
79
+ },
80
+ ];
81
+
82
+ const LMLOSeriesMatchingRules = [
83
+ {
84
+ weight: 10,
85
+ attribute: 'ViewCode',
86
+ constraint: {
87
+ contains: 'SCT:399368009',
88
+ },
89
+ },
90
+ {
91
+ weight: 0,
92
+ attribute: 'ViewCode',
93
+ constraint: {
94
+ doesNotEqual: 'SCT:399162004',
95
+ },
96
+ required: true,
97
+ },
98
+ {
99
+ weight: 5,
100
+ attribute: 'PatientOrientation',
101
+ constraint: {
102
+ equals: ['A', 'R'],
103
+ },
104
+ },
105
+ {
106
+ weight: 20,
107
+ attribute: 'SeriesDescription',
108
+ constraint: {
109
+ contains: 'L MLO',
110
+ },
111
+ },
112
+ ];
113
+
114
+ const RMLOSeriesMatchingRules = [
115
+ {
116
+ weight: 10,
117
+ attribute: 'ViewCode',
118
+ constraint: {
119
+ contains: 'SCT:399368009',
120
+ },
121
+ },
122
+ {
123
+ attribute: 'ViewCode',
124
+ constraint: {
125
+ doesNotEqual: 'SCT:399162004',
126
+ },
127
+ required: true,
128
+ },
129
+ {
130
+ attribute: 'PatientOrientation',
131
+ constraint: {
132
+ doesNotContain: ['P', 'FL'],
133
+ },
134
+ required: true,
135
+ },
136
+ {
137
+ weight: 5,
138
+ attribute: 'PatientOrientation',
139
+ constraint: {
140
+ equals: ['P', 'L'],
141
+ },
142
+ },
143
+ {
144
+ weight: 5,
145
+ attribute: 'PatientOrientation',
146
+ constraint: {
147
+ equals: ['A', 'FR'],
148
+ },
149
+ },
150
+ {
151
+ weight: 20,
152
+ attribute: 'SeriesDescription',
153
+ constraint: {
154
+ contains: 'R MLO',
155
+ },
156
+ },
157
+ {
158
+ attribute: 'SeriesDescription',
159
+ required: true,
160
+ constraint: {
161
+ doesNotContain: 'CC',
162
+ },
163
+ },
164
+ {
165
+ attribute: 'SeriesDescription',
166
+ required: true,
167
+ constraint: {
168
+ doesNotEqual: 'L MLO',
169
+ },
170
+ required: true,
171
+ },
172
+ ];
173
+
174
+ const RCC = {
175
+ seriesMatchingRules: RCCSeriesMatchingRules,
176
+ studyMatchingRules: currentStudyMatchingRules,
177
+ };
178
+
179
+ const RCCPrior = {
180
+ seriesMatchingRules: RCCSeriesMatchingRules,
181
+ studyMatchingRules: priorStudyMatchingRules,
182
+ };
183
+
184
+ const LCC = {
185
+ seriesMatchingRules: LCCSeriesMatchingRules,
186
+ studyMatchingRules: currentStudyMatchingRules,
187
+ };
188
+
189
+ const LCCPrior = {
190
+ seriesMatchingRules: LCCSeriesMatchingRules,
191
+ studyMatchingRules: priorStudyMatchingRules,
192
+ };
193
+
194
+ const RMLO = {
195
+ seriesMatchingRules: RMLOSeriesMatchingRules,
196
+ studyMatchingRules: currentStudyMatchingRules,
197
+ };
198
+
199
+ const RMLOPrior = {
200
+ seriesMatchingRules: RMLOSeriesMatchingRules,
201
+ studyMatchingRules: priorStudyMatchingRules,
202
+ };
203
+
204
+ const LMLO = {
205
+ seriesMatchingRules: LMLOSeriesMatchingRules,
206
+ studyMatchingRules: currentStudyMatchingRules,
207
+ };
208
+
209
+ const LMLOPrior = {
210
+ seriesMatchingRules: LMLOSeriesMatchingRules,
211
+ studyMatchingRules: priorStudyMatchingRules,
212
+ };
213
+
214
+ export { RCC, LCC, RMLO, LMLO, RCCPrior, LCCPrior, RMLOPrior, LMLOPrior };
@@ -0,0 +1,14 @@
1
+ import viewCode from './viewCode';
2
+ import laterality from './laterality';
3
+ import isNewestOfModality from './isNewestOfModality';
4
+
5
+ export default function registerHangingProtocolAttributes({ servicesManager }) {
6
+ const { hangingProtocolService } = servicesManager.services;
7
+ hangingProtocolService.addCustomAttribute('ViewCode', 'View Code Designator:Value', viewCode);
8
+ hangingProtocolService.addCustomAttribute('Laterality', 'Laterality of object', laterality);
9
+ hangingProtocolService.addCustomAttribute(
10
+ 'isNewestOfModality',
11
+ 'No newer display set of the same Modality in the study',
12
+ isNewestOfModality
13
+ );
14
+ }