larvitar 1.2.0 → 1.2.1

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 (190) hide show
  1. package/.github/workflows/build-docs.yml +1 -1
  2. package/.github/workflows/deploy.yml +4 -4
  3. package/README.md +3 -3
  4. package/modules/vuex/larvitar.js +1 -0
  5. package/package.json +1 -1
  6. package/docs/documentation/Mixins.polygonSegmentationMixin%20-%20segmentation%20operations%20for%20polyline.html +0 -171
  7. package/docs/documentation/Tools.Annotation.ContoursTool.html +0 -218
  8. package/docs/documentation/Tools.Annotation.DiameterTool.html +0 -219
  9. package/docs/documentation/Tools.Annotation.SeedsTool.html +0 -214
  10. package/docs/documentation/Tools.Brush.BrushTool.html +0 -218
  11. package/docs/documentation/Tools.Brush.ThresholdsBrushTool.html +0 -218
  12. package/docs/documentation/Tools.PolylineScissorsTool.html +0 -218
  13. package/docs/documentation/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  14. package/docs/documentation/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  15. package/docs/documentation/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  16. package/docs/documentation/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  17. package/docs/documentation/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  18. package/docs/documentation/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  19. package/docs/documentation/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  20. package/docs/documentation/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  21. package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  22. package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -978
  23. package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  24. package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  25. package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  26. package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  27. package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -1049
  28. package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  29. package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  30. package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  31. package/docs/documentation/global.html +0 -1303
  32. package/docs/documentation/imageAnonymization.js.html +0 -245
  33. package/docs/documentation/imageColormaps.js.html +0 -283
  34. package/docs/documentation/imageContours.js.html +0 -278
  35. package/docs/documentation/imageIo.js.html +0 -291
  36. package/docs/documentation/imageLayers.js.html +0 -188
  37. package/docs/documentation/imageLoading.js.html +0 -297
  38. package/docs/documentation/imageParsing.js.html +0 -385
  39. package/docs/documentation/imagePresets.js.html +0 -207
  40. package/docs/documentation/imageRendering.js.html +0 -849
  41. package/docs/documentation/imageReslice.js.html +0 -162
  42. package/docs/documentation/imageStore.js.html +0 -360
  43. package/docs/documentation/imageTools.js.html +0 -784
  44. package/docs/documentation/imageUtils.js.html +0 -1609
  45. package/docs/documentation/image_colormaps.js.html +0 -283
  46. package/docs/documentation/image_contours.js.html +0 -279
  47. package/docs/documentation/image_io.js.html +0 -288
  48. package/docs/documentation/image_layers.js.html +0 -188
  49. package/docs/documentation/image_loading.js.html +0 -294
  50. package/docs/documentation/image_parsing.js.html +0 -391
  51. package/docs/documentation/image_presets.js.html +0 -207
  52. package/docs/documentation/image_rendering.js.html +0 -845
  53. package/docs/documentation/image_reslice.js.html +0 -164
  54. package/docs/documentation/image_store.js.html +0 -359
  55. package/docs/documentation/image_tools.js.html +0 -792
  56. package/docs/documentation/image_utils.js.html +0 -1609
  57. package/docs/documentation/index.html +0 -175
  58. package/docs/documentation/loaders_commonLoader.js.html +0 -306
  59. package/docs/documentation/loaders_dicomLoader.js.html +0 -130
  60. package/docs/documentation/loaders_fileLoader.js.html +0 -155
  61. package/docs/documentation/loaders_multiframeLoader.js.html +0 -443
  62. package/docs/documentation/loaders_niftiLoader.js.html +0 -150
  63. package/docs/documentation/loaders_nrrdLoader.js.html +0 -545
  64. package/docs/documentation/loaders_resliceLoader.js.html +0 -258
  65. package/docs/documentation/module-imaging_contours.html +0 -954
  66. package/docs/documentation/module-imaging_imageAnonymization.html +0 -544
  67. package/docs/documentation/module-imaging_imageColormaps.html +0 -1012
  68. package/docs/documentation/module-imaging_imageContours.html +0 -954
  69. package/docs/documentation/module-imaging_imageIo.html +0 -1057
  70. package/docs/documentation/module-imaging_imageLayers.html +0 -904
  71. package/docs/documentation/module-imaging_imageLoading.html +0 -1301
  72. package/docs/documentation/module-imaging_imageParsing.html +0 -1356
  73. package/docs/documentation/module-imaging_imagePresets.html +0 -679
  74. package/docs/documentation/module-imaging_imageRendering.html +0 -3223
  75. package/docs/documentation/module-imaging_imageReslice.html +0 -413
  76. package/docs/documentation/module-imaging_imageStore-Larvitar_Store.html +0 -284
  77. package/docs/documentation/module-imaging_imageStore.html +0 -1560
  78. package/docs/documentation/module-imaging_imageTools.html +0 -3617
  79. package/docs/documentation/module-imaging_imageUtils.html +0 -7253
  80. package/docs/documentation/module-imaging_io.html +0 -1057
  81. package/docs/documentation/module-imaging_layers.html +0 -904
  82. package/docs/documentation/module-imaging_loading.html +0 -1301
  83. package/docs/documentation/module-imaging_parsing.html +0 -1375
  84. package/docs/documentation/module-imaging_presets.html +0 -679
  85. package/docs/documentation/module-imaging_rendering.html +0 -8094
  86. package/docs/documentation/module-imaging_reslice.html +0 -411
  87. package/docs/documentation/module-imaging_store-Larvitar_Store.html +0 -284
  88. package/docs/documentation/module-imaging_store.html +0 -1537
  89. package/docs/documentation/module-imaging_strategies_eraseFreehand.html +0 -708
  90. package/docs/documentation/module-imaging_strategies_fillFreehand.html +0 -708
  91. package/docs/documentation/module-imaging_tools.html +0 -3617
  92. package/docs/documentation/module-imaging_tools_custom_contourTool.html +0 -207
  93. package/docs/documentation/module-imaging_tools_custom_diameterTool.html +0 -205
  94. package/docs/documentation/module-imaging_tools_custom_editMaskTool.html +0 -205
  95. package/docs/documentation/module-imaging_tools_custom_polygonScissorsTool.html +0 -203
  96. package/docs/documentation/module-imaging_tools_custom_thresholdBrushTool.html +0 -684
  97. package/docs/documentation/module-imaging_tools_default.html +0 -205
  98. package/docs/documentation/module-imaging_tools_interaction.html +0 -530
  99. package/docs/documentation/module-imaging_tools_io.html +0 -832
  100. package/docs/documentation/module-imaging_tools_main.html +0 -2028
  101. package/docs/documentation/module-imaging_tools_polygonSegmentationMixin.html +0 -567
  102. package/docs/documentation/module-imaging_tools_segmentation.html +0 -3586
  103. package/docs/documentation/module-imaging_tools_state.html +0 -494
  104. package/docs/documentation/module-imaging_utils.html +0 -7253
  105. package/docs/documentation/module-loaders_commonLoader.html +0 -1313
  106. package/docs/documentation/module-loaders_dicomLoader.html +0 -522
  107. package/docs/documentation/module-loaders_fileLoader.html +0 -593
  108. package/docs/documentation/module-loaders_multiframeLoader.html +0 -1169
  109. package/docs/documentation/module-loaders_niftiLoader.html +0 -565
  110. package/docs/documentation/module-loaders_nrrdLoader.html +0 -1459
  111. package/docs/documentation/module-loaders_resliceLoader.html +0 -590
  112. package/docs/documentation/module-monitors_memory.html +0 -980
  113. package/docs/documentation/module-tools_default.html +0 -740
  114. package/docs/documentation/module.exports_module.exports.html +0 -203
  115. package/docs/documentation/monitors_memory.js.html +0 -189
  116. package/docs/documentation/parsers_nrrd.js.html +0 -569
  117. package/docs/documentation/scripts/collapse.js +0 -20
  118. package/docs/documentation/scripts/linenumber.js +0 -25
  119. package/docs/documentation/scripts/nav.js +0 -12
  120. package/docs/documentation/scripts/polyfill.js +0 -4
  121. package/docs/documentation/scripts/prettify/Apache-License-2.0.txt +0 -202
  122. package/docs/documentation/scripts/prettify/lang-css.js +0 -2
  123. package/docs/documentation/scripts/prettify/prettify.js +0 -28
  124. package/docs/documentation/scripts/search.js +0 -83
  125. package/docs/documentation/styles/jsdoc.css +0 -765
  126. package/docs/documentation/styles/prettify.css +0 -80
  127. package/docs/documentation/tools_contourTool.js.html +0 -1963
  128. package/docs/documentation/tools_custom_contourTool.js.html +0 -1968
  129. package/docs/documentation/tools_custom_diameterTool.js.html +0 -225
  130. package/docs/documentation/tools_custom_editMaskTool.js.html +0 -225
  131. package/docs/documentation/tools_custom_polylineScissorsTool.js.html +0 -143
  132. package/docs/documentation/tools_custom_thresholdsBrushTool.js.html +0 -245
  133. package/docs/documentation/tools_default.js.html +0 -576
  134. package/docs/documentation/tools_diameterTool.js.html +0 -219
  135. package/docs/documentation/tools_editMaskTool.js.html +0 -219
  136. package/docs/documentation/tools_interaction.js.html +0 -258
  137. package/docs/documentation/tools_io.js.html +0 -297
  138. package/docs/documentation/tools_main.js.html +0 -443
  139. package/docs/documentation/tools_polygonSegmentationMixin.js.html +0 -329
  140. package/docs/documentation/tools_polylineScissorsTool.js.html +0 -136
  141. package/docs/documentation/tools_seedTool.js.html +0 -423
  142. package/docs/documentation/tools_segmentation.js.html +0 -558
  143. package/docs/documentation/tools_state.js.html +0 -163
  144. package/docs/documentation/tools_strategies_eraseFreehand.js.html +0 -160
  145. package/docs/documentation/tools_strategies_fillFreehand.js.html +0 -163
  146. package/docs/documentation/tools_thresholdsBrushTool.js.html +0 -239
  147. package/docs/documentation/tools_tools.default.js.html +0 -569
  148. package/docs/documentation/tools_tools.interaction.js.html +0 -251
  149. package/docs/documentation/tools_tools.io.js.html +0 -288
  150. package/docs/documentation/tools_tools.main.js.html +0 -442
  151. package/docs/documentation/tools_tools.segmentation.js.html +0 -445
  152. package/docs/documentation/tools_tools.state.js.html +0 -157
  153. package/docs/examples/base.html +0 -170
  154. package/docs/examples/colorMaps.html +0 -181
  155. package/docs/examples/defaultTools.html +0 -246
  156. package/docs/examples/demo/anon1 +0 -0
  157. package/docs/examples/demo/anon10 +0 -0
  158. package/docs/examples/demo/anon11 +0 -0
  159. package/docs/examples/demo/anon12 +0 -0
  160. package/docs/examples/demo/anon13 +0 -0
  161. package/docs/examples/demo/anon14 +0 -0
  162. package/docs/examples/demo/anon15 +0 -0
  163. package/docs/examples/demo/anon16 +0 -0
  164. package/docs/examples/demo/anon17 +0 -0
  165. package/docs/examples/demo/anon18 +0 -0
  166. package/docs/examples/demo/anon19 +0 -0
  167. package/docs/examples/demo/anon2 +0 -0
  168. package/docs/examples/demo/anon20 +0 -0
  169. package/docs/examples/demo/anon21 +0 -0
  170. package/docs/examples/demo/anon22 +0 -0
  171. package/docs/examples/demo/anon23 +0 -0
  172. package/docs/examples/demo/anon24 +0 -0
  173. package/docs/examples/demo/anon3 +0 -0
  174. package/docs/examples/demo/anon4 +0 -0
  175. package/docs/examples/demo/anon5 +0 -0
  176. package/docs/examples/demo/anon6 +0 -0
  177. package/docs/examples/demo/anon7 +0 -0
  178. package/docs/examples/demo/anon8 +0 -0
  179. package/docs/examples/demo/anon9 +0 -0
  180. package/docs/examples/demo/example.nrrd +0 -0
  181. package/docs/examples/demo/segmentation.nrrd +0 -0
  182. package/docs/examples/demo/xa_integris.dcm +0 -0
  183. package/docs/examples/index.html +0 -129
  184. package/docs/examples/larvitar.js +0 -108623
  185. package/docs/examples/layers.html +0 -250
  186. package/docs/examples/masks.html +0 -273
  187. package/docs/examples/multiframe.html +0 -200
  188. package/docs/examples/nrrd.html +0 -96
  189. package/docs/examples/reslice.html +0 -174
  190. package/docs/index.html +0 -92
