larvitar 1.3.3 → 1.3.4

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/README.md CHANGED
@@ -4,15 +4,15 @@
4
4
 
5
5
  # Larvitar
6
6
 
7
- ## Dicom Image Toolkit for CornestoneJS
7
+ ## Dicom Image Toolkit for CornerstoneJS
8
8
 
9
- ### Current version: 1.3.3
9
+ ### Current version: 1.3.4
10
10
 
11
- ### Latest Stable version: 1.3.3
11
+ ### Latest Stable version: 1.3.4
12
12
 
13
- ### Latest Published Release: 1.3.3
13
+ ### Latest Published Release: 1.3.4
14
14
 
15
- This library provides common DICOM functionalities to be used in web-applications: it's wrapper that simplifies the use of cornestone-js environment.
15
+ This library provides common DICOM functionalities to be used in web-applications: it's wrapper that simplifies the use of cornerstone-js environment.
16
16
  Orthogonal multiplanar reformat is included as well as custom loader/exporter for nrrd files and [Vuex](https://vuex.vuejs.org/) custom integration.
17
17
 
18
18
  - `index` main file
@@ -22,7 +22,7 @@ Orthogonal multiplanar reformat is included as well as custom loader/exporter fo
22
22
  - `imageIo` import a dicom image in .nrrd format and build contiguous array for exporting data as volume
23
23
  - `imageLayers` provide support for multi-layer cornerstone fusion renderer
24
24
  - `imageLoading` initialize loader and custom loaders
25
- - `imageParsing` parse dicom files and return a cornestone data structure ready to be used for rendering
25
+ - `imageParsing` parse dicom files and return a cornerstone data structure ready to be used for rendering
26
26
  - `imagePresets` provides default image CT presets and set functionality
27
27
  - `imageRendering` provides rendering functionalities
28
28
  - `imageReslice` provides reslice functionalities
@@ -18,6 +18,7 @@ import { updateStackToolState } from "../imageTools";
18
18
 
19
19
  // custom code
20
20
  import { setLabelmap3DForElement } from "./setLabelMap3D";
21
+ import { each } from "hammerjs";
21
22
  // override function
22
23
  setters.labelmap3DForElement = setLabelmap3DForElement;
23
24
 
@@ -419,22 +420,37 @@ export function clearSegmentationState() {
419
420
 
420
421
  /**
421
422
  * Enable brushing
422
- * @param {Number} dimension - The initial brush radius
423
- * @param {Array} thresholds - The threshold values (min and max)
423
+ * NOTE: if options contains `thresholds`, ThresholdsBrush is activated, otherwise BrushTool is activated.
424
+ * Anyway, the activated tool name is returned
425
+ * @param {Object} options - An object containing configuration values (eg radius, thresholds, etc...)
424
426
  */
425
- export function enableBrushTool(dimension, thresholds) {
426
- segModule.configuration.radius = dimension;
427
- segModule.configuration.thresholds = thresholds;
428
- setToolActive("ThresholdsBrush");
427
+ export function enableBrushTool(viewports, options) {
428
+ console.log("enable", options);
429
+ setBrushProps(options);
430
+ const brushType = "thresholds" in options ? "ThresholdsBrush" : "Brush";
431
+ setToolActive(brushType, viewports);
432
+ return brushType;
429
433
  }
430
434
 
431
435
  /**
432
436
  * Disable brushing
433
- * @param {String} toolToActivate - The name of the tool to activate after removing the brush
437
+ * This function disables both brush tools, if found active on `viewports`
438
+ * @param {String} toolToActivate - The name of the tool to activate after removing the brush @optional
434
439
  */
435
- export function disableBrushTool(toolToActivate) {
436
- setToolDisabled("Brush");
437
- setToolActive(toolToActivate);
440
+ export function disableBrushTool(viewports, toolToActivate) {
441
+ each(viewports, viewport => {
442
+ const el = document.getElementById(viewport);
443
+ if (cornerstoneTools.isToolActiveForElement(el, "ThresholdsBrush")) {
444
+ setToolDisabled("ThresholdsBrush", [viewport]);
445
+ }
446
+ if (cornerstoneTools.isToolActiveForElement(el, "Brush")) {
447
+ setToolDisabled("Brush", [viewport]);
448
+ }
449
+ });
450
+
451
+ if (toolToActivate) {
452
+ setToolActive(toolToActivate);
453
+ }
438
454
  }
439
455
 
440
456
  /**
@@ -29,7 +29,7 @@ TODO
29
29
 
30
30
  # Larvitar segmentation API
31
31
 
32
- TODO
32
+ To enable brush tools, user can call directly the `setToolActive` / `setToolDisabled` api, in this case he has to handle brush type (thresholds or not), props (radius etc) and tool switching. Otherwise, Larvitar implements the utility functions `enableBrushTool` and `disableBrushTool` that internally handle brush type and props with a single call.
33
33
 
34
34
  # Customization
35
35
 
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "medical",
7
7
  "cornerstone"
8
8
  ],
9
- "version": "1.3.3",
9
+ "version": "1.3.4",
10
10
  "description": "javascript library for parsing, loading, rendering and interacting with DICOM images",
11
11
  "repository": {
12
12
  "url": "https://github.com/dvisionlab/Larvitar.git",