larvitar 2.0.5 → 2.0.7
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 +2 -2
- package/dist/imaging/imageRendering.d.ts +1 -71
- package/dist/imaging/imageStore.d.ts +5 -0
- package/dist/imaging/loaders/commonLoader.d.ts +4 -4
- package/dist/imaging/loaders/nrrdLoader.d.ts +1 -51
- package/dist/larvitar.js +13 -1
- package/dist/larvitar.js.map +1 -1
- package/imaging/tools/types.d.ts +19 -19
- package/imaging/types.d.ts +110 -2
- package/package.json +7 -2
- package/.github/workflows/build-docs.yml +0 -59
- package/.github/workflows/codeql-analysis.yml +0 -71
- package/.github/workflows/deploy.yml +0 -37
- package/.vscode/settings.json +0 -4
- package/CODE_OF_CONDUCT.md +0 -76
- package/MIGRATION.md +0 -25
- package/bundler/webpack.common.js +0 -27
- package/bundler/webpack.dev.js +0 -23
- package/bundler/webpack.prod.js +0 -19
- package/decs.d.ts +0 -12
- package/dist/imaging/MetaDataReadable.d.ts +0 -41
- package/dist/imaging/MetaDataTypes.d.ts +0 -3489
- package/imaging/dataDictionary.json +0 -21866
- package/imaging/imageAnonymization.ts +0 -135
- package/imaging/imageColormaps.ts +0 -217
- package/imaging/imageContours.ts +0 -196
- package/imaging/imageIo.ts +0 -251
- package/imaging/imageLayers.ts +0 -121
- package/imaging/imageLoading.ts +0 -299
- package/imaging/imageParsing.ts +0 -444
- package/imaging/imagePresets.ts +0 -156
- package/imaging/imageRendering.ts +0 -1091
- package/imaging/imageReslice.ts +0 -87
- package/imaging/imageStore.ts +0 -487
- package/imaging/imageTags.ts +0 -609
- package/imaging/imageTools.js +0 -708
- package/imaging/imageUtils.ts +0 -1079
- package/imaging/loaders/commonLoader.ts +0 -275
- package/imaging/loaders/dicomLoader.ts +0 -66
- package/imaging/loaders/fileLoader.ts +0 -71
- package/imaging/loaders/multiframeLoader.ts +0 -435
- package/imaging/loaders/nrrdLoader.ts +0 -630
- package/imaging/loaders/resliceLoader.ts +0 -205
- package/imaging/monitors/memory.ts +0 -151
- package/imaging/monitors/performance.ts +0 -34
- package/imaging/parsers/ecg.ts +0 -54
- package/imaging/parsers/nrrd.js +0 -485
- package/imaging/tools/custom/4dSliceScrollTool.js +0 -146
- package/imaging/tools/custom/BorderMagnifyTool.js +0 -99
- package/imaging/tools/custom/contourTool.js +0 -1884
- package/imaging/tools/custom/diameterTool.js +0 -141
- package/imaging/tools/custom/editMaskTool.js +0 -141
- package/imaging/tools/custom/ellipticalRoiOverlayTool.js +0 -534
- package/imaging/tools/custom/polygonSegmentationMixin.js +0 -245
- package/imaging/tools/custom/polylineScissorsTool.js +0 -59
- package/imaging/tools/custom/rectangleRoiOverlayTool.js +0 -564
- package/imaging/tools/custom/seedTool.js +0 -342
- package/imaging/tools/custom/setLabelMap3D.ts +0 -242
- package/imaging/tools/custom/thresholdsBrushTool.js +0 -161
- package/imaging/tools/default.ts +0 -594
- package/imaging/tools/interaction.ts +0 -266
- package/imaging/tools/io.ts +0 -229
- package/imaging/tools/main.ts +0 -427
- package/imaging/tools/segmentation.ts +0 -532
- package/imaging/tools/segmentations.md +0 -38
- package/imaging/tools/state.ts +0 -74
- package/imaging/tools/strategies/eraseFreehand.js +0 -76
- package/imaging/tools/strategies/fillFreehand.js +0 -79
- package/imaging/tools/strategies/index.js +0 -2
- package/imaging/waveforms/ecg.ts +0 -191
- package/index.ts +0 -431
- package/jsdoc.json +0 -52
- package/rollup.config.js +0 -51
- package/template/.gitkeep +0 -0
- package/tsconfig.json +0 -102
- /package/imaging/{MetaDataReadable.ts → MetaDataReadable.d.ts} +0 -0
- /package/imaging/{MetaDataTypes.ts → MetaDataTypes.d.ts} +0 -0
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/** @module imaging/tools/custom/thresholdBrushTool
|
|
2
|
-
* @desc This file provides functionalities for
|
|
3
|
-
* a brush tool with thresholds using a
|
|
4
|
-
* custom cornestone tool
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// external libraries
|
|
8
|
-
import cornerstoneTools from "cornerstone-tools";
|
|
9
|
-
const external = cornerstoneTools.external;
|
|
10
|
-
const BaseBrushTool = cornerstoneTools.importInternal("base/BaseBrushTool");
|
|
11
|
-
const segmentationUtils = cornerstoneTools.importInternal(
|
|
12
|
-
"util/segmentationUtils"
|
|
13
|
-
);
|
|
14
|
-
const drawBrushPixels = segmentationUtils.drawBrushPixels;
|
|
15
|
-
const getCircle = segmentationUtils.getCircle;
|
|
16
|
-
const segmentationModule = cornerstoneTools.getModule("segmentation");
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @public
|
|
20
|
-
* @class ThresholdsBrushTool
|
|
21
|
-
* @memberof Tools.Brush
|
|
22
|
-
* @classdesc Tool for drawing segmentations on an image (only pixels inside thresholds)
|
|
23
|
-
* @extends Tools.Base.BaseBrushTool
|
|
24
|
-
*/
|
|
25
|
-
export default class ThresholdsBrushTool extends BaseBrushTool {
|
|
26
|
-
constructor(props = {}) {
|
|
27
|
-
const defaultProps = {
|
|
28
|
-
name: "ThresholdsBrush",
|
|
29
|
-
supportedInteractionTypes: ["Mouse", "Touch"],
|
|
30
|
-
configuration: {},
|
|
31
|
-
mixins: ["renderBrushMixin"]
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
super(props, defaultProps);
|
|
35
|
-
|
|
36
|
-
this.touchDragCallback = this._paint.bind(this);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Paints the data to the labelmap.
|
|
41
|
-
*
|
|
42
|
-
* @protected
|
|
43
|
-
* @param {Object} evt The data object associated with the event.
|
|
44
|
-
* @returns {void}
|
|
45
|
-
*/
|
|
46
|
-
_paint(evt) {
|
|
47
|
-
const { configuration } = segmentationModule;
|
|
48
|
-
const eventData = evt.detail;
|
|
49
|
-
const { rows, columns } = eventData.image;
|
|
50
|
-
const { x, y } = eventData.currentPoints.image;
|
|
51
|
-
|
|
52
|
-
if (x < 0 || x > columns || y < 0 || y > rows) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const radius = configuration.radius;
|
|
57
|
-
const thresholds = configuration.thresholds;
|
|
58
|
-
const { labelmap2D, labelmap3D, shouldErase } = this.paintEventData;
|
|
59
|
-
|
|
60
|
-
let pointerArray = [];
|
|
61
|
-
|
|
62
|
-
// threshold should be applied only if painting, not erasing
|
|
63
|
-
if (shouldErase) {
|
|
64
|
-
pointerArray = getCircle(radius, rows, columns, x, y);
|
|
65
|
-
} else {
|
|
66
|
-
pointerArray = getCircleWithThreshold(
|
|
67
|
-
eventData.image,
|
|
68
|
-
radius,
|
|
69
|
-
thresholds,
|
|
70
|
-
x,
|
|
71
|
-
y
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Draw / Erase the active color.
|
|
76
|
-
drawBrushPixels(
|
|
77
|
-
pointerArray,
|
|
78
|
-
labelmap2D.pixelData,
|
|
79
|
-
labelmap3D.activeSegmentIndex,
|
|
80
|
-
columns,
|
|
81
|
-
shouldErase
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
external.cornerstone.updateImage(evt.detail.element);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Gets the pixels within the circle if inside thresholds (included)
|
|
90
|
-
* NOTE: thresholds values must consider slope and intercept (MO value)
|
|
91
|
-
* @method
|
|
92
|
-
* @name getCircleWithThreshold
|
|
93
|
-
*
|
|
94
|
-
* @param {Object} image The target image.
|
|
95
|
-
* @param {number} radius The radius of the circle.
|
|
96
|
-
* @param {Array} thresholds The thresholds array [min, max].
|
|
97
|
-
* @param {number} [xCoord = 0] The x-location of the center of the circle.
|
|
98
|
-
* @param {number} [yCoord = 0] The y-location of the center of the circle.
|
|
99
|
-
* @returns {Array.number[]} Array of pixels contained within the circle.
|
|
100
|
-
*/
|
|
101
|
-
function getCircleWithThreshold(
|
|
102
|
-
image,
|
|
103
|
-
radius,
|
|
104
|
-
thresholds,
|
|
105
|
-
xCoord = 0,
|
|
106
|
-
yCoord = 0
|
|
107
|
-
) {
|
|
108
|
-
const pixelData = image.getPixelData();
|
|
109
|
-
const { rows, columns } = image;
|
|
110
|
-
const x0 = Math.floor(xCoord);
|
|
111
|
-
const y0 = Math.floor(yCoord);
|
|
112
|
-
let circleArray = [];
|
|
113
|
-
|
|
114
|
-
// if no thresholds, set all pixels range
|
|
115
|
-
if (!thresholds) {
|
|
116
|
-
thresholds = [image.minPixelValue, image.maxPixelValue];
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function isInsideThresholds(v, t) {
|
|
120
|
-
return v >= t[0] && v <= t[1];
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (radius === 1) {
|
|
124
|
-
let value = pixelData[y0 * rows + x0];
|
|
125
|
-
let moValue = value * image.slope + image.intercept;
|
|
126
|
-
if (isInsideThresholds(moValue, thresholds)) {
|
|
127
|
-
circleArray = [[x0, y0]];
|
|
128
|
-
}
|
|
129
|
-
return circleArray;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
let index = 0;
|
|
133
|
-
|
|
134
|
-
for (let y = -radius; y <= radius; y++) {
|
|
135
|
-
const yCoord = y0 + y;
|
|
136
|
-
|
|
137
|
-
if (yCoord > rows || yCoord < 0) {
|
|
138
|
-
continue;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
for (let x = -radius; x <= radius; x++) {
|
|
142
|
-
const xCoord = x0 + x;
|
|
143
|
-
|
|
144
|
-
if (xCoord >= columns || xCoord < 0) {
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
let value = pixelData[yCoord * rows + xCoord];
|
|
149
|
-
let moValue = value * image.slope + image.intercept;
|
|
150
|
-
|
|
151
|
-
if (
|
|
152
|
-
x * x + y * y < radius * radius &&
|
|
153
|
-
isInsideThresholds(moValue, thresholds)
|
|
154
|
-
) {
|
|
155
|
-
circleArray[index++] = [x0 + x, y0 + y];
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return circleArray;
|
|
161
|
-
}
|