volview 4.0.0

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 (315) hide show
  1. package/.browserslistrc +4 -0
  2. package/.editorconfig +6 -0
  3. package/.env +6 -0
  4. package/.eslintrc.js +109 -0
  5. package/.gitattributes +1 -0
  6. package/.github/workflows/checks.yml +16 -0
  7. package/.github/workflows/publish.yml +52 -0
  8. package/.prettierignore +5 -0
  9. package/CONTRIBUTING.md +29 -0
  10. package/LICENSE +202 -0
  11. package/README.md +44 -0
  12. package/babel.config.js +3 -0
  13. package/documentation/config.js +15 -0
  14. package/documentation/content/KWVolViewLogo.png +0 -0
  15. package/documentation/content/KWVolViewLogo.svg +35 -0
  16. package/documentation/content/VolViewLogo.png +0 -0
  17. package/documentation/content/VolViewLogo.svg +22 -0
  18. package/documentation/content/doc/index.md +64 -0
  19. package/documentation/content/doc/loading_data.md +30 -0
  20. package/documentation/content/doc/mouse_controls.md +34 -0
  21. package/documentation/content/doc/quick_start_guide.md +75 -0
  22. package/documentation/content/doc/rendering.md +27 -0
  23. package/documentation/content/doc/state_files.md +18 -0
  24. package/documentation/content/doc/toolbar.md +20 -0
  25. package/documentation/content/doc/welcome_screen.md +23 -0
  26. package/documentation/content/gallery/01-volview-welcome-notes.jpg +0 -0
  27. package/documentation/content/gallery/01-volview-welcome.jpg +0 -0
  28. package/documentation/content/gallery/02-volview-about.jpg +0 -0
  29. package/documentation/content/gallery/02-volview-notifications.jpg +0 -0
  30. package/documentation/content/gallery/02-volview-settings.jpg +0 -0
  31. package/documentation/content/gallery/03-volview-sample-datasets.jpg +0 -0
  32. package/documentation/content/gallery/04-volview-active-data.jpg +0 -0
  33. package/documentation/content/gallery/05-volview-select-data-to-delete.jpg +0 -0
  34. package/documentation/content/gallery/06-volview-corner-annotation.jpg +0 -0
  35. package/documentation/content/gallery/07-volview-layout-notes.jpg +0 -0
  36. package/documentation/content/gallery/07-volview-layout.jpg +0 -0
  37. package/documentation/content/gallery/09-volview-layout-3DPrimary.jpg +0 -0
  38. package/documentation/content/gallery/10-volview-wl-pan-zoom-notes.jpg +0 -0
  39. package/documentation/content/gallery/10-volview-wl-pan-zoom.jpg +0 -0
  40. package/documentation/content/gallery/11-volview-paint-notes.jpg +0 -0
  41. package/documentation/content/gallery/11-volview-paint.jpg +0 -0
  42. package/documentation/content/gallery/12-volview-paint-options.jpg +0 -0
  43. package/documentation/content/gallery/13-volview-crop-notes.jpg +0 -0
  44. package/documentation/content/gallery/13-volview-crop.jpg +0 -0
  45. package/documentation/content/gallery/14-volview-ruler.jpg +0 -0
  46. package/documentation/content/gallery/15-volview-crosshairs.jpg +0 -0
  47. package/documentation/content/gallery/16-volview-rendering.jpg +0 -0
  48. package/documentation/content/gallery/17-volview-colormap-notes.jpg +0 -0
  49. package/documentation/content/gallery/17-volview-colormap.jpg +0 -0
  50. package/documentation/content/gallery/17-volview-opacity-notes.jpg +0 -0
  51. package/documentation/content/gallery/17-volview-opacity.jpg +0 -0
  52. package/documentation/content/gallery/17-volview-opacity2.jpg +0 -0
  53. package/documentation/content/gallery/18-volview-presets.jpg +0 -0
  54. package/documentation/content/gallery/19-volview-color.jpg +0 -0
  55. package/documentation/content/gallery/19-volview-color2.jpg +0 -0
  56. package/documentation/content/gallery/20-volview-lightfollowcamera0.jpg +0 -0
  57. package/documentation/content/gallery/20-volview-lightfollowcamera1.jpg +0 -0
  58. package/documentation/content/gallery/20-volview-lightfollowcamera2.jpg +0 -0
  59. package/documentation/content/gallery/20-volview-lightfollowcamera3.jpg +0 -0
  60. package/documentation/content/gallery/21-volview-hybrid-final.jpg +0 -0
  61. package/documentation/content/gallery/21-volview-hybrid0.0.jpg +0 -0
  62. package/documentation/content/gallery/21-volview-hybrid0.5.jpg +0 -0
  63. package/documentation/content/gallery/21-volview-hybrid1.0.jpg +0 -0
  64. package/documentation/content/gallery/LocalAmbientOcclusion.jpg +0 -0
  65. package/documentation/content/gallery/Notes.pptx +0 -0
  66. package/documentation/content/gallery/VolView-Overview.jpg +0 -0
  67. package/documentation/content/gallery/index.md +53 -0
  68. package/documentation/content/icon/favicon-16x16.png +0 -0
  69. package/documentation/content/icon/favicon-196x196.png +0 -0
  70. package/documentation/content/icon/favicon-32x32.png +0 -0
  71. package/documentation/content/icon/favicon-96x96.png +0 -0
  72. package/documentation/content/index.pug +43 -0
  73. package/documentation/content/logo.png +0 -0
  74. package/documentation/content/logo.svg +20 -0
  75. package/documentation/data/menu.yml +3 -0
  76. package/documentation/themes/navy/layout/partial/footer.swig +22 -0
  77. package/documentation/tpl/__en__ +31 -0
  78. package/documentation/tpl/__sidebar__ +11 -0
  79. package/package.json +96 -0
  80. package/patches/jsdom-global+3.0.2.patch +12 -0
  81. package/patches/vue-toastification+1.7.14.patch +41 -0
  82. package/patches/vuetify+2.6.10.patch +13 -0
  83. package/prettier.config.js +9 -0
  84. package/public/favicon.ico +0 -0
  85. package/public/global.css +20 -0
  86. package/public/index.html +28 -0
  87. package/public/pvm-sample.png +0 -0
  88. package/server/helper.py +147 -0
  89. package/server/host.js +134 -0
  90. package/server/serialize.js +111 -0
  91. package/server/serialize.py +203 -0
  92. package/server/server.py +84 -0
  93. package/server/test.py +17 -0
  94. package/src/assets/KitwareHeadAndNeck.jpg +0 -0
  95. package/src/assets/logo.png +0 -0
  96. package/src/assets/logo.svg +20 -0
  97. package/src/assets/samples/3DUS-Fetus.jpg +0 -0
  98. package/src/assets/samples/CTA-Head_and_Neck.jpg +0 -0
  99. package/src/assets/samples/MRA-Head_and_Neck.jpg +0 -0
  100. package/src/assets/samples/MRI-Cardiac.jpg +0 -0
  101. package/src/assets/samples/MRI-PROSTATEx.jpg +0 -0
  102. package/src/components/AboutBox.vue +157 -0
  103. package/src/components/AiModule.vue +60 -0
  104. package/src/components/AnnotationsModule.vue +37 -0
  105. package/src/components/App.vue +539 -0
  106. package/src/components/ColorFunctionSlider.vue +181 -0
  107. package/src/components/DataBrowser.vue +173 -0
  108. package/src/components/DragAndDrop.vue +107 -0
  109. package/src/components/GroupableItem.vue +30 -0
  110. package/src/components/ImageDataBrowser.vue +186 -0
  111. package/src/components/ImageListCard.vue +114 -0
  112. package/src/components/ItemGroup.vue +74 -0
  113. package/src/components/LabelmapList.vue +36 -0
  114. package/src/components/LayoutGrid.vue +96 -0
  115. package/src/components/MeasurementsList.vue +134 -0
  116. package/src/components/MessageCenter.vue +189 -0
  117. package/src/components/MessageItem.vue +83 -0
  118. package/src/components/MessageNotificationContent.vue +20 -0
  119. package/src/components/MessageNotifications.vue +84 -0
  120. package/src/components/ModelBrowser.vue +83 -0
  121. package/src/components/ModulePanel.vue +137 -0
  122. package/src/components/PaintControls.vue +174 -0
  123. package/src/components/PatientBrowser.vue +280 -0
  124. package/src/components/PatientStudyVolumeBrowser.vue +325 -0
  125. package/src/components/RenderingModule.vue +49 -0
  126. package/src/components/ResizableNavDrawer.vue +158 -0
  127. package/src/components/SampleDataBrowser.vue +198 -0
  128. package/src/components/SaveSession.vue +57 -0
  129. package/src/components/Settings.vue +35 -0
  130. package/src/components/SliceSlider.vue +182 -0
  131. package/src/components/SpleenModule.vue +101 -0
  132. package/src/components/ToolButton.vue +58 -0
  133. package/src/components/ToolStrip.vue +186 -0
  134. package/src/components/ViewOverlayGrid.vue +84 -0
  135. package/src/components/VolumePresets.vue +165 -0
  136. package/src/components/VolumeProperties.vue +171 -0
  137. package/src/components/VolumeRendering.vue +365 -0
  138. package/src/components/VtkThreeView.vue +512 -0
  139. package/src/components/VtkTwoView.vue +665 -0
  140. package/src/components/__tests__/ResizableNavDrawer.spec.js +32 -0
  141. package/src/components/__tests__/ToolButton.spec.js +46 -0
  142. package/src/components/icons/KitwareLogoIcon.vue +54 -0
  143. package/src/components/icons/VolViewFullLogo.vue +139 -0
  144. package/src/components/icons/VolViewLogo.vue +78 -0
  145. package/src/components/styles/utils.css +16 -0
  146. package/src/components/styles/vtk-view.css +116 -0
  147. package/src/components/tools/CropTool.vue +61 -0
  148. package/src/components/tools/CrosshairsTool.vue +93 -0
  149. package/src/components/tools/MouseManipulatorTool.vue +108 -0
  150. package/src/components/tools/PaintTool.vue +54 -0
  151. package/src/components/tools/PanTool.vue +35 -0
  152. package/src/components/tools/RulerTool.vue +202 -0
  153. package/src/components/tools/SliceScrollTool.vue +123 -0
  154. package/src/components/tools/WindowLevelTool.vue +191 -0
  155. package/src/components/tools/ZoomTool.vue +35 -0
  156. package/src/components/tools/crop/Crop2D.vue +367 -0
  157. package/src/components/tools/crop/Crop2DLineHandle.vue +103 -0
  158. package/src/components/tools/crop/Crop3D.vue +192 -0
  159. package/src/components/tools/crop/CropControls.vue +38 -0
  160. package/src/components/tools/crop/types.ts +12 -0
  161. package/src/components/tools/crosshairs/CrosshairSVG2D.vue +125 -0
  162. package/src/components/tools/crosshairs/CrosshairsWidget2D.vue +100 -0
  163. package/src/components/tools/paint/PaintWidget2D.vue +192 -0
  164. package/src/components/tools/ruler/RulerSVG2D.vue +181 -0
  165. package/src/components/tools/ruler/RulerWidget2D.vue +154 -0
  166. package/src/composables/__tests__/useDoubleRecord.spec.ts +57 -0
  167. package/src/composables/__tests__/useOrientationLabels.spec.ts +29 -0
  168. package/src/composables/isViewAnimating.ts +25 -0
  169. package/src/composables/manageVTKSubscription.ts +6 -0
  170. package/src/composables/onProxyManagerEvent.ts +50 -0
  171. package/src/composables/proxyManager.ts +13 -0
  172. package/src/composables/sync/__tests__/createPrimitiveSyncContext.spec.ts +41 -0
  173. package/src/composables/sync/__tests__/useWindowingSync.spec.ts +51 -0
  174. package/src/composables/sync/createPrimitiveSyncContext.ts +83 -0
  175. package/src/composables/sync/useWindowingSync.ts +48 -0
  176. package/src/composables/useAppLoadingNotifications.ts +73 -0
  177. package/src/composables/useCameraOrientation.ts +34 -0
  178. package/src/composables/useCurrentImage.ts +74 -0
  179. package/src/composables/useCurrentSlice.ts +43 -0
  180. package/src/composables/useDoubleRecord.ts +77 -0
  181. package/src/composables/useEventListener.ts +26 -0
  182. package/src/composables/useGlobalErrorHook.ts +18 -0
  183. package/src/composables/useMultiSelection.ts +29 -0
  184. package/src/composables/useOrientationLabels.ts +62 -0
  185. package/src/composables/usePanels.ts +42 -0
  186. package/src/composables/usePersistCameraConfig.ts +138 -0
  187. package/src/composables/useResizeObserver.ts +37 -0
  188. package/src/composables/useResizeToFit.ts +50 -0
  189. package/src/composables/useSceneBuilder.ts +96 -0
  190. package/src/composables/useToast.js +11 -0
  191. package/src/composables/useVTKCallback.ts +33 -0
  192. package/src/composables/useVTKWorldToDisplay.ts +141 -0
  193. package/src/composables/useViewProxy.ts +87 -0
  194. package/src/composables/useVolumeThumbnailing.ts +173 -0
  195. package/src/composables/useWebGLWatchdog.ts +32 -0
  196. package/src/composables/useWidgetManager.ts +41 -0
  197. package/src/config.ts +182 -0
  198. package/src/constants.ts +38 -0
  199. package/src/core/id.ts +18 -0
  200. package/src/core/provider.ts +31 -0
  201. package/src/core/proxies.ts +90 -0
  202. package/src/core/thumbnailers/__tests__/vtk-image.spec.ts +58 -0
  203. package/src/core/thumbnailers/index.ts +5 -0
  204. package/src/core/thumbnailers/volume-thumbnailer.ts +130 -0
  205. package/src/core/thumbnailers/vtk-image.ts +142 -0
  206. package/src/core/tools/__tests__/paint.spec.ts +101 -0
  207. package/src/core/tools/__tests__/ruler.spec.ts +73 -0
  208. package/src/core/tools/paint/brush.ts +20 -0
  209. package/src/core/tools/paint/ellipse-brush.ts +96 -0
  210. package/src/core/tools/paint/index.ts +141 -0
  211. package/src/core/tools/ruler.ts +149 -0
  212. package/src/global.d.ts +24 -0
  213. package/src/io/__tests__/io.spec.ts +26 -0
  214. package/src/io/dicom.ts +187 -0
  215. package/src/io/index.ts +11 -0
  216. package/src/io/io.ts +157 -0
  217. package/src/io/itk/itkConfig.js +8 -0
  218. package/src/io/itk-dicom/dicom.cpp +327 -0
  219. package/src/io/itk-dicom/web-build/dicom.js +16 -0
  220. package/src/io/itk-dicom/web-build/dicom.umd.js +21 -0
  221. package/src/io/itk-dicom/web-build/dicom.umd.wasm +0 -0
  222. package/src/io/itk-dicom/web-build/dicom.wasm +0 -0
  223. package/src/io/manifest.ts +30 -0
  224. package/src/io/readers.ts +36 -0
  225. package/src/io/state-file/index.ts +170 -0
  226. package/src/io/state-file/schema.ts +277 -0
  227. package/src/io/state-file/utils.ts +33 -0
  228. package/src/io/types.ts +4 -0
  229. package/src/io/vtk/async.reader.worker.ts +50 -0
  230. package/src/io/vtk/async.ts +58 -0
  231. package/src/io/vtk/async.writer.worker.ts +46 -0
  232. package/src/io/vtk/common.ts +30 -0
  233. package/src/io/zip.ts +31 -0
  234. package/src/main.js +66 -0
  235. package/src/main.ts +1 -0
  236. package/src/plugins/vuetify.js +25 -0
  237. package/src/shims-itk.d.ts +67 -0
  238. package/src/shims-misc.d.ts +4 -0
  239. package/src/shims-tsx.d.ts +13 -0
  240. package/src/shims-vtk.d.ts +1042 -0
  241. package/src/shims-vue.d.ts +5 -0
  242. package/src/store/__tests__/datasets.spec.ts +75 -0
  243. package/src/store/__tests__/messages.spec.ts +74 -0
  244. package/src/store/__tests__/rulers.spec.ts +77 -0
  245. package/src/store/__tests__/view-configs.spec.ts +37 -0
  246. package/src/store/datasets-dicom.ts +398 -0
  247. package/src/store/datasets-files.ts +35 -0
  248. package/src/store/datasets-images.ts +118 -0
  249. package/src/store/datasets-labelmaps.ts +136 -0
  250. package/src/store/datasets-models.ts +25 -0
  251. package/src/store/datasets.ts +341 -0
  252. package/src/store/messages.ts +144 -0
  253. package/src/store/tools/crop.ts +136 -0
  254. package/src/store/tools/crosshairs.ts +131 -0
  255. package/src/store/tools/index.ts +95 -0
  256. package/src/store/tools/paint.ts +191 -0
  257. package/src/store/tools/rulers.ts +305 -0
  258. package/src/store/tools/types.ts +54 -0
  259. package/src/store/view-configs/camera.ts +51 -0
  260. package/src/store/view-configs/common.ts +61 -0
  261. package/src/store/view-configs/slicing.ts +86 -0
  262. package/src/store/view-configs/types.ts +39 -0
  263. package/src/store/view-configs/volume-coloring.ts +193 -0
  264. package/src/store/view-configs/windowing.ts +69 -0
  265. package/src/store/view-configs.ts +78 -0
  266. package/src/store/views.ts +130 -0
  267. package/src/types/index.ts +16 -0
  268. package/src/types/layout.ts +10 -0
  269. package/src/types/lps.ts +40 -0
  270. package/src/types/views.ts +65 -0
  271. package/src/types/vtk-types.ts +29 -0
  272. package/src/utils/__tests__/lps.spec.ts +102 -0
  273. package/src/utils/color.ts +23 -0
  274. package/src/utils/errors.js +3 -0
  275. package/src/utils/fetch.ts +101 -0
  276. package/src/utils/hacks.ts +14 -0
  277. package/src/utils/index.ts +83 -0
  278. package/src/utils/lps.ts +129 -0
  279. package/src/utils/manipulators.ts +35 -0
  280. package/src/utils/promise-worker.ts +45 -0
  281. package/src/utils/vtk-helpers.ts +215 -0
  282. package/src/utils/workerHandler.js +42 -0
  283. package/src/vtk/ColorMaps.ts +72 -0
  284. package/src/vtk/CrosshairsWidget/behavior.ts +112 -0
  285. package/src/vtk/CrosshairsWidget/index.d.ts +22 -0
  286. package/src/vtk/CrosshairsWidget/index.js +73 -0
  287. package/src/vtk/CrosshairsWidget/state.ts +51 -0
  288. package/src/vtk/IJKSliceRepresentationProxy/index.d.ts +9 -0
  289. package/src/vtk/IJKSliceRepresentationProxy/index.js +59 -0
  290. package/src/vtk/LPSView2DProxy/index.d.ts +18 -0
  291. package/src/vtk/LPSView2DProxy/index.js +89 -0
  292. package/src/vtk/LPSView3DProxy/index.d.ts +16 -0
  293. package/src/vtk/LPSView3DProxy/index.js +78 -0
  294. package/src/vtk/LabelMap/index.d.ts +16 -0
  295. package/src/vtk/LabelMap/index.js +49 -0
  296. package/src/vtk/LabelMapSliceRepProxy/index.d.ts +6 -0
  297. package/src/vtk/LabelMapSliceRepProxy/index.js +104 -0
  298. package/src/vtk/MedicalColorPresets.json +1448 -0
  299. package/src/vtk/PaintBrushContextRepresentation/index.js +191 -0
  300. package/src/vtk/PaintWidget/behavior.ts +101 -0
  301. package/src/vtk/PaintWidget/index.d.ts +28 -0
  302. package/src/vtk/PaintWidget/index.js +56 -0
  303. package/src/vtk/PaintWidget/state.ts +41 -0
  304. package/src/vtk/PiecewiseWidget/index.js +203 -0
  305. package/src/vtk/RulerWidget/behavior.ts +185 -0
  306. package/src/vtk/RulerWidget/index.d.ts +25 -0
  307. package/src/vtk/RulerWidget/index.js +79 -0
  308. package/src/vtk/RulerWidget/state.ts +63 -0
  309. package/src/vtk/TreJsonConverter/index.js +150 -0
  310. package/src/vtk/proxy.js +66 -0
  311. package/src/vtk/proxyUtils.js +16 -0
  312. package/src/vtk/webvr-empty.js +1 -0
  313. package/tests/testUtils.js +12 -0
  314. package/tsconfig.json +46 -0
  315. package/vue.config.js +86 -0
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <div id="model-module" class="mx-2 height-100">
3
+ <template v-if="hasModels">
4
+ <v-expansion-panels>
5
+ <v-expansion-panel v-for="model in models" :key="model.id">
6
+ <v-expansion-panel-header>
7
+ {{ model.name }}
8
+ </v-expansion-panel-header>
9
+ <v-expansion-panel-content>
10
+ <v-select
11
+ label="Color By"
12
+ :items="model.pointArrays"
13
+ item-text="name"
14
+ item-value="value"
15
+ :value="model.colorBy"
16
+ @change="setColorBy(model.id, $event)"
17
+ />
18
+ </v-expansion-panel-content>
19
+ </v-expansion-panel>
20
+ </v-expansion-panels>
21
+ </template>
22
+ <template v-else>
23
+ <div>No models loaded</div>
24
+ </template>
25
+ </div>
26
+ </template>
27
+
28
+ <script>
29
+ import { mapState, mapActions } from 'vuex';
30
+
31
+ const SOLID_COLOR = Symbol('SOLID_COLOR');
32
+
33
+ export default {
34
+ name: 'ModelBrowser',
35
+
36
+ computed: {
37
+ ...mapState({
38
+ vtkCache: (state) => state.data.vtkCache,
39
+ dataIndex: (state) => state.data.index,
40
+ modelIDs: (state) => state.data.modelIDs,
41
+ }),
42
+ ...mapState('visualization', ['colorBy']),
43
+
44
+ models() {
45
+ return this.modelIDs.map((id) => ({
46
+ ...this.dataIndex[id],
47
+ id,
48
+ colorBy: this.colorBy[id]?.array || SOLID_COLOR,
49
+ pointArrays: [{ name: 'Solid Color', value: SOLID_COLOR }].concat(
50
+ this.vtkCache[id]
51
+ .getPointData()
52
+ .getArrays()
53
+ .map((arr) => ({ name: arr.getName(), value: arr.getName() }))
54
+ ),
55
+ }));
56
+ },
57
+
58
+ hasModels() {
59
+ return !!this.models.length;
60
+ },
61
+ },
62
+
63
+ methods: {
64
+ setColorBy(id, arrayName) {
65
+ let array;
66
+ let location;
67
+ if (arrayName === SOLID_COLOR) {
68
+ array = '';
69
+ location = '';
70
+ } else {
71
+ array = arrayName;
72
+ location = 'pointData';
73
+ }
74
+
75
+ this.setModelColorBy({
76
+ id,
77
+ colorBy: { array, location },
78
+ });
79
+ },
80
+ ...mapActions('visualization', ['setModelColorBy']),
81
+ },
82
+ };
83
+ </script>
@@ -0,0 +1,137 @@
1
+ <template>
2
+ <div class="fill-height d-flex flex-column">
3
+ <div id="module-switcher">
4
+ <v-btn
5
+ v-if="$vuetify.breakpoint.mobile"
6
+ icon
7
+ id="close-btn"
8
+ @click="$emit('close')"
9
+ >
10
+ <v-icon>mdi-arrow-left</v-icon>
11
+ </v-btn>
12
+ <v-tabs
13
+ id="module-switcher-tabs"
14
+ v-model="selectedModuleIndex"
15
+ icons-and-text
16
+ :show-arrows="true"
17
+ >
18
+ <v-tab v-for="item in Modules" :key="item.name" class="pl-1 pr-1">
19
+ <div class="tab-content">
20
+ <span class="mb-0 mt-1 module-text">{{ item.name }}</span>
21
+ <v-icon>mdi-{{ item.icon }}</v-icon>
22
+ </div>
23
+ </v-tab>
24
+ </v-tabs>
25
+ </div>
26
+ <div id="module-container">
27
+ <v-tabs-items v-model="selectedModuleIndex" touchless class="fill-height">
28
+ <v-tab-item v-for="mod in Modules" :key="mod.name" class="fill-height">
29
+ <component
30
+ :key="mod.name"
31
+ v-show="Modules[selectedModuleIndex] === mod"
32
+ :is="mod.component"
33
+ />
34
+ </v-tab-item>
35
+ </v-tabs-items>
36
+ </div>
37
+ </div>
38
+ </template>
39
+
40
+ <script lang="ts">
41
+ import { defineComponent, ref } from '@vue/composition-api';
42
+
43
+ import DataBrowser from './DataBrowser.vue';
44
+ import RenderingModule from './RenderingModule.vue';
45
+ import AnnotationsModule from './AnnotationsModule.vue';
46
+
47
+ export const Modules = [
48
+ {
49
+ name: 'Data',
50
+ icon: 'database',
51
+ component: DataBrowser,
52
+ },
53
+ {
54
+ name: 'Annotations',
55
+ icon: 'pencil',
56
+ component: AnnotationsModule,
57
+ },
58
+ {
59
+ name: 'Rendering',
60
+ icon: 'cube',
61
+ component: RenderingModule,
62
+ },
63
+ // {
64
+ // name: 'AI',
65
+ // icon: 'robot-outline',
66
+ // component: null,
67
+ // },
68
+ ];
69
+
70
+ export default defineComponent({
71
+ name: 'ModulePanel',
72
+ setup() {
73
+ const selectedModuleIndex = ref(0);
74
+
75
+ return {
76
+ selectedModuleIndex,
77
+ Modules,
78
+ };
79
+ },
80
+ });
81
+ </script>
82
+
83
+ <style scoped>
84
+ #module-switcher {
85
+ display: relative;
86
+ flex: 0 2;
87
+ /* roughly match vuetify's dark/light transition */
88
+ transition: border-bottom 0.3s;
89
+ }
90
+
91
+ .theme--light #module-switcher {
92
+ border-bottom: 2px solid #efefef;
93
+ }
94
+
95
+ .theme--dark #module-switcher {
96
+ border-bottom: 2px solid #2f2f2f;
97
+ }
98
+
99
+ #close-btn {
100
+ position: absolute;
101
+ top: 1.5em;
102
+ left: 0.5em;
103
+ z-index: 10;
104
+ }
105
+
106
+ #module-container {
107
+ position: relative;
108
+ flex: 2;
109
+ overflow: auto;
110
+ }
111
+
112
+ .module-text {
113
+ font-size: 0.6rem;
114
+ white-space: pre;
115
+ }
116
+
117
+ .tab-content {
118
+ display: flex;
119
+ padding-top: 14px;
120
+ justify-content: flex-end;
121
+ flex-direction: column-reverse;
122
+ height: 100%;
123
+ align-items: center;
124
+ }
125
+
126
+ #module-switcher-tabs >>> .v-tabs-bar__content {
127
+ justify-content: center;
128
+ }
129
+
130
+ #module-switcher-tabs >>> .v-slide-group__prev.v-slide-group__prev--disabled {
131
+ visibility: hidden;
132
+ }
133
+
134
+ #module-switcher-tabs >>> .v-slide-group__next.v-slide-group__next--disabled {
135
+ visibility: hidden;
136
+ }
137
+ </style>
@@ -0,0 +1,174 @@
1
+ <template>
2
+ <v-card width="350px">
3
+ <v-container>
4
+ <!--
5
+ <v-row no-gutters align="center">
6
+ <v-col>
7
+ <v-select
8
+ dense
9
+ outlined
10
+ hide-details
11
+ label="Select or create a labelmap"
12
+ />
13
+ </v-col>
14
+ </v-row>
15
+ -->
16
+ <v-row no-gutters align="center">
17
+ <v-col>
18
+ <v-slider
19
+ :value="brushSize"
20
+ @input="setBrushSize"
21
+ dense
22
+ hide-details
23
+ label="Size"
24
+ min="1"
25
+ max="50"
26
+ >
27
+ <template v-slot:append>
28
+ <v-text-field
29
+ :value="brushSize"
30
+ @input="setBrushSize"
31
+ class="mt-n1 pt-0"
32
+ style="width: 40px"
33
+ hide-details
34
+ type="number"
35
+ min="1"
36
+ max="50"
37
+ />
38
+ </template>
39
+ </v-slider>
40
+ </v-col>
41
+ </v-row>
42
+ <v-row no-gutters align="center">
43
+ <v-col>
44
+ <v-slider
45
+ :value="opacity"
46
+ @input="setOpacity"
47
+ dense
48
+ hide-details
49
+ label="Opacity"
50
+ min="0"
51
+ max="1"
52
+ step="0.01"
53
+ >
54
+ <template v-slot:append>
55
+ <v-text-field
56
+ :value="opacity"
57
+ @input="setOpacity"
58
+ class="mt-n1 pt-0"
59
+ style="width: 40px"
60
+ hide-details
61
+ type="number"
62
+ min="0"
63
+ max="1"
64
+ step="0.1"
65
+ />
66
+ </template>
67
+ </v-slider>
68
+ </v-col>
69
+ </v-row>
70
+ <v-row no-gutters align="center">
71
+ <v-col>
72
+ <v-color-picker
73
+ hide-canvas
74
+ hide-inputs
75
+ hide-mode-switch
76
+ hide-sliders
77
+ show-swatches
78
+ :swatches="swatches"
79
+ :value="brushColor"
80
+ @input="setBrushColor"
81
+ />
82
+ </v-col>
83
+ </v-row>
84
+ </v-container>
85
+ </v-card>
86
+ </template>
87
+
88
+ <script lang="ts">
89
+ import { computed, defineComponent } from '@vue/composition-api';
90
+ import { LABELMAP_PALETTE } from '../config';
91
+ import { usePaintToolStore } from '../store/tools/paint';
92
+ import { rgbaToHexa } from '../utils/color';
93
+
94
+ // generates both the swatches for v-color-picker and the color-to-value mapping
95
+ function convertToSwatches(
96
+ palette: typeof LABELMAP_PALETTE,
97
+ width: number = 5
98
+ ) {
99
+ const hexToValue: Record<string, number> = {};
100
+ const swatches: string[][] = [];
101
+ const entries = Object.entries(palette);
102
+ while (entries.length) {
103
+ const [value, rgba] = entries.shift()!;
104
+ const hex = rgbaToHexa(rgba).toUpperCase();
105
+ hexToValue[hex] = Number(value);
106
+
107
+ let row = swatches[swatches.length - 1];
108
+ if (!row || row.length === width) {
109
+ row = [];
110
+ swatches.push(row);
111
+ }
112
+ row.push(hex);
113
+ }
114
+
115
+ return { hexToValue, swatches };
116
+ }
117
+
118
+ export default defineComponent({
119
+ name: 'PaintControls',
120
+
121
+ setup() {
122
+ const paintStore = usePaintToolStore();
123
+
124
+ const { hexToValue, swatches } = convertToSwatches(LABELMAP_PALETTE, 3);
125
+ const brushColor = computed(() => {
126
+ const value = paintStore.brushValue;
127
+ if (value in LABELMAP_PALETTE) {
128
+ return rgbaToHexa(LABELMAP_PALETTE[value]);
129
+ }
130
+ return null;
131
+ });
132
+
133
+ const setBrushColor = (color: string) => {
134
+ const hexa = color.toUpperCase();
135
+ if (hexa in hexToValue) {
136
+ paintStore.setBrushValue(hexToValue[hexa]);
137
+ }
138
+ };
139
+
140
+ const brushSize = computed(() => paintStore.brushSize);
141
+ const setBrushSize = (size: number) => {
142
+ paintStore.setBrushSize(Number(size));
143
+ };
144
+
145
+ const opacity = computed(() => paintStore.labelmapOpacity);
146
+ const setOpacity = (op: number) => {
147
+ paintStore.setLabelmapOpacity(Number(op));
148
+ };
149
+
150
+ return {
151
+ brushSize,
152
+ setBrushSize,
153
+ swatches,
154
+ brushColor,
155
+ setBrushColor,
156
+ opacity,
157
+ setOpacity,
158
+ };
159
+ },
160
+ });
161
+ </script>
162
+
163
+ <style scoped>
164
+ .form-label {
165
+ color: rgba(0, 0, 0, 0.6);
166
+ }
167
+
168
+ .scrolled-radios {
169
+ max-height: 300px;
170
+ overflow: auto;
171
+ /* prevents hover circle from clipping left */
172
+ padding-left: 6px;
173
+ }
174
+ </style>
@@ -0,0 +1,280 @@
1
+ <script lang="ts">
2
+ import { computed, defineComponent, ref, toRefs } from '@vue/composition-api';
3
+ import type { Ref } from '@vue/composition-api';
4
+ import ItemGroup from '@/src/components/ItemGroup.vue';
5
+ import { useDICOMStore } from '../store/datasets-dicom';
6
+ import {
7
+ DataSelection,
8
+ DICOMSelection,
9
+ selectionEquals,
10
+ useDatasetStore,
11
+ } from '../store/datasets';
12
+ import { useMultiSelection } from '../composables/useMultiSelection';
13
+ import PatientStudyVolumeBrowser from './PatientStudyVolumeBrowser.vue';
14
+ import { usePanels } from '../composables/usePanels';
15
+
16
+ export default defineComponent({
17
+ name: 'PatientBrowser',
18
+ props: {
19
+ patientKey: {
20
+ type: String,
21
+ required: true,
22
+ },
23
+ },
24
+ components: {
25
+ ItemGroup,
26
+ PatientStudyVolumeBrowser,
27
+ },
28
+ setup(props) {
29
+ const { patientKey } = toRefs(props);
30
+
31
+ const selectedSeries: Ref<DICOMSelection[]> = ref([]);
32
+
33
+ const dicomStore = useDICOMStore();
34
+ const dataStore = useDatasetStore();
35
+
36
+ const primarySelection = computed(() => dataStore.primarySelection);
37
+
38
+ const studies = computed(() => {
39
+ const selPatient = patientKey.value;
40
+ const { patientStudies, studyInfo, studyVolumes } = dicomStore;
41
+ return patientStudies[selPatient].map((studyKey) => {
42
+ const info = studyInfo[studyKey];
43
+ return {
44
+ ...info,
45
+ key: studyKey,
46
+ title:
47
+ info.StudyDescription || info.StudyDate || info.StudyInstanceUID,
48
+ volumeKeys: studyVolumes[studyKey].sort(),
49
+ };
50
+ });
51
+ });
52
+
53
+ const studyKeys = computed(() => studies.value.map((study) => study.key));
54
+ const studyKeysSet = computed(() => new Set(studyKeys.value));
55
+
56
+ const { handlePanelChange, openPanels } = usePanels(studyKeysSet);
57
+
58
+ // --- selection --- //
59
+
60
+ const { selected, selectedAll, selectedSome } =
61
+ useMultiSelection(studyKeys);
62
+
63
+ const removeSelectedStudies = () => {
64
+ selected.value.forEach(async (study) => {
65
+ dicomStore.deleteStudy(study);
66
+ });
67
+ selected.value = [];
68
+
69
+ // Handle the case where we are deleting the selected study
70
+ // if (selected.value.indexOf(selectedStudy.value) !== -1) {
71
+ // dataStore.setPrimarySelection(null);
72
+ // }
73
+ };
74
+
75
+ return {
76
+ selected,
77
+ selectedAll,
78
+ selectedSome,
79
+ selectedSeries,
80
+ primarySelection,
81
+ removeSelectedStudies,
82
+ studies,
83
+ selectionEquals,
84
+ setPrimarySelection: (sel: DataSelection) => {
85
+ dataStore.setPrimarySelection(sel);
86
+ },
87
+ openPanels,
88
+ handlePanelChange,
89
+ };
90
+ },
91
+ });
92
+ </script>
93
+
94
+ <template>
95
+ <item-group
96
+ :value="primarySelection"
97
+ :testFunction="selectionEquals"
98
+ @change="setPrimarySelection"
99
+ >
100
+ <v-container class="pa-0">
101
+ <v-row no-gutters justify="space-between" class="mb-2">
102
+ <v-col cols="6" align-self="center">
103
+ <v-checkbox
104
+ class="ml-3 align-center justify-center"
105
+ :indeterminate="selectedSome && !selectedAll"
106
+ label="Select All Studies"
107
+ v-model="selectedAll"
108
+ dense
109
+ hide-details
110
+ />
111
+ </v-col>
112
+ <v-col cols="6" align-self="center" class="d-flex justify-end mt-2">
113
+ <v-tooltip left>
114
+ <template v-slot:activator="{ on, attrs }">
115
+ <v-btn
116
+ icon
117
+ small
118
+ :disabled="!selectedSome"
119
+ @click.stop="removeSelectedStudies"
120
+ v-bind="attrs"
121
+ v-on="on"
122
+ >
123
+ <v-icon>mdi-delete</v-icon>
124
+ </v-btn>
125
+ </template>
126
+ Delete selected
127
+ </v-tooltip>
128
+ </v-col>
129
+ </v-row>
130
+ </v-container>
131
+ <v-expansion-panels
132
+ id="patient-data-studies"
133
+ accordion
134
+ multiple
135
+ :value="openPanels"
136
+ >
137
+ <v-expansion-panel
138
+ v-for="study in studies"
139
+ :key="study.StudyInstanceUID"
140
+ class="patient-data-study-panel"
141
+ @change="handlePanelChange(study.StudyInstanceUID)"
142
+ >
143
+ <v-expansion-panel-header
144
+ color="#1976fa0a"
145
+ class="pl-3 no-select"
146
+ :title="study.StudyDate"
147
+ >
148
+ <div class="study-header">
149
+ <div class="study-header-title">
150
+ <v-checkbox
151
+ dense
152
+ :key="study.StudyInstanceUID"
153
+ :value="study.StudyInstanceUID"
154
+ v-model="selected"
155
+ @click.stop
156
+ />
157
+ <v-icon class="mb-2">mdi-folder-table</v-icon>
158
+ <div class="ml-2 overflow-hidden text-no-wrap">
159
+ <div class="text-subtitle-2 text-truncate" :title="study.title">
160
+ {{ study.title }}
161
+ </div>
162
+ <div
163
+ v-if="study.StudyDescription"
164
+ class="text-caption text-truncate"
165
+ >
166
+ {{ study.StudyDate }}
167
+ </div>
168
+ </div>
169
+ </div>
170
+
171
+ <div class="d-flex flex-column align-center justify-end mx-2">
172
+ <v-tooltip bottom>
173
+ Total series in study
174
+ <template v-slot:activator="{ on }">
175
+ <div class="d-flex flex-row align-center mr-2" v-on="on">
176
+ <v-icon small>mdi-folder-open</v-icon>
177
+ <span class="text-caption text--secondary text-no-wrap">
178
+ : {{ study.volumeKeys.length }}
179
+ </span>
180
+ </div>
181
+ </template>
182
+ </v-tooltip>
183
+ </div>
184
+ </div>
185
+ </v-expansion-panel-header>
186
+ <v-expansion-panel-content>
187
+ <patient-study-volume-browser :volume-keys="study.volumeKeys" />
188
+ </v-expansion-panel-content>
189
+ </v-expansion-panel>
190
+ </v-expansion-panels>
191
+ </item-group>
192
+ </template>
193
+
194
+ <style>
195
+ #patient-data-studies .v-expansion-panel--active > .v-expansion-panel-header {
196
+ min-height: unset;
197
+ }
198
+
199
+ #patient-data-studies .v-expansion-panel-content__wrap {
200
+ padding: 0 8px;
201
+ }
202
+
203
+ #patient-data-studies .v-expansion-panel::before {
204
+ box-shadow: none;
205
+ }
206
+ </style>
207
+
208
+ <style scoped>
209
+ .theme--light .patient-data-study-panel {
210
+ border: 1px solid #ddd;
211
+ }
212
+
213
+ .theme--dark .patient-data-study-panel {
214
+ border: 1px solid #171519;
215
+ }
216
+
217
+ .volume-list {
218
+ display: grid;
219
+ grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
220
+ grid-auto-rows: 200px;
221
+ justify-content: center;
222
+ }
223
+
224
+ .volume-card {
225
+ padding: 8px;
226
+ cursor: pointer;
227
+ }
228
+
229
+ .theme--light.volume-card-active {
230
+ background-color: #b3e5fc;
231
+ border-color: #b3e5fc;
232
+ }
233
+
234
+ .theme--dark.volume-card-active {
235
+ background-color: #01579b;
236
+ border-color: #01579b;
237
+ }
238
+
239
+ .study-header {
240
+ display: flex;
241
+ flex-flow: row;
242
+ align-items: center;
243
+ width: calc(100% - 24px);
244
+ }
245
+
246
+ .study-header-title {
247
+ display: flex;
248
+ flex-flow: row;
249
+ align-items: center;
250
+ flex-grow: 1;
251
+ /* used to ensure that the text can truncate */
252
+ min-width: 0;
253
+ }
254
+
255
+ .study-header-content {
256
+ overflow: hidden;
257
+ white-space: nowrap;
258
+ }
259
+
260
+ .study-header-line {
261
+ text-overflow: ellipsis;
262
+ overflow: hidden;
263
+ white-space: nowrap;
264
+ }
265
+
266
+ .series-desc {
267
+ white-space: nowrap;
268
+ text-overflow: ellipsis;
269
+ overflow: hidden;
270
+ }
271
+
272
+ .thumbnail-overlay >>> .v-overlay__content {
273
+ height: 100%;
274
+ width: 100%;
275
+ }
276
+
277
+ .volume-list >>> .theme--light.v-sheet--outlined {
278
+ border: none;
279
+ }
280
+ </style>