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.
Files changed (77) hide show
  1. package/README.md +2 -2
  2. package/dist/imaging/imageRendering.d.ts +1 -71
  3. package/dist/imaging/imageStore.d.ts +5 -0
  4. package/dist/imaging/loaders/commonLoader.d.ts +4 -4
  5. package/dist/imaging/loaders/nrrdLoader.d.ts +1 -51
  6. package/dist/larvitar.js +13 -1
  7. package/dist/larvitar.js.map +1 -1
  8. package/imaging/tools/types.d.ts +19 -19
  9. package/imaging/types.d.ts +110 -2
  10. package/package.json +7 -2
  11. package/.github/workflows/build-docs.yml +0 -59
  12. package/.github/workflows/codeql-analysis.yml +0 -71
  13. package/.github/workflows/deploy.yml +0 -37
  14. package/.vscode/settings.json +0 -4
  15. package/CODE_OF_CONDUCT.md +0 -76
  16. package/MIGRATION.md +0 -25
  17. package/bundler/webpack.common.js +0 -27
  18. package/bundler/webpack.dev.js +0 -23
  19. package/bundler/webpack.prod.js +0 -19
  20. package/decs.d.ts +0 -12
  21. package/dist/imaging/MetaDataReadable.d.ts +0 -41
  22. package/dist/imaging/MetaDataTypes.d.ts +0 -3489
  23. package/imaging/dataDictionary.json +0 -21866
  24. package/imaging/imageAnonymization.ts +0 -135
  25. package/imaging/imageColormaps.ts +0 -217
  26. package/imaging/imageContours.ts +0 -196
  27. package/imaging/imageIo.ts +0 -251
  28. package/imaging/imageLayers.ts +0 -121
  29. package/imaging/imageLoading.ts +0 -299
  30. package/imaging/imageParsing.ts +0 -444
  31. package/imaging/imagePresets.ts +0 -156
  32. package/imaging/imageRendering.ts +0 -1091
  33. package/imaging/imageReslice.ts +0 -87
  34. package/imaging/imageStore.ts +0 -487
  35. package/imaging/imageTags.ts +0 -609
  36. package/imaging/imageTools.js +0 -708
  37. package/imaging/imageUtils.ts +0 -1079
  38. package/imaging/loaders/commonLoader.ts +0 -275
  39. package/imaging/loaders/dicomLoader.ts +0 -66
  40. package/imaging/loaders/fileLoader.ts +0 -71
  41. package/imaging/loaders/multiframeLoader.ts +0 -435
  42. package/imaging/loaders/nrrdLoader.ts +0 -630
  43. package/imaging/loaders/resliceLoader.ts +0 -205
  44. package/imaging/monitors/memory.ts +0 -151
  45. package/imaging/monitors/performance.ts +0 -34
  46. package/imaging/parsers/ecg.ts +0 -54
  47. package/imaging/parsers/nrrd.js +0 -485
  48. package/imaging/tools/custom/4dSliceScrollTool.js +0 -146
  49. package/imaging/tools/custom/BorderMagnifyTool.js +0 -99
  50. package/imaging/tools/custom/contourTool.js +0 -1884
  51. package/imaging/tools/custom/diameterTool.js +0 -141
  52. package/imaging/tools/custom/editMaskTool.js +0 -141
  53. package/imaging/tools/custom/ellipticalRoiOverlayTool.js +0 -534
  54. package/imaging/tools/custom/polygonSegmentationMixin.js +0 -245
  55. package/imaging/tools/custom/polylineScissorsTool.js +0 -59
  56. package/imaging/tools/custom/rectangleRoiOverlayTool.js +0 -564
  57. package/imaging/tools/custom/seedTool.js +0 -342
  58. package/imaging/tools/custom/setLabelMap3D.ts +0 -242
  59. package/imaging/tools/custom/thresholdsBrushTool.js +0 -161
  60. package/imaging/tools/default.ts +0 -594
  61. package/imaging/tools/interaction.ts +0 -266
  62. package/imaging/tools/io.ts +0 -229
  63. package/imaging/tools/main.ts +0 -427
  64. package/imaging/tools/segmentation.ts +0 -532
  65. package/imaging/tools/segmentations.md +0 -38
  66. package/imaging/tools/state.ts +0 -74
  67. package/imaging/tools/strategies/eraseFreehand.js +0 -76
  68. package/imaging/tools/strategies/fillFreehand.js +0 -79
  69. package/imaging/tools/strategies/index.js +0 -2
  70. package/imaging/waveforms/ecg.ts +0 -191
  71. package/index.ts +0 -431
  72. package/jsdoc.json +0 -52
  73. package/rollup.config.js +0 -51
  74. package/template/.gitkeep +0 -0
  75. package/tsconfig.json +0 -102
  76. /package/imaging/{MetaDataReadable.ts → MetaDataReadable.d.ts} +0 -0
  77. /package/imaging/{MetaDataTypes.ts → MetaDataTypes.d.ts} +0 -0
