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,99 +0,0 @@
|
|
|
1
|
-
import cornerstone from "cornerstone-core";
|
|
2
|
-
import cornerstoneTools from "cornerstone-tools";
|
|
3
|
-
const MagnifyTool = cornerstoneTools.MagnifyTool;
|
|
4
|
-
const drawTextBox = cornerstoneTools.importInternal("drawing/drawTextBox");
|
|
5
|
-
const textStyle = cornerstoneTools.textStyle;
|
|
6
|
-
const toolColors = cornerstoneTools.toolColors;
|
|
7
|
-
|
|
8
|
-
export default class BorderMagnifyTool extends MagnifyTool {
|
|
9
|
-
constructor(props = {}) {
|
|
10
|
-
super(props);
|
|
11
|
-
|
|
12
|
-
// Additional configuration options
|
|
13
|
-
this.configuration.showBorders = props.showBorders || true; // Default to true
|
|
14
|
-
this.configuration.showInfo = props.showInfo || true; // Default to true
|
|
15
|
-
this.configuration.borderColor = props.borderColor ; // Default border color is green
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// Add global keydown event listener
|
|
19
|
-
window.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Event handler for the "keydown" event to toggle the visibility of borders and info on "B" key press.
|
|
24
|
-
* @param {KeyboardEvent} event
|
|
25
|
-
* @returns {void}
|
|
26
|
-
*/
|
|
27
|
-
handleKeyDown(event) {
|
|
28
|
-
if (event.key === 'B' || event.key === 'b') {
|
|
29
|
-
// Toggle the visibility of borders
|
|
30
|
-
this.configuration.showBorders = !this.configuration.showBorders;
|
|
31
|
-
|
|
32
|
-
// Toggle the visibility of zoom/ROI info
|
|
33
|
-
this.configuration.showInfo = !this.configuration.showInfo;
|
|
34
|
-
|
|
35
|
-
// Redraw the magnification tool
|
|
36
|
-
this._drawMagnificationTool();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Overrides the _drawMagnificationTool method to add configurable borders and display zoom/ROI dimensions.
|
|
42
|
-
* @param {*} evt
|
|
43
|
-
* @returns {void}
|
|
44
|
-
*/
|
|
45
|
-
_drawMagnificationTool(evt) {
|
|
46
|
-
// Call the parent method to draw the magnification tool
|
|
47
|
-
super._drawMagnificationTool(evt);
|
|
48
|
-
// Query for the magnify canvas using the correct class name
|
|
49
|
-
const magnifyCanvas = evt ? evt.detail.element.querySelector('.magnifyTool') : null;
|
|
50
|
-
|
|
51
|
-
if (magnifyCanvas) {
|
|
52
|
-
const context = magnifyCanvas.getContext('2d');
|
|
53
|
-
|
|
54
|
-
// Check if the user wants to show borders
|
|
55
|
-
if (this.configuration.showBorders) {
|
|
56
|
-
// Add configurable borders
|
|
57
|
-
context.strokeStyle = this.configuration.borderColor|| toolColors.getColorIfActive({active: true});
|
|
58
|
-
context.lineWidth = 4;
|
|
59
|
-
context.strokeRect(0, 0, magnifyCanvas.width, magnifyCanvas.height);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Check if the user wants to show info
|
|
63
|
-
if (this.configuration.showInfo) {
|
|
64
|
-
// Get the zoom level
|
|
65
|
-
const viewport = cornerstone.getViewport(evt.detail.element);
|
|
66
|
-
const zoomLevel = viewport.scale.toFixed(2); // Adjust the precision as needed
|
|
67
|
-
|
|
68
|
-
// Get ROI dimensions
|
|
69
|
-
const roiWidth = magnifyCanvas.width;
|
|
70
|
-
const roiHeight = magnifyCanvas.height;
|
|
71
|
-
const roiArea = (roiWidth * roiHeight).toFixed(2); // Area of the ROI
|
|
72
|
-
|
|
73
|
-
// Display the zoom level and ROI dimensions
|
|
74
|
-
//context.fillStyle = this.configuration.borderColor; // Adjust text color as needed
|
|
75
|
-
//context.font = 'bold 14px Arial';
|
|
76
|
-
//context.fillText(`Zoom: x${zoomLevel}`, 10, 20);
|
|
77
|
-
//context.fillText(`ROI Area: ${roiWidth} x ${roiHeight} square pixels`, 10, 40);
|
|
78
|
-
const text = `Zoom: x${zoomLevel}`;
|
|
79
|
-
const str = `ROI: ${roiWidth}px x ${roiHeight}px`;
|
|
80
|
-
const fontHeight = textStyle.getFontSize();
|
|
81
|
-
const color=this.configuration.borderColor|| toolColors.getColorIfActive({active: true});
|
|
82
|
-
// Draw text 5px away from cursor
|
|
83
|
-
const textCoords = {
|
|
84
|
-
x: 5,
|
|
85
|
-
y: 2,
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
drawTextBox(
|
|
89
|
-
context,
|
|
90
|
-
str,
|
|
91
|
-
textCoords.x,
|
|
92
|
-
textCoords.y + fontHeight + 5,
|
|
93
|
-
color
|
|
94
|
-
);
|
|
95
|
-
drawTextBox(context, text, textCoords.x, textCoords.y, color);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|