cloudmr-ux 4.3.7 → 4.3.8

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 (49) hide show
  1. package/dist/CmrComponents/niivue-contrast-adjustments/NiivueContrastAdjustments.js +4 -4
  2. package/dist/CmrComponents/niivue-slice-position/NiivueSlicePosition.js +2 -2
  3. package/dist/CmrComponents/niivue-viewer/CloudMrNiivuePanel.d.ts +38 -0
  4. package/dist/CmrComponents/niivue-viewer/CloudMrNiivuePanel.js +197 -0
  5. package/dist/CmrComponents/niivue-viewer/CloudMrNiivueViewer.d.ts +41 -0
  6. package/dist/CmrComponents/niivue-viewer/CloudMrNiivueViewer.js +1239 -0
  7. package/dist/CmrComponents/niivue-viewer/ColorPicker.d.ts +1 -0
  8. package/dist/CmrComponents/niivue-viewer/ColorPicker.js +65 -0
  9. package/dist/CmrComponents/niivue-viewer/Layer.d.ts +1 -0
  10. package/dist/CmrComponents/niivue-viewer/Layer.js +122 -0
  11. package/dist/CmrComponents/niivue-viewer/LayersPanel.d.ts +1 -0
  12. package/dist/CmrComponents/niivue-viewer/LayersPanel.js +107 -0
  13. package/dist/CmrComponents/niivue-viewer/Niivue.css +8 -0
  14. package/dist/CmrComponents/niivue-viewer/NiivuePatcher.d.ts +2 -0
  15. package/dist/CmrComponents/niivue-viewer/NiivuePatcher.js +1402 -0
  16. package/dist/CmrComponents/niivue-viewer/NumberPicker.d.ts +1 -0
  17. package/dist/CmrComponents/niivue-viewer/NumberPicker.js +40 -0
  18. package/dist/CmrComponents/niivue-viewer/SettingsPanel.d.ts +1 -0
  19. package/dist/CmrComponents/niivue-viewer/SettingsPanel.js +30 -0
  20. package/dist/CmrComponents/niivue-viewer/Switch.d.ts +1 -0
  21. package/dist/CmrComponents/niivue-viewer/Switch.js +27 -0
  22. package/dist/CmrComponents/niivue-viewer/Toolbar.d.ts +48 -0
  23. package/dist/CmrComponents/niivue-viewer/Toolbar.js +276 -0
  24. package/dist/CmrComponents/niivue-viewer/Toolbar.scss +40 -0
  25. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/DrawColorPlatte.d.ts +2 -0
  26. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/DrawColorPlatte.js +61 -0
  27. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/EraserPlatte.d.ts +2 -0
  28. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/EraserPlatte.js +56 -0
  29. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MaskPlatte.d.ts +2 -0
  30. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MaskPlatte.js +148 -0
  31. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MroDrawToolkit.d.ts +1 -0
  32. package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MroDrawToolkit.js +177 -0
  33. package/dist/CmrComponents/niivue-viewer/niivuePenType.d.ts +10 -0
  34. package/dist/CmrComponents/niivue-viewer/niivuePenType.js +10 -0
  35. package/dist/core/common/components/NiivueTools/NiivuePatcher.d.ts +2 -0
  36. package/dist/core/common/components/NiivueTools/components/ControlThemes.d.ts +1 -0
  37. package/dist/core/common/components/NiivueTools/components/ControlThemes.js +123 -0
  38. package/dist/core/common/components/NiivueTools/components/Example.d.ts +10 -0
  39. package/dist/core/common/components/NiivueTools/components/Example.js +326 -0
  40. package/dist/core/common/components/NiivueTools/components/ImageList.d.ts +1 -0
  41. package/dist/core/common/components/NiivueTools/components/ImageList.js +22 -0
  42. package/dist/core/common/components/NiivueTools/components/ImageListItem.d.ts +1 -0
  43. package/dist/core/common/components/NiivueTools/components/ImageListItem.js +103 -0
  44. package/dist/core/common/components/NiivueTools/main.d.ts +1 -0
  45. package/dist/core/common/components/NiivueTools/main.js +16 -0
  46. package/dist/core/common/components/NiivueTools/util.d.ts +21 -0
  47. package/dist/index.d.ts +3 -0
  48. package/dist/index.js +2 -0
  49. package/package.json +3 -3