@@ -1,792 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
-
5
- <meta charset="utf-8">
6
- <title>image_tools.js - Larvitar</title>
7
-
8
- <meta name="description" content="Dicom Image Toolkit for CornestoneJS" />
9
-
10
- <meta name="keywords" content="imaging, dataviz, medical, cornerstone" />
11
- <meta name="keyword" content="imaging, dataviz, medical, cornerstone" />
12
-
13
-
14
-
15
- <script src="scripts/prettify/prettify.js"></script>
16
- <script src="scripts/prettify/lang-css.js"></script>
17
- <!--[if lt IE 9]>
18
- <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
19
- <![endif]-->
20
- <link type="text/css" rel="stylesheet" href="styles/prettify.css">
21
- <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
22
- <script src="scripts/nav.js" defer></script>
23
-
24
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
25
- </head>
26
- <body>
27
-
28
- <input type="checkbox" id="nav-trigger" class="nav-trigger" />
29
- <label for="nav-trigger" class="navicon-button x">
30
- <div class="navicon"></div>
31
- </label>
32
-
33
- <label for="nav-trigger" class="overlay"></label>
34
-
35
- <nav >
36
-
37
- <input type="text" id="nav-search" placeholder="Search" />
38
-
39
-
40
- <h2><a href="index.html">Home</a></h2><h2><a href="https://github.com/dvisionlab/Larvitar" target="_blank" class="menu-item" id="repository" >Github repo</a></h2><h3>Classes</h3><ul><li><a href="module.exports_module.exports.html">module.exports#module.exports</a></li><li><a href="module-imaging_store-Larvitar_Store.html">imaging/store~Larvitar_Store</a></li><li><a href="Tools.Annotation.ContoursTool.html">Tools.Annotation.ContoursTool</a></li><li><a href="Tools.Annotation.DiameterTool.html">Tools.Annotation.DiameterTool</a></li><li><a href="Tools.Brush.BrushTool.html">Tools.Brush.BrushTool</a></li><li><a href="Tools.Brush.ThresholdsBrushTool.html">Tools.Brush.ThresholdsBrushTool</a></li><li><a href="Tools.PolylineScissorsTool.html">Tools.PolylineScissorsTool</a></li></ul><h3>Modules</h3><ul><li><a href="module-imaging_anonymization.html">imaging/anonymization</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-imaging_anonymization.html#anonymize#~anonymize">anonymize</a></li><li data-type='method' style='display: none;'><a href="module-imaging_anonymization.html#encrypt#~encrypt">encrypt</a></li></ul></li><li><a href="module-imaging_contours.html">imaging/contours</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-imaging_contours.html#extractSlicePoints#extractSlicePoints">extractSlicePoints</a></li><li data-type='method' style='display: none;'><a href="module-imaging_contours.html#populateContoursObject#populateContoursObject">populateContoursObject</a></li><li data-type='method' style='display: none;'><a href="module-imaging_contours.html#parseContours#~parseContours">parseContours</a></li></ul></li><li><a href="module-imaging_io.html">imaging/io</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-imaging_io.html#buildData#~buildData">buildData</a></li><li data-type='method' style='display: none;'><a href="module-imaging_io.html#buildDataAsync#~buildDataAsync">buildDataAsync</a></li><li data-type='method' style='display: none;'><a href="module-imaging_io.html#buildHeader#~buildHeader">buildHeader</a></li><li data-type='method' style='display: none;'><a href="module-imaging_io.html#getCachedPixelData#~getCachedPixelData">getCachedPixelData</a></li><li data-type='method' style='display: none;'><a href="module-imaging_io.html#importNRRDImage#~importNRRDImage">importNRRDImage</a></li></ul></li><li><a href="module-imaging_layers.html">imaging/layers</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-imaging_layers.html#getActiveLayer#getActiveLayer">getActiveLayer</a></li><li data-type='method' style='display: none;'><a href="module-imaging_layers.html#setActiveLayer#setActiveLayer">setActiveLayer</a></li><li data-type='method' style='display: none;'><a href="module-imaging_layers.html#updateLayer#updateLayer">updateLayer</a></li><li data-type='method' style='display: none;'><a href="module-imaging_layers.html#buildLayers#~buildLayers">buildLayers</a></li></ul></li><li><a href="module-imaging_loading.html">imaging/loading</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-imaging_loading.html#initializeFileImageLoader#initializeFileImageLoader">initializeFileImageLoader</a></li><li data-type='method' style='display: none;'><a href="module-imaging_loading.html#initializeImageLoader#initializeImageLoader">initializeImageLoader</a></li><li data-type='method' style='display: none;'><a href="module-imaging_loading.html#initializeWebImageLoader#initializeWebImageLoader">initializeWebImageLoader</a></li><li data-type='method' style='display: none;'><a href="module-imaging_loading.html#registerMultiFrameImageLoader#registerMultiFrameImageLoader">registerMultiFrameImageLoader</a></li><li data-type='method' style='display: none;'><a href="module-imaging_loading.html#registerNRRDImageLoader#registerNRRDImageLoader">registerNRRDImageLoader</a></li><li data-type='method' style='display: none;'><a href="module-imaging_loading.html#registerResliceLoader#registerResliceLoader">registerResliceLoader</a></li><li data-type='method' style='display: none;'><a href="module-imaging_loading.html#updateLoadedStack#updateLoadedStack">updateLoadedStack</a></li><li data-type='method' style='display: none;'><a href="module-imaging_loading.html#isNewInstance#~isNewInstance">isNewInstance</a></li></ul></li><li><a href="module-imaging_parsing.html">imaging/parsing</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-imaging_parsing.html#clearImageParsing#clearImageParsing">clearImageParsing</a></li><li data-type='method' style='display: none;'><a href="module-imaging_parsing.html#dumpDataSet#dumpDataSet">dumpDataSet</a></li><li data-type='method' style='display: none;'><a href="module-imaging_parsing.html#readFile#readFile">readFile</a></li><li data-type='method' style='display: none;'><a href="module-imaging_parsing.html#readFiles#readFiles">readFiles</a></li><li data-type='method' style='display: none;'><a href="module-imaging_parsing.html#dumpFile#~dumpFile">dumpFile</a></li><li data-type='method' style='display: none;'><a href="module-imaging_parsing.html#dumpFiles#~dumpFiles">dumpFiles</a></li><li data-type='method' style='display: none;'><a href="module-imaging_parsing.html#parseNextFile#~parseNextFile">parseNextFile</a></li></ul></li><li><a href="module-imaging_presets.html">imaging/presets</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-imaging_presets.html#getImagePresets#getImagePresets">getImagePresets</a></li><li data-type='method' style='display: none;'><a href="module-imaging_presets.html#setImageCustomPreset#setImageCustomPreset">setImageCustomPreset</a></li><li data-type='method' style='display: none;'><a href="module-imaging_presets.html#setImagePreset#setImagePreset">setImagePreset</a></li></ul></li><li><a href="module-imaging_rendering.html">imaging/rendering</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#HSVToRGB#.HSVToRGB">HSVToRGB</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#addColorMap#addColorMap">addColorMap</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#applyColorMap#applyColorMap">applyColorMap</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#clearImageCache#clearImageCache">clearImageCache</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#disableViewport#disableViewport">disableViewport</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#fillPixelData#fillPixelData">fillPixelData</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#flipImageHorizontal#flipImageHorizontal">flipImageHorizontal</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#flipImageVertical#flipImageVertical">flipImageVertical</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#getColormapsList#getColormapsList">getColormapsList</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#getSeriesData#getSeriesData">getSeriesData</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#invertImage#invertImage">invertImage</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#loadAndCacheImages#loadAndCacheImages">loadAndCacheImages</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#renderImage#renderImage">renderImage</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#renderWebImage#renderWebImage">renderWebImage</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#renderWebImage#renderWebImage">renderWebImage</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#resetViewports#resetViewports">resetViewports</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#resizeViewport#resizeViewport">resizeViewport</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#rotateImageLeft#rotateImageLeft">rotateImageLeft</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#rotateImageRight#rotateImageRight">rotateImageRight</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#storeViewportData#storeViewportData">storeViewportData</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#unloadViewport#unloadViewport">unloadViewport</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#updateImage#updateImage">updateImage</a></li><li data-type='method' style='display: none;'><a href="module-imaging_rendering.html#updateViewportData#updateViewportData">updateViewportData</a></li></ul></li><li></li><li><a href="module-imaging_reslice.html">imaging/reslice</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-imaging_reslice.html#resliceSeries#resliceSeries">resliceSeries</a></li></ul></li><li><a href="module-imaging_store.html">imaging/store</a><ul class='members'><li data-type='member' style='display: none;'><a href="module-imaging_store.html#.larvitar_store">larvitar_store</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="module-imaging_store.html#initLarvitarStore#.initLarvitarStore">initLarvitarStore</a></li><li data-type='method' style='display: none;'><a href="module-imaging_store.html#addSeriesIds#~addSeriesIds">addSeriesIds</a></li><li data-type='method' style='display: none;'><a href="module-imaging_store.html#addViewport#~addViewport">addViewport</a></li><li data-type='method' style='display: none;'><a href="module-imaging_store.html#deleteViewport#~deleteViewport">deleteViewport</a></li><li data-type='method' style='display: none;'><a href="module-imaging_store.html#disableVuex#~disableVuex">disableVuex</a></li><li data-type='method' style='display: none;'><a href="module-imaging_store.html#enableVuex#~enableVuex">enableVuex</a></li><li data-type='method' style='display: none;'><a href="module-imaging_store.html#get#~get">get</a></li><li data-type='method' style='display: none;'><a href="module-imaging_store.html#removeSeriesIds#~removeSeriesIds">removeSeriesIds</a></li><li data-type='method' style='display: none;'><a href="module-imaging_store.html#set#~set">set</a></li></ul></li><li><a href="module-imaging_tools.html">imaging/tools</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#addContoursTool#~addContoursTool">addContoursTool</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#addDefaultTools#~addDefaultTools">addDefaultTools</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#addDiameterTool#~addDiameterTool">addDiameterTool</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#addMaskEditingTool#~addMaskEditingTool">addMaskEditingTool</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#addSeedsTool#~addSeedsTool">addSeedsTool</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#addStackStateToElement#~addStackStateToElement">addStackStateToElement</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#addToolStateSingleSlice#~addToolStateSingleSlice">addToolStateSingleSlice</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#clearCornerstoneElements#~clearCornerstoneElements">clearCornerstoneElements</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#clearMeasurements#~clearMeasurements">clearMeasurements</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#clearToolStateByName#~clearToolStateByName">clearToolStateByName</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#getCurrentMaskData#~getCurrentMaskData">getCurrentMaskData</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#getToolState#~getToolState">getToolState</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#isToolMissing#~isToolMissing">isToolMissing</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#setSegmentationConfig#~setSegmentationConfig">setSegmentationConfig</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#setToolActive#~setToolActive">setToolActive</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#setToolActive#~setToolActive">setToolActive</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#setToolEnabled#~setToolEnabled">setToolEnabled</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#setToolPassive#~setToolPassive">setToolPassive</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#syncToolStack#~syncToolStack">syncToolStack</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#updateDiameterTool#~updateDiameterTool">updateDiameterTool</a></li><li data-type='method' style='display: none;'><a href="module-imaging_tools.html#updateStackToolState#~updateStackToolState">updateStackToolState</a></li></ul></li><li><a href="module-imaging_utils.html">imaging/utils</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#formatDate#formatDate">formatDate</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#formatDateTime#formatDateTime">formatDateTime</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getCmprMetadata#getCmprMetadata">getCmprMetadata</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getDICOMTag#getDICOMTag">getDICOMTag</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getDICOMTagCode#getDICOMTagCode">getDICOMTagCode</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getDistanceBetweenSlices#getDistanceBetweenSlices">getDistanceBetweenSlices</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getMaxPixelValue#getMaxPixelValue">getMaxPixelValue</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getMeanValue#getMeanValue">getMeanValue</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getMinPixelValue#getMinPixelValue">getMinPixelValue</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getNormalOrientation#getNormalOrientation">getNormalOrientation</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getPixelRepresentation#getPixelRepresentation">getPixelRepresentation</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getPixelTypedArray#getPixelTypedArray">getPixelTypedArray</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getReslicedIOP#getReslicedIOP">getReslicedIOP</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getReslicedIPP#getReslicedIPP">getReslicedIPP</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getReslicedMetadata#getReslicedMetadata">getReslicedMetadata</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getReslicedPixeldata#getReslicedPixeldata">getReslicedPixeldata</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getReslicedSliceLocation#getReslicedSliceLocation">getReslicedSliceLocation</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getSortedStack#getSortedStack">getSortedStack</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getSortedUIDs#getSortedUIDs">getSortedUIDs</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getTagValue#getTagValue">getTagValue</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getTypedArray#getTypedArray">getTypedArray</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#getTypedArrayFromDataType#getTypedArrayFromDataType">getTypedArrayFromDataType</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#isElement#isElement">isElement</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#isNegativeSign#isNegativeSign">isNegativeSign</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#isStringVr#isStringVr">isStringVr</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#isValidDate#isValidDate">isValidDate</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#parseAgeTag#parseAgeTag">parseAgeTag</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#parseDateTag#parseDateTag">parseDateTag</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#parseDateTimeTag#parseDateTimeTag">parseDateTimeTag</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#parseDICOMFileIDTag#parseDICOMFileIDTag">parseDICOMFileIDTag</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#parsePatientNameTag#parsePatientNameTag">parsePatientNameTag</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#parseTag#parseTag">parseTag</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#parseTimeTag#parseTimeTag">parseTimeTag</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#permuteSignedArrays#permuteSignedArrays">permuteSignedArrays</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#permuteValues#permuteValues">permuteValues</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#rand#rand">rand</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#randomId#randomId">randomId</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#sortStackCallback#sortStackCallback">sortStackCallback</a></li><li data-type='method' style='display: none;'><a href="module-imaging_utils.html#spacingArray#spacingArray">spacingArray</a></li></ul></li><li><a href="module-loaders_commonLoader.html">loaders/commonLoader</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-loaders_commonLoader.html#getImageFrame#getImageFrame">getImageFrame</a></li><li data-type='method' style='display: none;'><a href="module-loaders_commonLoader.html#getLarvitarImageTracker#getLarvitarImageTracker">getLarvitarImageTracker</a></li><li data-type='method' style='display: none;'><a href="module-loaders_commonLoader.html#getLarvitarManager#getLarvitarManager">getLarvitarManager</a></li><li data-type='method' style='display: none;'><a href="module-loaders_commonLoader.html#getSeriesDataFromLarvitarManager#getSeriesDataFromLarvitarManager">getSeriesDataFromLarvitarManager</a></li><li data-type='method' style='display: none;'><a href="module-loaders_commonLoader.html#populateLarvitarManager#populateLarvitarManager">populateLarvitarManager</a></li><li data-type='method' style='display: none;'><a href="module-loaders_commonLoader.html#removeSeriesFromLarvitarManager#removeSeriesFromLarvitarManager">removeSeriesFromLarvitarManager</a></li><li data-type='method' style='display: none;'><a href="module-loaders_commonLoader.html#resetLarvitarManager#resetLarvitarManager">resetLarvitarManager</a></li><li data-type='method' style='display: none;'><a href="module-loaders_commonLoader.html#updateLarvitarManager#updateLarvitarManager">updateLarvitarManager</a></li></ul></li><li><a href="module-loaders_dicomLoader.html">loaders/dicomLoader</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-loaders_dicomLoader.html#cacheImages#cacheImages">cacheImages</a></li><li data-type='method' style='display: none;'><a href="module-loaders_dicomLoader.html#getDicomImageId#getDicomImageId">getDicomImageId</a></li></ul></li><li><a href="module-loaders_fileLoader.html">loaders/fileLoader</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-loaders_fileLoader.html#getFileImageId#getFileImageId">getFileImageId</a></li><li data-type='method' style='display: none;'><a href="module-loaders_fileLoader.html#populateFileManager#populateFileManager">populateFileManager</a></li><li data-type='method' style='display: none;'><a href="module-loaders_fileLoader.html#resetFileLoader#resetFileLoader">resetFileLoader</a></li><li data-type='method' style='display: none;'><a href="module-loaders_fileLoader.html#resetFileManager#resetFileManager">resetFileManager</a></li></ul></li><li><a href="module-loaders_nrrdLoader.html">loaders/nrrdLoader</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-loaders_nrrdLoader.html#buildNrrdImage#buildNrrdImage">buildNrrdImage</a></li><li data-type='method' style='display: none;'><a href="module-loaders_nrrdLoader.html#createCustomImage#createCustomImage">createCustomImage</a></li><li data-type='method' style='display: none;'><a href="module-loaders_nrrdLoader.html#getImageIdFromSlice#getImageIdFromSlice">getImageIdFromSlice</a></li><li data-type='method' style='display: none;'><a href="module-loaders_nrrdLoader.html#getNrrdImageId#getNrrdImageId">getNrrdImageId</a></li><li data-type='method' style='display: none;'><a href="module-loaders_nrrdLoader.html#getNrrdSerieDimensions#getNrrdSerieDimensions">getNrrdSerieDimensions</a></li><li data-type='method' style='display: none;'><a href="module-loaders_nrrdLoader.html#getSliceNumberFromImageId#getSliceNumberFromImageId">getSliceNumberFromImageId</a></li><li data-type='method' style='display: none;'><a href="module-loaders_nrrdLoader.html#loadNrrdImage#loadNrrdImage">loadNrrdImage</a></li></ul></li><li><a href="module-loaders_resliceLoader.html">loaders/resliceLoader</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-loaders_resliceLoader.html#createCustomImage#createCustomImage">createCustomImage</a></li><li data-type='method' style='display: none;'><a href="module-loaders_resliceLoader.html#loadReslicedImage#loadReslicedImage">loadReslicedImage</a></li></ul></li><li><a href="module-monitors_memory.html">monitors/memory</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-monitors_memory.html#checkMemoryAllocation#checkMemoryAllocation">checkMemoryAllocation</a></li><li data-type='method' style='display: none;'><a href="module-monitors_memory.html#checkMemorySupport#checkMemorySupport">checkMemorySupport</a></li><li data-type='method' style='display: none;'><a href="module-monitors_memory.html#getAvailableMemory#getAvailableMemory">getAvailableMemory</a></li><li data-type='method' style='display: none;'><a href="module-monitors_memory.html#getMB#getMB">getMB</a></li><li data-type='method' style='display: none;'><a href="module-monitors_memory.html#getUsedMemory#getUsedMemory">getUsedMemory</a></li><li data-type='method' style='display: none;'><a href="module-monitors_memory.html#setAvailableMemory#setAvailableMemory">setAvailableMemory</a></li></ul></li><li><a href="module-tools_default.html">tools/default</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-tools_default.html#getDefaultToolsByType#~getDefaultToolsByType">getDefaultToolsByType</a></li><li data-type='method' style='display: none;'><a href="module-tools_default.html#setDefaultToolsProps#~setDefaultToolsProps">setDefaultToolsProps</a></li></ul></li></ul><h3>Events</h3><ul><li><a href="ContoursTool.html#event:_drawingDoubleTapClickCallback">ContoursTool#_drawingDoubleTapClickCallback</a></li><li><a href="ContoursTool.html#event:_drawingMouseDoubleClickCallback">ContoursTool#_drawingMouseDoubleClickCallback</a></li><li><a href="ContoursTool.html#event:_drawingMouseDownCallback">ContoursTool#_drawingMouseDownCallback</a></li><li><a href="ContoursTool.html#event:_drawingMouseDragCallback">ContoursTool#_drawingMouseDragCallback</a></li><li><a href="ContoursTool.html#event:_drawingMouseMoveCallback">ContoursTool#_drawingMouseMoveCallback</a></li><li><a href="ContoursTool.html#event:_drawingMouseUpCallback">ContoursTool#_drawingMouseUpCallback</a></li><li><a href="ContoursTool.html#event:_drawingTouchDragCallback">ContoursTool#_drawingTouchDragCallback</a></li><li><a href="ContoursTool.html#event:_drawingTouchStartCallback">ContoursTool#_drawingTouchStartCallback</a></li><li><a href="ContoursTool.html#event:_editMouseDragCallback">ContoursTool#_editMouseDragCallback</a></li><li><a href="ContoursTool.html#event:_editTouchDragCallback">ContoursTool#_editTouchDragCallback</a></li></ul><h3>Mixins</h3><ul><li><a href="Mixins.polygonSegmentationMixin%2520-%2520segmentation%2520operations%2520for%2520polyline.html">Mixins.polygonSegmentationMixin - segmentation operations for polyline</a></li></ul><h3>Global</h3><ul><li><a href="global.html#_checkIfDrawing">_checkIfDrawing</a></li><li><a href="global.html#_paint">_paint</a></li><li><a href="global.html#addDefaultTools">addDefaultTools</a></li><li><a href="global.html#addMouseKeyHandlers">addMouseKeyHandlers</a></li><li><a href="global.html#addSegmentationMask">addSegmentationMask</a></li><li><a href="global.html#addTool">addTool</a></li><li><a href="global.html#buildMultiFrameImage">buildMultiFrameImage</a></li><li><a href="global.html">clearMultiFrameCache</a></li><li><a href="global.html#clearSegmentationState">clearSegmentationState</a></li><li><a href="global.html#config">config</a></li><li><a href="global.html">createCustomImage</a></li><li><a href="global.html#csToolsCreateStack">csToolsCreateStack</a></li><li><a href="global.html#csToolsUpdateImageIndex">csToolsUpdateImageIndex</a></li><li><a href="global.html#deleteMask">deleteMask</a></li><li><a href="global.html#disableBrushTool">disableBrushTool</a></li><li><a href="global.html#download">download</a></li><li><a href="global.html#enableBrushTool">enableBrushTool</a></li><li><a href="global.html#eraseFreehand">eraseFreehand</a></li><li><a href="global.html#eraseInsideFreehand">eraseInsideFreehand</a></li><li><a href="global.html#eraseOutsideFreehand">eraseOutsideFreehand</a></li><li><a href="global.html#exportAnnotations">exportAnnotations</a></li><li><a href="global.html#extractToolInfo">extractToolInfo</a></li><li><a href="global.html#fillFreehand">fillFreehand</a></li><li><a href="global.html#fillInsideFreehand">fillInsideFreehand</a></li><li><a href="global.html#fillOutsideFreehand">fillOutsideFreehand</a></li><li><a href="global.html#forceRender">forceRender</a></li><li><a href="global.html#generateCSV">generateCSV</a></li><li><a href="global.html#generateLUT">generateLUT</a></li><li><a href="global.html#generateUniformLUT">generateUniformLUT</a></li><li><a href="global.html#getActiveLabelmapBuffer">getActiveLabelmapBuffer</a></li><li><a href="global.html#getCircleWithThreshold">getCircleWithThreshold</a></li><li><a href="global.html">getMultiFrameImageId</a></li><li><a href="global.html#HSVtoRGB">HSVtoRGB</a></li><li><a href="global.html#initializeCSTools">initializeCSTools</a></li><li><a href="global.html#initSegmentationModule">initSegmentationModule</a></li><li><a href="global.html#isDrawing">isDrawing</a></li><li><a href="global.html#isToolMissing">isToolMissing</a></li><li><a href="global.html#loadAnnotations">loadAnnotations</a></li><li><a href="global.html#loadMultiFrameImage">loadMultiFrameImage</a></li><li><a href="global.html#NRRD_TYPES_TO_TYPEDARRAY">NRRD_TYPES_TO_TYPEDARRAY</a></li><li><a href="global.html">parse</a></li><li><a href="global.html#redoLastStroke">redoLastStroke</a></li><li><a href="global.html#renderToolData">renderToolData</a></li><li><a href="global.html#restoreToolState">restoreToolState</a></li><li><a href="global.html#saveAnnotations">saveAnnotations</a></li><li><a href="global.html#saveToolState">saveToolState</a></li><li><a href="global.html#setActiveLabelmap">setActiveLabelmap</a></li><li><a href="global.html#setActiveLabelOpacity">setActiveLabelOpacity</a></li><li><a href="global.html#setActiveSegment">setActiveSegment</a></li><li><a href="global.html#setBrushProps">setBrushProps</a></li><li><a href="global.html#setInactiveLabelOpacity">setInactiveLabelOpacity</a></li><li><a href="global.html#setMaskProps">setMaskProps</a></li><li><a href="global.html">setPixelDataType</a></li><li><a href="global.html#setToolActive">setToolActive</a></li><li><a href="global.html#setToolDisabled">setToolDisabled</a></li><li><a href="global.html#setToolEnabled">setToolEnabled</a></li><li><a href="global.html#setToolPassive">setToolPassive</a></li><li><a href="global.html#setToolsStyle">setToolsStyle</a></li><li><a href="global.html#toggleContourMode">toggleContourMode</a></li><li><a href="global.html">toggleMouseHandlers</a></li><li><a href="global.html#tryUpdateImage">tryUpdateImage</a></li><li><a href="global.html#undoLastStroke">undoLastStroke</a></li></ul>
41
-
42
- </nav>
43
-
44
- <div id="main">
45
-
46
- <h1 class="page-title">image_tools.js</h1>
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
- <section>
55
- <article>
56
- <pre class="prettyprint source linenums"><code>/** @module imaging/tools
57
- * @desc This file provides functionalities for
58
- * interacting with cornerstone tools
59
- */
60
-
61
- // external libraries
62
- import cornerstone from "cornerstone-core";
63
- import cornerstoneTools from "cornerstone-tools";
64
- import { each, extend, filter, remove, cloneDeep } from "lodash";
65
-
66
- // internal libraries
67
- import { DEFAULT_TOOLS } from "./tools/tools.default";
68
- // import { SeedsTool } from "./tools/seedTool";
69
- import { ContoursTool } from "./tools/contourTool";
70
- import { EditMaskTool } from "./tools/editMaskTool";
71
- import { DiameterTool } from "./tools/diameterTool";
72
- import { getImageIdFromSlice } from "./loaders/nrrdLoader";
73
- import { getSeriesDataFromLarvitarManager } from "./loaders/commonLoader";
74
- import { parseContours } from "./image_contours";
75
- import { isElement } from "./image_utils";
76
-
77
- /*
78
- * This module provides the following functions to be exported:
79
- * csToolsCreateStack(element)
80
- * addDefaultTools()
81
- * clearMeasurements()
82
- * addContoursTool(rawContours, maskName)
83
- * addMaskEditingTool(seriesId,mask,setConfig,callback, targetViewport)
84
- * getCurrentMaskData(viewportId)
85
- * addStackStateToElement(seriesId, element)
86
- * addSeedsTool(preLoadSeeds, initViewport)
87
- * addDiameterTool(targetElementId, diameters, seriesId)
88
- * setToolActive(toolName, options, activeViewport, viewports)
89
- * setToolDisabled(toolName, options, activeViewport, viewports)
90
- * setToolEnabled(toolName, options, activeViewport, viewports)
91
- * setToolPassive(toolName, options, activeViewport, viewports)
92
- * getToolState(toolName)
93
- * updateDiameterTool(diameterId, value, seriesId)
94
- * addToolStateSingleSlice(element, toolType, data, slice, seriesId)
95
- * clearToolStateByName(toolName, options)
96
- * clearCornerstoneElements()
97
- * syncToolStack(srcSliceNumber, toolName, viewport, seriesId)
98
- * updateStackToolState(element, imageIndex)
99
- */
100
-
101
- /**
102
- * Add all default tools, as listed in tools.default.js
103
- * @function addDefaultTools
104
- * @deprecated (OBSOLETE)
105
- */
106
- export const addDefaultTools = function (toolToActivate, cb) {
107
- // for each default tool
108
- each(DEFAULT_TOOLS, tool => {
109
- // check if already added
110
- if (!isToolMissing(tool.name)) {
111
- return;
112
- }
113
-
114
- let configuration = tool.configuration;
115
- let toolClass = cornerstoneTools[tool.class];
116
-
117
- // check target viewports and call add tool with options
118
- if (tool.viewports == "all") {
119
- cornerstoneTools.addTool(toolClass, { configuration });
120
- } else {
121
- // call add tool for element for each element
122
- each(tool.viewports, targetElement => {
123
- cornerstoneTools.addToolForElement(
124
- targetElement,
125
- toolClass,
126
- configuration
127
- );
128
- });
129
- }
130
-
131
- let elements = cornerstone.getEnabledElements();
132
-
133
- // if sync tool, enable
134
- if (tool.sync) {
135
- const synchronizer = new cornerstoneTools.Synchronizer(
136
- "cornerstoneimagerendered",
137
- cornerstoneTools[tool.sync]
138
- );
139
- elements.forEach(element => {
140
- synchronizer.add(element.element);
141
- });
142
-
143
- synchronizer.enabled = true;
144
- }
145
-
146
- if (tool.defaultActive || tool.name == toolToActivate) {
147
- setToolActive(tool.name, tool.options);
148
- }
149
- });
150
-
151
- // set wheel scroll active
152
- setToolActive("StackScrollMouseWheel", {
153
- loop: false, // default false
154
- allowSkipping: false, // default true
155
- invert: false
156
- });
157
-
158
- if (cb) {
159
- cb();
160
- }
161
- };
162
-
163
- /**
164
- * Add Diameter tool
165
- * @function addDiameterTool
166
- * @param {String} elementId - The target hmtl element id or its DOM HTMLElement
167
- * @param {Array} diameters - The array of diameter objects.
168
- * @param {String} seriesId - The id of the target serie.
169
- */
170
- export const addDiameterTool = function (elementId, diameters, seriesId) {
171
- if (isToolMissing("Diameter")) {
172
- let element = isElement(elementId)
173
- ? elementId
174
- : document.getElementById(elementId);
175
- cornerstoneTools.addToolForElement(element, DiameterTool, {
176
- dataArray: diameters,
177
- seriesId: seriesId
178
- });
179
- setToolPassive("Diameter");
180
- }
181
- };
182
-
183
- /**
184
- * Add Contour tool
185
- * @function addContoursTool
186
- * @param {Object} rawContours - The contours object (generated from a segmentation mask).
187
- * @param {String} maskName - The name tag that identify the mask
188
- */
189
- export const addContoursTool = function (rawContours, maskName) {
190
- var pointBatchSize = 2;
191
- console.time("...parsing contours");
192
- var contoursParsedData = parseContours(rawContours, pointBatchSize, maskName);
193
- console.timeEnd("...parsing contours");
194
- cornerstoneTools.addTool(ContoursTool, {
195
- contoursParsedData,
196
- maskName
197
- });
198
- };
199
-
200
- /**
201
- * Add mask editing tool
202
- * @function addMaskEditingTool
203
- * @param {Array} mask - The mask data.
204
- * @param {String} targetViewport - The target hmtl element id.
205
- * @param {Function} callback - The tool initialization callback
206
- */
207
- export const addMaskEditingTool = function (mask, callback, targetViewport) {
208
- let enabledElements = cornerstone.getEnabledElements();
209
-
210
- each(enabledElements, el => {
211
- if (el.element.id == targetViewport) {
212
- cornerstoneTools.addToolForElement(el.element, EditMaskTool, {
213
- mask: mask,
214
- initCallback: callback,
215
- configuration: { alwaysEraseOnClick: false }
216
- });
217
- cornerstoneTools.setToolEnabledForElement(el.element, "EditMask", {
218
- mouseButtonMask: 1
219
- });
220
- }
221
- });
222
-
223
- let defaultConfig = {
224
- radius: 5,
225
- fillAlpha: 0.5
226
- };
227
-
228
- setSegmentationConfig(defaultConfig);
229
- };
230
-
231
- /**
232
- * Modify configuration for cornerstone tools segmentation module
233
- * @function setSegmentationConfig
234
- * @param {Object} config - The custom configuration.
235
- * @example
236
- * Example of custom configuration
237
- * config = {
238
- renderOutline: true,
239
- renderFill: true,
240
- shouldRenderInactiveLabelmaps: true,
241
- radius: 10,
242
- minRadius: 1,
243
- maxRadius: 50,
244
- segmentsPerLabelmap: 65535,
245
- fillAlpha: 0.7,
246
- fillAlphaInactive: 0.1,
247
- outlineAlpha: 0.7,
248
- outlineAlphaInactive: 0.35,
249
- outlineWidth: 3,
250
- storeHistory: true
251
- };
252
- */
253
- export const setSegmentationConfig = function (config) {
254
- let { configuration } = cornerstoneTools.getModule("segmentation");
255
- extend(configuration, config);
256
- let enabledElements = cornerstone.getEnabledElements();
257
- each(enabledElements, el => {
258
- cornerstone.updateImage(el.element);
259
- });
260
- };
261
-
262
- /**
263
- * Get mask editing tool current data from state
264
- * @function getCurrentMaskData
265
- * @param {String} viewportId - The target hmtl element id.
266
- * @return {Array} labelmap3D - The mask array
267
- */
268
- export const getCurrentMaskData = function (viewportId) {
269
- const { getters } = cornerstoneTools.getModule("segmentation");
270
- let enabledElement = cornerstone
271
- .getEnabledElements()
272
- .filter(e => e.element.id == viewportId)
273
- .pop();
274
-
275
- const { labelmap3D } = getters.labelmap2D(enabledElement.element);
276
- return labelmap3D;
277
- };
278
-
279
- /**
280
- * Add Stack State to a single hmtl element
281
- * @function addStackStateToElement
282
- * @param {String} seriesId - The id of the target serie.
283
- * @param {HTMLElement} element - The target hmtl element.
284
- */
285
- export const addStackStateToElement = function (seriesId, element) {
286
- // Define the Stack object
287
- const stack = getSeriesDataFromLarvitarManager(seriesId)[element.id];
288
- // Add the stack tool state to the enabled element
289
- cornerstoneTools.addStackStateManager(element, ["stack"]);
290
- cornerstoneTools.addToolState(element, "stack", stack);
291
- };
292
-
293
- /**
294
- * Add seeds tool
295
- * @function addSeedsTool
296
- * @param {Array} preLoadSeeds - The array of seeds to load as initialization.
297
- * @param {String} initViewport - The hmtl element id to be used for tool initialization.
298
- */
299
- export const addSeedsTool = function (preLoadSeeds, initViewport) {
300
- if (isToolMissing("Seeds")) {
301
- let enabledElements = cornerstone.getEnabledElements();
302
- each(enabledElements, el => {
303
- let initialize = el.element.id == initViewport;
304
- cornerstoneTools.addToolForElement(el.element, SeedsTool, {
305
- preLoadSeeds,
306
- initialize,
307
- initViewport
308
- });
309
- });
310
- setToolEnabled("Seeds");
311
- }
312
- };
313
-
314
- /**
315
- * Delete all measurements from tools state, for tools that have the "cleaneable" prop set to true in tools.default.js
316
- * @function clearMeasurements
317
- */
318
- export const clearMeasurements = function (cb) {
319
- let enabledElements = cornerstone.getEnabledElements();
320
- let clenableTools = filter(DEFAULT_TOOLS, "cleanable");
321
-
322
- each(enabledElements, el => {
323
- each(clenableTools, function (tool) {
324
- cornerstoneTools.clearToolState(el.element, tool.name);
325
- });
326
- });
327
- each(enabledElements, el => {
328
- cornerstone.updateImage(el.element);
329
- });
330
-
331
- if (cb) {
332
- cb();
333
- }
334
- };
335
-
336
- /**
337
- * Set Tool "active" on all elements (ie, rendered and manipulable) &amp; refresh cornerstone elements
338
- * @function setToolActive
339
- * @param {String} toolName - The tool name.
340
- * @param {Object} options - The custom options. @default from tools.default.js
341
- * @param {String} activeViewport - The active viewport (if "all", viewports array will be used)
342
- * @param {Array} viewports - The hmtl element id to be used for tool initialization.
343
- */
344
- export const setToolActive = function (
345
- toolName,
346
- options,
347
- activeViewport,
348
- viewports
349
- ) {
350
- let defaultOpt = DEFAULT_TOOLS[toolName].options;
351
- extend(defaultOpt, options);
352
- cornerstoneTools.setToolActive(toolName, defaultOpt);
353
- if (activeViewport == "all") {
354
- each(viewports, function (elementId) {
355
- let el = document.getElementById(elementId);
356
- if (el) {
357
- cornerstone.updateImage(el);
358
- }
359
- });
360
- } else {
361
- let el = document.getElementById(activeViewport);
362
- if (el) {
363
- cornerstone.updateImage(el);
364
- }
365
- }
366
- };
367
-
368
- /**
369
- * Set Tool "disabled" on all elements (ie, not rendered) &amp; refresh cornerstone elements
370
- * @function setToolActive
371
- * @param {String} toolName - The tool name.
372
- * @param {String} activeViewport - The active viewport (if "all", viewports array will be used)
373
- * @param {Array} viewports - The hmtl element id to be used for tool initialization.
374
- */
375
- export const setToolDisabled = function (toolName, activeViewport, viewports) {
376
- cornerstoneTools.setToolDisabled(toolName);
377
- if (activeViewport == "all") {
378
- each(viewports, function (elementId) {
379
- let el = document.getElementById(elementId);
380
- if (el) {
381
- cornerstone.updateImage(el);
382
- }
383
- });
384
- } else {
385
- let el = document.getElementById(activeViewport);
386
- if (el) {
387
- cornerstone.updateImage(el);
388
- }
389
- }
390
- };
391
-
392
- /**
393
- * Set Tool "enabled" on all elements (ie, rendered but not manipulable) &amp; refresh cornerstone elements
394
- * @function setToolEnabled
395
- * @param {String} toolName - The tool name.
396
- * @param {String} activeViewport - The active viewport (if "all", viewports array will be used)
397
- * @param {Array} viewports - The hmtl element id to be used for tool initialization.
398
- */
399
- export const setToolEnabled = function (toolName, activeViewport, viewports) {
400
- cornerstoneTools.setToolEnabled(toolName);
401
- if (activeViewport == "all") {
402
- each(viewports, function (elementId) {
403
- let el = document.getElementById(elementId);
404
- if (el) {
405
- cornerstone.updateImage(el);
406
- }
407
- });
408
- } else {
409
- let el = document.getElementById(activeViewport);
410
- if (el) {
411
- cornerstone.updateImage(el);
412
- }
413
- }
414
- };
415
-
416
- /**
417
- * Set Tool "enabled" on all elements (ie, rendered and manipulable passively) &amp; refresh cornerstone elements
418
- * @function setToolPassive
419
- * @param {String} toolName - The tool name.
420
- * @param {String} activeViewport - The active viewport (if "all", viewports array will be used)
421
- * @param {Array} viewports - The hmtl element id to be used for tool initialization.
422
- */
423
- export const setToolPassive = function (toolName, activeViewport, viewports) {
424
- cornerstoneTools.setToolPassive(toolName);
425
- if (activeViewport == "all") {
426
- each(viewports, function (elementId) {
427
- let el = document.getElementById(elementId);
428
- if (el) {
429
- cornerstone.updateImage(el);
430
- }
431
- });
432
- } else {
433
- let el = document.getElementById(activeViewport);
434
- if (el) {
435
- cornerstone.updateImage(el);
436
- }
437
- }
438
- };
439
-
440
- /**
441
- * Get tool data for all enabled elements
442
- * @function getToolState
443
- * @param {String} toolName - The tool name.
444
- * @return {Object} - Tool data grouped by element id
445
- */
446
- export const getToolState = function (toolName) {
447
- let enabledElements = cornerstone.getEnabledElements();
448
- let toolData = {};
449
- each(enabledElements, el => {
450
- toolData[el.element.id] = cornerstoneTools.getToolState(
451
- el.element,
452
- toolName
453
- );
454
- });
455
- return toolData;
456
- };
457
-
458
- /**
459
- * Clear tool data for a subset of seeds
460
- * @function clearToolStateByName
461
- * @param {String} toolName - The tool name.
462
- * @param {Object} options - Props used to select the data to delete (at the moment only {name : "targetName"} is implemented)
463
- */
464
- export const clearToolStateByName = function (toolName, options) {
465
- let enabledElements = cornerstone.getEnabledElements();
466
- each(enabledElements, el => {
467
- const toolStateManager = el.toolStateManager;
468
- let imageIds = Object.keys(toolStateManager.toolState);
469
- each(imageIds, imageId => {
470
- let toolData = toolStateManager.toolState[imageId];
471
- if (toolData[toolName]) {
472
- remove(toolData[toolName].data, singleData => {
473
- return singleData.name == options.name;
474
- });
475
- }
476
- });
477
- });
478
- each(enabledElements, el => {
479
- cornerstone.updateImage(el.element);
480
- });
481
- };
482
-
483
- /**
484
- * Update diameter tool with new value (removing old one)
485
- * @function updateDiameterTool
486
- * @param {String | Number} diameterId - The id that identify the diameter data.
487
- * @param {Object} value - The object representing the new diameter data.
488
- * @param {String} seriesId - The target serie id.
489
- * @param {String} viewportId - The viewport id.
490
- */
491
- export const updateDiameterTool = function (
492
- diameterId,
493
- value,
494
- seriesId,
495
- viewportId
496
- ) {
497
- // clear target diameter
498
- if (!diameterId) {
499
- console.warn("no diameterId, return");
500
- return;
501
- }
502
-
503
- clearToolStateByName("Diameter", {
504
- name: diameterId
505
- });
506
- // insert new one
507
- let data = {
508
- toolType: "Diameter",
509
- name: diameterId,
510
- isCreating: true,
511
- visible: true,
512
- active: false,
513
- invalidated: false,
514
- handles: {
515
- start: {
516
- x: value.tool.x1,
517
- y: value.tool.y1,
518
- index: 0,
519
- drawnIndependently: false,
520
- allowedOutsideImage: false,
521
- highlight: true,
522
- active: false
523
- },
524
- end: {
525
- x: value.tool.x2,
526
- y: value.tool.y2,
527
- index: 1,
528
- drawnIndependently: false,
529
- allowedOutsideImage: false,
530
- highlight: true,
531
- active: false
532
- },
533
- perpendicularStart: {
534
- x: value.tool.x3,
535
- y: value.tool.y3,
536
- index: 2,
537
- drawnIndependently: false,
538
- allowedOutsideImage: false,
539
- highlight: true,
540
- active: false,
541
- locked: false
542
- },
543
- perpendicularEnd: {
544
- x: value.tool.x4,
545
- y: value.tool.y4,
546
- index: 3,
547
- drawnIndependently: false,
548
- allowedOutsideImage: false,
549
- highlight: true,
550
- active: false
551
- },
552
- textBox: {
553
- x: value.tool.value_max,
554
- y: value.tool.value_min,
555
- index: null,
556
- drawnIndependently: true,
557
- allowedOutsideImage: true,
558
- highlight: false,
559
- active: false,
560
- hasMoved: true,
561
- movesIndependently: false,
562
- hasBoundingBox: true,
563
- boundingBox: {
564
- width: 59.6484375,
565
- height: 47,
566
- left: 165.02487562189057,
567
- top: 240.53482587064684
568
- }
569
- }
570
- },
571
- longestDiameter: value.tool.value_max.toString(),
572
- shortestDiameter: value.tool.value_min.toString()
573
- };
574
-
575
- let sliceNumber = value.tool.slice;
576
- let enabledElement = cornerstone
577
- .getEnabledElements()
578
- .filter(el => el.element.id == viewportId)
579
- .pop();
580
-
581
- // add to master viewport
582
- addToolStateSingleSlice(
583
- enabledElement.element,
584
- "Diameter",
585
- data,
586
- sliceNumber,
587
- seriesId
588
- );
589
- };
590
-
591
- /**
592
- * Add tool data for a single target slice
593
- * @function addToolStateSingleSlice
594
- * @param {HTMLElement} element - The target hmtl element.
595
- * @param {String} toolName - The tool name.
596
- * @param {Object | Array} data - The tool data to add (tool-specific)
597
- * @param {Number} slice - The target slice to put the data in.
598
- * @param {String} seriesId - The target serie id.
599
- */
600
- export const addToolStateSingleSlice = function (
601
- element,
602
- toolName,
603
- data,
604
- slice,
605
- seriesId
606
- ) {
607
- const enabledElement = cornerstone.getEnabledElement(element);
608
-
609
- if (!enabledElement.image) {
610
- console.warn("no image");
611
- return;
612
- }
613
-
614
- let targetImageId = getImageIdFromSlice(slice, element.id, seriesId);
615
-
616
- if (enabledElement.toolStateManager === undefined) {
617
- console.warn("State Manager undefined");
618
- return;
619
- }
620
- let toolState = enabledElement.toolStateManager.toolState;
621
-
622
- if (toolState.hasOwnProperty(targetImageId) === false) {
623
- toolState[targetImageId] = {};
624
- }
625
-
626
- const imageIdToolState = toolState[targetImageId];
627
-
628
- // If we don't have tool state for this type of tool, add an empty object
629
- if (imageIdToolState.hasOwnProperty(toolName) === false) {
630
- imageIdToolState[toolName] = {
631
- data: []
632
- };
633
- }
634
-
635
- const toolData = imageIdToolState[toolName];
636
-
637
- // if an array is provided, override data
638
- // if (Array.isArray(data)) {
639
- // toolData.data = data;
640
- // } else {
641
- // toolData.data.push(data);
642
- // }
643
-
644
- // This implementation works better
645
- let singledata = typeof data.pop == "function" ? data.pop() : data;
646
- // remove old data for this id (avoid doubling contours) // TODO generalize
647
- if (toolName == "ContoursTool") {
648
- remove(toolData.data, entry => entry &amp;&amp; entry.id == singledata.id);
649
- }
650
- toolData.data.push(singledata);
651
- };
652
-
653
- /**
654
- * Clear tool state and disable all cornerstone elements
655
- * @function clearCornerstoneElements
656
- */
657
- export const clearCornerstoneElements = function () {
658
- var enabledElements = cornerstone.getEnabledElements();
659
- var inMemElements = cloneDeep(enabledElements); // copy before modifying
660
- each(inMemElements, el => {
661
- each(DEFAULT_TOOLS, function (tool) {
662
- if (tool.cleanable) {
663
- cornerstoneTools.clearToolState(el.element, tool.name);
664
- }
665
- });
666
- cornerstone.disable(el.element);
667
- });
668
- };
669
-
670
- /**
671
- * Sync the cornerstone tools stack given a slice as data source
672
- * @function syncToolStack
673
- * @param {Number} srcSliceNumber - The slice to be used as data source.
674
- * @param {String} toolName - The name of the tool to sync.
675
- * @param {String} viewport - The target viewport id.
676
- * @param {String} seriesId - The target serie id.
677
- */
678
- export const syncToolStack = function (
679
- srcSliceNumber,
680
- toolName,
681
- viewport,
682
- seriesId
683
- ) {
684
- // get the imageIds array
685
- let seriesData = getSeriesDataFromLarvitarManager(seriesId);
686
- let imageIds = seriesData[viewport].imageIds;
687
-
688
- // get the tool state of source imageId
689
- let element = document.getElementById(viewport);
690
- let enabledElement = cornerstone.getEnabledElement(element);
691
- let srcImageId = getImageIdFromSlice(srcSliceNumber, viewport, seriesId);
692
- let srcImageToolState =
693
- enabledElement.toolStateManager.toolState[srcImageId][toolName];
694
-
695
- each(Object.keys(imageIds), sliceNumber => {
696
- if (sliceNumber == srcSliceNumber) {
697
- return;
698
- }
699
- each(srcImageToolState, data => {
700
- addToolStateSingleSlice(element, toolName, data, sliceNumber, seriesId);
701
- });
702
- });
703
- };
704
-
705
- /**
706
- * Update slice index in cornerstone tools stack state
707
- * @function updateStackToolState
708
- * @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
709
- * @param {Number} imageIndex - The new imageIndex value.
710
- */
711
- export const updateStackToolState = function (elementId, imageIndex) {
712
- let element = isElement(elementId)
713
- ? elementId
714
- : document.getElementById(elementId);
715
- if (!element) {
716
- console.error("invalid html element: " + elementId);
717
- return;
718
- }
719
- let enabledElement = cornerstone.getEnabledElement(element);
720
- if (!enabledElement.toolStateManager) {
721
- return;
722
- }
723
- let stackState = enabledElement.toolStateManager.toolState["stack"];
724
- if (!stackState) {
725
- return;
726
- }
727
- // READY for different segmentations data (data[segmentation_label_id])
728
- stackState.data[0].currentImageIdIndex = imageIndex;
729
- };
730
-
731
- /** @inner Internal module functions */
732
-
733
- /**
734
- * Check if a tool has already been added
735
- * @function isToolMissing
736
- * @param {String} toolName - The tool name.
737
- * @param {Array} _viewports - The viewports to check.
738
- */
739
- const isToolMissing = function (toolName, _viewports) {
740
- let isToolMissing = false;
741
-
742
- if (_viewports) {
743
- each(_viewports, function (viewport) {
744
- let element = cornerstone.getEnabledElement(
745
- document.getElementById(viewport)
746
- );
747
- let added = cornerstoneTools.getToolForElement(element, toolName);
748
- if (added === undefined) {
749
- isToolMissing = true;
750
- }
751
- });
752
- } else {
753
- let elements = cornerstone.getEnabledElements();
754
- each(elements, function (element) {
755
- let added = cornerstoneTools.getToolForElement(element, toolName);
756
- if (added === undefined) {
757
- isToolMissing = true;
758
- }
759
- });
760
- }
761
-
762
- return isToolMissing;
763
- };
764
- </code></pre>
765
- </article>
766
- </section>
767
-
768
-
769
-
770
-
771
-
772
-
773
- </div>
774
-
775
- <br class="clear">
776
-
777
- <footer>
778
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
779
- </footer>
780
-
781
- <script>prettyPrint();</script>
782
- <script src="scripts/polyfill.js"></script>
783
- <script src="scripts/linenumber.js"></script>
784
-
785
- <script src="scripts/search.js" defer></script>
786
-
787
-
788
- <script src="scripts/collapse.js" defer></script>
789
-
790
-
791
- </body>
792
- </html>