larvitar 0.20.0 → 1.1.2
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/MIGRATION.md +25 -0
- package/README.md +28 -27
- package/imaging/dataDictionary.json +21865 -21865
- package/imaging/{image_anonymization.js → imageAnonymization.js} +1 -1
- 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} +9 -2
- 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} +14 -13
- package/imaging/tools/polygonSegmentationMixin.js +8 -4
- package/imaging/tools/{tools.segmentation.js → segmentation.js} +162 -59
- package/imaging/tools/segmentations.md +32 -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 +41 -39
- package/modules/vuex/larvitar.js +1 -1
- package/package.json +11 -8
- package/imaging/image_parsing.js +0 -307
- package/imaging/image_reslice.js +0 -80
|
@@ -1,33 +1,18 @@
|
|
|
1
|
+
/** @module imaging/tools/segmentation
|
|
2
|
+
* @desc This file provides functionalities
|
|
3
|
+
* for handling masks and luts
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
// external libraries
|
|
2
7
|
import cornerstone from "cornerstone-core";
|
|
3
8
|
import cornerstoneTools from "cornerstone-tools/dist/cornerstoneTools.js";
|
|
4
|
-
|
|
5
|
-
import { setToolActive, setToolDisabled } from "./tools.main";
|
|
6
|
-
// utils
|
|
7
|
-
import { cloneDeep, extend, values } from "lodash";
|
|
8
|
-
|
|
9
|
+
import { cloneDeep, extend, values, sum } from "lodash";
|
|
9
10
|
const segModule = cornerstoneTools.getModule("segmentation");
|
|
10
|
-
const setters = segModule
|
|
11
|
-
const getters = segModule.getters;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* THIS MODULE IS A WIP
|
|
15
|
-
*/
|
|
11
|
+
const { getters, setters } = segModule;
|
|
16
12
|
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
window.cornerstoneTools = cornerstoneTools;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* NOTES ON CS TOOLS SEGMENTATION MODULE
|
|
24
|
-
* The value in the mask (binary) define which color will be used from the LUT map
|
|
25
|
-
* The different masks are 'labelmap', while different values in the same mask are 'segments'
|
|
26
|
-
* Segments get the color from the lutmap (up to 2^16 segments) and can be shown/hidden one by one
|
|
27
|
-
* > setters.toggleSegmentVisibility(htmlelement,segmentvalue,labelmapid)
|
|
28
|
-
* > setters.colorForSegmentIndexOfColorLUT(colorLutIndex, segmentValue, colorRGBAarray)
|
|
29
|
-
* Labelmaps are linked to a colormap and can be active / inactive
|
|
30
|
-
* */
|
|
13
|
+
// internal libraries
|
|
14
|
+
import { setToolActive, setToolDisabled } from "./main";
|
|
15
|
+
import { isElement } from "../imageUtils";
|
|
31
16
|
|
|
32
17
|
// General segmentation cs tools module configuration
|
|
33
18
|
const config = {
|
|
@@ -145,53 +130,148 @@ function generateUniformLUT(hex_color, opacity) {
|
|
|
145
130
|
return lut;
|
|
146
131
|
}
|
|
147
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Set color for label
|
|
135
|
+
* @param {Number} labelId
|
|
136
|
+
* @param {String} color in hex format
|
|
137
|
+
*/
|
|
138
|
+
export function setLabelColor(labelId, color) {
|
|
139
|
+
let volumeId = 0; // TODO MULTIVOLUME
|
|
140
|
+
let rgb = hexToRgb(color);
|
|
141
|
+
let rgba = [...rgb, 128];
|
|
142
|
+
setters.colorForSegmentIndexOfColorLUT(volumeId, labelId, rgba);
|
|
143
|
+
// force render ? depends on image visualization (render all ?)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Get color from label
|
|
148
|
+
* @param {Number} labelId
|
|
149
|
+
* @returns {String} Color in hex format
|
|
150
|
+
*/
|
|
151
|
+
export function getLabelColor(labelId) {
|
|
152
|
+
let volumeId = 0; // TODO MULTIVOLUME
|
|
153
|
+
let rgba = getters.colorForSegmentIndexColorLUT(volumeId, labelId);
|
|
154
|
+
return rgbToHex(rgba);
|
|
155
|
+
}
|
|
156
|
+
|
|
148
157
|
/**
|
|
149
158
|
* A function to group all settings to load before masks
|
|
150
|
-
*
|
|
159
|
+
* @param {Object} customConfig - Object containing override values for segmentation module config
|
|
151
160
|
*/
|
|
152
|
-
export function initSegmentationModule() {
|
|
161
|
+
export function initSegmentationModule(customConfig) {
|
|
153
162
|
// set configuration
|
|
154
163
|
segModule.configuration = cloneDeep(config);
|
|
164
|
+
extend(segModule.configuration, customConfig);
|
|
155
165
|
}
|
|
156
166
|
|
|
157
167
|
/**
|
|
158
168
|
* Add segmentation mask to segmentation module
|
|
159
|
-
* @param {
|
|
169
|
+
* @param {Object} maskProps - The mask properties (labelId, color and opacity)
|
|
160
170
|
* @param {TypedArray} - The mask data array
|
|
171
|
+
* @param {String} elementId - The target html element Id or its DOM HTMLElement
|
|
172
|
+
* @returns {Promise} - Return a promise which will resolve when segmentation mask is added
|
|
161
173
|
*/
|
|
162
|
-
export function addSegmentationMask(props, data, elementId
|
|
163
|
-
let
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
export function addSegmentationMask(props, data, elementId) {
|
|
175
|
+
let promise = new Promise(resolve => {
|
|
176
|
+
let element = isElement(elementId)
|
|
177
|
+
? elementId
|
|
178
|
+
: document.getElementById(elementId);
|
|
179
|
+
if (!element) {
|
|
180
|
+
console.error("invalid html element: " + elementId);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
setters.labelmap3DForElement(element, data.buffer, props.labelId);
|
|
184
|
+
// if user set a color property, use that color for all segments on the labelmap
|
|
185
|
+
let lut = props.color
|
|
186
|
+
? generateUniformLUT(props.color, props.opacity)
|
|
187
|
+
: generateLUT(props.opacity);
|
|
188
|
+
setters.colorLUT(props.labelId, lut);
|
|
189
|
+
// bind labelmap to colorLUT
|
|
190
|
+
let labelmap3d = getters.labelmap3D(element, props.labelId);
|
|
191
|
+
setters.colorLUTIndexForLabelmap3D(labelmap3d, props.labelId);
|
|
192
|
+
resolve();
|
|
193
|
+
});
|
|
194
|
+
return promise;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Set a new mask slice into the labelmap buffer
|
|
199
|
+
* @param {String} elementId - The target html element Id or its DOM HTMLElement
|
|
200
|
+
* @param {Number} sliceIndex - the index of the new mask slice
|
|
201
|
+
* @param {ArrayBuffer} pixelData - the pixelData array
|
|
202
|
+
*/
|
|
203
|
+
export function loadMaskSlice(elementId, sliceIndex, pixelData) {
|
|
204
|
+
// optimization: if pixelData contains no labels, return
|
|
205
|
+
if (sum(pixelData) === 0) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
let element = isElement(elementId)
|
|
210
|
+
? elementId
|
|
211
|
+
: document.getElementById(elementId);
|
|
212
|
+
if (!element) {
|
|
213
|
+
console.error("invalid html element: " + elementId);
|
|
214
|
+
return;
|
|
175
215
|
}
|
|
216
|
+
let volumeId = 0; // TODO for multivolume
|
|
217
|
+
// get labelmap buffer
|
|
218
|
+
let labelmaps2D = getters.labelmap3D(element, volumeId).labelmaps2D;
|
|
219
|
+
|
|
220
|
+
// add if not alresdy present
|
|
221
|
+
if (!labelmaps2D[sliceIndex]) {
|
|
222
|
+
labelmaps2D[sliceIndex] = {};
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
labelmaps2D[sliceIndex].pixelData = pixelData;
|
|
226
|
+
setters.updateSegmentsOnLabelmap2D(labelmaps2D[sliceIndex]);
|
|
227
|
+
cornerstone.updateImage(element);
|
|
176
228
|
}
|
|
177
229
|
|
|
178
230
|
/**
|
|
179
231
|
* Activate a specific labelmap through its labelId
|
|
180
232
|
* @param {Number} labelId - The labelmap id to activate
|
|
181
|
-
* @param {String} elementId - The target html element
|
|
233
|
+
* @param {String} elementId - The target html element Id or its DOM HTMLElement
|
|
182
234
|
*/
|
|
183
235
|
export function setActiveLabelmap(labelId, elementId) {
|
|
184
|
-
let element =
|
|
236
|
+
let element = isElement(elementId)
|
|
237
|
+
? elementId
|
|
238
|
+
: document.getElementById(elementId);
|
|
239
|
+
if (!element) {
|
|
240
|
+
console.error("invalid html element: " + elementId);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
185
243
|
setters.activeLabelmapIndex(element, labelId);
|
|
186
244
|
}
|
|
187
245
|
|
|
246
|
+
/**
|
|
247
|
+
* Get active labelmap for target element
|
|
248
|
+
* @param {String} elementId - The target html element Id or its DOM HTMLElement
|
|
249
|
+
* @returns {Object} The active labelmap object that contains the buffer
|
|
250
|
+
*/
|
|
251
|
+
export function getActiveLabelmapBuffer(elementId) {
|
|
252
|
+
let element = isElement(elementId)
|
|
253
|
+
? elementId
|
|
254
|
+
: document.getElementById(elementId);
|
|
255
|
+
if (!element) {
|
|
256
|
+
console.error("invalid html element: " + elementId);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
return getters.activeLabelmapBuffer(element);
|
|
260
|
+
}
|
|
261
|
+
|
|
188
262
|
/**
|
|
189
263
|
* Activate a specific segment through its index
|
|
190
264
|
* @param {Number} segmentIndex - The segment index to activate
|
|
191
|
-
* @param {String} elementId - The target html element
|
|
265
|
+
* @param {String} elementId - The target html element Id or its DOM HTMLElement
|
|
192
266
|
*/
|
|
193
267
|
export function setActiveSegment(segmentIndex, elementId) {
|
|
194
|
-
let element =
|
|
268
|
+
let element = isElement(elementId)
|
|
269
|
+
? elementId
|
|
270
|
+
: document.getElementById(elementId);
|
|
271
|
+
if (!element) {
|
|
272
|
+
console.error("invalid html element: " + elementId);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
195
275
|
setters.activeSegmentIndex(element, segmentIndex);
|
|
196
276
|
}
|
|
197
277
|
|
|
@@ -213,6 +293,24 @@ export function setInactiveLabelOpacity(opacity) {
|
|
|
213
293
|
forceRender();
|
|
214
294
|
}
|
|
215
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Toggle mask visibility
|
|
298
|
+
* @param {String} elementId - The target html element Id or its DOM HTMLElement
|
|
299
|
+
* @param {Number} labelId - The id of the mask label
|
|
300
|
+
*/
|
|
301
|
+
export function toggleVisibility(elementId, labelId) {
|
|
302
|
+
let element = isElement(elementId)
|
|
303
|
+
? elementId
|
|
304
|
+
: document.getElementById(elementId);
|
|
305
|
+
if (!element) {
|
|
306
|
+
console.error("invalid html element: " + elementId);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
let volumeId = 0; // TODO MULTIVOLUME
|
|
310
|
+
setters.toggleSegmentVisibility(element, labelId, volumeId);
|
|
311
|
+
cornerstone.updateImage(element);
|
|
312
|
+
}
|
|
313
|
+
|
|
216
314
|
/**
|
|
217
315
|
* Toggle between 'contours mode' and 'filled mode'
|
|
218
316
|
* @param {Bool} toggle - Contour mode enabled if true
|
|
@@ -236,9 +334,7 @@ export function toggleContourMode(toggle) {
|
|
|
236
334
|
|
|
237
335
|
/**
|
|
238
336
|
* Set mask appearance props
|
|
239
|
-
* @param {
|
|
240
|
-
* @param {Integer} mode - [0=filled, 1=contour, 2=hidden]
|
|
241
|
-
* @param {Float} alpha - Opacity value (if mode=0), between 0 and 1
|
|
337
|
+
* @param {Object} maskProps - The mask appearance props (labelId, visualization [0=filled, 1=contour, 2=hidden], opacity (if mode=0), between 0 and 1)
|
|
242
338
|
*/
|
|
243
339
|
export function setMaskProps(props) {
|
|
244
340
|
// Lut index and segment values are hardcoded because they will depend on design choices:
|
|
@@ -299,6 +395,7 @@ export function clearSegmentationState() {
|
|
|
299
395
|
/**
|
|
300
396
|
* Enable brushing
|
|
301
397
|
* @param {Number} dimension - The initial brush radius
|
|
398
|
+
* @param {Array} thresholds - The threshold values (min and max)
|
|
302
399
|
*/
|
|
303
400
|
export function enableBrushTool(dimension, thresholds) {
|
|
304
401
|
segModule.configuration.radius = dimension;
|
|
@@ -324,35 +421,41 @@ export function setBrushProps(props) {
|
|
|
324
421
|
forceRender();
|
|
325
422
|
}
|
|
326
423
|
|
|
327
|
-
/**
|
|
328
|
-
* Retrieve the buffer that represents the current active mask
|
|
329
|
-
*/
|
|
330
|
-
export function getActiveLabelmapBuffer() {
|
|
331
|
-
let element = document.getElementById("axial");
|
|
332
|
-
let object = segModule.getters.activeLabelmapBuffer(element);
|
|
333
|
-
return object.buffer;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
424
|
/**
|
|
337
425
|
* Undo last brush operation (stroke)
|
|
426
|
+
* @param {String} elementId - The target html element Id or its DOM HTMLElement
|
|
338
427
|
*/
|
|
339
428
|
export function undoLastStroke(elementId) {
|
|
340
|
-
let element =
|
|
429
|
+
let element = isElement(elementId)
|
|
430
|
+
? elementId
|
|
431
|
+
: document.getElementById(elementId);
|
|
432
|
+
if (!element) {
|
|
433
|
+
console.error("invalid html element: " + elementId);
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
341
436
|
let activeLabelMapIndex = segModule.getters.activeLabelmapIndex(element);
|
|
342
437
|
setters.undo(element, activeLabelMapIndex);
|
|
343
438
|
}
|
|
344
439
|
|
|
345
440
|
/**
|
|
346
441
|
* Redo last brush operation (stroke)
|
|
442
|
+
* @param {String} elementId - The target html element Id or its DOM HTMLElement
|
|
347
443
|
*/
|
|
348
444
|
export function redoLastStroke(elementId) {
|
|
349
|
-
let element =
|
|
445
|
+
let element = isElement(elementId)
|
|
446
|
+
? elementId
|
|
447
|
+
: document.getElementById(elementId);
|
|
448
|
+
if (!element) {
|
|
449
|
+
console.error("invalid html element: " + elementId);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
350
452
|
let activeLabelMapIndex = segModule.getters.activeLabelmapIndex(element);
|
|
351
453
|
setters.redo(element, activeLabelMapIndex);
|
|
352
454
|
}
|
|
353
455
|
|
|
354
456
|
/**
|
|
355
457
|
* Delete mask from state
|
|
458
|
+
* @param {Number} labelId - The labelmap id to activate
|
|
356
459
|
*/
|
|
357
460
|
export function deleteMask(labelId) {
|
|
358
461
|
let masks = values(segModule.state.series)[0].labelmaps3D;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Introduction
|
|
2
|
+
|
|
3
|
+
This guide explains the key concepts of Larvitar **segmentation masks management**, based on cornerstone tools's **segmentation module**.
|
|
4
|
+
|
|
5
|
+
# Definitions
|
|
6
|
+
|
|
7
|
+
- _segmentation mask_ or just _mask_: the set of pixels that belongs to a specific structure
|
|
8
|
+
- _volume_: a buffer containing one or more segmentations
|
|
9
|
+
- _label_: the value inside a volume that identifies a specific segmentation
|
|
10
|
+
|
|
11
|
+
# CS tools
|
|
12
|
+
|
|
13
|
+
## Segmentation module structure
|
|
14
|
+
|
|
15
|
+
In cs tools world, the different volumes are defined _labelmaps_, while the different labels in a volume are _segments_. Labelmaps can support up to 2^16 segments.
|
|
16
|
+
The values in the volume (ie, labels) define which color will be used from the LUT map: in fact, segments get the color from the lutmap and can be shown/hidden one by one.
|
|
17
|
+
Each labelmaps can be linked to a different colormap and has a active / inactive property that affects the rendering style (see configuration).
|
|
18
|
+
|
|
19
|
+
> setters.toggleSegmentVisibility(htmlelement,segmentvalue,labelmapid)
|
|
20
|
+
> setters.colorForSegmentIndexOfColorLUT(colorLutIndex, segmentValue, colorRGBAarray)
|
|
21
|
+
|
|
22
|
+
## Configuration
|
|
23
|
+
|
|
24
|
+
TODO
|
|
25
|
+
|
|
26
|
+
# Larvitar segmentation management
|
|
27
|
+
|
|
28
|
+
TODO
|
|
29
|
+
|
|
30
|
+
# Larvitar segmentation API
|
|
31
|
+
|
|
32
|
+
TODO
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
/** @module imaging/tools/state
|
|
2
|
+
* @desc This file provides functionalities
|
|
3
|
+
* for handling tools' state
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
// external libraries
|
|
2
7
|
import cornerstone from "cornerstone-core";
|
|
3
8
|
import cornerstoneTools from "cornerstone-tools";
|
|
4
|
-
|
|
5
9
|
import { each } from "lodash";
|
|
10
|
+
|
|
11
|
+
// internal libraries
|
|
6
12
|
import { state_example } from "./cstools_state_example.js";
|
|
7
13
|
|
|
8
14
|
/**
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
eraseInsideShape,
|
|
6
|
-
eraseOutsideShape
|
|
7
|
-
} = cornerstoneTools.importInternal("util/segmentationUtils");
|
|
1
|
+
/** @module imaging/strategies/eraseFreehand
|
|
2
|
+
* @desc This file provides functionalities for
|
|
3
|
+
* erasing pixels
|
|
4
|
+
*/
|
|
8
5
|
|
|
6
|
+
// external libraries
|
|
7
|
+
import cornerstoneTools from "cornerstone-tools";
|
|
8
|
+
const { getBoundingBoxAroundPolygon, eraseInsideShape, eraseOutsideShape } =
|
|
9
|
+
cornerstoneTools.importInternal("util/segmentationUtils");
|
|
9
10
|
const isPointInPolygon = cornerstoneTools.importInternal(
|
|
10
11
|
"util/isPointInPolygon"
|
|
11
12
|
);
|
|
12
|
-
|
|
13
13
|
const getLogger = cornerstoneTools.importInternal("util/getLogger");
|
|
14
|
-
|
|
15
14
|
const logger = getLogger("util:segmentation:operations:eraseInsideFreehand");
|
|
16
15
|
|
|
17
16
|
/**
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
fillInsideShape,
|
|
6
|
-
fillOutsideShape
|
|
7
|
-
} = cornerstoneTools.importInternal("util/segmentationUtils");
|
|
1
|
+
/** @module imaging/strategies/fillFreehand
|
|
2
|
+
* @desc This file provides functionalities for
|
|
3
|
+
* filling pixels
|
|
4
|
+
*/
|
|
8
5
|
|
|
6
|
+
// external libraries
|
|
7
|
+
import cornerstoneTools from "cornerstone-tools";
|
|
8
|
+
const { getBoundingBoxAroundPolygon, fillInsideShape, fillOutsideShape } =
|
|
9
|
+
cornerstoneTools.importInternal("util/segmentationUtils");
|
|
9
10
|
const isPointInPolygon = cornerstoneTools.importInternal(
|
|
10
11
|
"util/isPointInPolygon"
|
|
11
12
|
);
|
|
12
|
-
|
|
13
13
|
const getLogger = cornerstoneTools.importInternal("util/getLogger");
|
|
14
|
-
|
|
15
14
|
const logger = getLogger("util:segmentation:operations:fillInsideFreehand");
|
|
16
15
|
|
|
17
16
|
/**
|
package/index.js
CHANGED
|
@@ -5,6 +5,7 @@ console.log(`LARVITAR v${VERSION}`);
|
|
|
5
5
|
import cornerstone from "cornerstone-core";
|
|
6
6
|
import cornerstoneTools from "cornerstone-tools";
|
|
7
7
|
import cornerstoneWADOImageLoader from "cornerstone-wado-image-loader";
|
|
8
|
+
const segModule = cornerstoneTools.getModule("segmentation");
|
|
8
9
|
|
|
9
10
|
import larvitarModule from "./modules/vuex/larvitar";
|
|
10
11
|
|
|
@@ -14,15 +15,15 @@ import {
|
|
|
14
15
|
getAvailableMemory
|
|
15
16
|
} from "./imaging/monitors/memory";
|
|
16
17
|
|
|
17
|
-
import { initLarvitarStore, larvitar_store } from "./imaging/
|
|
18
|
+
import { initLarvitarStore, larvitar_store } from "./imaging/imageStore";
|
|
18
19
|
|
|
19
|
-
import { parseContours } from "./imaging/
|
|
20
|
+
import { parseContours } from "./imaging/imageContours";
|
|
20
21
|
|
|
21
22
|
import {
|
|
22
23
|
getImagePresets,
|
|
23
24
|
setImagePreset,
|
|
24
25
|
setImageCustomPreset
|
|
25
|
-
} from "./imaging/
|
|
26
|
+
} from "./imaging/imagePresets";
|
|
26
27
|
|
|
27
28
|
import {
|
|
28
29
|
getNormalOrientation,
|
|
@@ -37,7 +38,7 @@ import {
|
|
|
37
38
|
getReslicedMetadata,
|
|
38
39
|
getReslicedPixeldata,
|
|
39
40
|
getDistanceBetweenSlices
|
|
40
|
-
} from "./imaging/
|
|
41
|
+
} from "./imaging/imageUtils";
|
|
41
42
|
|
|
42
43
|
import {
|
|
43
44
|
buildHeader,
|
|
@@ -45,16 +46,16 @@ import {
|
|
|
45
46
|
buildData,
|
|
46
47
|
buildDataAsync,
|
|
47
48
|
importNRRDImage
|
|
48
|
-
} from "./imaging/
|
|
49
|
+
} from "./imaging/imageIo";
|
|
49
50
|
|
|
50
|
-
import { anonymize, encrypt } from "./imaging/
|
|
51
|
+
import { anonymize, encrypt } from "./imaging/imageAnonymization";
|
|
51
52
|
|
|
52
53
|
import {
|
|
53
54
|
buildLayer,
|
|
54
55
|
updateLayer,
|
|
55
56
|
getActiveLayer,
|
|
56
57
|
setActiveLayer
|
|
57
|
-
} from "./imaging/
|
|
58
|
+
} from "./imaging/imageLayers";
|
|
58
59
|
|
|
59
60
|
import {
|
|
60
61
|
initializeImageLoader,
|
|
@@ -64,14 +65,14 @@ import {
|
|
|
64
65
|
registerResliceLoader,
|
|
65
66
|
registerMultiFrameImageLoader,
|
|
66
67
|
updateLoadedStack
|
|
67
|
-
} from "./imaging/
|
|
68
|
+
} from "./imaging/imageLoading";
|
|
68
69
|
|
|
69
70
|
import {
|
|
70
71
|
readFile,
|
|
71
72
|
readFiles,
|
|
72
|
-
|
|
73
|
+
parseDataSet,
|
|
73
74
|
clearImageParsing
|
|
74
|
-
} from "./imaging/
|
|
75
|
+
} from "./imaging/imageParsing";
|
|
75
76
|
|
|
76
77
|
import {
|
|
77
78
|
clearImageCache,
|
|
@@ -91,9 +92,9 @@ import {
|
|
|
91
92
|
flipImageVertical,
|
|
92
93
|
rotateImageLeft,
|
|
93
94
|
rotateImageRight
|
|
94
|
-
} from "./imaging/
|
|
95
|
+
} from "./imaging/imageRendering";
|
|
95
96
|
|
|
96
|
-
import { resliceSeries } from "./imaging/
|
|
97
|
+
import { resliceSeries } from "./imaging/imageReslice";
|
|
97
98
|
|
|
98
99
|
import {
|
|
99
100
|
addDiameterTool,
|
|
@@ -111,7 +112,7 @@ import {
|
|
|
111
112
|
syncToolStack,
|
|
112
113
|
updateStackToolState,
|
|
113
114
|
setSegmentationConfig
|
|
114
|
-
} from "./imaging/
|
|
115
|
+
} from "./imaging/imageTools";
|
|
115
116
|
|
|
116
117
|
import {
|
|
117
118
|
csToolsCreateStack,
|
|
@@ -126,13 +127,13 @@ import {
|
|
|
126
127
|
setToolEnabled,
|
|
127
128
|
setToolPassive,
|
|
128
129
|
exportAnnotations
|
|
129
|
-
} from "./imaging/tools/
|
|
130
|
+
} from "./imaging/tools/main";
|
|
130
131
|
|
|
131
132
|
import {
|
|
132
133
|
DEFAULT_TOOLS,
|
|
133
134
|
getDefaultToolsByType,
|
|
134
135
|
setDefaultToolsProps
|
|
135
|
-
} from "./imaging/tools/
|
|
136
|
+
} from "./imaging/tools/default";
|
|
136
137
|
|
|
137
138
|
import {
|
|
138
139
|
initSegmentationModule,
|
|
@@ -142,7 +143,7 @@ import {
|
|
|
142
143
|
undoLastStroke,
|
|
143
144
|
redoLastStroke,
|
|
144
145
|
setBrushProps
|
|
145
|
-
} from "./imaging/tools/
|
|
146
|
+
} from "./imaging/tools/segmentation";
|
|
146
147
|
|
|
147
148
|
import {
|
|
148
149
|
updateLarvitarManager,
|
|
@@ -189,20 +190,21 @@ import {
|
|
|
189
190
|
addColorMap,
|
|
190
191
|
fillPixelData,
|
|
191
192
|
HSVToRGB
|
|
192
|
-
} from "./imaging/
|
|
193
|
+
} from "./imaging/imageColormaps";
|
|
193
194
|
|
|
194
|
-
import { saveAnnotations, loadAnnotations } from "./imaging/tools/
|
|
195
|
+
import { saveAnnotations, loadAnnotations } from "./imaging/tools/io";
|
|
195
196
|
|
|
196
197
|
import {
|
|
197
198
|
addMouseKeyHandlers,
|
|
198
199
|
toggleMouseToolsListeners
|
|
199
|
-
} from "./imaging/tools/
|
|
200
|
+
} from "./imaging/tools/interaction";
|
|
200
201
|
|
|
201
202
|
export {
|
|
202
203
|
VERSION,
|
|
203
204
|
// global cornerstone variables
|
|
204
205
|
cornerstone,
|
|
205
206
|
cornerstoneTools,
|
|
207
|
+
segModule,
|
|
206
208
|
cornerstoneWADOImageLoader,
|
|
207
209
|
// vuex module
|
|
208
210
|
larvitarModule,
|
|
@@ -210,14 +212,14 @@ export {
|
|
|
210
212
|
checkMemoryAllocation,
|
|
211
213
|
getUsedMemory,
|
|
212
214
|
getAvailableMemory,
|
|
213
|
-
//
|
|
215
|
+
// larvitarStore
|
|
214
216
|
initLarvitarStore,
|
|
215
217
|
larvitar_store,
|
|
216
|
-
//
|
|
218
|
+
// imagePresets
|
|
217
219
|
getImagePresets,
|
|
218
220
|
setImagePreset,
|
|
219
221
|
setImageCustomPreset,
|
|
220
|
-
//
|
|
222
|
+
// imageUtils
|
|
221
223
|
getNormalOrientation,
|
|
222
224
|
getMinPixelValue,
|
|
223
225
|
getMaxPixelValue,
|
|
@@ -230,21 +232,21 @@ export {
|
|
|
230
232
|
getReslicedMetadata,
|
|
231
233
|
getReslicedPixeldata,
|
|
232
234
|
getDistanceBetweenSlices,
|
|
233
|
-
//
|
|
235
|
+
// imageIo
|
|
234
236
|
buildHeader,
|
|
235
237
|
getCachedPixelData,
|
|
236
238
|
buildData,
|
|
237
239
|
buildDataAsync,
|
|
238
240
|
importNRRDImage,
|
|
239
|
-
//
|
|
241
|
+
// imageAnonymization
|
|
240
242
|
anonymize,
|
|
241
243
|
encrypt,
|
|
242
|
-
//
|
|
244
|
+
// imageLayers
|
|
243
245
|
buildLayer,
|
|
244
246
|
updateLayer,
|
|
245
247
|
getActiveLayer,
|
|
246
248
|
setActiveLayer,
|
|
247
|
-
//
|
|
249
|
+
// imageLoading
|
|
248
250
|
initializeImageLoader,
|
|
249
251
|
initializeWebImageLoader,
|
|
250
252
|
initializeFileImageLoader,
|
|
@@ -252,12 +254,12 @@ export {
|
|
|
252
254
|
registerResliceLoader,
|
|
253
255
|
registerMultiFrameImageLoader,
|
|
254
256
|
updateLoadedStack,
|
|
255
|
-
//
|
|
257
|
+
// imageParsing
|
|
256
258
|
readFile,
|
|
257
259
|
readFiles,
|
|
258
|
-
|
|
260
|
+
parseDataSet,
|
|
259
261
|
clearImageParsing,
|
|
260
|
-
//
|
|
262
|
+
// imageRendering
|
|
261
263
|
clearImageCache,
|
|
262
264
|
loadAndCacheImages,
|
|
263
265
|
renderFileImage,
|
|
@@ -276,15 +278,15 @@ export {
|
|
|
276
278
|
flipImageVertical,
|
|
277
279
|
rotateImageLeft,
|
|
278
280
|
rotateImageRight,
|
|
279
|
-
//
|
|
281
|
+
// imageReslice
|
|
280
282
|
resliceSeries,
|
|
281
|
-
//
|
|
283
|
+
// imageColormaps
|
|
282
284
|
getColormapsList,
|
|
283
285
|
applyColorMap,
|
|
284
286
|
addColorMap,
|
|
285
287
|
fillPixelData,
|
|
286
288
|
HSVToRGB,
|
|
287
|
-
//
|
|
289
|
+
// imageContours
|
|
288
290
|
parseContours,
|
|
289
291
|
// loaders/commonLoader
|
|
290
292
|
updateLarvitarManager,
|
|
@@ -307,7 +309,7 @@ export {
|
|
|
307
309
|
// loaders/dicomLoader
|
|
308
310
|
getDicomImageId,
|
|
309
311
|
cacheImages,
|
|
310
|
-
// loaders/
|
|
312
|
+
// loaders/multiframeLoader
|
|
311
313
|
loadMultiFrameImage,
|
|
312
314
|
buildMultiFrameImage,
|
|
313
315
|
getMultiFrameImageId,
|
|
@@ -318,7 +320,7 @@ export {
|
|
|
318
320
|
resetFileManager,
|
|
319
321
|
populateFileManager,
|
|
320
322
|
getFileImageId,
|
|
321
|
-
//
|
|
323
|
+
// imageTools
|
|
322
324
|
addDiameterTool,
|
|
323
325
|
addContoursTool,
|
|
324
326
|
addMaskEditingTool,
|
|
@@ -334,7 +336,7 @@ export {
|
|
|
334
336
|
syncToolStack,
|
|
335
337
|
updateStackToolState,
|
|
336
338
|
setSegmentationConfig,
|
|
337
|
-
// tools
|
|
339
|
+
// tools/main
|
|
338
340
|
csToolsCreateStack,
|
|
339
341
|
csToolsUpdateImageIds,
|
|
340
342
|
csToolsUpdateImageIndex,
|
|
@@ -347,16 +349,16 @@ export {
|
|
|
347
349
|
setToolEnabled,
|
|
348
350
|
setToolPassive,
|
|
349
351
|
exportAnnotations,
|
|
350
|
-
// tools
|
|
352
|
+
// tools/default
|
|
351
353
|
DEFAULT_TOOLS,
|
|
352
354
|
getDefaultToolsByType,
|
|
353
355
|
setDefaultToolsProps,
|
|
354
|
-
// tools
|
|
356
|
+
// tools/io
|
|
355
357
|
saveAnnotations,
|
|
356
358
|
loadAnnotations,
|
|
357
|
-
// tools
|
|
359
|
+
// tools/interaction
|
|
358
360
|
addMouseKeyHandlers,
|
|
359
|
-
// tools
|
|
361
|
+
// tools/segmentation
|
|
360
362
|
initSegmentationModule,
|
|
361
363
|
addSegmentationMask,
|
|
362
364
|
setActiveLabelmap,
|
package/modules/vuex/larvitar.js
CHANGED