cloudmr-ux 4.3.7 → 4.3.9

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 (50) hide show
  1. package/dist/CmrComponents/niivue-contrast-adjustments/NiivueContrastAdjustments.d.ts +4 -3
  2. package/dist/CmrComponents/niivue-contrast-adjustments/NiivueContrastAdjustments.js +5 -5
  3. package/dist/CmrComponents/niivue-slice-position/NiivueSlicePosition.js +2 -2
  4. package/dist/CmrComponents/niivue-viewer/CloudMrNiivuePanel.d.ts +38 -0
  5. package/dist/CmrComponents/niivue-viewer/CloudMrNiivuePanel.js +197 -0
  6. package/dist/CmrComponents/niivue-viewer/CloudMrNiivueViewer.d.ts +41 -0
  7. package/dist/CmrComponents/niivue-viewer/CloudMrNiivueViewer.js +1239 -0
  8. package/dist/CmrComponents/niivue-viewer/ColorPicker.d.ts +1 -0
  9. package/dist/CmrComponents/niivue-viewer/ColorPicker.js +65 -0
  10. package/dist/CmrComponents/niivue-viewer/Layer.d.ts +1 -0
  11. package/dist/CmrComponents/niivue-viewer/Layer.js +122 -0
  12. package/dist/CmrComponents/niivue-viewer/LayersPanel.d.ts +1 -0
  13. package/dist/CmrComponents/niivue-viewer/LayersPanel.js +107 -0
  14. package/dist/CmrComponents/niivue-viewer/Niivue.css +8 -0
  15. package/dist/CmrComponents/niivue-viewer/NiivuePatcher.d.ts +2 -0
  16. package/dist/CmrComponents/niivue-viewer/NiivuePatcher.js +1402 -0
  17. package/dist/CmrComponents/niivue-viewer/NumberPicker.d.ts +1 -0
  18. package/dist/CmrComponents/niivue-viewer/NumberPicker.js +40 -0
  19. package/dist/CmrComponents/niivue-viewer/SettingsPanel.d.ts +1 -0
  20. package/dist/CmrComponents/niivue-viewer/SettingsPanel.js +30 -0
  21. package/dist/CmrComponents/niivue-viewer/Switch.d.ts +1 -0
  22. package/dist/CmrComponents/niivue-viewer/Switch.js +27 -0
  23. package/dist/CmrComponents/niivue-viewer/Toolbar.d.ts +48 -0
  24. package/dist/CmrComponents/niivue-viewer/Toolbar.js +276 -0
  25. package/dist/CmrComponents/niivue-viewer/Toolbar.scss +40 -0
  26. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/DrawColorPlatte.d.ts +2 -0
  27. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/DrawColorPlatte.js +61 -0
  28. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/EraserPlatte.d.ts +2 -0
  29. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/EraserPlatte.js +56 -0
  30. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MaskPlatte.d.ts +2 -0
  31. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MaskPlatte.js +148 -0
  32. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MroDrawToolkit.d.ts +1 -0
  33. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MroDrawToolkit.js +177 -0
  34. package/dist/CmrComponents/niivue-viewer/niivuePenType.d.ts +10 -0
  35. package/dist/CmrComponents/niivue-viewer/niivuePenType.js +10 -0
  36. package/dist/core/common/components/NiivueTools/NiivuePatcher.d.ts +2 -0
  37. package/dist/core/common/components/NiivueTools/components/ControlThemes.d.ts +1 -0
  38. package/dist/core/common/components/NiivueTools/components/ControlThemes.js +123 -0
  39. package/dist/core/common/components/NiivueTools/components/Example.d.ts +10 -0
  40. package/dist/core/common/components/NiivueTools/components/Example.js +326 -0
  41. package/dist/core/common/components/NiivueTools/components/ImageList.d.ts +1 -0
  42. package/dist/core/common/components/NiivueTools/components/ImageList.js +22 -0
  43. package/dist/core/common/components/NiivueTools/components/ImageListItem.d.ts +1 -0
  44. package/dist/core/common/components/NiivueTools/components/ImageListItem.js +103 -0
  45. package/dist/core/common/components/NiivueTools/main.d.ts +1 -0
  46. package/dist/core/common/components/NiivueTools/main.js +16 -0
  47. package/dist/core/common/components/NiivueTools/util.d.ts +21 -0
  48. package/dist/index.d.ts +3 -0
  49. package/dist/index.js +2 -0
  50. package/package.json +3 -3
