larvitar 1.3.1 → 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 +6 -6
- package/imaging/imageRendering.js +4 -6
- package/imaging/tools/segmentation.js +27 -11
- package/imaging/tools/segmentations.md +1 -1
- package/index.js +16 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
# Larvitar
|
|
6
6
|
|
|
7
|
-
## Dicom Image Toolkit for
|
|
7
|
+
## Dicom Image Toolkit for CornerstoneJS
|
|
8
8
|
|
|
9
|
-
### Current version: 1.3.
|
|
9
|
+
### Current version: 1.3.4
|
|
10
10
|
|
|
11
|
-
### Latest Stable version: 1.3.
|
|
11
|
+
### Latest Stable version: 1.3.4
|
|
12
12
|
|
|
13
|
-
### Latest Published Release: 1.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
|
|
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
|
|
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
|
|
@@ -577,10 +577,9 @@ export const storeViewportData = function (image, elementId, viewport, data) {
|
|
|
577
577
|
elementId,
|
|
578
578
|
data.numberOfTemporalPositions - 1
|
|
579
579
|
]);
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
]);
|
|
580
|
+
let maxSliceId = data.numberOfSlices * data.numberOfTemporalPositions - 1;
|
|
581
|
+
larvitar_store.set("maxSliceId", [elementId, maxSliceId]);
|
|
582
|
+
|
|
584
583
|
larvitar_store.set("timestamp", [elementId, data.timestamp]);
|
|
585
584
|
larvitar_store.set("timestamps", [elementId, data.timestamps]);
|
|
586
585
|
larvitar_store.set("timeIds", [elementId, data.timeIds]);
|
|
@@ -728,8 +727,7 @@ let getSeriesData = function (series, defaultProps) {
|
|
|
728
727
|
data.isMultiframe = false;
|
|
729
728
|
data.isTimeserie = true;
|
|
730
729
|
// check with real indices
|
|
731
|
-
data.numberOfSlices =
|
|
732
|
-
series.imageIds.length / series.numberOfTemporalPositions;
|
|
730
|
+
data.numberOfSlices = series.numberOfImages;
|
|
733
731
|
data.numberOfTemporalPositions = series.numberOfTemporalPositions;
|
|
734
732
|
data.imageIndex = 0;
|
|
735
733
|
data.timeIndex = 0;
|
|
@@ -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
|
-
*
|
|
423
|
-
*
|
|
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(
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
437
|
-
|
|
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
|
/**
|
|
@@ -480,7 +496,7 @@ export function redoLastStroke(elementId) {
|
|
|
480
496
|
|
|
481
497
|
/**
|
|
482
498
|
* Delete mask from state
|
|
483
|
-
* @param {Number} labelId - The labelmap id to
|
|
499
|
+
* @param {Number} labelId - The labelmap id to delete
|
|
484
500
|
*/
|
|
485
501
|
export function deleteMask(labelId) {
|
|
486
502
|
let masks = values(segModule.state.series)[0].labelmaps3D;
|
|
@@ -29,7 +29,7 @@ TODO
|
|
|
29
29
|
|
|
30
30
|
# Larvitar segmentation API
|
|
31
31
|
|
|
32
|
-
|
|
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/index.js
CHANGED
|
@@ -138,13 +138,20 @@ import {
|
|
|
138
138
|
import {
|
|
139
139
|
initSegmentationModule,
|
|
140
140
|
addSegmentationMask,
|
|
141
|
+
clearSegmentationState,
|
|
142
|
+
deleteMask,
|
|
141
143
|
setActiveLabelmap,
|
|
142
144
|
setActiveSegment,
|
|
145
|
+
enableBrushTool,
|
|
146
|
+
disableBrushTool,
|
|
143
147
|
undoLastStroke,
|
|
144
148
|
redoLastStroke,
|
|
145
149
|
setBrushProps,
|
|
150
|
+
toggleContourMode,
|
|
151
|
+
toggleVisibility,
|
|
146
152
|
hexToRgb,
|
|
147
|
-
rgbToHex
|
|
153
|
+
rgbToHex,
|
|
154
|
+
getActiveLabelmapBuffer
|
|
148
155
|
} from "./imaging/tools/segmentation";
|
|
149
156
|
|
|
150
157
|
import {
|
|
@@ -369,5 +376,12 @@ export {
|
|
|
369
376
|
redoLastStroke,
|
|
370
377
|
setBrushProps,
|
|
371
378
|
hexToRgb,
|
|
372
|
-
rgbToHex
|
|
379
|
+
rgbToHex,
|
|
380
|
+
clearSegmentationState,
|
|
381
|
+
deleteMask,
|
|
382
|
+
enableBrushTool,
|
|
383
|
+
disableBrushTool,
|
|
384
|
+
toggleContourMode,
|
|
385
|
+
toggleVisibility,
|
|
386
|
+
getActiveLabelmapBuffer
|
|
373
387
|
};
|
package/package.json
CHANGED