cloudmr-ux 4.5.8 → 4.6.0
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-roi-histogram/resampleNiivueRoiHistogram.js +1 -1
- package/dist/CmrComponents/niivue-viewer/CloudMrNiivuePanel.d.ts +2 -0
- package/dist/CmrComponents/niivue-viewer/CloudMrNiivuePanel.js +2 -7
- package/dist/CmrComponents/niivue-viewer/CloudMrNiivueViewer.js +51 -1
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MroDrawToolkit.js +22 -10
- package/dist/core/common/components/NiivueTools/Niivue.js +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,8 @@ export type CloudMrDrawToolkitProps = Omit<DrawToolkitProps, "rois" | "selectedR
|
|
|
11
11
|
onCancelPenDraft?: () => void;
|
|
12
12
|
onFillPenDraft?: () => void;
|
|
13
13
|
penDraftActive?: boolean;
|
|
14
|
+
onActivateEraser?: () => void;
|
|
15
|
+
onDeactivateDrawTools?: () => void;
|
|
14
16
|
shapeDraftActive?: boolean;
|
|
15
17
|
onApplyShapeDraft?: () => void;
|
|
16
18
|
onCancelShapeDraft?: () => void;
|
|
@@ -153,13 +153,8 @@ export function CloudMrNiivuePanel(props) {
|
|
|
153
153
|
justifyContent: "flex-start",
|
|
154
154
|
mb: { xs: 2, md: 0 }
|
|
155
155
|
} }, { children: [_jsx(MroDrawToolkit, __assign({}, props.drawToolkitProps, { drawShapeTool: props.drawShapeTool, onDrawShapeToolChange: applyDrawShapeTool, onExitDrawMode: function () {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
if (props.penDraft) {
|
|
160
|
-
props.onCancelPenDraft();
|
|
161
|
-
}
|
|
162
|
-
props.setDrawShapeTool(null);
|
|
156
|
+
var _a, _b;
|
|
157
|
+
(_b = (_a = props.drawToolkitProps).onDeactivateDrawTools) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
163
158
|
}, shapeDraftActive: props.shapeDraft != null, penDraftActive: props.penDraft != null, onApplyShapeDraft: props.onApplyShapeDraft, onCancelShapeDraft: props.onCancelShapeDraft, style: {
|
|
164
159
|
marginBottom: 0,
|
|
165
160
|
width: "100%",
|
|
@@ -576,6 +576,7 @@ export default function CloudMrNiivueViewer(props) {
|
|
|
576
576
|
nv.setPenValue(raw & 7, raw > 0);
|
|
577
577
|
}
|
|
578
578
|
if (isEraser) {
|
|
579
|
+
nv.opts.penType = NI_PEN_TYPE.PEN;
|
|
579
580
|
nv.opts.deferFreehandCommit = false;
|
|
580
581
|
nv.opts.deferShapeCommit = false;
|
|
581
582
|
nv.opts.polylinePenMode = false;
|
|
@@ -597,6 +598,53 @@ export default function CloudMrNiivueViewer(props) {
|
|
|
597
598
|
nv.opts.isFilledPen = penDrawModeRef.current === "freehand";
|
|
598
599
|
}
|
|
599
600
|
}
|
|
601
|
+
function deactivateDrawTools() {
|
|
602
|
+
var _a, _b;
|
|
603
|
+
if (shapeDraftRef.current) {
|
|
604
|
+
cancelShapeDraft();
|
|
605
|
+
}
|
|
606
|
+
if (penDraftRef.current) {
|
|
607
|
+
cancelPenDraft(nv, penDraftRef.current);
|
|
608
|
+
(_a = nv.cloudMrResetPolyline) === null || _a === void 0 ? void 0 : _a.call(nv);
|
|
609
|
+
setPolylineVertexCount(0);
|
|
610
|
+
setPenDraft(null);
|
|
611
|
+
penDraftRef.current = null;
|
|
612
|
+
nv._cloudMrPenDraftActive = false;
|
|
613
|
+
}
|
|
614
|
+
setDrawShapeTool(null);
|
|
615
|
+
nv.opts.penType = NI_PEN_TYPE.PEN;
|
|
616
|
+
nv.opts.deferShapeCommit = false;
|
|
617
|
+
nv.opts.deferFreehandCommit = false;
|
|
618
|
+
nv.opts.polylinePenMode = false;
|
|
619
|
+
(_b = nv.cloudMrResetPolyline) === null || _b === void 0 ? void 0 : _b.call(nv);
|
|
620
|
+
nvSetDrawingEnabled(false);
|
|
621
|
+
if (drawPen === 0 || drawPen === 8) {
|
|
622
|
+
setDrawPen(1);
|
|
623
|
+
nv.setPenValue(1, false);
|
|
624
|
+
nv.opts.isFilledPen = false;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
function activateEraser() {
|
|
628
|
+
var _a;
|
|
629
|
+
setDrawShapeTool(null);
|
|
630
|
+
nv.opts.penType = NI_PEN_TYPE.PEN;
|
|
631
|
+
nv.opts.deferShapeCommit = false;
|
|
632
|
+
nv.opts.deferFreehandCommit = false;
|
|
633
|
+
nv.opts.polylinePenMode = false;
|
|
634
|
+
if (shapeDraftRef.current) {
|
|
635
|
+
cancelShapeDraft();
|
|
636
|
+
}
|
|
637
|
+
if (penDraftRef.current) {
|
|
638
|
+
cancelPenDraft(nv, penDraftRef.current);
|
|
639
|
+
(_a = nv.cloudMrResetPolyline) === null || _a === void 0 ? void 0 : _a.call(nv);
|
|
640
|
+
setPolylineVertexCount(0);
|
|
641
|
+
setPenDraft(null);
|
|
642
|
+
penDraftRef.current = null;
|
|
643
|
+
nv._cloudMrPenDraftActive = false;
|
|
644
|
+
}
|
|
645
|
+
nvUpdateDrawPen({ target: { value: 8 } });
|
|
646
|
+
nvSetDrawingEnabled(true);
|
|
647
|
+
}
|
|
600
648
|
function nvUpdateDrawOpacity(a) {
|
|
601
649
|
setDrawOpacity(a);
|
|
602
650
|
nv.setDrawOpacity(a);
|
|
@@ -1470,7 +1518,9 @@ export default function CloudMrNiivueViewer(props) {
|
|
|
1470
1518
|
onFillPenDraft: fillPolylineDraftHandler,
|
|
1471
1519
|
penDraftActive: penDraft != null,
|
|
1472
1520
|
brushSize: brushSize,
|
|
1473
|
-
updateBrushSize: nvUpdateBrushSize
|
|
1521
|
+
updateBrushSize: nvUpdateBrushSize,
|
|
1522
|
+
onActivateEraser: activateEraser,
|
|
1523
|
+
onDeactivateDrawTools: deactivateDrawTools
|
|
1474
1524
|
};
|
|
1475
1525
|
return (_jsxs(Box, __assign({ sx: {
|
|
1476
1526
|
display: 'flex',
|
|
@@ -85,7 +85,17 @@ export function MroDrawToolkit(props) {
|
|
|
85
85
|
? { backgroundColor: "rgba(88, 15, 139, 0.12)", color: "#580f8b" }
|
|
86
86
|
: {};
|
|
87
87
|
};
|
|
88
|
+
var eraserActive = expandedOption === "e";
|
|
89
|
+
function leaveEraserIfActive() {
|
|
90
|
+
var _a;
|
|
91
|
+
if (!eraserActive && props.drawPen !== 0 && props.drawPen !== 8) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
(_a = props.onDeactivateDrawTools) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
95
|
+
setExpandedOption("n");
|
|
96
|
+
}
|
|
88
97
|
function clickPen() {
|
|
98
|
+
leaveEraserIfActive();
|
|
89
99
|
onDrawShapeToolChange === null || onDrawShapeToolChange === void 0 ? void 0 : onDrawShapeToolChange("pen");
|
|
90
100
|
if (expandedOption === "d") {
|
|
91
101
|
setExpandedOption("n");
|
|
@@ -98,6 +108,7 @@ export function MroDrawToolkit(props) {
|
|
|
98
108
|
}
|
|
99
109
|
}
|
|
100
110
|
function clickRectangle() {
|
|
111
|
+
leaveEraserIfActive();
|
|
101
112
|
onDrawShapeToolChange === null || onDrawShapeToolChange === void 0 ? void 0 : onDrawShapeToolChange("rectangle");
|
|
102
113
|
if (expandedOption === "r") {
|
|
103
114
|
setExpandedOption("n");
|
|
@@ -110,6 +121,7 @@ export function MroDrawToolkit(props) {
|
|
|
110
121
|
}
|
|
111
122
|
}
|
|
112
123
|
function clickEllipse() {
|
|
124
|
+
leaveEraserIfActive();
|
|
113
125
|
onDrawShapeToolChange === null || onDrawShapeToolChange === void 0 ? void 0 : onDrawShapeToolChange("ellipse");
|
|
114
126
|
if (expandedOption === "l") {
|
|
115
127
|
setExpandedOption("n");
|
|
@@ -122,16 +134,15 @@ export function MroDrawToolkit(props) {
|
|
|
122
134
|
}
|
|
123
135
|
}
|
|
124
136
|
function clickEraser() {
|
|
125
|
-
var _a;
|
|
137
|
+
var _a, _b;
|
|
126
138
|
if (expandedOption === "e") {
|
|
127
139
|
setExpandedOption("n");
|
|
140
|
+
(_a = props.onDeactivateDrawTools) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
141
|
+
return;
|
|
128
142
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
setExpandedOption("e");
|
|
133
|
-
}
|
|
134
|
-
props.setDrawingEnabled(expandedOption !== "e");
|
|
143
|
+
leaveEraserIfActive();
|
|
144
|
+
(_b = props.onActivateEraser) === null || _b === void 0 ? void 0 : _b.call(props);
|
|
145
|
+
setExpandedOption("e");
|
|
135
146
|
}
|
|
136
147
|
function clickMask() {
|
|
137
148
|
if (expandedOption === "m") {
|
|
@@ -157,8 +168,7 @@ export function MroDrawToolkit(props) {
|
|
|
157
168
|
return;
|
|
158
169
|
setExpandedOption("n");
|
|
159
170
|
setExpandOpacityOptions(false);
|
|
160
|
-
props.
|
|
161
|
-
(_a = props.onExitDrawMode) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
171
|
+
(_a = props.onDeactivateDrawTools) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
162
172
|
} }, { 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: {
|
|
163
173
|
mb: 2,
|
|
164
174
|
borderTopLeftRadius: 0,
|
|
@@ -174,7 +184,9 @@ export function MroDrawToolkit(props) {
|
|
|
174
184
|
alignItems: "center",
|
|
175
185
|
gap: 4,
|
|
176
186
|
overflow: "visible"
|
|
177
|
-
} }, { 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, showPenModes: true, penDrawMode: props.penDrawMode, onPenDrawModeChange: props.onPenDrawModeChange, polylineVertexCount: props.polylineVertexCount, onCancelPolyline: props.onCancelPolyline, penDraftActive: props.penDraftActive, onApplyPenDraft: props.onApplyPenDraft, onCancelPenDraft: props.onCancelPenDraft, onFillPenDraft: props.onFillPenDraft, brushSize: props.brushSize, updateBrushSize: props.updateBrushSize })] })), _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, shapeDraftActive: props.shapeDraftActive && drawShapeTool === "rectangle", onApplyShapeDraft: props.onApplyShapeDraft, onCancelShapeDraft: props.onCancelShapeDraft })] })), _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, shapeDraftActive: props.shapeDraftActive && drawShapeTool === "ellipse", onApplyShapeDraft: props.onApplyShapeDraft, onCancelShapeDraft: props.onCancelShapeDraft })] })), _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:
|
|
187
|
+
} }, { 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, showPenModes: true, penDrawMode: props.penDrawMode, onPenDrawModeChange: props.onPenDrawModeChange, polylineVertexCount: props.polylineVertexCount, onCancelPolyline: props.onCancelPolyline, penDraftActive: props.penDraftActive, onApplyPenDraft: props.onApplyPenDraft, onCancelPenDraft: props.onCancelPenDraft, onFillPenDraft: props.onFillPenDraft, brushSize: props.brushSize, updateBrushSize: props.updateBrushSize })] })), _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, shapeDraftActive: props.shapeDraftActive && drawShapeTool === "rectangle", onApplyShapeDraft: props.onApplyShapeDraft, onCancelShapeDraft: props.onCancelShapeDraft })] })), _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, shapeDraftActive: props.shapeDraftActive && drawShapeTool === "ellipse", onApplyShapeDraft: props.onApplyShapeDraft, onCancelShapeDraft: props.onCancelShapeDraft })] })), _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: __assign(__assign({}, toolBtnSx), (eraserActive
|
|
188
|
+
? { backgroundColor: "rgba(88, 15, 139, 0.12)", color: "#580f8b" }
|
|
189
|
+
: {})) }, { children: filled || !eraserActive ? (_jsx(EraserIcon, {})) : (_jsx(AutoFixNormalOutlinedIcon, { sx: { color: ICON_COLOR } })) })) })), _jsx(EraserPlatte, { expandEraseOptions: expandedOption === "e", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled, brushSize: props.brushSize, updateBrushSize: props.updateBrushSize })] })), _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 () {
|
|
178
190
|
props.nv.clearDrawing();
|
|
179
191
|
props.resampleImage();
|
|
180
192
|
props.setDrawingChanged(false);
|