@@ -1,141 +0,0 @@
1
- /** @module imaging/tools/custom/diameterTool
2
- * @desc This file provides functionalities for
3
- * a custom diameter cornestone tool
4
- */
5
-
6
- // external libraries
7
- import csTools from "cornerstone-tools";
8
- const BidirectionalTool = csTools.BidirectionalTool;
9
- import { each } from "lodash";
10
-
11
- // internal libraries
12
- import { addToolStateSingleSlice } from "../../imageTools";
13
-
14
- /**
15
- * @public
16
- * @class DiameterTool
17
- * @memberof Tools.Annotation
18
- * @classdesc Create and position an annotation that measures the
19
- * length and width of a region.
20
- * @extends Tools.Base.BaseAnnotationTool
21
- */
22
-
23
- export class DiameterTool extends BidirectionalTool {
24
- constructor(props) {
25
- const defaultProps = {
26
- name: "Diameter",
27
- isBeenModified: false,
28
- lastData: null
29
- };
30
-
31
- super(props, defaultProps);
32
-
33
- this.name = "Diameter";
34
-
35
- this.initializeTool(props.dataArray, "cmprAxial", props.seriesId);
36
- }
37
-
38
- initializeTool(dataArray, elementId, seriesId) {
39
- let element = document.getElementById(elementId);
40
-
41
- each(dataArray, singleData => {
42
- let data = {
43
- toolType: "Diameter",
44
- name: singleData.id.toString(),
45
- isCreating: true,
46
- visible: true,
47
- active: false,
48
- invalidated: false,
49
- handles: {
50
- start: {
51
- x: singleData.x1,
52
- y: singleData.y1,
53
- index: 0,
54
- drawnIndependently: false,
55
- allowedOutsideImage: false,
56
- highlight: true,
57
- active: false
58
- },
59
- end: {
60
- x: singleData.x2,
61
- y: singleData.y2,
62
- index: 1,
63
- drawnIndependently: false,
64
- allowedOutsideImage: false,
65
- highlight: true,
66
- active: false
67
- },
68
- perpendicularStart: {
69
- x: singleData.x3,
70
- y: singleData.y3,
71
- index: 2,
72
- drawnIndependently: false,
73
- allowedOutsideImage: false,
74
- highlight: true,
75
- active: false,
76
- locked: false
77
- },
78
- perpendicularEnd: {
79
- x: singleData.x4,
80
- y: singleData.y4,
81
- index: 3,
82
- drawnIndependently: false,
83
- allowedOutsideImage: false,
84
- highlight: true,
85
- active: false
86
- },
87
- textBox: {
88
- x: singleData.value_max,
89
- y: singleData.value_min,
90
- index: null,
91
- drawnIndependently: true,
92
- allowedOutsideImage: true,
93
- highlight: false,
94
- active: false,
95
- hasMoved: true,
96
- movesIndependently: false,
97
- hasBoundingBox: true,
98
- boundingBox: {
99
- width: 59.6484375,
100
- height: 47,
101
- left: 165.02487562189057,
102
- top: 240.53482587064684
103
- }
104
- }
105
- },
106
- longestDiameter: singleData.value_max.toString(),
107
- shortestDiameter: singleData.value_min.toString()
108
- };
109
-
110
- let sliceNumber = singleData.slice;
111
-
112
- // add to master viewport
113
- addToolStateSingleSlice(element, this.name, data, sliceNumber, seriesId);
114
- });
115
-
116
- csTools.external.cornerstone.updateImage(element);
117
- }
118
-
119
- passiveCallback(element) {
120
- element.addEventListener(
121
- "cornerstonetoolsmeasurementmodified",
122
- this.measureOnGoingCallback
123
- );
124
- }
125
-
126
- measureOnGoingCallback(event) {
127
- if (!this.isBeenModified) {
128
- event.target.addEventListener("mouseup", function (evt) {
129
- this.__proto__.measureEndCallback(evt);
130
- });
131
- }
132
- this.isBeenModified = true;
133
- this.lastData = event.detail.measurementData;
134
- }
135
-
136
- measureEndCallback(event) {
137
- event.element.removeEventListener("mouseup", this.measureEndCallback);
138
- this.isBeenModified = false;
139
- this.lastData = null;
140
- }
141
- }
@@ -1,141 +0,0 @@
1
- /** @module imaging/tools/custom/editMaskTool
2
- * @desc This file provides functionalities for
3
- * a custom mask cornestone tool
4
- */
5
-
6
- // external libraries
7
- import csTools from "cornerstone-tools";
8
- const external = csTools.external;
9
- const BaseBrushTool = csTools.importInternal("base/BaseBrushTool");
10
- const segmentationUtils = csTools.importInternal("util/segmentationUtils");
11
- const getCircle = segmentationUtils.getCircle;
12
- const drawBrushPixels = segmentationUtils.drawBrushPixels;
13
- const getModule = csTools.getModule;
14
- const { configuration, setters } = getModule("segmentation");
15
-
16
- /**
17
- * @public
18
- * @class BrushTool
19
- * @memberof Tools.Brush
20
- * @classdesc Tool for drawing segmentations on an image.
21
- * @extends Tools.Base.BaseBrushTool
22
- */
23
- export class EditMaskTool extends BaseBrushTool {
24
- constructor(props = {}) {
25
- const defaultProps = {
26
- name: "EditMask",
27
- supportedInteractionTypes: ["Mouse"],
28
- configuration: {},
29
- mixins: ["renderBrushMixin"]
30
- };
31
-
32
- super(props, defaultProps);
33
- this.touchDragCallback = this._paint.bind(this);
34
-
35
- this._initializeTool(props.mask, props.initCallback);
36
- }
37
-
38
- _initializeTool(mask, callback) {
39
- let enabledElement = csTools.external.cornerstone
40
- .getEnabledElements()
41
- .filter(e => e.element.id == "axial")
42
- .pop();
43
-
44
- // TODO improve performances!
45
-
46
- console.time("...typedToNormal");
47
- let pixelsNormalArray = Array.prototype.slice.call(mask.data);
48
- console.timeEnd("...typedToNormal");
49
-
50
- console.time("...normalToTyped");
51
- let pixelData = Uint16Array.from(pixelsNormalArray);
52
- console.timeEnd("...normalToTyped");
53
-
54
- let labelmapIndex = 1;
55
-
56
- let segmentsOnLabelmapArray = new Array(mask.sizes[2]).fill([
57
- labelmapIndex
58
- ]);
59
-
60
- setters.labelmap3DForElement(
61
- enabledElement.element,
62
- pixelData.buffer,
63
- labelmapIndex,
64
- [],
65
- segmentsOnLabelmapArray,
66
- 0
67
- );
68
-
69
- csTools.external.cornerstone.updateImage(enabledElement.element);
70
-
71
- if (callback) {
72
- callback();
73
- }
74
- // SIMPLE WAY --- AS FALLBACK :
75
-
76
- // labelmap3D.labelmaps2D = [];
77
-
78
- // for (let f = 0; f < 110; f++) {
79
- // let pixels = mask.data.slice(f * 512 * 512, (f + 1) * 512 * 512);
80
- // let pixelsNormalArray = Array.prototype.slice.call(pixels);
81
- // // let pixelData = new Uint16Array();
82
- // let pixelData = Uint16Array.from(pixelsNormalArray);
83
- // labelmap3D.labelmaps2D.push({
84
- // pixelData: pixelData,
85
- // segmentsOnLabelmap: [labelmapIndex]
86
- // });
87
- // }
88
- }
89
-
90
- activeCallback(element, options) {
91
- switch (options.force) {
92
- case "delete":
93
- this.configuration.alwaysEraseOnClick = true;
94
- break;
95
- case "add":
96
- this.preventCtrl();
97
- break;
98
- default:
99
- this.configuration.alwaysEraseOnClick = false;
100
- }
101
- }
102
-
103
- preventCtrl() {
104
- this.__proto__.__proto__._isCtrlDown = function () {
105
- return false;
106
- };
107
- }
108
-
109
- /**
110
- * Paints the data to the labelmap.
111
- *
112
- * @protected
113
- * @param {Object} evt The data object associated with the event.
114
- * @returns {void}
115
- */
116
- _paint(evt) {
117
- const eventData = evt.detail;
118
- const { rows, columns } = eventData.image;
119
- const { x, y } = eventData.currentPoints.image;
120
-
121
- if (x < 0 || x > columns || y < 0 || y > rows) {
122
- return;
123
- }
124
-
125
- const radius = configuration.radius;
126
- const pointerArray = getCircle(radius, rows, columns, x, y);
127
-
128
- const { labelmap2D, labelmap3D, shouldErase } = this.paintEventData;
129
-
130
- // Draw / Erase the active color.
131
- drawBrushPixels(
132
- pointerArray,
133
- labelmap2D.pixelData,
134
- labelmap3D.activeSegmentIndex,
135
- columns,
136
- shouldErase
137
- );
138
-
139
- external.cornerstone.updateImage(evt.detail.element);
140
- }
141
- }