larvitar 0.18.2 → 1.2.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.
- package/.github/workflows/deploy.yml +3 -12
- package/MIGRATION.md +25 -0
- package/README.md +28 -27
- package/docs/documentation/Mixins.polygonSegmentationMixin%20-%20segmentation%20operations%20for%20polyline.html +171 -0
- package/docs/documentation/Tools.Annotation.ContoursTool.html +218 -0
- package/docs/documentation/Tools.Annotation.DiameterTool.html +219 -0
- package/docs/documentation/Tools.Annotation.SeedsTool.html +214 -0
- package/docs/documentation/Tools.Brush.BrushTool.html +218 -0
- package/docs/documentation/Tools.Brush.ThresholdsBrushTool.html +218 -0
- package/docs/documentation/Tools.PolylineScissorsTool.html +218 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/documentation/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/documentation/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/documentation/global.html +1303 -0
- package/docs/documentation/imageAnonymization.js.html +245 -0
- package/docs/documentation/imageColormaps.js.html +283 -0
- package/docs/documentation/imageContours.js.html +278 -0
- package/docs/documentation/imageIo.js.html +291 -0
- package/docs/documentation/imageLayers.js.html +188 -0
- package/docs/documentation/imageLoading.js.html +297 -0
- package/docs/documentation/imageParsing.js.html +385 -0
- package/docs/documentation/imagePresets.js.html +207 -0
- package/docs/documentation/imageRendering.js.html +849 -0
- package/docs/documentation/imageReslice.js.html +162 -0
- package/docs/documentation/imageStore.js.html +360 -0
- package/docs/documentation/imageTools.js.html +784 -0
- package/docs/documentation/imageUtils.js.html +1609 -0
- package/docs/documentation/image_colormaps.js.html +283 -0
- package/docs/documentation/image_contours.js.html +279 -0
- package/docs/documentation/image_io.js.html +288 -0
- package/docs/documentation/image_layers.js.html +188 -0
- package/docs/documentation/image_loading.js.html +294 -0
- package/docs/documentation/image_parsing.js.html +391 -0
- package/docs/documentation/image_presets.js.html +207 -0
- package/docs/documentation/image_rendering.js.html +845 -0
- package/docs/documentation/image_reslice.js.html +164 -0
- package/docs/documentation/image_store.js.html +359 -0
- package/docs/documentation/image_tools.js.html +792 -0
- package/docs/documentation/image_utils.js.html +1609 -0
- package/docs/documentation/index.html +175 -0
- package/docs/documentation/loaders_commonLoader.js.html +306 -0
- package/docs/documentation/loaders_dicomLoader.js.html +130 -0
- package/docs/documentation/loaders_fileLoader.js.html +155 -0
- package/docs/documentation/loaders_multiframeLoader.js.html +443 -0
- package/docs/documentation/loaders_niftiLoader.js.html +150 -0
- package/docs/documentation/loaders_nrrdLoader.js.html +545 -0
- package/docs/documentation/loaders_resliceLoader.js.html +258 -0
- package/docs/documentation/module-imaging_contours.html +954 -0
- package/docs/documentation/module-imaging_imageAnonymization.html +544 -0
- package/docs/documentation/module-imaging_imageColormaps.html +1012 -0
- package/docs/documentation/module-imaging_imageContours.html +954 -0
- package/docs/documentation/module-imaging_imageIo.html +1057 -0
- package/docs/documentation/module-imaging_imageLayers.html +904 -0
- package/docs/documentation/module-imaging_imageLoading.html +1301 -0
- package/docs/documentation/module-imaging_imageParsing.html +1356 -0
- package/docs/documentation/module-imaging_imagePresets.html +679 -0
- package/docs/documentation/module-imaging_imageRendering.html +3223 -0
- package/docs/documentation/module-imaging_imageReslice.html +413 -0
- package/docs/documentation/module-imaging_imageStore-Larvitar_Store.html +284 -0
- package/docs/documentation/module-imaging_imageStore.html +1560 -0
- package/docs/documentation/module-imaging_imageTools.html +3617 -0
- package/docs/documentation/module-imaging_imageUtils.html +7253 -0
- package/docs/documentation/module-imaging_io.html +1057 -0
- package/docs/documentation/module-imaging_layers.html +904 -0
- package/docs/documentation/module-imaging_loading.html +1301 -0
- package/docs/documentation/module-imaging_parsing.html +1375 -0
- package/docs/documentation/module-imaging_presets.html +679 -0
- package/docs/documentation/module-imaging_rendering.html +8094 -0
- package/docs/documentation/module-imaging_reslice.html +411 -0
- package/docs/documentation/module-imaging_store-Larvitar_Store.html +284 -0
- package/docs/documentation/module-imaging_store.html +1537 -0
- package/docs/documentation/module-imaging_strategies_eraseFreehand.html +708 -0
- package/docs/documentation/module-imaging_strategies_fillFreehand.html +708 -0
- package/docs/documentation/module-imaging_tools.html +3617 -0
- package/docs/documentation/module-imaging_tools_custom_contourTool.html +207 -0
- package/docs/documentation/module-imaging_tools_custom_diameterTool.html +205 -0
- package/docs/documentation/module-imaging_tools_custom_editMaskTool.html +205 -0
- package/docs/documentation/module-imaging_tools_custom_polygonScissorsTool.html +203 -0
- package/docs/documentation/module-imaging_tools_custom_thresholdBrushTool.html +684 -0
- package/docs/documentation/module-imaging_tools_default.html +205 -0
- package/docs/documentation/module-imaging_tools_interaction.html +530 -0
- package/docs/documentation/module-imaging_tools_io.html +832 -0
- package/docs/documentation/module-imaging_tools_main.html +2028 -0
- package/docs/documentation/module-imaging_tools_polygonSegmentationMixin.html +567 -0
- package/docs/documentation/module-imaging_tools_segmentation.html +3586 -0
- package/docs/documentation/module-imaging_tools_state.html +494 -0
- package/docs/documentation/module-imaging_utils.html +7253 -0
- package/docs/documentation/module-loaders_commonLoader.html +1313 -0
- package/docs/documentation/module-loaders_dicomLoader.html +522 -0
- package/docs/documentation/module-loaders_fileLoader.html +593 -0
- package/docs/documentation/module-loaders_multiframeLoader.html +1169 -0
- package/docs/documentation/module-loaders_niftiLoader.html +565 -0
- package/docs/documentation/module-loaders_nrrdLoader.html +1459 -0
- package/docs/documentation/module-loaders_resliceLoader.html +590 -0
- package/docs/documentation/module-monitors_memory.html +980 -0
- package/docs/documentation/module-tools_default.html +740 -0
- package/docs/documentation/module.exports_module.exports.html +203 -0
- package/docs/documentation/monitors_memory.js.html +189 -0
- package/docs/documentation/parsers_nrrd.js.html +569 -0
- package/docs/documentation/scripts/collapse.js +20 -0
- package/docs/documentation/scripts/linenumber.js +25 -0
- package/docs/documentation/scripts/nav.js +12 -0
- package/docs/documentation/scripts/polyfill.js +4 -0
- package/docs/documentation/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/docs/documentation/scripts/prettify/lang-css.js +2 -0
- package/docs/documentation/scripts/prettify/prettify.js +28 -0
- package/docs/documentation/scripts/search.js +83 -0
- package/docs/documentation/styles/jsdoc.css +765 -0
- package/docs/documentation/styles/prettify.css +80 -0
- package/docs/documentation/tools_contourTool.js.html +1963 -0
- package/docs/documentation/tools_custom_contourTool.js.html +1968 -0
- package/docs/documentation/tools_custom_diameterTool.js.html +225 -0
- package/docs/documentation/tools_custom_editMaskTool.js.html +225 -0
- package/docs/documentation/tools_custom_polylineScissorsTool.js.html +143 -0
- package/docs/documentation/tools_custom_thresholdsBrushTool.js.html +245 -0
- package/docs/documentation/tools_default.js.html +576 -0
- package/docs/documentation/tools_diameterTool.js.html +219 -0
- package/docs/documentation/tools_editMaskTool.js.html +219 -0
- package/docs/documentation/tools_interaction.js.html +258 -0
- package/docs/documentation/tools_io.js.html +297 -0
- package/docs/documentation/tools_main.js.html +443 -0
- package/docs/documentation/tools_polygonSegmentationMixin.js.html +329 -0
- package/docs/documentation/tools_polylineScissorsTool.js.html +136 -0
- package/docs/documentation/tools_seedTool.js.html +423 -0
- package/docs/documentation/tools_segmentation.js.html +558 -0
- package/docs/documentation/tools_state.js.html +163 -0
- package/docs/documentation/tools_strategies_eraseFreehand.js.html +160 -0
- package/docs/documentation/tools_strategies_fillFreehand.js.html +163 -0
- package/docs/documentation/tools_thresholdsBrushTool.js.html +239 -0
- package/docs/documentation/tools_tools.default.js.html +569 -0
- package/docs/documentation/tools_tools.interaction.js.html +251 -0
- package/docs/documentation/tools_tools.io.js.html +288 -0
- package/docs/documentation/tools_tools.main.js.html +442 -0
- package/docs/documentation/tools_tools.segmentation.js.html +445 -0
- package/docs/documentation/tools_tools.state.js.html +157 -0
- package/docs/examples/base.html +170 -0
- package/docs/examples/colorMaps.html +181 -0
- package/docs/examples/defaultTools.html +246 -0
- package/docs/examples/demo/anon1 +0 -0
- package/docs/examples/demo/anon10 +0 -0
- package/docs/examples/demo/anon11 +0 -0
- package/docs/examples/demo/anon12 +0 -0
- package/docs/examples/demo/anon13 +0 -0
- package/docs/examples/demo/anon14 +0 -0
- package/docs/examples/demo/anon15 +0 -0
- package/docs/examples/demo/anon16 +0 -0
- package/docs/examples/demo/anon17 +0 -0
- package/docs/examples/demo/anon18 +0 -0
- package/docs/examples/demo/anon19 +0 -0
- package/docs/examples/demo/anon2 +0 -0
- package/docs/examples/demo/anon20 +0 -0
- package/docs/examples/demo/anon21 +0 -0
- package/docs/examples/demo/anon22 +0 -0
- package/docs/examples/demo/anon23 +0 -0
- package/docs/examples/demo/anon24 +0 -0
- package/docs/examples/demo/anon3 +0 -0
- package/docs/examples/demo/anon4 +0 -0
- package/docs/examples/demo/anon5 +0 -0
- package/docs/examples/demo/anon6 +0 -0
- package/docs/examples/demo/anon7 +0 -0
- package/docs/examples/demo/anon8 +0 -0
- package/docs/examples/demo/anon9 +0 -0
- package/docs/examples/demo/example.nrrd +0 -0
- package/docs/examples/demo/segmentation.nrrd +0 -0
- package/docs/examples/demo/xa_integris.dcm +0 -0
- package/docs/examples/index.html +129 -0
- package/docs/examples/larvitar.js +108623 -0
- package/docs/examples/layers.html +250 -0
- package/docs/examples/masks.html +273 -0
- package/docs/examples/multiframe.html +200 -0
- package/docs/examples/nrrd.html +96 -0
- package/docs/examples/reslice.html +174 -0
- package/docs/index.html +92 -0
- package/imaging/dataDictionary.json +21865 -21865
- package/imaging/imageAnonymization.js +161 -0
- package/imaging/{image_colormaps.js → imageColormaps.js} +2 -2
- package/imaging/{image_contours.js → imageContours.js} +1 -2
- package/imaging/{image_io.js → imageIo.js} +18 -15
- package/imaging/{image_layers.js → imageLayers.js} +2 -2
- package/imaging/{image_loading.js → imageLoading.js} +9 -6
- package/imaging/imageParsing.js +301 -0
- package/imaging/{image_presets.js → imagePresets.js} +2 -2
- package/imaging/{image_rendering.js → imageRendering.js} +36 -32
- package/imaging/imageReslice.js +78 -0
- package/imaging/{image_store.js → imageStore.js} +8 -7
- package/imaging/{image_tools.js → imageTools.js} +15 -23
- package/imaging/{image_utils.js → imageUtils.js} +1 -1
- package/imaging/loaders/commonLoader.js +1 -1
- package/imaging/loaders/dicomLoader.js +1 -1
- package/imaging/loaders/fileLoader.js +2 -2
- package/imaging/loaders/multiframeLoader.js +6 -2
- package/imaging/loaders/nrrdLoader.js +11 -7
- package/imaging/tools/{contourTool.js → custom/contourTool.js} +25 -20
- package/imaging/tools/{diameterTool.js → custom/diameterTool.js} +9 -3
- package/imaging/tools/{editMaskTool.js → custom/editMaskTool.js} +7 -1
- package/imaging/tools/{polylineScissorsTool.js → custom/polylineScissorsTool.js} +12 -5
- package/imaging/tools/{seedTool.js → custom/seedTool.js} +3 -3
- package/imaging/tools/{thresholdsBrushTool.js → custom/thresholdsBrushTool.js} +7 -1
- package/imaging/tools/{tools.default.js → default.js} +10 -3
- package/imaging/tools/{tools.interaction.js → interaction.js} +13 -6
- package/imaging/tools/{tools.io.js → io.js} +15 -6
- package/imaging/tools/{tools.main.js → main.js} +16 -14
- package/imaging/tools/polygonSegmentationMixin.js +8 -4
- package/imaging/tools/{tools.segmentation.js → segmentation.js} +171 -58
- package/imaging/tools/segmentations.md +38 -0
- package/imaging/tools/setLabelMap3D.js +248 -0
- package/imaging/tools/{tools.state.js → state.js} +7 -1
- package/imaging/tools/strategies/eraseFreehand.js +8 -9
- package/imaging/tools/strategies/fillFreehand.js +8 -9
- package/index.js +44 -39
- package/modules/vuex/larvitar.js +13 -3
- package/package.json +13 -10
- package/imaging/image_parsing.js +0 -307
- package/imaging/image_reslice.js +0 -80
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>tools/tools.main.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">tools/tools.main.js</h1>
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
<section>
|
|
55
|
+
<article>
|
|
56
|
+
<pre class="prettyprint source linenums"><code>// external libraries
|
|
57
|
+
import cornerstone from "cornerstone-core";
|
|
58
|
+
import cornerstoneTools from "cornerstone-tools/dist/cornerstoneTools.js";
|
|
59
|
+
import cornerstoneMath from "cornerstone-math";
|
|
60
|
+
import Hammer from "hammerjs";
|
|
61
|
+
|
|
62
|
+
import { each, extend } from "lodash";
|
|
63
|
+
|
|
64
|
+
import {
|
|
65
|
+
saveAnnotations,
|
|
66
|
+
loadAnnotations,
|
|
67
|
+
exportAnnotations
|
|
68
|
+
} from "./tools.io";
|
|
69
|
+
import {
|
|
70
|
+
DEFAULT_TOOLS,
|
|
71
|
+
DEFAULT_STYLE,
|
|
72
|
+
DEFAULT_SETTINGS,
|
|
73
|
+
dvTools
|
|
74
|
+
} from "./tools.default";
|
|
75
|
+
import { larvitar_store } from "../image_store";
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Initialize cornerstone tools with default configuration (extended with custom configuration)
|
|
79
|
+
* @function initializeCSTools
|
|
80
|
+
* @param {Object} settings - the settings object (see tools.default.js)
|
|
81
|
+
* @param {Object} settings - the style object (see tools.default.js)
|
|
82
|
+
* @example larvitar.initializeCSTools({showSVGCursors:false}, {color: "0000FF"});
|
|
83
|
+
*/
|
|
84
|
+
const initializeCSTools = function (settings, style) {
|
|
85
|
+
cornerstoneTools.external.cornerstone = cornerstone;
|
|
86
|
+
cornerstoneTools.external.cornerstoneMath = cornerstoneMath;
|
|
87
|
+
cornerstoneTools.external.Hammer = Hammer;
|
|
88
|
+
extend(DEFAULT_SETTINGS, settings);
|
|
89
|
+
|
|
90
|
+
// hack to fix warning on init() - but breaks labelmap 0 auto generation
|
|
91
|
+
// see https://github.com/cornerstonejs/cornerstoneTools/issues/1395
|
|
92
|
+
cornerstoneTools.getModule(
|
|
93
|
+
"segmentation"
|
|
94
|
+
).configuration.segmentsPerLabelmap = 0;
|
|
95
|
+
|
|
96
|
+
cornerstoneTools.init(DEFAULT_SETTINGS);
|
|
97
|
+
setToolsStyle(style);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Create stack object to sync stack tools
|
|
102
|
+
* @function csToolsCreateStack
|
|
103
|
+
* @param {HTMLElement} element - The target hmtl element.
|
|
104
|
+
* @param {Array} imageIds - Stack image ids.
|
|
105
|
+
* @param {String} currentImageId - The current image id.
|
|
106
|
+
*/
|
|
107
|
+
const csToolsCreateStack = function (element, imageIds, currentImageIndex) {
|
|
108
|
+
let stack;
|
|
109
|
+
if (imageIds) {
|
|
110
|
+
stack = {
|
|
111
|
+
currentImageIdIndex: currentImageIndex,
|
|
112
|
+
imageIds: imageIds
|
|
113
|
+
};
|
|
114
|
+
} else {
|
|
115
|
+
stack = {
|
|
116
|
+
currentImageIdIndex: 0,
|
|
117
|
+
imageIds: "imageLoader://0"
|
|
118
|
+
};
|
|
119
|
+
if (cornerstone.getEnabledElements().length == 0) {
|
|
120
|
+
cornerstone.enable(element);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
cornerstoneTools.addStackStateManager(element, ["stack"]);
|
|
124
|
+
cornerstoneTools.addToolState(element, "stack", stack);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export function csToolsUpdateImageIds(elementId, imageIds, imageIdIndex) {
|
|
128
|
+
const element = document.getElementById(elementId);
|
|
129
|
+
if (element) {
|
|
130
|
+
const stackState = cornerstoneTools.getToolState(element, "stack");
|
|
131
|
+
const stackData = stackState.data[0];
|
|
132
|
+
stackData.imageIds = imageIds;
|
|
133
|
+
stackData.currentImageIdIndex =
|
|
134
|
+
stackData.currentImageIdIndex < imageIdIndex
|
|
135
|
+
? stackData.currentImageIdIndex
|
|
136
|
+
: (stackData.currentImageIdIndex += 1);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Update currentImageIdIndex in cs tools stack
|
|
142
|
+
* @param {String} elementId - The target html element id
|
|
143
|
+
* @param {String} imageId - The imageId in the form xxxxxx//:imageIndex
|
|
144
|
+
*/
|
|
145
|
+
export function csToolsUpdateImageIndex(elementId, imageId) {
|
|
146
|
+
let currentImageIdIndex = parseInt(imageId.split(":")[1]);
|
|
147
|
+
const element = document.getElementById(elementId);
|
|
148
|
+
const stackState = cornerstoneTools.getToolState(element, "stack");
|
|
149
|
+
const stackData = stackState.data[0];
|
|
150
|
+
stackData.currentImageIdIndex = currentImageIdIndex;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
*
|
|
155
|
+
* @param {*} toolName
|
|
156
|
+
*/
|
|
157
|
+
const isToolMissing = function (toolName) {
|
|
158
|
+
let elements = cornerstone.getEnabledElements();
|
|
159
|
+
let isToolMissing = false;
|
|
160
|
+
// TODO check only target viewports
|
|
161
|
+
each(elements, function (el) {
|
|
162
|
+
let added = cornerstoneTools.getToolForElement(el.element, toolName);
|
|
163
|
+
if (added === undefined) {
|
|
164
|
+
isToolMissing = true;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
return isToolMissing;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Add a cornerstone tool (grab it from original library or dvision custom tools)
|
|
173
|
+
* @param {*} toolName
|
|
174
|
+
* @param {*} targetElementId
|
|
175
|
+
* @example larvitar.addTool("ScaleOverlay", {configuration:{minorTickLength: 10, majorTickLength: 25}}, "viewer")
|
|
176
|
+
*/
|
|
177
|
+
const addTool = function (toolName, customConfig, targetElementId) {
|
|
178
|
+
// extend defaults with user custom props
|
|
179
|
+
let defaultConfig = DEFAULT_TOOLS[toolName];
|
|
180
|
+
extend(defaultConfig, customConfig);
|
|
181
|
+
|
|
182
|
+
if (isToolMissing(toolName)) {
|
|
183
|
+
const toolClassName = DEFAULT_TOOLS[toolName].class;
|
|
184
|
+
const toolClass = cornerstoneTools[toolClassName] || dvTools[toolClassName];
|
|
185
|
+
if (targetElementId) {
|
|
186
|
+
let element = document.getElementById(targetElementId);
|
|
187
|
+
cornerstoneTools.addToolForElement(element, toolClass, defaultConfig);
|
|
188
|
+
} else {
|
|
189
|
+
cornerstoneTools.addTool(toolClass, defaultConfig);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Add all default tools, as listed in tools.default.js
|
|
196
|
+
* @function addDefaultTools
|
|
197
|
+
*/
|
|
198
|
+
export const addDefaultTools = function (elementId) {
|
|
199
|
+
let elements = cornerstone.getEnabledElements();
|
|
200
|
+
|
|
201
|
+
if (elements.length == 0) {
|
|
202
|
+
let element = document.getElementById(elementId);
|
|
203
|
+
cornerstone.enable(element);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// for each default tool
|
|
207
|
+
each(DEFAULT_TOOLS, tool => {
|
|
208
|
+
// check if already added
|
|
209
|
+
if (!isToolMissing(tool.name)) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// check target viewports and call add tool with options
|
|
214
|
+
if (tool.viewports == "all") {
|
|
215
|
+
addTool(tool.name, tool.configuration);
|
|
216
|
+
} else {
|
|
217
|
+
// call add tool for element for each element
|
|
218
|
+
each(tool.viewports, targetElementId => {
|
|
219
|
+
addTool(tool.name, tool.configuration, targetElementId);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// if sync tool, enable
|
|
224
|
+
if (tool.sync) {
|
|
225
|
+
const synchronizer = new cornerstoneTools.Synchronizer(
|
|
226
|
+
"cornerstoneimagerendered",
|
|
227
|
+
cornerstoneTools[tool.sync]
|
|
228
|
+
);
|
|
229
|
+
elements.forEach(element => {
|
|
230
|
+
synchronizer.add(element.element);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
synchronizer.enabled = true;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (tool.defaultActive) {
|
|
237
|
+
setToolActive(tool.name, tool.options, [], true);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Try to update image, catching errors if image is not loaded yet
|
|
244
|
+
* @param {HTMLObject} element
|
|
245
|
+
*/
|
|
246
|
+
function tryUpdateImage(element) {
|
|
247
|
+
try {
|
|
248
|
+
cornerstone.updateImage(element);
|
|
249
|
+
} catch (err) {
|
|
250
|
+
// console.warn("updateImage: image has not been loaded yet:", element.id);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Set Tool "active" on all elements (ie, rendered and manipulable) & refresh cornerstone elements
|
|
256
|
+
* @function setToolActive
|
|
257
|
+
* @param {String} toolName - The tool name.
|
|
258
|
+
* @param {Object} options - The custom options. @default from tools.default.js
|
|
259
|
+
* @param {Array} viewports - The hmtl element id to be used for tool initialization.
|
|
260
|
+
* @param {Boolean} doNotSetInStore - Flag to avoid setting in store (useful on tools initialization eg in addDefaultTools). NOTE: This is just a hack, we must rework tools/ui sync.
|
|
261
|
+
*/
|
|
262
|
+
const setToolActive = function (toolName, options, viewports, doNotSetInStore) {
|
|
263
|
+
let defaultOpt = { ...DEFAULT_TOOLS[toolName].options }; // deep copy obj because otherwise cornerstone tools will modify it
|
|
264
|
+
|
|
265
|
+
extend(defaultOpt, options);
|
|
266
|
+
|
|
267
|
+
if (viewports && viewports.length > 0) {
|
|
268
|
+
// activate and update only for "viewports"
|
|
269
|
+
each(viewports, function (elementId) {
|
|
270
|
+
let el = document.getElementById(elementId);
|
|
271
|
+
cornerstoneTools.setToolActiveForElement(el, toolName, defaultOpt);
|
|
272
|
+
tryUpdateImage(el);
|
|
273
|
+
});
|
|
274
|
+
} else {
|
|
275
|
+
// activate and update all
|
|
276
|
+
cornerstoneTools.setToolActive(toolName, defaultOpt);
|
|
277
|
+
let enabledElements = cornerstone.getEnabledElements();
|
|
278
|
+
each(enabledElements, enel => {
|
|
279
|
+
tryUpdateImage(enel.element);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// set active tool in larvitar store
|
|
284
|
+
// mouseButtonMask is now an array, thanks to cs tools "setToolActiveForElement",
|
|
285
|
+
// but only if it has a rendered image in the viewport (!)
|
|
286
|
+
// so we must check the type anyway for type coherence
|
|
287
|
+
if (!doNotSetInStore && defaultOpt.mouseButtonMask) {
|
|
288
|
+
if (typeof defaultOpt.mouseButtonMask == "number") {
|
|
289
|
+
defaultOpt.mouseButtonMask = [defaultOpt.mouseButtonMask];
|
|
290
|
+
}
|
|
291
|
+
if (defaultOpt.mouseButtonMask.includes(1)) {
|
|
292
|
+
larvitar_store.set("leftActiveTool", toolName);
|
|
293
|
+
}
|
|
294
|
+
if (defaultOpt.mouseButtonMask.includes(2)) {
|
|
295
|
+
larvitar_store.set("rightActiveTool", toolName);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Set Tool "disabled" on all elements (ie, not rendered) & refresh cornerstone elements
|
|
302
|
+
* @function setToolDisabled
|
|
303
|
+
* @param {String} toolName - The tool name.
|
|
304
|
+
* @param {Array} viewports - The hmtl element id to be used for tool initialization.
|
|
305
|
+
*/
|
|
306
|
+
const setToolDisabled = function (toolName, viewports) {
|
|
307
|
+
if (viewports && viewports.length > 0) {
|
|
308
|
+
// activate and update only for "viewports"
|
|
309
|
+
each(viewports, function (elementId) {
|
|
310
|
+
let el = document.getElementById(elementId);
|
|
311
|
+
cornerstoneTools.setToolDisabledForElement(el, toolName);
|
|
312
|
+
// restore native cursor
|
|
313
|
+
el.style.cursor = "initial";
|
|
314
|
+
tryUpdateImage(el);
|
|
315
|
+
});
|
|
316
|
+
} else {
|
|
317
|
+
// activate and update all
|
|
318
|
+
cornerstoneTools.setToolDisabled(toolName);
|
|
319
|
+
let enabledElements = cornerstone.getEnabledElements();
|
|
320
|
+
each(enabledElements, enel => {
|
|
321
|
+
// restore native cursor
|
|
322
|
+
enel.element.style.cursor = "initial";
|
|
323
|
+
tryUpdateImage(enel.element);
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Set Tool "enabled" on all elements (ie, rendered but not manipulable) & refresh cornerstone elements
|
|
330
|
+
* @function setToolEnabled
|
|
331
|
+
* @param {String} toolName - The tool name.
|
|
332
|
+
* @param {Array} viewports - The hmtl element id to be used for tool initialization.
|
|
333
|
+
*/
|
|
334
|
+
const setToolEnabled = function (toolName, viewports) {
|
|
335
|
+
if (viewports && viewports.length > 0) {
|
|
336
|
+
// activate and update only for "viewports"
|
|
337
|
+
each(viewports, function (elementId) {
|
|
338
|
+
let el = document.getElementById(elementId);
|
|
339
|
+
cornerstoneTools.setToolEnabledForElement(el, toolName);
|
|
340
|
+
// restore native cursor
|
|
341
|
+
el.style.cursor = "initial";
|
|
342
|
+
tryUpdateImage(el);
|
|
343
|
+
});
|
|
344
|
+
} else {
|
|
345
|
+
// activate and update all
|
|
346
|
+
cornerstoneTools.setToolEnabled(toolName);
|
|
347
|
+
let enabledElements = cornerstone.getEnabledElements();
|
|
348
|
+
each(enabledElements, enel => {
|
|
349
|
+
// restore native cursor
|
|
350
|
+
enel.element.style.cursor = "initial";
|
|
351
|
+
tryUpdateImage(enel.element);
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Set Tool "enabled" on all elements (ie, rendered and manipulable passively) & refresh cornerstone elements
|
|
358
|
+
* @function setToolPassive
|
|
359
|
+
* @param {String} toolName - The tool name.
|
|
360
|
+
* @param {Array} viewports - The hmtl element id to be used for tool initialization.
|
|
361
|
+
*/
|
|
362
|
+
const setToolPassive = function (toolName, viewports) {
|
|
363
|
+
if (viewports && viewports.length > 0) {
|
|
364
|
+
// activate and update only for "viewports"
|
|
365
|
+
each(viewports, function (elementId) {
|
|
366
|
+
let el = document.getElementById(elementId);
|
|
367
|
+
cornerstoneTools.setToolPassiveForElement(el, toolName);
|
|
368
|
+
tryUpdateImage(el);
|
|
369
|
+
});
|
|
370
|
+
} else {
|
|
371
|
+
// activate and update all
|
|
372
|
+
cornerstoneTools.setToolPassive(toolName);
|
|
373
|
+
let enabledElements = cornerstone.getEnabledElements();
|
|
374
|
+
each(enabledElements, enel => {
|
|
375
|
+
tryUpdateImage(enel.element);
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
/** @inner Internal module functions */
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Set cornerstone tools custom configuration (extend default configuration)
|
|
384
|
+
* @function setToolsStyle
|
|
385
|
+
* @param {Object} style - the style object (see tools.defaults.js)
|
|
386
|
+
*/
|
|
387
|
+
const setToolsStyle = function (style) {
|
|
388
|
+
extend(DEFAULT_STYLE, style);
|
|
389
|
+
|
|
390
|
+
let fontFamily = DEFAULT_STYLE.fontFamily;
|
|
391
|
+
let fontSize = DEFAULT_STYLE.fontSize;
|
|
392
|
+
|
|
393
|
+
cornerstoneTools.toolStyle.setToolWidth(DEFAULT_STYLE.width);
|
|
394
|
+
cornerstoneTools.toolColors.setToolColor(DEFAULT_STYLE.color);
|
|
395
|
+
cornerstoneTools.toolColors.setActiveColor(DEFAULT_STYLE.activeColor);
|
|
396
|
+
cornerstoneTools.toolColors.setFillColor(DEFAULT_STYLE.fillColor); // used only by FreehandRoiTool indide handles
|
|
397
|
+
cornerstoneTools.textStyle.setFont(`${fontSize}px ${fontFamily}`);
|
|
398
|
+
cornerstoneTools.textStyle.setBackgroundColor(DEFAULT_STYLE.backgroundColor);
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
export {
|
|
402
|
+
initializeCSTools,
|
|
403
|
+
setToolsStyle,
|
|
404
|
+
csToolsCreateStack,
|
|
405
|
+
addTool,
|
|
406
|
+
setToolActive,
|
|
407
|
+
setToolEnabled,
|
|
408
|
+
setToolDisabled,
|
|
409
|
+
setToolPassive,
|
|
410
|
+
saveAnnotations,
|
|
411
|
+
loadAnnotations,
|
|
412
|
+
exportAnnotations
|
|
413
|
+
};
|
|
414
|
+
</code></pre>
|
|
415
|
+
</article>
|
|
416
|
+
</section>
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
</div>
|
|
424
|
+
|
|
425
|
+
<br class="clear">
|
|
426
|
+
|
|
427
|
+
<footer>
|
|
428
|
+
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.
|
|
429
|
+
</footer>
|
|
430
|
+
|
|
431
|
+
<script>prettyPrint();</script>
|
|
432
|
+
<script src="scripts/polyfill.js"></script>
|
|
433
|
+
<script src="scripts/linenumber.js"></script>
|
|
434
|
+
|
|
435
|
+
<script src="scripts/search.js" defer></script>
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
<script src="scripts/collapse.js" defer></script>
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
</body>
|
|
442
|
+
</html>
|