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.
- package/dist/CmrComponents/niivue-contrast-adjustments/NiivueContrastAdjustments.d.ts +4 -3
- package/dist/CmrComponents/niivue-contrast-adjustments/NiivueContrastAdjustments.js +5 -5
- package/dist/CmrComponents/niivue-slice-position/NiivueSlicePosition.js +2 -2
- package/dist/CmrComponents/niivue-viewer/CloudMrNiivuePanel.d.ts +38 -0
- package/dist/CmrComponents/niivue-viewer/CloudMrNiivuePanel.js +197 -0
- package/dist/CmrComponents/niivue-viewer/CloudMrNiivueViewer.d.ts +41 -0
- package/dist/CmrComponents/niivue-viewer/CloudMrNiivueViewer.js +1239 -0
- package/dist/CmrComponents/niivue-viewer/ColorPicker.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/ColorPicker.js +65 -0
- package/dist/CmrComponents/niivue-viewer/Layer.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/Layer.js +122 -0
- package/dist/CmrComponents/niivue-viewer/LayersPanel.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/LayersPanel.js +107 -0
- package/dist/CmrComponents/niivue-viewer/Niivue.css +8 -0
- package/dist/CmrComponents/niivue-viewer/NiivuePatcher.d.ts +2 -0
- package/dist/CmrComponents/niivue-viewer/NiivuePatcher.js +1402 -0
- package/dist/CmrComponents/niivue-viewer/NumberPicker.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/NumberPicker.js +40 -0
- package/dist/CmrComponents/niivue-viewer/SettingsPanel.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/SettingsPanel.js +30 -0
- package/dist/CmrComponents/niivue-viewer/Switch.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/Switch.js +27 -0
- package/dist/CmrComponents/niivue-viewer/Toolbar.d.ts +48 -0
- package/dist/CmrComponents/niivue-viewer/Toolbar.js +276 -0
- package/dist/CmrComponents/niivue-viewer/Toolbar.scss +40 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/DrawColorPlatte.d.ts +2 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/DrawColorPlatte.js +61 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/EraserPlatte.d.ts +2 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/EraserPlatte.js +56 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MaskPlatte.d.ts +2 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MaskPlatte.js +148 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MroDrawToolkit.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MroDrawToolkit.js +177 -0
- package/dist/CmrComponents/niivue-viewer/niivuePenType.d.ts +10 -0
- package/dist/CmrComponents/niivue-viewer/niivuePenType.js +10 -0
- package/dist/core/common/components/NiivueTools/NiivuePatcher.d.ts +2 -0
- package/dist/core/common/components/NiivueTools/components/ControlThemes.d.ts +1 -0
- package/dist/core/common/components/NiivueTools/components/ControlThemes.js +123 -0
- package/dist/core/common/components/NiivueTools/components/Example.d.ts +10 -0
- package/dist/core/common/components/NiivueTools/components/Example.js +326 -0
- package/dist/core/common/components/NiivueTools/components/ImageList.d.ts +1 -0
- package/dist/core/common/components/NiivueTools/components/ImageList.js +22 -0
- package/dist/core/common/components/NiivueTools/components/ImageListItem.d.ts +1 -0
- package/dist/core/common/components/NiivueTools/components/ImageListItem.js +103 -0
- package/dist/core/common/components/NiivueTools/main.d.ts +1 -0
- package/dist/core/common/components/NiivueTools/main.js +16 -0
- package/dist/core/common/components/NiivueTools/util.d.ts +21 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/package.json +3 -3
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Stack, IconButton, Typography, Box } from "@mui/material";
|
|
4
|
+
import FiberManualRecordIcon from "@mui/icons-material/FiberManualRecord";
|
|
5
|
+
import CheckIcon from "@mui/icons-material/Check";
|
|
6
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
7
|
+
import { InvertibleDualSlider, CmrCheckbox } from "cloudmr-ux";
|
|
8
|
+
var __assign = function () {
|
|
9
|
+
__assign =
|
|
10
|
+
Object.assign ||
|
|
11
|
+
function (t) {
|
|
12
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
13
|
+
s = arguments[i];
|
|
14
|
+
for (var p in s)
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
}
|
|
18
|
+
return t;
|
|
19
|
+
};
|
|
20
|
+
return __assign.apply(this, arguments);
|
|
21
|
+
};
|
|
22
|
+
var MaskPlatte = function (_a) {
|
|
23
|
+
var expanded = _a.expanded, nv = _a.nv, setMaskColor = _a.setMaskColor, resampleImage = _a.resampleImage, unfocus = _a.unfocus;
|
|
24
|
+
var _b = useState(0), colorIndex = _b[0], storeColorIndex = _b[1];
|
|
25
|
+
var _c = useState("red"), maskColor = _c[0], storeMaskColor = _c[1];
|
|
26
|
+
var _d = useState(false), checked = _d[0], setChecked = _d[1];
|
|
27
|
+
var _e = useState(undefined), original = _e[0], setOriginal = _e[1];
|
|
28
|
+
var colors = ["red", "green", "blue", "yellow", "cyan", "#e81ce8"];
|
|
29
|
+
var filledOptions = colors.map(function (color, i) {
|
|
30
|
+
return _jsx(FiberManualRecordIcon, { sx: { color: color } }, i);
|
|
31
|
+
});
|
|
32
|
+
if (expanded) {
|
|
33
|
+
setMaskColor(maskColor);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
setMaskColor(undefined);
|
|
37
|
+
}
|
|
38
|
+
var _f = useState(nv.volumes[0] ? nv.volumes[0].vox_min : 0), min = _f[0], setMin = _f[1];
|
|
39
|
+
var _g = useState(nv.volumes[0] ? nv.volumes[0].vox_max : 1), max = _g[0], setMax = _g[1];
|
|
40
|
+
var cancelMask = function () {
|
|
41
|
+
if (original)
|
|
42
|
+
nv.drawBitmap = new Uint8Array(original);
|
|
43
|
+
else
|
|
44
|
+
return;
|
|
45
|
+
nv.refreshDrawing(true);
|
|
46
|
+
resampleImage();
|
|
47
|
+
setOriginal(undefined);
|
|
48
|
+
};
|
|
49
|
+
useEffect(function () {
|
|
50
|
+
if (!expanded) {
|
|
51
|
+
cancelMask();
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
if (colorIndex !== -1)
|
|
55
|
+
nv.fillRange(min, max, colorIndex + 1, checked, original, setOriginal);
|
|
56
|
+
resampleImage();
|
|
57
|
+
}
|
|
58
|
+
}, [expanded]);
|
|
59
|
+
useEffect(function () {
|
|
60
|
+
if (colorIndex !== -1 && expanded)
|
|
61
|
+
nv.fillRange(min, max, colorIndex + 1, checked, original, setOriginal);
|
|
62
|
+
}, [min, max, checked]);
|
|
63
|
+
return _jsxs(Stack, __assign({
|
|
64
|
+
style: {
|
|
65
|
+
position: "absolute",
|
|
66
|
+
top: "100%",
|
|
67
|
+
left: 0,
|
|
68
|
+
zIndex: 1500,
|
|
69
|
+
border: "".concat(expanded ? "1px" : 0, " solid #bbb"),
|
|
70
|
+
maxWidth: expanded ? 450 : 0,
|
|
71
|
+
overflow: expanded ? "visible" : "hidden",
|
|
72
|
+
borderRadius: "16px",
|
|
73
|
+
borderTopLeftRadius: "6pt",
|
|
74
|
+
borderTopRightRadius: "6pt",
|
|
75
|
+
background: "#333"
|
|
76
|
+
},
|
|
77
|
+
direction: "column"
|
|
78
|
+
}, {
|
|
79
|
+
children: [
|
|
80
|
+
_jsx(Stack, __assign({ alignItems: "center" }, {
|
|
81
|
+
children: _jsx(Typography, __assign({
|
|
82
|
+
color: "white",
|
|
83
|
+
gutterBottom: true,
|
|
84
|
+
width: "100%",
|
|
85
|
+
marginLeft: "10pt",
|
|
86
|
+
fontSize: "11pt",
|
|
87
|
+
alignItems: "start"
|
|
88
|
+
}, { children: "Mask range:" }))
|
|
89
|
+
})),
|
|
90
|
+
_jsxs(Stack, __assign({ direction: "row", flexDirection: "row", justifyContent: "center" }, {
|
|
91
|
+
children: [
|
|
92
|
+
filledOptions.map(function (value, index) {
|
|
93
|
+
return _jsx(IconButton, __assign({
|
|
94
|
+
onClick: function () {
|
|
95
|
+
storeColorIndex(index);
|
|
96
|
+
storeMaskColor(colors[index]);
|
|
97
|
+
setMaskColor(colors[index]);
|
|
98
|
+
nv.fillRange(min, max, index + 1, checked, original, setOriginal);
|
|
99
|
+
resampleImage();
|
|
100
|
+
}
|
|
101
|
+
}, { children: value }), index);
|
|
102
|
+
}),
|
|
103
|
+
_jsx(CmrCheckbox, __assign({
|
|
104
|
+
style: { color: "white" },
|
|
105
|
+
onChange: function (e) {
|
|
106
|
+
e.stopPropagation();
|
|
107
|
+
setChecked(e.target.checked);
|
|
108
|
+
resampleImage();
|
|
109
|
+
}
|
|
110
|
+
}, { children: "Inverted" })),
|
|
111
|
+
]
|
|
112
|
+
})),
|
|
113
|
+
_jsx(Stack, __assign({ direction: "row", sx: { mb: 1 } }, {
|
|
114
|
+
children: _jsx(Box, __assign({ width: 400, style: { paddingLeft: "10px", paddingRight: "10px" } }, {
|
|
115
|
+
children: _jsx(InvertibleDualSlider, {
|
|
116
|
+
name: "",
|
|
117
|
+
min: nv.volumes[0] ? nv.volumes[0].vox_min : 0,
|
|
118
|
+
max: nv.volumes[0] ? nv.volumes[0].vox_max : 1,
|
|
119
|
+
reverse: checked,
|
|
120
|
+
setMin: setMin,
|
|
121
|
+
setMax: setMax,
|
|
122
|
+
onFinalize: function () {
|
|
123
|
+
resampleImage();
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
}))
|
|
127
|
+
})),
|
|
128
|
+
_jsxs(Stack, __assign({ direction: "row", flexDirection: "row", justifyContent: "center" }, {
|
|
129
|
+
children: [
|
|
130
|
+
_jsx(IconButton, __assign({
|
|
131
|
+
onClick: function () {
|
|
132
|
+
setOriginal(undefined);
|
|
133
|
+
nv.drawAddUndoBitmapWithHiddenVoxels();
|
|
134
|
+
unfocus();
|
|
135
|
+
}
|
|
136
|
+
}, { children: _jsx(CheckIcon, { style: { color: "green" } }) })),
|
|
137
|
+
_jsx(IconButton, __assign({
|
|
138
|
+
onClick: function () {
|
|
139
|
+
cancelMask();
|
|
140
|
+
unfocus();
|
|
141
|
+
}
|
|
142
|
+
}, { children: _jsx(CloseIcon, { style: { color: "red" } }) })),
|
|
143
|
+
]
|
|
144
|
+
})),
|
|
145
|
+
]
|
|
146
|
+
}));
|
|
147
|
+
};
|
|
148
|
+
export default MaskPlatte;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function MroDrawToolkit(props: any): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,177 @@
|
|
|
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
|
+
/**
|
|
14
|
+
* MROptimum fork of cloudmr-ux DrawToolkit.
|
|
15
|
+
* Click-away exits drawing mode when you focus elsewhere (slice controls, histogram, etc.),
|
|
16
|
+
* but clicks on `#niiCanvas` are ignored so you can keep drawing on the viewer.
|
|
17
|
+
*
|
|
18
|
+
* Layout matches {@link NiivueSlicePosition}: outer wrapper → `.title` → `Card` + `CardContent` (no custom fill).
|
|
19
|
+
*/
|
|
20
|
+
import React, { useState } from "react";
|
|
21
|
+
import { Box, Card, CardContent, IconButton, Slider, Stack, Tooltip, Typography, } from "@mui/material";
|
|
22
|
+
import DrawIcon from "@mui/icons-material/Draw";
|
|
23
|
+
import CropSquareOutlinedIcon from "@mui/icons-material/CropSquareOutlined";
|
|
24
|
+
import CircleOutlinedIcon from "@mui/icons-material/CircleOutlined";
|
|
25
|
+
import AutoFixNormalOutlinedIcon from "@mui/icons-material/AutoFixNormalOutlined";
|
|
26
|
+
import ReplyIcon from "@mui/icons-material/Reply";
|
|
27
|
+
import CameraAltIcon from "@mui/icons-material/CameraAlt";
|
|
28
|
+
import SvgIcon from "@mui/material/SvgIcon";
|
|
29
|
+
import FormatColorFillIcon from "@mui/icons-material/FormatColorFill";
|
|
30
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
|
31
|
+
import VisibilityIcon from "@mui/icons-material/Visibility";
|
|
32
|
+
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
|
|
33
|
+
import OpacityIcon from "@mui/icons-material/Opacity";
|
|
34
|
+
import ClickAwayListener from "@mui/material/ClickAwayListener";
|
|
35
|
+
import DrawColorPlatte from "./DrawColorPlatte";
|
|
36
|
+
import EraserPlatte from "./EraserPlatte";
|
|
37
|
+
import MaskPlatte from "./MaskPlatte";
|
|
38
|
+
/** True if the event target is the main NiiVue canvas (drawing surface). Clicks there must not exit draw mode. */
|
|
39
|
+
function clickTargetIsNiivueCanvas(target) {
|
|
40
|
+
if (typeof document === "undefined" || !(target instanceof Element))
|
|
41
|
+
return false;
|
|
42
|
+
return !!target.closest("#niiCanvas");
|
|
43
|
+
}
|
|
44
|
+
/** Same icon tone as typical MUI on-paper controls (matches slice panel body). */
|
|
45
|
+
var ICON_COLOR = "#212121";
|
|
46
|
+
function EraserIcon(props) {
|
|
47
|
+
return (_jsxs(SvgIcon, __assign({}, props, { viewBox: "0 0 25 25", sx: { color: "inherit" } }, { children: [_jsx("rect", { x: "6", y: "3", width: "12", height: "22", rx: "2", ry: "2", transform: "rotate(230 12 12)", fill: "currentColor" }), _jsx("rect", { x: "7", y: "4", width: "10", height: "8", rx: "2", ry: "2", transform: "rotate(230 12 12)", fill: "#FFFFFF" })] })));
|
|
48
|
+
}
|
|
49
|
+
function OpacityPlatte(_a) {
|
|
50
|
+
var drawingOpacity = _a.drawingOpacity, setDrawingOpacity = _a.setDrawingOpacity, expanded = _a.expanded;
|
|
51
|
+
return (_jsx(Stack, __assign({ style: {
|
|
52
|
+
position: "absolute",
|
|
53
|
+
top: "100%",
|
|
54
|
+
left: 0,
|
|
55
|
+
zIndex: 1500,
|
|
56
|
+
border: "".concat(expanded ? "1px" : 0, " solid #bbb"),
|
|
57
|
+
maxWidth: expanded ? 300 : 0,
|
|
58
|
+
overflow: expanded ? "visible" : "hidden",
|
|
59
|
+
borderRadius: "16px",
|
|
60
|
+
borderTopLeftRadius: "6pt",
|
|
61
|
+
borderTopRightRadius: "6pt",
|
|
62
|
+
background: "#333",
|
|
63
|
+
width: 150
|
|
64
|
+
}, direction: "column" }, { children: _jsxs(Stack, __assign({ sx: { mb: 1 }, alignItems: "center" }, { children: [_jsxs(Typography, __assign({ color: "white", noWrap: true, gutterBottom: true, width: "100%", marginLeft: "10pt", fontSize: "11pt", alignItems: "start" }, { children: ["Opacity: ", drawingOpacity] })), _jsx(Slider, { sx: { width: "80%" }, value: drawingOpacity, step: 0.01, min: 0, max: 1, onChange: function (_e, value) { return setDrawingOpacity(value); } })] })) })));
|
|
65
|
+
}
|
|
66
|
+
export function MroDrawToolkit(props) {
|
|
67
|
+
var _a;
|
|
68
|
+
var drawShapeTool = props.drawShapeTool, onDrawShapeToolChange = props.onDrawShapeToolChange;
|
|
69
|
+
var _b = useState("n"), expandedOption = _b[0], setExpandedOption = _b[1];
|
|
70
|
+
var _c = useState(false), expandOpacityOptions = _c[0], setExpandOpacityOptions = _c[1];
|
|
71
|
+
var _d = useState(undefined), setMaskColor = _d[1];
|
|
72
|
+
var filled = props.drawPen > 7;
|
|
73
|
+
var shapeSelectedSx = function (shape) {
|
|
74
|
+
return drawShapeTool === shape
|
|
75
|
+
? { backgroundColor: "rgba(88, 15, 139, 0.12)", color: "#580f8b" }
|
|
76
|
+
: {};
|
|
77
|
+
};
|
|
78
|
+
function clickPen() {
|
|
79
|
+
onDrawShapeToolChange === null || onDrawShapeToolChange === void 0 ? void 0 : onDrawShapeToolChange("pen");
|
|
80
|
+
if (expandedOption === "d") {
|
|
81
|
+
setExpandedOption("n");
|
|
82
|
+
props.setDrawingEnabled(false);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
setExpandedOption("d");
|
|
86
|
+
setExpandOpacityOptions(false);
|
|
87
|
+
props.setDrawingEnabled(true);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function clickRectangle() {
|
|
91
|
+
onDrawShapeToolChange === null || onDrawShapeToolChange === void 0 ? void 0 : onDrawShapeToolChange("rectangle");
|
|
92
|
+
if (expandedOption === "r") {
|
|
93
|
+
setExpandedOption("n");
|
|
94
|
+
props.setDrawingEnabled(false);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
setExpandedOption("r");
|
|
98
|
+
setExpandOpacityOptions(false);
|
|
99
|
+
props.setDrawingEnabled(true);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function clickEllipse() {
|
|
103
|
+
onDrawShapeToolChange === null || onDrawShapeToolChange === void 0 ? void 0 : onDrawShapeToolChange("ellipse");
|
|
104
|
+
if (expandedOption === "l") {
|
|
105
|
+
setExpandedOption("n");
|
|
106
|
+
props.setDrawingEnabled(false);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
setExpandedOption("l");
|
|
110
|
+
setExpandOpacityOptions(false);
|
|
111
|
+
props.setDrawingEnabled(true);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function clickEraser() {
|
|
115
|
+
if (expandedOption === "e") {
|
|
116
|
+
setExpandedOption("n");
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
props.updateDrawPen({ target: { value: 8 } });
|
|
120
|
+
setExpandedOption("e");
|
|
121
|
+
}
|
|
122
|
+
props.setDrawingEnabled(expandedOption !== "e");
|
|
123
|
+
}
|
|
124
|
+
function clickMask() {
|
|
125
|
+
if (expandedOption === "m") {
|
|
126
|
+
setExpandedOption("n");
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
setExpandedOption("m");
|
|
130
|
+
}
|
|
131
|
+
props.setDrawingEnabled(false);
|
|
132
|
+
}
|
|
133
|
+
var vol = (_a = props.volumes) === null || _a === void 0 ? void 0 : _a[props.selectedVolume];
|
|
134
|
+
var toolBtnSx = {
|
|
135
|
+
color: ICON_COLOR,
|
|
136
|
+
p: 0.5,
|
|
137
|
+
"&:hover": { backgroundColor: "rgba(0,0,0,0.04)" },
|
|
138
|
+
"&.Mui-disabled": { color: "rgba(0,0,0,0.26)" }
|
|
139
|
+
};
|
|
140
|
+
return (_jsx(ClickAwayListener, __assign({ onClickAway: function (event) {
|
|
141
|
+
var _a;
|
|
142
|
+
if (clickTargetIsNiivueCanvas(event.target))
|
|
143
|
+
return;
|
|
144
|
+
setExpandedOption("n");
|
|
145
|
+
setExpandOpacityOptions(false);
|
|
146
|
+
props.setDrawingEnabled(false);
|
|
147
|
+
(_a = props.onExitDrawMode) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
148
|
+
} }, { children: _jsxs("div", __assign({ style: __assign({ width: "100%", position: "relative", zIndex: 1080 }, props.style) }, { children: [_jsx("div", __assign({ className: "title", style: { width: "100%" } }, { children: "ROI Tools" })), _jsx(Card, __assign({ variant: "outlined", sx: {
|
|
149
|
+
mb: 2,
|
|
150
|
+
borderTopLeftRadius: 0,
|
|
151
|
+
borderTopRightRadius: 0,
|
|
152
|
+
overflow: "visible"
|
|
153
|
+
} }, { children: _jsx(CardContent, __assign({ sx: {
|
|
154
|
+
overflow: "visible",
|
|
155
|
+
"&:last-child": { paddingBottom: 2 }
|
|
156
|
+
} }, { children: _jsx("div", __assign({ style: { display: "flex", flexDirection: "column", overflow: "visible" } }, { children: _jsxs("div", __assign({ style: {
|
|
157
|
+
display: "flex",
|
|
158
|
+
flexDirection: "row",
|
|
159
|
+
flexWrap: "wrap",
|
|
160
|
+
alignItems: "center",
|
|
161
|
+
gap: 4,
|
|
162
|
+
overflow: "visible"
|
|
163
|
+
} }, { children: [_jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "d" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Pen" }, { children: _jsx(IconButton, __assign({ "aria-label": "pen", size: "small", onClick: clickPen, sx: __assign(__assign({}, toolBtnSx), shapeSelectedSx("pen")) }, { children: _jsx(DrawIcon, { sx: { color: "inherit" } }) })) })), _jsx(DrawColorPlatte, { expanded: expandedOption === "d", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled })] })), _jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "r" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Rectangle" }, { children: _jsx(IconButton, __assign({ "aria-label": "rectangle", size: "small", onClick: clickRectangle, sx: __assign(__assign({}, toolBtnSx), shapeSelectedSx("rectangle")) }, { children: _jsx(CropSquareOutlinedIcon, { sx: { color: "inherit" } }) })) })), _jsx(DrawColorPlatte, { expanded: expandedOption === "r", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled })] })), _jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "l" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Ellipse" }, { children: _jsx(IconButton, __assign({ "aria-label": "ellipse", size: "small", onClick: clickEllipse, sx: __assign(__assign({}, toolBtnSx), shapeSelectedSx("ellipse")) }, { children: _jsx(CircleOutlinedIcon, { sx: { color: "inherit" } }) })) })), _jsx(DrawColorPlatte, { expanded: expandedOption === "l", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled })] })), _jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "e" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Eraser" }, { children: _jsx(IconButton, __assign({ "aria-label": "erase", size: "small", onClick: clickEraser, sx: toolBtnSx }, { children: filled || expandedOption !== "e" ? (_jsx(EraserIcon, {})) : (_jsx(AutoFixNormalOutlinedIcon, { sx: { color: ICON_COLOR } })) })) })), _jsx(EraserPlatte, { expandEraseOptions: expandedOption === "e", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled })] })), _jsx(Tooltip, __assign({ title: "Undo" }, { children: _jsx(IconButton, __assign({ "aria-label": "revert", size: "small", onClick: function () { return props.drawUndo(); }, sx: toolBtnSx }, { children: _jsx(ReplyIcon, { sx: { color: ICON_COLOR } }) })) })), _jsx(Tooltip, __assign({ title: "Save screenshot" }, { children: _jsx("span", { children: _jsx(IconButton, __assign({ "aria-label": "capture", size: "small", disabled: !vol, onClick: function () { return vol && props.nv.saveScene("".concat(vol.name, "_drawing.png")); }, sx: toolBtnSx }, { children: _jsx(CameraAltIcon, { sx: { color: ICON_COLOR } }) })) }) })), _jsx(Tooltip, __assign({ title: "Clear drawing" }, { children: _jsx(IconButton, __assign({ "aria-label": "delete", size: "small", onClick: function () {
|
|
164
|
+
props.nv.clearDrawing();
|
|
165
|
+
props.resampleImage();
|
|
166
|
+
props.setDrawingChanged(false);
|
|
167
|
+
}, sx: toolBtnSx }, { children: _jsx(DeleteIcon, { sx: { color: ICON_COLOR } }) })) })), _jsx(Tooltip, __assign({ title: "ROI visibility" }, { children: _jsx(IconButton, __assign({ "aria-label": "visible", size: "small", onClick: function () { return props.toggleROIVisible(); }, sx: toolBtnSx }, { children: props.roiVisible ? (_jsx(VisibilityIcon, { sx: { color: ICON_COLOR } })) : (_jsx(VisibilityOffIcon, { sx: { color: ICON_COLOR, opacity: 0.45 } })) })) })), _jsxs(Box, __assign({ sx: {
|
|
168
|
+
position: "relative",
|
|
169
|
+
zIndex: expandOpacityOptions ? 1600 : "auto",
|
|
170
|
+
display: "inline-flex",
|
|
171
|
+
alignItems: "center",
|
|
172
|
+
color: ICON_COLOR
|
|
173
|
+
} }, { children: [_jsx(Tooltip, __assign({ title: "Drawing opacity" }, { children: _jsx(IconButton, __assign({ "aria-label": "opaque", size: "small", onClick: function () { return setExpandOpacityOptions(!expandOpacityOptions); }, sx: toolBtnSx }, { children: _jsx(OpacityIcon, { sx: { color: ICON_COLOR } }) })) })), _jsx(Typography, __assign({ component: "span", sx: { fontSize: "0.7rem", mr: 0.25, userSelect: "none", color: ICON_COLOR } }, { children: props.drawingOpacity.toFixed(2) })), _jsx(OpacityPlatte, { drawingOpacity: props.drawingOpacity, setDrawingOpacity: props.setDrawingOpacity, expanded: expandOpacityOptions })] })), _jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "m" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Mask by intensity range" }, { children: _jsx(IconButton, __assign({ "aria-label": "fill", size: "small", onClick: clickMask, sx: toolBtnSx }, { children: _jsx(FormatColorFillIcon, { sx: { color: ICON_COLOR } }) })) })), _jsx(MaskPlatte, { resampleImage: function () {
|
|
174
|
+
props.resampleImage();
|
|
175
|
+
props.setDrawingChanged(true);
|
|
176
|
+
}, expanded: expandedOption === "m", nv: props.nv, setMaskColor: setMaskColor, unfocus: function () { return setExpandedOption("n"); } })] }))] })) })) })) }))] })) })));
|
|
177
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Values match @niivue/niivue PEN_TYPE. Import them locally because Vite's
|
|
3
|
+
* optimizeDeps pre-bundle for @niivue/niivue currently omits the PEN_TYPE export
|
|
4
|
+
* (see node_modules/.vite/deps/@niivue_niivue.js export list).
|
|
5
|
+
*/
|
|
6
|
+
export declare const NI_PEN_TYPE: {
|
|
7
|
+
readonly PEN: 0;
|
|
8
|
+
readonly RECTANGLE: 1;
|
|
9
|
+
readonly ELLIPSE: 2;
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Values match @niivue/niivue PEN_TYPE. Import them locally because Vite's
|
|
3
|
+
* optimizeDeps pre-bundle for @niivue/niivue currently omits the PEN_TYPE export
|
|
4
|
+
* (see node_modules/.vite/deps/@niivue_niivue.js export list).
|
|
5
|
+
*/
|
|
6
|
+
export var NI_PEN_TYPE = {
|
|
7
|
+
PEN: 0,
|
|
8
|
+
RECTANGLE: 1,
|
|
9
|
+
ELLIPSE: 2
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { make, container } from './kitchen-sink.js';
|
|
2
|
+
var Default = {};
|
|
3
|
+
var themes = {
|
|
4
|
+
Default: Default,
|
|
5
|
+
Light: {
|
|
6
|
+
'--background-color': '#f6f6f6',
|
|
7
|
+
'--text-color': '#3d3d3d',
|
|
8
|
+
'--title-background-color': '#efefef',
|
|
9
|
+
'--title-text-color': '#3d3d3d',
|
|
10
|
+
'--widget-color': '#eaeaea',
|
|
11
|
+
'--hover-color': '#f0f0f0',
|
|
12
|
+
'--focus-color': '#fafafa',
|
|
13
|
+
'--number-color': '#07aacf',
|
|
14
|
+
'--string-color': '#8da300'
|
|
15
|
+
},
|
|
16
|
+
'Solarized~ Light': {
|
|
17
|
+
'--background-color': '#fdf6e3',
|
|
18
|
+
'--text-color': '#657b83',
|
|
19
|
+
'--title-background-color': '#f5efdc',
|
|
20
|
+
'--title-text-color': '#657b83',
|
|
21
|
+
'--widget-color': '#eee8d5',
|
|
22
|
+
'--hover-color': '#e7e1cf',
|
|
23
|
+
'--focus-color': '#e6ddc7',
|
|
24
|
+
'--number-color': '#2aa0f3',
|
|
25
|
+
'--string-color': '#97ad00'
|
|
26
|
+
},
|
|
27
|
+
'Solarized~ Dark': {
|
|
28
|
+
'--background-color': '#002b36',
|
|
29
|
+
'--text-color': '#b2c2c2',
|
|
30
|
+
'--title-background-color': '#001f27',
|
|
31
|
+
'--title-text-color': '#b2c2c2',
|
|
32
|
+
'--widget-color': '#094e5f',
|
|
33
|
+
'--hover-color': '#0a6277',
|
|
34
|
+
'--focus-color': '#0b6c84',
|
|
35
|
+
'--number-color': '#2aa0f2',
|
|
36
|
+
'--string-color': '#97ad00'
|
|
37
|
+
},
|
|
38
|
+
'Tennis': {
|
|
39
|
+
'--background-color': '#32405e',
|
|
40
|
+
'--text-color': '#ebe193',
|
|
41
|
+
'--title-background-color': '#713154',
|
|
42
|
+
'--title-text-color': '#ffffff',
|
|
43
|
+
'--widget-color': '#057170',
|
|
44
|
+
'--hover-color': '#057170',
|
|
45
|
+
'--focus-color': '#b74f88',
|
|
46
|
+
'--number-color': '#ddfcff',
|
|
47
|
+
'--string-color': '#ffbf00'
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var colorGUI = make({ title: 'Customization' }, function (gui) {
|
|
51
|
+
gui.add({ theme: Default }, 'theme', themes)
|
|
52
|
+
.name('Themes')
|
|
53
|
+
.onChange(function (v) {
|
|
54
|
+
if (v === Default) {
|
|
55
|
+
colorGUI.reset();
|
|
56
|
+
allVarGUI.reset();
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
colorGUI.load({ controllers: v });
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return gui.addFolder('Colors');
|
|
63
|
+
});
|
|
64
|
+
var allVarGUI = make({ title: 'All CSS Vars' });
|
|
65
|
+
var customDisplay = document.createElement('pre');
|
|
66
|
+
customDisplay.id = 'custom-css';
|
|
67
|
+
container.appendChild(customDisplay);
|
|
68
|
+
var customStyleTag = document.createElement('style');
|
|
69
|
+
document.head.appendChild(customStyleTag);
|
|
70
|
+
var originalStyles = {};
|
|
71
|
+
var stylesheet = new Proxy({}, {
|
|
72
|
+
set: function (target, property, value) {
|
|
73
|
+
if (!(property in target)) {
|
|
74
|
+
originalStyles[property] = value;
|
|
75
|
+
}
|
|
76
|
+
target[property] = value;
|
|
77
|
+
updateStylesheet();
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
function updateStylesheet() {
|
|
82
|
+
var style = '';
|
|
83
|
+
for (var prop in stylesheet) {
|
|
84
|
+
var value = stylesheet[prop];
|
|
85
|
+
if (value === originalStyles[prop])
|
|
86
|
+
continue;
|
|
87
|
+
style += "\t".concat(prop, ": ").concat(value, ";\n");
|
|
88
|
+
}
|
|
89
|
+
if (style) {
|
|
90
|
+
style = '.lil-gui {\n' + style + '}';
|
|
91
|
+
customDisplay.innerHTML = style;
|
|
92
|
+
customStyleTag.innerHTML = style;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
customDisplay.innerHTML = '';
|
|
96
|
+
customStyleTag.innerHTML = '';
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
var defaultStyleTag = Array.from(document.querySelectorAll('style'))
|
|
100
|
+
.find(function (tag) { return tag.innerHTML.includes('lil-gui'); });
|
|
101
|
+
defaultStyleTag.innerHTML.replace(/(--[a-z0-9-]+)\s*:\s*([^;}]*)[;}]/ig, function (_, property, value) {
|
|
102
|
+
if (property in stylesheet)
|
|
103
|
+
return;
|
|
104
|
+
stylesheet[property] = value;
|
|
105
|
+
if (/color$/.test(property)) {
|
|
106
|
+
colorGUI.addColor(stylesheet, property);
|
|
107
|
+
}
|
|
108
|
+
else if (/^\d+px$/.test(value)) {
|
|
109
|
+
var obj = {};
|
|
110
|
+
var initial = parseFloat(value.replace('px', ''));
|
|
111
|
+
obj[property] = initial;
|
|
112
|
+
allVarGUI.add(obj, property, 0, undefined, 1).onChange(function (v) { return stylesheet[property] = v + 'px'; });
|
|
113
|
+
}
|
|
114
|
+
else if (/%$/.test(value)) {
|
|
115
|
+
var obj = {};
|
|
116
|
+
var initial = parseFloat(value.replace('%', ''));
|
|
117
|
+
obj[property] = initial;
|
|
118
|
+
allVarGUI.add(obj, property, 0).onChange(function (v) { return stylesheet[property] = v + '%'; });
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
allVarGUI.add(stylesheet, property);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare function handleIntensityChange(data: any): void;
|
|
2
|
+
declare function toggleGroup(id: any): void;
|
|
3
|
+
declare function onButtonClick(event: any): Promise<void>;
|
|
4
|
+
declare const isTouchDevice: boolean;
|
|
5
|
+
declare var isFilled: boolean;
|
|
6
|
+
declare var nv1: any;
|
|
7
|
+
declare var volumeList1: {
|
|
8
|
+
url: string;
|
|
9
|
+
}[];
|
|
10
|
+
declare var buttons: HTMLCollectionOf<Element>;
|