@@ -0,0 +1 @@
1
+ export function ColorPicker(props: any): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,65 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Typography } from "@mui/material";
14
+ import { Input } from "@mui/material";
15
+ import { Box } from "@mui/material";
16
+ import React from 'react';
17
+ export function ColorPicker(props) {
18
+ var _a = React.useState('#ff0000'), hexColor = _a[0], setHexColor = _a[1];
19
+ React.useEffect(function () {
20
+ var rgb255 = rgb01Torgb255(props.colorRGB01);
21
+ var hex = rgb2Hex(rgb255);
22
+ console.log(props.title);
23
+ console.log(rgb255);
24
+ console.log(hex);
25
+ console.log('end use effect');
26
+ setHexColor(hex);
27
+ }, []);
28
+ function rgb01Torgb255(rgb01) {
29
+ return [
30
+ Math.round(rgb01[0] * 255),
31
+ Math.round(rgb01[1] * 255),
32
+ Math.round(rgb01[2] * 255),
33
+ ];
34
+ }
35
+ function componentToHex(c) {
36
+ var hex = c.toString(16);
37
+ return hex.length == 1 ? "0" + hex : hex;
38
+ }
39
+ function rgb2Hex(rgb255) {
40
+ return "#" + componentToHex(rgb255[0]) + componentToHex(rgb255[1]) + componentToHex(rgb255[2]);
41
+ }
42
+ function hex2rgb(h) {
43
+ return [
44
+ parseInt(h.substring(1, 3), 16),
45
+ parseInt(h.substring(3, 5), 16),
46
+ parseInt(h.substring(5), 16)
47
+ ];
48
+ }
49
+ function updateColor(event) {
50
+ var hex = event.target.value;
51
+ console.log(hex);
52
+ setHexColor(hex);
53
+ var rgb = hex2rgb(hex);
54
+ var rgb01 = rgb.map(function (val) { return (val / 255); });
55
+ props.onSetColor(rgb01);
56
+ }
57
+ return (_jsxs(Box, __assign({ sx: {
58
+ display: 'flex'
59
+ }, m: 1 }, { children: [_jsx(Typography, __assign({ style: {
60
+ marginRight: 'auto'
61
+ } }, { children: props.title })), _jsx(Input, { disableUnderline: false, autoFocus: false, type: 'color', style: {
62
+ width: '50px',
63
+ height: '20px'
64
+ }, onInput: updateColor, value: hexColor })] })));
65
+ }
@@ -0,0 +1 @@
1
+ export default function Layer(props: any): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,122 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Box, Divider, MenuItem, Card, CardContent } from "@mui/material";
14
+ import { Typography } from "@mui/material";
15
+ import { CmrLabel } from "cloudmr-ux";
16
+ import { Select } from "@mui/material";
17
+ import { InputLabel } from "@mui/material";
18
+ import { FormControl } from "@mui/material";
19
+ import { Paper } from "@mui/material";
20
+ import { IconButton } from "@mui/material";
21
+ import DeleteIcon from '@mui/icons-material/Delete';
22
+ import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
23
+ import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
24
+ import KeyboardDoubleArrowDownIcon from '@mui/icons-material/KeyboardDoubleArrowDown';
25
+ import KeyboardDoubleArrowUpIcon from '@mui/icons-material/KeyboardDoubleArrowUp';
26
+ import { NumberPicker } from './NumberPicker';
27
+ import React from 'react';
28
+ import { display } from "@mui/system";
29
+ function makeColorGradients(colorMapValues) {
30
+ var gradients = '';
31
+ var c = colorMapValues;
32
+ var n = c.R.length;
33
+ gradients += "rgba(".concat(c.R[n - 1], ",").concat(c.G[n - 1], ",").concat(c.B[n - 1], ",").concat(1, ")");
34
+ gradients += "linear-gradient(90deg,";
35
+ for (var j = 0; j < n; j++) {
36
+ gradients += "rgba(".concat(c.R[j], ",").concat(c.G[j], ",").concat(c.B[j], ",").concat(1, ") ").concat((j / (n - 1)) * 100, "%,");
37
+ }
38
+ gradients = gradients.slice(0, -1);
39
+ gradients += ')';
40
+ return gradients;
41
+ }
42
+ export default function Layer(props) {
43
+ var _a;
44
+ var allowedColorMaps = [
45
+ "bone",
46
+ "gray",
47
+ "hot",
48
+ "hsv",
49
+ "jet",
50
+ "plasma",
51
+ "turbo",
52
+ "viridis"
53
+ ];
54
+ var image = props.image;
55
+ var nii = props.nii;
56
+ var _b = React.useState(true), detailsOpen = _b[0], setDetailsOpen = _b[1];
57
+ var _c = React.useState(image.colormap), color = _c[0], setColor = _c[1];
58
+ var opacity = (_a = props.opacity) !== null && _a !== void 0 ? _a : 1.0;
59
+ var ArrowIcon = detailsOpen ? _jsx(KeyboardArrowUpIcon, {}) : _jsx(KeyboardArrowDownIcon, {});
60
+ // console.log(props.colorMapValues)
61
+ var allColors = props.nv.colormaps().filter(function (colorName) { return allowedColorMaps.includes(colorName); }).map(function (colorName) {
62
+ return (_jsx(MenuItem, __assign({ value: colorName }, { children: _jsxs(Box, __assign({ sx: {
63
+ display: 'flex',
64
+ flexDirection: 'row',
65
+ width: '100%'
66
+ } }, { children: [_jsx(Box, __assign({ sx: {
67
+ display: 'flex',
68
+ flexDirection: 'row'
69
+ } }, { children: colorName })), _jsx(Box, { sx: {
70
+ display: 'flex',
71
+ flexDirection: 'row',
72
+ width: '20%',
73
+ ml: 'auto'
74
+ }, style: {
75
+ background: makeColorGradients(props.getColorMapValues(colorName))
76
+ } })] })) }), colorName));
77
+ });
78
+ function handleDetails() {
79
+ setDetailsOpen(!detailsOpen);
80
+ }
81
+ function handleColorChange(event) {
82
+ var clr = event.target.value;
83
+ var id = image.id;
84
+ console.log(clr);
85
+ console.log(id);
86
+ props.onColorMapChange(id, clr);
87
+ setColor(clr);
88
+ }
89
+ function handleDelete() {
90
+ props.onRemoveLayer(image);
91
+ }
92
+ function handleOpacityChanged(a) {
93
+ image.opacity = a;
94
+ props.onOpacityChange(a);
95
+ }
96
+ return (_jsx(Box, __assign({ sx: {
97
+ display: 'flex',
98
+ flexDirection: 'column'
99
+ } }, { children: _jsxs(Box, __assign({ sx: {
100
+ display: detailsOpen ? 'flex' : 'none',
101
+ flexDirection: 'column'
102
+ } }, { children: [_jsxs(Box, __assign({ sx: {
103
+ display: 'flex',
104
+ flexDirection: 'column',
105
+ height: '100%',
106
+ width: '100%',
107
+ marginBottom: '10px'
108
+ } }, { children: [_jsxs(CmrLabel, __assign({ marginLeft: 2 }, { children: ["Opacity: ", opacity.toFixed(2)] })), _jsx("input", { type: "range", min: 0, max: 1, step: 0.01, value: opacity, onChange: function (e) {
109
+ var v = Math.max(0, Math.min(1, parseFloat(e.target.value) || 0));
110
+ handleOpacityChanged(v); // updates local state, image.opacity, and notifies parent
111
+ }, style: {
112
+ width: '100%',
113
+ alignSelf: 'center',
114
+ margin: '8px 0 16px 0',
115
+ accentColor: '#580f8b'
116
+ } })] })), _jsx(Box, __assign({ sx: {
117
+ display: 'flex',
118
+ flexDirection: 'row',
119
+ justifyContent: 'space-between',
120
+ width: '100%'
121
+ } }, { children: _jsxs(FormControl, { children: [_jsx(InputLabel, { children: "Colormap" }), _jsx(Select, __assign({ style: { width: '200px' }, value: color, label: 'Colormap', size: 'small', onChange: handleColorChange }, { children: allColors }))] }) }))] })) })));
122
+ }
@@ -0,0 +1 @@
1
+ export function LayersPanel(props: any): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,107 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ 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;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
49
+ import { Drawer } from "@mui/material";
50
+ import { Box } from "@mui/material";
51
+ import { Typography } from "@mui/material";
52
+ import { IconButton } from "@mui/material";
53
+ import { Button } from "@mui/material";
54
+ import ArrowBackIcon from '@mui/icons-material/ArrowBack';
55
+ import GestureIcon from "@mui/icons-material/Gesture";
56
+ import CodeIcon from "@mui/icons-material/Code";
57
+ import LayersIcon from "@mui/icons-material/Layers";
58
+ import AddIcon from '@mui/icons-material/Add';
59
+ export function LayersPanel(props) {
60
+ function handleAddLayer() {
61
+ var input = document.createElement('input');
62
+ input.type = 'file';
63
+ input.onchange = function () {
64
+ return __awaiter(this, void 0, void 0, function () {
65
+ return __generator(this, function (_a) {
66
+ props.onAddLayer(input.files[0]);
67
+ return [2 /*return*/];
68
+ });
69
+ });
70
+ };
71
+ input.click();
72
+ }
73
+ return (_jsx(Drawer, __assign({ open: props.open, variant: "temporary", anchor: "left", sx: {
74
+ width: props.width
75
+ } }, { children: _jsxs(Box, __assign({ sx: {
76
+ width: props.width,
77
+ display: 'flex',
78
+ flexDirection: 'row',
79
+ height: '100%'
80
+ } }, { children: [_jsxs(Box, __assign({ sx: {
81
+ width: 48,
82
+ display: 'flex',
83
+ flexDirection: 'column',
84
+ backgroundColor: '#F8F8F8',
85
+ height: '100%',
86
+ alignItems: 'center'
87
+ } }, { children: [_jsx(IconButton, __assign({ style: {
88
+ marginTop: '36px'
89
+ } }, { children: _jsx(LayersIcon, { color: 'primary' }) })), _jsx(IconButton, __assign({ style: {
90
+ marginTop: '8px'
91
+ } }, { children: _jsx(GestureIcon, {}) })), _jsx(IconButton, __assign({ style: {
92
+ marginTop: '8px'
93
+ } }, { children: _jsx(CodeIcon, {}) }))] })), _jsxs(Box, __assign({ sx: {
94
+ width: props.width,
95
+ role: 'presentation',
96
+ display: 'flex',
97
+ height: '100%',
98
+ flexDirection: 'column',
99
+ justifyContent: 'flex-start',
100
+ ml: 1,
101
+ mr: 1
102
+ } }, { children: [_jsx(Box, __assign({ sx: {
103
+ display: 'flex'
104
+ } }, { children: _jsx(IconButton, __assign({ onClick: props.onToggleMenu, style: { marginLeft: 'auto' } }, { children: _jsx(ArrowBackIcon, {}) })) })), _jsx(Box, __assign({ sx: {
105
+ display: 'flex'
106
+ } }, { children: _jsx(Button, __assign({ onClick: handleAddLayer, endIcon: _jsx(AddIcon, {}), size: 'small' }, { children: "Add Layer" })) })), props.children] }))] })) })));
107
+ }
@@ -0,0 +1,8 @@
1
+ canvas:focus {
2
+ outline: none;
3
+ }
4
+
5
+ .js-plotly-plot,
6
+ .plot-container {
7
+ width:100%;
8
+ }
@@ -0,0 +1,2 @@
1
+ export { Niivue };
2
+ import { Niivue } from "@niivue/niivue";