@@ -0,0 +1,326 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var isTouchDevice = "ontouchstart" in window ||
39
+ navigator.maxTouchPoints > 0 ||
40
+ navigator.msMaxTouchPoints > 0;
41
+ var isFilled = true;
42
+ function handleIntensityChange(data) {
43
+ document.getElementById("intensity").innerHTML =
44
+ "&nbsp;&nbsp;" + data.string;
45
+ }
46
+ var nv1 = new niivue.Niivue({
47
+ logging: true,
48
+ dragAndDropEnabled: true,
49
+ backColor: [0, 0, 0, 1],
50
+ show3Dcrosshair: true,
51
+ onLocationChange: handleIntensityChange
52
+ });
53
+ nv1.opts.isColorbar = false;
54
+ nv1.setRadiologicalConvention(false);
55
+ nv1.attachTo("gl1");
56
+ nv1.setClipPlane([0.3, 270, 0]);
57
+ nv1.setRenderAzimuthElevation(120, 10);
58
+ nv1.setSliceType(nv1.sliceTypeMultiplanar);
59
+ nv1.setSliceMM(true);
60
+ nv1.opts.multiplanarForceRender = false;
61
+ nv1.graph.autoSizeMultiplanar = true;
62
+ nv1.graph.opacity = 1.0;
63
+ nv1.drawOpacity = 0.5;
64
+ nv1.opts.isColorbar = false;
65
+ var volumeList1 = [{ url: "../images/FLAIR.nii.gz" }];
66
+ await nv1.loadVolumes(volumeList1);
67
+ await nv1.loadDrawingFromUrl("../images/lesion.nii.gz");
68
+ function toggleGroup(id) {
69
+ var buttons = document.getElementsByClassName("viewBtn");
70
+ var char0 = id.charAt(0);
71
+ for (var i = 0; i < buttons.length; i++) {
72
+ if (buttons[i].id.charAt(0) !== char0)
73
+ continue;
74
+ buttons[i].classList.remove("dropdown-item-checked");
75
+ if (buttons[i].id === id)
76
+ buttons[i].classList.add("dropdown-item-checked");
77
+ }
78
+ } // toggleGroup()
79
+ function onButtonClick(event) {
80
+ return __awaiter(this, void 0, void 0, function () {
81
+ var cmap, levels, level, s, root, s, img;
82
+ return __generator(this, function (_a) {
83
+ switch (_a.label) {
84
+ case 0:
85
+ if (isTouchDevice) {
86
+ console.log("Touch device: click menu to close menu");
87
+ /*var el = this.parentNode
88
+ el.style.display = "none"
89
+ setTimeout(function() { //close menu
90
+ //el.style.removeProperty("display")
91
+ //el.style.display = "block"
92
+ }, 500)*/
93
+ }
94
+ if (event.target.id === "SaveDraw") {
95
+ nv1.saveImage("draw.nii", true);
96
+ return [2 /*return*/];
97
+ }
98
+ if (event.target.id === "CloseDraw") {
99
+ nv1.closeDrawing();
100
+ return [2 /*return*/];
101
+ }
102
+ if (event.target.id === "SaveBitmap") {
103
+ nv1.saveScene("ScreenShot.png");
104
+ return [2 /*return*/];
105
+ }
106
+ if (event.target.id === "ShowHeader") {
107
+ alert(nv1.volumes[0].hdr.toFormattedString());
108
+ return [2 /*return*/];
109
+ }
110
+ if (event.target.id === "Colorbar") {
111
+ nv1.opts.isColorbar = !nv1.opts.isColorbar;
112
+ event.srcElement.classList.toggle("dropdown-item-checked");
113
+ nv1.drawScene();
114
+ return [2 /*return*/];
115
+ }
116
+ if (event.target.id === "Radiological") {
117
+ nv1.opts.isRadiologicalConvention = !nv1.opts.isRadiologicalConvention;
118
+ event.srcElement.classList.toggle("dropdown-item-checked");
119
+ nv1.drawScene();
120
+ return [2 /*return*/];
121
+ }
122
+ if (event.target.id === "Crosshair") {
123
+ nv1.opts.show3Dcrosshair = !nv1.opts.show3Dcrosshair;
124
+ event.srcElement.classList.toggle("dropdown-item-checked");
125
+ nv1.drawScene();
126
+ }
127
+ if (event.target.id === "ClipPlane") {
128
+ if (nv1.scene.clipPlaneDepthAziElev[0] > 1)
129
+ nv1.setClipPlane([0.3, 270, 0]);
130
+ else
131
+ nv1.setClipPlane([2, 270, 0]);
132
+ nv1.drawScene();
133
+ return [2 /*return*/];
134
+ }
135
+ if (event.target.id.charAt(0) === "!") {
136
+ // set color scheme
137
+ nv1.volumes[0].colormap = event.target.id.substr(1);
138
+ nv1.updateGLVolume();
139
+ toggleGroup(event.target.id);
140
+ return [2 /*return*/];
141
+ }
142
+ if (event.target.id.charAt(0) === "{") {
143
+ // change color labels https://github.com/niivue/niivue/issues/575
144
+ if (event.target.id === "{$Custom") {
145
+ cmap = {
146
+ R: [0, 255, 22, 127],
147
+ G: [0, 20, 192, 187],
148
+ B: [0, 152, 80, 255],
149
+ A: [0, 255, 255, 255],
150
+ labels: ["", "pink", "lime", "sky"]
151
+ };
152
+ nv1.setDrawColormap(cmap);
153
+ }
154
+ else
155
+ nv1.setDrawColormap(event.target.id.substr(1));
156
+ toggleGroup(event.target.id);
157
+ return [2 /*return*/];
158
+ }
159
+ if (event.target.id === "Undo") {
160
+ nv1.drawUndo();
161
+ }
162
+ if (event.target.id.charAt(0) === "@") {
163
+ //sliceType
164
+ if (event.target.id === "@Off")
165
+ nv1.setDrawingEnabled(false);
166
+ else
167
+ nv1.setDrawingEnabled(true);
168
+ if (event.target.id === "@Erase")
169
+ nv1.setPenValue(0, isFilled);
170
+ if (event.target.id === "@Red")
171
+ nv1.setPenValue(1, isFilled);
172
+ if (event.target.id === "@Green")
173
+ nv1.setPenValue(2, isFilled);
174
+ if (event.target.id === "@Blue")
175
+ nv1.setPenValue(3, isFilled);
176
+ if (event.target.id === "@Yellow")
177
+ nv1.setPenValue(4, isFilled);
178
+ if (event.target.id === "@Cyan")
179
+ nv1.setPenValue(5, isFilled);
180
+ if (event.target.id === "@Purple")
181
+ nv1.setPenValue(6, isFilled);
182
+ if (event.target.id === "@Cluster")
183
+ nv1.setPenValue(-0, isFilled);
184
+ if (event.target.id === "@GrowCluster")
185
+ nv1.setPenValue(NaN, isFilled);
186
+ if (event.target.id === "@GrowClusterBright")
187
+ nv1.setPenValue(Number.POSITIVE_INFINITY, isFilled);
188
+ if (event.target.id === "@GrowClusterDark")
189
+ nv1.setPenValue(Number.NEGATIVE_INFINITY, isFilled);
190
+ toggleGroup(event.target.id);
191
+ } //Draw Color
192
+ if (event.target.id === "Growcut")
193
+ nv1.drawGrowCut();
194
+ if (event.target.id === "Translucent") {
195
+ if (nv1.drawOpacity > 0.75)
196
+ nv1.drawOpacity = 0.5;
197
+ else
198
+ nv1.drawOpacity = 1.0;
199
+ nv1.drawScene();
200
+ event.srcElement.classList.toggle("dropdown-item-checked");
201
+ return [2 /*return*/];
202
+ }
203
+ if (event.target.id === "DrawOtsu") {
204
+ levels = parseInt(prompt("Segmentation classes (2..4)", "3"));
205
+ nv1.drawOtsu(levels);
206
+ }
207
+ if (event.target.id === "RemoveHaze") {
208
+ level = parseInt(prompt("Remove Haze (1..5)", "5"));
209
+ nv1.removeHaze(level);
210
+ }
211
+ if (event.target.id === "DrawFilled") {
212
+ isFilled = !isFilled;
213
+ nv1.setPenValue(nv1.opts.penValue, isFilled);
214
+ event.srcElement.classList.toggle("dropdown-item-checked");
215
+ return [2 /*return*/];
216
+ }
217
+ if (event.target.id === "DrawOverwrite") {
218
+ nv1.drawFillOverwrites = !nv1.drawFillOverwrites;
219
+ event.srcElement.classList.toggle("dropdown-item-checked");
220
+ return [2 /*return*/];
221
+ }
222
+ if (event.target.id.charAt(0) === "|") {
223
+ //sliceType
224
+ if (event.target.id === "|Axial")
225
+ nv1.setSliceType(nv1.sliceTypeAxial);
226
+ if (event.target.id === "|Coronal")
227
+ nv1.setSliceType(nv1.sliceTypeCoronal);
228
+ if (event.target.id === "|Sagittal")
229
+ nv1.setSliceType(nv1.sliceTypeSagittal);
230
+ if (event.target.id === "|Render")
231
+ nv1.setSliceType(nv1.sliceTypeRender);
232
+ if (event.target.id === "|MultiPlanar") {
233
+ nv1.opts.multiplanarForceRender = false;
234
+ nv1.setSliceType(nv1.sliceTypeMultiplanar);
235
+ }
236
+ if (event.target.id === "|MultiPlanarRender") {
237
+ nv1.opts.multiplanarForceRender = true;
238
+ nv1.setSliceType(nv1.sliceTypeMultiplanar);
239
+ }
240
+ toggleGroup(event.target.id);
241
+ } //sliceType
242
+ if (event.target.id === "WorldSpace") {
243
+ nv1.setSliceMM(!nv1.opts.isSliceMM);
244
+ event.srcElement.classList.toggle("dropdown-item-checked");
245
+ return [2 /*return*/];
246
+ }
247
+ if (event.target.id === "Interpolate") {
248
+ nv1.setInterpolation(!nv1.opts.isNearestInterpolation);
249
+ event.srcElement.classList.toggle("dropdown-item-checked");
250
+ return [2 /*return*/];
251
+ }
252
+ if (event.target.id === "Left")
253
+ nv1.moveCrosshairInVox(-1, 0, 0);
254
+ if (event.target.id === "Right")
255
+ nv1.moveCrosshairInVox(1, 0, 0);
256
+ if (event.target.id === "Posterior")
257
+ nv1.moveCrosshairInVox(0, -1, 0);
258
+ if (event.target.id === "Anterior")
259
+ nv1.moveCrosshairInVox(0, 1, 0);
260
+ if (event.target.id === "Inferior")
261
+ nv1.moveCrosshairInVox(0, 0, -1);
262
+ if (event.target.id === "Superior")
263
+ nv1.moveCrosshairInVox(0, 0, 1);
264
+ if (event.target.id === "BackColor") {
265
+ if (nv1.opts.backColor[0] < 0.5)
266
+ nv1.opts.backColor = [1, 1, 1, 1];
267
+ else
268
+ nv1.opts.backColor = [0, 0, 0, 1];
269
+ nv1.drawScene();
270
+ event.srcElement.classList.toggle("dropdown-item-checked");
271
+ return [2 /*return*/];
272
+ }
273
+ if (event.target.id.charAt(0) === "^") {
274
+ s = event.target.id.substr(1);
275
+ switch (s) {
276
+ case "none":
277
+ nv1.opts.dragMode = nv1.dragModes.none;
278
+ break;
279
+ case "contrast":
280
+ nv1.opts.dragMode = nv1.dragModes.contrast;
281
+ break;
282
+ case "measurement":
283
+ nv1.opts.dragMode = nv1.dragModes.measurement;
284
+ break;
285
+ case "pan":
286
+ nv1.opts.dragMode = nv1.dragModes.pan;
287
+ break;
288
+ }
289
+ toggleGroup(event.target.id);
290
+ } //drag mode
291
+ if (!(event.target.id === "_mesh")) return [3 /*break*/, 2];
292
+ volumeList1[0].url = "../images/mni152.nii.gz";
293
+ return [4 /*yield*/, nv1.loadVolumes(volumeList1)];
294
+ case 1:
295
+ _a.sent();
296
+ nv1.loadMeshes([
297
+ {
298
+ url: "../images/BrainMesh_ICBM152.lh.mz3",
299
+ rgba255: [200, 162, 255, 255]
300
+ },
301
+ { url: "../images/dpsv.trx", rgba255: [255, 255, 255, 255] },
302
+ ]);
303
+ toggleGroup(event.target.id);
304
+ return [3 /*break*/, 3];
305
+ case 2:
306
+ if (event.target.id.charAt(0) === "_") {
307
+ //example image
308
+ nv1.meshes = []; //close open meshes
309
+ root = "../images/";
310
+ s = event.target.id.substr(1);
311
+ img = root + s + ".nii.gz";
312
+ console.log("Loading " + img);
313
+ volumeList1[0].url = img;
314
+ nv1.loadVolumes(volumeList1);
315
+ toggleGroup(event.target.id);
316
+ nv1.updateGLVolume();
317
+ } //example image
318
+ _a.label = 3;
319
+ case 3: return [2 /*return*/];
320
+ }
321
+ });
322
+ });
323
+ } // onButtonClick()
324
+ var buttons = document.getElementsByClassName("viewBtn");
325
+ for (var i = 0; i < buttons.length; i++)
326
+ buttons[i].addEventListener("click", onButtonClick, false);
@@ -0,0 +1,22 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ // Image list Panel is a component that shows all loaded
14
+ // NVimages and NVmeshes. It contains one ImageListItem per row in the list
15
+ function ImageListPanel(_a) {
16
+ var imageList = _a.imageList, setImageList = _a.setImageList, crosshairValues = _a.crosshairValues;
17
+ var listItems = [];
18
+ for (var i = imageList.length - 1; i >= 0; i--) {
19
+ listItems.push(_jsx(ImageListItem, { image: imageList[i], setImageList: setImageList, crosshairValue: crosshairValues[i] }, i));
20
+ }
21
+ return (_jsx(Grid, __assign({ container: true, item: true, xs: 12, sm: 12, md: 4, lg: 4 }, { children: _jsx(List, __assign({ sx: { width: '100%', bgcolor: 'background.paper' }, component: 'div' }, { children: listItems })) })));
22
+ }
@@ -0,0 +1,103 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
21
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
+ // Image list items components that show UI elements related to
23
+ // NiiVue volumes and meshes.
24
+ // The UI elements in an Image list item can update NVImage properties
25
+ function ImageListItem(_a) {
26
+ var image = _a.image, setImageList = _a.setImageList, _b = _a.crosshairValue, crosshairValue = _b === void 0 ? null : _b, _c = _a.precision, precision = _c === void 0 ? 4 : _c;
27
+ var _d = useState(_jsx(Visibility, {})), visibilityIcon = _d[0], setVisibilityIcon = _d[1];
28
+ var _e = useState(false), openMore = _e[0], setOpenMore = _e[1];
29
+ var _f = useState([image.global_min, image.global_max]), minMax = _f[0], setMinMax = _f[1];
30
+ var _g = useState(image.colorMap ? image.colorMap : 'gray'), color = _g[0], setColor = _g[1];
31
+ useEffect(function () {
32
+ setMinMax([image.global_min, image.global_max]);
33
+ }, [image]);
34
+ function visibilityToggle() {
35
+ var idx = nv.getVolumeIndexByID(image.id);
36
+ var currentOpacity = nv.volumes[idx].opacity;
37
+ var newOpacity = currentOpacity > 0 ? 0 : 1;
38
+ nv.setOpacity(idx, newOpacity);
39
+ if (newOpacity == 0) {
40
+ setVisibilityIcon(_jsx(VisibilityOff, {}));
41
+ }
42
+ else if (newOpacity == 1) {
43
+ setVisibilityIcon(_jsx(Visibility, {}));
44
+ }
45
+ }
46
+ var handleOpenMore = function () {
47
+ setOpenMore(!openMore);
48
+ };
49
+ function handleSliderChange(event, newValue) {
50
+ setMinMax(newValue);
51
+ //nv.volumes[nv.getVolumeIndexByID(image.id)].cal_min = newValue[0];
52
+ //nv.volumes[nv.getVolumeIndexByID(image.id)].cal_max = newValue[1];
53
+ //nv.updateGLVolume()
54
+ }
55
+ function handleSliderCommitted(event, newValue) {
56
+ setMinMax(newValue);
57
+ nv.volumes[nv.getVolumeIndexByID(image.id)].cal_min = newValue[0];
58
+ nv.volumes[nv.getVolumeIndexByID(image.id)].cal_max = newValue[1];
59
+ nv.updateGLVolume();
60
+ }
61
+ function handleMinNumberInput(event) {
62
+ setMinMax([Number(event.target.value), minMax[1]]);
63
+ nv.volumes[nv.getVolumeIndexByID(image.id)].cal_min = Number(event.target.value);
64
+ nv.updateGLVolume();
65
+ }
66
+ function handleMaxNumberInput(event) {
67
+ setMinMax([minMax[0], Number(event.target.value)]);
68
+ nv.volumes[nv.getVolumeIndexByID(image.id)].cal_max = Number(event.target.value);
69
+ nv.updateGLVolume();
70
+ }
71
+ function handleIntensityReset(event) {
72
+ setMinMax([image.global_min, image.global_max]);
73
+ nv.volumes[nv.getVolumeIndexByID(image.id)].cal_min = image.global_min;
74
+ nv.volumes[nv.getVolumeIndexByID(image.id)].cal_max = image.global_max;
75
+ nv.updateGLVolume();
76
+ }
77
+ function handleColorChange(event) {
78
+ var color = event.target.value;
79
+ var id = nv.volumes[nv.getVolumeIndexByID(image.id)].setColorMap(color);
80
+ nv.updateGLVolume();
81
+ setColor(color);
82
+ }
83
+ function handleRemoveImage() {
84
+ nv.removeVolume(image);
85
+ setImageList(__spreadArray([], nv.volumes, true));
86
+ }
87
+ return (_jsxs(Box, { children: [_jsxs(ListItemButton, __assign({ onClick: function () { } }, { children: [_jsx(ListItemIcon, __assign({ onClick: function (e) { e.stopPropagation(); visibilityToggle(image); } }, { children: visibilityIcon })), _jsx(ListItemText, { children: image.name }), _jsx(Typography, __assign({ style: { marginLeft: 'auto' } }, { children: crosshairValue === null ? '' : crosshairValue.toFixed(precision) })), openMore ? _jsx(ExpandLess, { onClick: handleOpenMore }) : _jsx(ExpandMore, { onClick: handleOpenMore })] })), _jsx(Collapse, __assign({ "in": openMore, timeout: 'auto', unmountOnExit: true }, { children: _jsxs(List, __assign({ component: 'div', disablePadding: true }, { children: [_jsxs(ListItem, { children: [_jsx(Input, { size: 'small', style: { marginRight: '4px', marginLeft: '4px' }, value: Number(minMax[0]), inputProps: {
88
+ step: 1.0,
89
+ min: image.global_min || 0,
90
+ max: image.global_max || 999,
91
+ type: 'number'
92
+ }, onInput: handleMinNumberInput }), _jsx(Slider, { style: {
93
+ marginLeft: '12px',
94
+ marginRight: '12px'
95
+ }, min: image.global_min || 0, max: image.global_max || 999, size: 'small', value: minMax, valueLabelDisplay: "auto", onChange: handleSliderChange, onChangeCommitted: handleSliderCommitted }), _jsx(Input, { size: 'small', style: { marginLeft: '4px', marginRight: '4px' }, value: Number(minMax[1]), inputProps: {
96
+ step: 1.0,
97
+ min: image.global_min || 0,
98
+ max: image.global_max || 999,
99
+ type: 'number'
100
+ }, onInput: handleMaxNumberInput }), _jsx(IconButton, __assign({ style: { marginRight: '0px', marginLeft: 'auto' }, onClick: handleIntensityReset }, { children: _jsx(Replay, {}) }))] }), _jsxs(ListItem, { children: [_jsxs(FormControl, __assign({ fullWidth: true }, { children: [_jsx(InputLabel, { children: "Color" }), _jsx(Select, __assign({ style: { marginRight: 'auto', width: '100%' }, value: color, label: "Color", size: "small", onChange: handleColorChange }, { children: nv.colorMaps().map(function (c) {
101
+ return (_jsx(MenuItem, __assign({ value: c }, { children: c }), c));
102
+ }) }))] })), _jsx(IconButton, __assign({ style: { marginRight: '0px', marginLeft: 'auto' }, onClick: handleRemoveImage }, { children: _jsx(Delete, {}) }))] })] })) }))] }));
103
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import ReactDOM from 'react-dom';
4
+ import { Container } from '@mui/material';
5
+ import { CssBaseline } from '@mui/material';
6
+ import './index.css';
7
+ import NiiVue from './Niivue';
8
+ import '@fontsource/roboto/300.css';
9
+ import '@fontsource/roboto/400.css';
10
+ import '@fontsource/roboto/500.css';
11
+ import '@fontsource/roboto/700.css';
12
+ var volumes = [
13
+ { url: './mni152reallyreallyreallyreallyreallyLongName.nii' },
14
+ { url: './hippo.nii' },
15
+ ];
16
+ ReactDOM.render(_jsxs(React.StrictMode, { children: [_jsx(CssBaseline, { enableColorScheme: true }), _jsx(NiiVue, { volumes: volumes })] }), document.getElementById('root'));
@@ -0,0 +1,21 @@
1
+ export function img2ras16(volume: any): Int16Array;
2
+ export function tickSpacing(mn: any, mx: any): (number | boolean)[];
3
+ export function deg2rad(deg: any): number;
4
+ export function negMinMax(min: any, max: any, minNeg: any, maxNeg: any): number[];
5
+ export function swizzleVec3(vec: any, order?: number[]): vec3;
6
+ export function isRadiological(mtx: any): number;
7
+ export function unProject(winX: any, winY: any, winZ: any, mvpMatrix: any): vec4;
8
+ export function unpackFloatFromVec4i(val: any): number;
9
+ export function clamp(value: any, min: any, max: any): number;
10
+ export function encodeRLE(data: any): Uint8Array;
11
+ export function decodeRLE(rle: any, decodedlen: any): Uint8Array;
12
+ /**
13
+ * scale the raw intensity values by the header scale slope and intercept
14
+ * @param {object} hdr the header object
15
+ * @param {Array} raw the raw intensity values
16
+ * @returns {Array} the scaled intensity values
17
+ * @private
18
+ */
19
+ export function intensityRaw2Scaled(hdr: object, raw: any[]): any[];
20
+ import { vec3 } from "gl-matrix";
21
+ import { vec4 } from "gl-matrix";
package/dist/index.d.ts CHANGED
@@ -33,6 +33,9 @@ export { NiivueRoiHistogram } from "./CmrComponents/niivue-roi-histogram/NiivueR
33
33
  export { useNiivueRoiHistogram } from "./CmrComponents/niivue-roi-histogram/useNiivueRoiHistogram";
34
34
  export { NiivueRoiTable, DEFAULT_ROI_GROUP_TARGET_LABEL, } from "./CmrComponents/niivue-roi-table/NiivueRoiTable";
35
35
  export type { NiivueRoiTableProps } from "./CmrComponents/niivue-roi-table/NiivueRoiTable";
36
+ export { default as CloudMrNiivueViewer, nv } from "./CmrComponents/niivue-viewer/CloudMrNiivueViewer.js";
37
+ export { CloudMrNiivuePanel } from "./CmrComponents/niivue-viewer/CloudMrNiivuePanel";
38
+ export type { CloudMrNiivuePanelProps, CloudMrDrawToolkitProps, } from "./CmrComponents/niivue-viewer/CloudMrNiivuePanel";
36
39
  import type { FC } from "react";
37
40
  import type { CmrTableProps } from "./CmrTable/CmrTable";
38
41
  import { CMR_TABLE_DEFAULT_HEADER_ICON } from "./CmrTable/CmrTable";
package/dist/index.js CHANGED
@@ -29,6 +29,8 @@ export { resampleNiivueRoiHistogram, getDefaultRoiHistogramLayout, } from "./Cmr
29
29
  export { NiivueRoiHistogram } from "./CmrComponents/niivue-roi-histogram/NiivueRoiHistogram";
30
30
  export { useNiivueRoiHistogram } from "./CmrComponents/niivue-roi-histogram/useNiivueRoiHistogram";
31
31
  export { NiivueRoiTable, DEFAULT_ROI_GROUP_TARGET_LABEL, } from "./CmrComponents/niivue-roi-table/NiivueRoiTable";
32
+ export { default as CloudMrNiivueViewer, nv } from "./CmrComponents/niivue-viewer/CloudMrNiivueViewer.js";
33
+ export { CloudMrNiivuePanel } from "./CmrComponents/niivue-viewer/CloudMrNiivuePanel";
32
34
  import CmrTableComponent, { CMR_TABLE_DEFAULT_HEADER_ICON } from "./CmrTable/CmrTable";
33
35
  export var CmrTable = CmrTableComponent;
34
36
  export { CMR_TABLE_DEFAULT_HEADER_ICON };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "4.3.7",
3
+ "version": "4.3.9",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",
@@ -261,7 +261,7 @@
261
261
  ],
262
262
  "scripts": {
263
263
  "build": "tsc && npm run copy-assets",
264
- "copy-assets": "find src \\( -name '*.scss' -o -name '*.css' -o -name 'NiivuePatcher.js' -o -name 'util.js' \\) | while read file; do mkdir -p \"dist/$(dirname \"${file#src/}\")\" && cp \"$file\" \"dist/${file#src/}\"; done",
264
+ "copy-assets": "node scripts/copy-assets.mjs",
265
265
  "prepublishOnly": "npm run build",
266
266
  "prepare": "npm run build"
267
267
  },
@@ -301,7 +301,7 @@
301
301
  "@mui/icons-material": "^5.14.1",
302
302
  "@mui/material": "^5.14.2",
303
303
  "@mui/x-data-grid": "^6.10.1",
304
- "@niivue/niivue": "^0.39.0",
304
+ "@niivue/niivue": "0.68.2",
305
305
  "antd": "^5.22.1",
306
306
  "css-loader": "^7.1.2",
307
307
  "jszip": "^3.10.1",