copper3d 4.1.3 → 4.1.4
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/README.md +9 -1
- package/ai-index/guides/nrrd-tools.md +50 -1
- package/ai-index/guides/segmentation-module.md +44 -1
- package/ai-index/manifest.json +5 -5
- package/ai-index/symbols.json +1 -1
- package/dist/Utils/segmentation/DrawToolCore.d.ts +11 -0
- package/dist/Utils/segmentation/DrawToolCore.js +21 -3
- package/dist/Utils/segmentation/DrawToolCore.js.map +1 -1
- package/dist/Utils/segmentation/NrrdTools.d.ts +17 -1
- package/dist/Utils/segmentation/NrrdTools.js +24 -1
- package/dist/Utils/segmentation/NrrdTools.js.map +1 -1
- package/dist/Utils/segmentation/core/UndoManager.d.ts +18 -0
- package/dist/Utils/segmentation/core/UndoManager.js +19 -3
- package/dist/Utils/segmentation/core/UndoManager.js.map +1 -1
- package/dist/Utils/segmentation/core/index.d.ts +2 -2
- package/dist/Utils/segmentation/core/index.js +1 -1
- package/dist/Utils/segmentation/core/index.js.map +1 -1
- package/dist/bundle.esm.mjs +66 -9
- package/dist/bundle.umd.js +66 -9
- package/dist/index.d.ts +2 -2
- package/dist/types/Utils/segmentation/DrawToolCore.d.ts +11 -0
- package/dist/types/Utils/segmentation/NrrdTools.d.ts +17 -1
- package/dist/types/Utils/segmentation/core/UndoManager.d.ts +18 -0
- package/dist/types/Utils/segmentation/core/index.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -33,6 +33,17 @@ export interface VolumeSnapshot {
|
|
|
33
33
|
}
|
|
34
34
|
/** A slice-delta group or a whole-volume snapshot. `Array.isArray` discriminates. */
|
|
35
35
|
export type UndoEntry = MaskDelta[] | VolumeSnapshot;
|
|
36
|
+
/**
|
|
37
|
+
* One channel clear, as `NrrdTools.clearChannel` returns it, for `NrrdTools.undoChannelClear`.
|
|
38
|
+
* `entry` is the undo entry the clear pushed and is compared by identity.
|
|
39
|
+
*/
|
|
40
|
+
export interface ChannelClear {
|
|
41
|
+
readonly layerId: string;
|
|
42
|
+
readonly channel: number;
|
|
43
|
+
readonly entry: UndoEntry;
|
|
44
|
+
}
|
|
45
|
+
/** The layer an entry belongs to. */
|
|
46
|
+
export declare function entryLayer(entry: UndoEntry): string | undefined;
|
|
36
47
|
export declare class UndoManager {
|
|
37
48
|
private undoStacks;
|
|
38
49
|
private redoStacks;
|
|
@@ -67,6 +78,13 @@ export declare class UndoManager {
|
|
|
67
78
|
* @returns The delta(s) that were undone, or undefined if nothing to undo.
|
|
68
79
|
*/
|
|
69
80
|
undo(): UndoEntry | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Undo the last operation on `layerId`, whichever layer is active. The entry moves to that
|
|
83
|
+
* layer's redo stack, exactly as `undo` does for the active one.
|
|
84
|
+
*/
|
|
85
|
+
undoOn(layerId: string): UndoEntry | undefined;
|
|
86
|
+
/** The entry an undo on `layerId` would take next, left in place. */
|
|
87
|
+
peek(layerId: string): UndoEntry | undefined;
|
|
70
88
|
/**
|
|
71
89
|
* Redo the last undone operation on the active layer.
|
|
72
90
|
* @returns The delta(s) that were redone, or undefined if nothing to redo.
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
* - maxStackSize: 50 entries per layer.
|
|
11
11
|
* - Undo/redo operations also trigger backend sync via getMask callback.
|
|
12
12
|
*/
|
|
13
|
+
/** The layer an entry belongs to. */
|
|
14
|
+
export function entryLayer(entry) {
|
|
15
|
+
var _a;
|
|
16
|
+
return Array.isArray(entry) ? (_a = entry[0]) === null || _a === void 0 ? void 0 : _a.layerId : entry.layerId;
|
|
17
|
+
}
|
|
13
18
|
const MAX_STACK_SIZE = 50;
|
|
14
19
|
export class UndoManager {
|
|
15
20
|
constructor() {
|
|
@@ -82,13 +87,24 @@ export class UndoManager {
|
|
|
82
87
|
* @returns The delta(s) that were undone, or undefined if nothing to undo.
|
|
83
88
|
*/
|
|
84
89
|
undo() {
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
return this.undoOn(this.activeLayer);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Undo the last operation on `layerId`, whichever layer is active. The entry moves to that
|
|
94
|
+
* layer's redo stack, exactly as `undo` does for the active one.
|
|
95
|
+
*/
|
|
96
|
+
undoOn(layerId) {
|
|
97
|
+
const entry = this.stackFor(this.undoStacks, layerId).pop();
|
|
87
98
|
if (entry) {
|
|
88
|
-
this.stackFor(this.redoStacks,
|
|
99
|
+
this.stackFor(this.redoStacks, layerId).push(entry);
|
|
89
100
|
}
|
|
90
101
|
return entry;
|
|
91
102
|
}
|
|
103
|
+
/** The entry an undo on `layerId` would take next, left in place. */
|
|
104
|
+
peek(layerId) {
|
|
105
|
+
const stack = this.undoStacks.get(layerId);
|
|
106
|
+
return stack === null || stack === void 0 ? void 0 : stack[stack.length - 1];
|
|
107
|
+
}
|
|
92
108
|
/**
|
|
93
109
|
* Redo the last undone operation on the active layer.
|
|
94
110
|
* @returns The delta(s) that were redone, or undefined if nothing to redo.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UndoManager.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/core/UndoManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"UndoManager.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/core/UndoManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAsCH,qCAAqC;AACrC,MAAM,UAAU,UAAU,CAAC,KAAgB;;IACzC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAA,KAAK,CAAC,CAAC,CAAC,0CAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;AAClE,CAAC;AAED,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,MAAM,OAAO,WAAW;IAAxB;QACU,eAAU,GAAG,IAAI,GAAG,EAAuB,CAAC;QAC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AAM,GAAG,CAAC,CAAC;QAC/D,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;YAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACjE,CAAC;CACF"}
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
export type { Dimensions, RGBAColor, ChannelColorMap, SliceRenderOptions, LayerId, ChannelValue, ICommXYZ, ICommXY, ISkipSlicesDictType, ToolMode, IDragPrameters, IDrawingEvents, IContrastEvents, IPaintImages, IPaintImage, ILayerRenderTarget, IDownloadImageConfig, INewMaskData, IMaskData, IProtected, IToolModeState, IDrawingConfig, IViewConfig, ILayerChannelState, IGUIStates, IGuiMeta, IGuiParameterSettings, IImageMetadata, IViewState, IInteractionState, ISphereState, IInternalFlags, INrrdStates, IAnnotationCallbacks, IMaskHistoryChange, IConvertObjType, ICursorPage, IDragOpts, IDrawOpts, IKeyBoardSettings, MaskRenderMode, } from './types';
|
|
71
71
|
export { RenderMode, MAX_ENGINE_CHANNEL, MASK_CHANNEL_COLORS, MASK_CHANNEL_CSS_COLORS, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, } from './types';
|
|
72
72
|
export { MaskVolume } from './MaskVolume';
|
|
73
|
-
export type { MaskDelta, UndoEntry } from './UndoManager';
|
|
74
|
-
export { UndoManager } from './UndoManager';
|
|
73
|
+
export type { MaskDelta, UndoEntry, ChannelClear } from './UndoManager';
|
|
74
|
+
export { UndoManager, entryLayer } from './UndoManager';
|
|
75
75
|
export type { ContourBBox, ContourPolygon } from './MarchingSquares';
|
|
76
76
|
export { extractLabelBoundarySegments, extractLabelContours, extractLabelOutline, extractLabelPolygons, findLabelsInSlice, } from './MarchingSquares';
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
export { RenderMode, MAX_ENGINE_CHANNEL, MASK_CHANNEL_COLORS, MASK_CHANNEL_CSS_COLORS, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, } from './types';
|
|
71
71
|
// ── Core volume ────────────────────────────────────────────────────────────
|
|
72
72
|
export { MaskVolume } from './MaskVolume';
|
|
73
|
-
export { UndoManager } from './UndoManager';
|
|
73
|
+
export { UndoManager, entryLayer } from './UndoManager';
|
|
74
74
|
export { extractLabelBoundarySegments, extractLabelContours, extractLabelOutline, extractLabelPolygons, findLabelsInSlice, } from './MarchingSquares';
|
|
75
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAgDH,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,SAAS,EACT,SAAS,GACV,MAAM,SAAS,CAAC;AAEjB,8EAA8E;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAgDH,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,SAAS,EACT,SAAS,GACV,MAAM,SAAS,CAAC;AAEjB,8EAA8E;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIxD,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC"}
|
package/dist/bundle.esm.mjs
CHANGED
|
@@ -11231,6 +11231,11 @@ class MaskVolume {
|
|
|
11231
11231
|
* - maxStackSize: 50 entries per layer.
|
|
11232
11232
|
* - Undo/redo operations also trigger backend sync via getMask callback.
|
|
11233
11233
|
*/
|
|
11234
|
+
/** The layer an entry belongs to. */
|
|
11235
|
+
function entryLayer(entry) {
|
|
11236
|
+
var _a;
|
|
11237
|
+
return Array.isArray(entry) ? (_a = entry[0]) === null || _a === void 0 ? void 0 : _a.layerId : entry.layerId;
|
|
11238
|
+
}
|
|
11234
11239
|
const MAX_STACK_SIZE = 50;
|
|
11235
11240
|
class UndoManager {
|
|
11236
11241
|
constructor() {
|
|
@@ -11303,13 +11308,24 @@ class UndoManager {
|
|
|
11303
11308
|
* @returns The delta(s) that were undone, or undefined if nothing to undo.
|
|
11304
11309
|
*/
|
|
11305
11310
|
undo() {
|
|
11306
|
-
|
|
11307
|
-
|
|
11311
|
+
return this.undoOn(this.activeLayer);
|
|
11312
|
+
}
|
|
11313
|
+
/**
|
|
11314
|
+
* Undo the last operation on `layerId`, whichever layer is active. The entry moves to that
|
|
11315
|
+
* layer's redo stack, exactly as `undo` does for the active one.
|
|
11316
|
+
*/
|
|
11317
|
+
undoOn(layerId) {
|
|
11318
|
+
const entry = this.stackFor(this.undoStacks, layerId).pop();
|
|
11308
11319
|
if (entry) {
|
|
11309
|
-
this.stackFor(this.redoStacks,
|
|
11320
|
+
this.stackFor(this.redoStacks, layerId).push(entry);
|
|
11310
11321
|
}
|
|
11311
11322
|
return entry;
|
|
11312
11323
|
}
|
|
11324
|
+
/** The entry an undo on `layerId` would take next, left in place. */
|
|
11325
|
+
peek(layerId) {
|
|
11326
|
+
const stack = this.undoStacks.get(layerId);
|
|
11327
|
+
return stack === null || stack === void 0 ? void 0 : stack[stack.length - 1];
|
|
11328
|
+
}
|
|
11313
11329
|
/**
|
|
11314
11330
|
* Redo the last undone operation on the active layer.
|
|
11315
11331
|
* @returns The delta(s) that were redone, or undefined if nothing to redo.
|
|
@@ -17610,8 +17626,26 @@ class DrawToolCore {
|
|
|
17610
17626
|
*/
|
|
17611
17627
|
undoLastPainting() {
|
|
17612
17628
|
const entry = this.undoManager.undo();
|
|
17613
|
-
if (
|
|
17614
|
-
|
|
17629
|
+
if (entry)
|
|
17630
|
+
this.applyUndo(entry);
|
|
17631
|
+
}
|
|
17632
|
+
/**
|
|
17633
|
+
* Undo `entry` on its own layer if it is still that layer's latest operation, whichever
|
|
17634
|
+
* layer is active; otherwise change nothing.
|
|
17635
|
+
*
|
|
17636
|
+
* @returns Whether it was undone. False when a later operation is stacked on top of it, or
|
|
17637
|
+
* when it has already been undone.
|
|
17638
|
+
*/
|
|
17639
|
+
undoEntry(entry) {
|
|
17640
|
+
const layerId = entryLayer(entry);
|
|
17641
|
+
if (layerId === undefined || this.undoManager.peek(layerId) !== entry)
|
|
17642
|
+
return false;
|
|
17643
|
+
this.undoManager.undoOn(layerId);
|
|
17644
|
+
this.applyUndo(entry);
|
|
17645
|
+
return true;
|
|
17646
|
+
}
|
|
17647
|
+
/** Write an entry's "before" state back into its volume, repaint, and report the change. */
|
|
17648
|
+
applyUndo(entry) {
|
|
17615
17649
|
this.state.protectedData.isDrawing = true;
|
|
17616
17650
|
if (!Array.isArray(entry)) {
|
|
17617
17651
|
// VolumeSnapshot: restore the pre-replacement volume in one step.
|
|
@@ -19891,6 +19925,7 @@ class NrrdTools {
|
|
|
19891
19925
|
*
|
|
19892
19926
|
* @param layerId Layer whose mask to edit.
|
|
19893
19927
|
* @param channel Label to erase, 1-255.
|
|
19928
|
+
* @returns The clear, for `undoChannelClear`; null when the channel held nothing.
|
|
19894
19929
|
* @throws {Error} If `layerId` names no layer. Deliberately NOT routed through
|
|
19895
19930
|
* `getVolumeForLayer`, which warns and falls back to the first layer — for a
|
|
19896
19931
|
* destructive call that would quietly erase a different layer's annotation.
|
|
@@ -19918,7 +19953,7 @@ class NrrdTools {
|
|
|
19918
19953
|
});
|
|
19919
19954
|
}
|
|
19920
19955
|
if (deltas.length === 0)
|
|
19921
|
-
return; // nothing drawn on this channel
|
|
19956
|
+
return null; // nothing drawn on this channel
|
|
19922
19957
|
volume.clearChannel(channel);
|
|
19923
19958
|
for (const delta of deltas) {
|
|
19924
19959
|
delta.newSlice = volume.getSliceUint8(delta.sliceIndex, "z").data.slice();
|
|
@@ -19929,6 +19964,28 @@ class NrrdTools {
|
|
|
19929
19964
|
this.state.annotationCallbacks.onMaskChanged(data, layerId, channel, delta.sliceIndex, "z", width, height, false);
|
|
19930
19965
|
}
|
|
19931
19966
|
this.reloadMasksFromVolume();
|
|
19967
|
+
return { layerId, channel, entry: deltas };
|
|
19968
|
+
}
|
|
19969
|
+
/**
|
|
19970
|
+
* Undo one `clearChannel`, on its own layer, whatever layer is active now.
|
|
19971
|
+
*
|
|
19972
|
+
* `undo()` acts on the active layer's latest operation, and by the time a caller offers to
|
|
19973
|
+
* reverse a clear the active layer may have changed. This names the clear instead, and
|
|
19974
|
+
* reverses it only while it is still the latest operation on its layer: a later edit there is
|
|
19975
|
+
* newer work, never undone in passing -- `undo()` steps back through it in order.
|
|
19976
|
+
*
|
|
19977
|
+
* Reported through `onMaskChanged` with the channels it restored, exactly as `undo()` reports.
|
|
19978
|
+
*
|
|
19979
|
+
* @returns Whether the clear was undone. False when a later operation is stacked on it, or
|
|
19980
|
+
* it has already been undone.
|
|
19981
|
+
*/
|
|
19982
|
+
undoChannelClear(clear) {
|
|
19983
|
+
if (!this.drawCore.undoEntry(clear.entry))
|
|
19984
|
+
return false;
|
|
19985
|
+
// `undo()` repaints only the slice on screen when it lies on the clear's axis; a clear
|
|
19986
|
+
// spans every slice of the label, so repaint them all, as the clear itself does.
|
|
19987
|
+
this.reloadMasksFromVolume();
|
|
19988
|
+
return true;
|
|
19932
19989
|
}
|
|
19933
19990
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
19934
19991
|
// 4. Public API — Keyboard & History
|
|
@@ -22134,15 +22191,15 @@ function checkThreeRevision(built, loaded) {
|
|
|
22134
22191
|
}
|
|
22135
22192
|
|
|
22136
22193
|
// import * as kiwrious from "copper3d_plugin_heart_k";
|
|
22137
|
-
// "v4.1.
|
|
22194
|
+
// "v4.1.4" is injected at build time by rollup @rollup/plugin-replace, sourced from package.json version.
|
|
22138
22195
|
// When copper3d is consumed from local source (no rollup replace step), the identifier is undefined and
|
|
22139
22196
|
// referencing it throws a ReferenceError — guard it so local loading still works.
|
|
22140
22197
|
let _revision = "unknown";
|
|
22141
22198
|
try {
|
|
22142
|
-
_revision = "v4.1.
|
|
22199
|
+
_revision = "v4.1.4";
|
|
22143
22200
|
}
|
|
22144
22201
|
catch (_a) {
|
|
22145
|
-
/* "v4.1.
|
|
22202
|
+
/* "v4.1.4" not injected (local source build) */
|
|
22146
22203
|
}
|
|
22147
22204
|
const REVISION = _revision;
|
|
22148
22205
|
// "186" is three's revision at build time, injected the same way.
|
package/dist/bundle.umd.js
CHANGED
|
@@ -11240,6 +11240,11 @@
|
|
|
11240
11240
|
* - maxStackSize: 50 entries per layer.
|
|
11241
11241
|
* - Undo/redo operations also trigger backend sync via getMask callback.
|
|
11242
11242
|
*/
|
|
11243
|
+
/** The layer an entry belongs to. */
|
|
11244
|
+
function entryLayer(entry) {
|
|
11245
|
+
var _a;
|
|
11246
|
+
return Array.isArray(entry) ? (_a = entry[0]) === null || _a === void 0 ? void 0 : _a.layerId : entry.layerId;
|
|
11247
|
+
}
|
|
11243
11248
|
const MAX_STACK_SIZE = 50;
|
|
11244
11249
|
class UndoManager {
|
|
11245
11250
|
constructor() {
|
|
@@ -11312,13 +11317,24 @@
|
|
|
11312
11317
|
* @returns The delta(s) that were undone, or undefined if nothing to undo.
|
|
11313
11318
|
*/
|
|
11314
11319
|
undo() {
|
|
11315
|
-
|
|
11316
|
-
|
|
11320
|
+
return this.undoOn(this.activeLayer);
|
|
11321
|
+
}
|
|
11322
|
+
/**
|
|
11323
|
+
* Undo the last operation on `layerId`, whichever layer is active. The entry moves to that
|
|
11324
|
+
* layer's redo stack, exactly as `undo` does for the active one.
|
|
11325
|
+
*/
|
|
11326
|
+
undoOn(layerId) {
|
|
11327
|
+
const entry = this.stackFor(this.undoStacks, layerId).pop();
|
|
11317
11328
|
if (entry) {
|
|
11318
|
-
this.stackFor(this.redoStacks,
|
|
11329
|
+
this.stackFor(this.redoStacks, layerId).push(entry);
|
|
11319
11330
|
}
|
|
11320
11331
|
return entry;
|
|
11321
11332
|
}
|
|
11333
|
+
/** The entry an undo on `layerId` would take next, left in place. */
|
|
11334
|
+
peek(layerId) {
|
|
11335
|
+
const stack = this.undoStacks.get(layerId);
|
|
11336
|
+
return stack === null || stack === void 0 ? void 0 : stack[stack.length - 1];
|
|
11337
|
+
}
|
|
11322
11338
|
/**
|
|
11323
11339
|
* Redo the last undone operation on the active layer.
|
|
11324
11340
|
* @returns The delta(s) that were redone, or undefined if nothing to redo.
|
|
@@ -17619,8 +17635,26 @@
|
|
|
17619
17635
|
*/
|
|
17620
17636
|
undoLastPainting() {
|
|
17621
17637
|
const entry = this.undoManager.undo();
|
|
17622
|
-
if (
|
|
17623
|
-
|
|
17638
|
+
if (entry)
|
|
17639
|
+
this.applyUndo(entry);
|
|
17640
|
+
}
|
|
17641
|
+
/**
|
|
17642
|
+
* Undo `entry` on its own layer if it is still that layer's latest operation, whichever
|
|
17643
|
+
* layer is active; otherwise change nothing.
|
|
17644
|
+
*
|
|
17645
|
+
* @returns Whether it was undone. False when a later operation is stacked on top of it, or
|
|
17646
|
+
* when it has already been undone.
|
|
17647
|
+
*/
|
|
17648
|
+
undoEntry(entry) {
|
|
17649
|
+
const layerId = entryLayer(entry);
|
|
17650
|
+
if (layerId === undefined || this.undoManager.peek(layerId) !== entry)
|
|
17651
|
+
return false;
|
|
17652
|
+
this.undoManager.undoOn(layerId);
|
|
17653
|
+
this.applyUndo(entry);
|
|
17654
|
+
return true;
|
|
17655
|
+
}
|
|
17656
|
+
/** Write an entry's "before" state back into its volume, repaint, and report the change. */
|
|
17657
|
+
applyUndo(entry) {
|
|
17624
17658
|
this.state.protectedData.isDrawing = true;
|
|
17625
17659
|
if (!Array.isArray(entry)) {
|
|
17626
17660
|
// VolumeSnapshot: restore the pre-replacement volume in one step.
|
|
@@ -19900,6 +19934,7 @@
|
|
|
19900
19934
|
*
|
|
19901
19935
|
* @param layerId Layer whose mask to edit.
|
|
19902
19936
|
* @param channel Label to erase, 1-255.
|
|
19937
|
+
* @returns The clear, for `undoChannelClear`; null when the channel held nothing.
|
|
19903
19938
|
* @throws {Error} If `layerId` names no layer. Deliberately NOT routed through
|
|
19904
19939
|
* `getVolumeForLayer`, which warns and falls back to the first layer — for a
|
|
19905
19940
|
* destructive call that would quietly erase a different layer's annotation.
|
|
@@ -19927,7 +19962,7 @@
|
|
|
19927
19962
|
});
|
|
19928
19963
|
}
|
|
19929
19964
|
if (deltas.length === 0)
|
|
19930
|
-
return; // nothing drawn on this channel
|
|
19965
|
+
return null; // nothing drawn on this channel
|
|
19931
19966
|
volume.clearChannel(channel);
|
|
19932
19967
|
for (const delta of deltas) {
|
|
19933
19968
|
delta.newSlice = volume.getSliceUint8(delta.sliceIndex, "z").data.slice();
|
|
@@ -19938,6 +19973,28 @@
|
|
|
19938
19973
|
this.state.annotationCallbacks.onMaskChanged(data, layerId, channel, delta.sliceIndex, "z", width, height, false);
|
|
19939
19974
|
}
|
|
19940
19975
|
this.reloadMasksFromVolume();
|
|
19976
|
+
return { layerId, channel, entry: deltas };
|
|
19977
|
+
}
|
|
19978
|
+
/**
|
|
19979
|
+
* Undo one `clearChannel`, on its own layer, whatever layer is active now.
|
|
19980
|
+
*
|
|
19981
|
+
* `undo()` acts on the active layer's latest operation, and by the time a caller offers to
|
|
19982
|
+
* reverse a clear the active layer may have changed. This names the clear instead, and
|
|
19983
|
+
* reverses it only while it is still the latest operation on its layer: a later edit there is
|
|
19984
|
+
* newer work, never undone in passing -- `undo()` steps back through it in order.
|
|
19985
|
+
*
|
|
19986
|
+
* Reported through `onMaskChanged` with the channels it restored, exactly as `undo()` reports.
|
|
19987
|
+
*
|
|
19988
|
+
* @returns Whether the clear was undone. False when a later operation is stacked on it, or
|
|
19989
|
+
* it has already been undone.
|
|
19990
|
+
*/
|
|
19991
|
+
undoChannelClear(clear) {
|
|
19992
|
+
if (!this.drawCore.undoEntry(clear.entry))
|
|
19993
|
+
return false;
|
|
19994
|
+
// `undo()` repaints only the slice on screen when it lies on the clear's axis; a clear
|
|
19995
|
+
// spans every slice of the label, so repaint them all, as the clear itself does.
|
|
19996
|
+
this.reloadMasksFromVolume();
|
|
19997
|
+
return true;
|
|
19941
19998
|
}
|
|
19942
19999
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
19943
20000
|
// 4. Public API — Keyboard & History
|
|
@@ -22143,15 +22200,15 @@
|
|
|
22143
22200
|
}
|
|
22144
22201
|
|
|
22145
22202
|
// import * as kiwrious from "copper3d_plugin_heart_k";
|
|
22146
|
-
// "v4.1.
|
|
22203
|
+
// "v4.1.4" is injected at build time by rollup @rollup/plugin-replace, sourced from package.json version.
|
|
22147
22204
|
// When copper3d is consumed from local source (no rollup replace step), the identifier is undefined and
|
|
22148
22205
|
// referencing it throws a ReferenceError — guard it so local loading still works.
|
|
22149
22206
|
let _revision = "unknown";
|
|
22150
22207
|
try {
|
|
22151
|
-
_revision = "v4.1.
|
|
22208
|
+
_revision = "v4.1.4";
|
|
22152
22209
|
}
|
|
22153
22210
|
catch (_a) {
|
|
22154
|
-
/* "v4.1.
|
|
22211
|
+
/* "v4.1.4" not injected (local source build) */
|
|
22155
22212
|
}
|
|
22156
22213
|
const REVISION = _revision;
|
|
22157
22214
|
// "186" is three's revision at build time, injected the same way.
|
package/dist/index.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ import { NrrdState } from "./Utils/segmentation/coreTools/NrrdState";
|
|
|
58
58
|
import { GuiState } from "./Utils/segmentation/coreTools/GuiState";
|
|
59
59
|
import type { ToolMode, IAnnotationCallbacks, IMaskHistoryChange, MaskRenderMode } from "./Utils/segmentation/core/types";
|
|
60
60
|
import { CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss } from "./Utils/segmentation/core/index";
|
|
61
|
-
import type { LayerId, ChannelValue } from "./Utils/segmentation/core/index";
|
|
61
|
+
import type { LayerId, ChannelValue, ChannelClear } from "./Utils/segmentation/core/index";
|
|
62
62
|
import { MAX_ENGINE_CHANNEL } from "./Utils/segmentation/core/index";
|
|
63
63
|
import type { AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult } from "./Utils/segmentation/tools/AiAssistTool";
|
|
64
64
|
import { OrientationError, canonicalTransform, geometryFromNrrd, readNrrdOrientationFields, reorientVoxels, reorientedGeometry, viewLabels } from "./Utils/orientation";
|
|
@@ -66,5 +66,5 @@ import type { NrrdOrientationFields, OrientationErrorCode, OrientationTransform,
|
|
|
66
66
|
import "./css/style.css";
|
|
67
67
|
export declare const REVISION: string;
|
|
68
68
|
export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, loadKiwrious, NrrdTools, registerNiftiMaskGrid, loading, Copper3dTrackballControls, Copper3dOrbitControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, MAX_ENGINE_CHANNEL, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, GaussianSmoother, SurfaceAnnotator, exposureExponent, DEFAULT_TARGET_GREY, disposeObject3D, disposeMaterial, collectFadeTargets, setFade, restoreFade, createSceneBudget, defaultBudgetBytes, disposeScene, removeSceneFromMap, fitDistance, fitView, isRotateEnabled, setRotateEnabled, isPanEnabled, setPanEnabled, isZoomEnabled, setZoomEnabled, beginGesture, isGestureActive, setCameraPose, addVolumeBoundingBox, VOLUME_BOUNDS_NAME, rasDimensions, DEFAULT_AXES, ensureAxisExtracted, prepareVolumeSlices, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, OrientationError, canonicalTransform, geometryFromNrrd, readNrrdOrientationFields, reorientVoxels, reorientedGeometry, viewLabels, };
|
|
69
|
-
export type { positionType, screenPosType, optsType, NrrdHeaderLike, GltfLoadOpts, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, aligned4DSurfaceType, aligned4DOptsType, Aligned4DController, raw4DVolumeTransformType, raw4DVolumeOptsType, Raw4DVolumeController, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, NrrdState, GuiState, IGuiMeta, ToolMode, IAnnotationCallbacks, IMaskHistoryChange, MaskRenderMode, LayerId, ChannelValue, AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult, SurfaceAnnotatorOptions, Annotation, AnnotationMode, ExportOptions, ExposureVolume, DisposableObject3D, DisposableMaterial, FadeTarget, FadeableMaterial, SceneBudget, DisposableScene, SceneDisposalHost, FitBounds, FitViewScene, AxisGatedControls, GestureAxes, PosableScene, BoundingBoxHost, VolumeBoundingBoxOpts, NrrdAxis, Pose, NrrdOrientationFields, OrientationErrorCode, OrientationTransform, ViewAxis, ViewLabels, VolumeGeometry, VolumeOrientation, };
|
|
69
|
+
export type { positionType, screenPosType, optsType, NrrdHeaderLike, GltfLoadOpts, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, aligned4DSurfaceType, aligned4DOptsType, Aligned4DController, raw4DVolumeTransformType, raw4DVolumeOptsType, Raw4DVolumeController, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, NrrdState, GuiState, IGuiMeta, ToolMode, IAnnotationCallbacks, IMaskHistoryChange, MaskRenderMode, LayerId, ChannelValue, ChannelClear, AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult, SurfaceAnnotatorOptions, Annotation, AnnotationMode, ExportOptions, ExposureVolume, DisposableObject3D, DisposableMaterial, FadeTarget, FadeableMaterial, SceneBudget, DisposableScene, SceneDisposalHost, FitBounds, FitViewScene, AxisGatedControls, GestureAxes, PosableScene, BoundingBoxHost, VolumeBoundingBoxOpts, NrrdAxis, Pose, NrrdOrientationFields, OrientationErrorCode, OrientationTransform, ViewAxis, ViewLabels, VolumeGeometry, VolumeOrientation, };
|
|
70
70
|
export type { CameraViewPreset } from "./Controls/orbitFraming";
|
|
@@ -13,6 +13,7 @@ import { ImageStoreHelper } from "./tools/ImageStoreHelper";
|
|
|
13
13
|
import { SphereBrushTool } from "./tools/SphereBrushTool";
|
|
14
14
|
import { AiAssistTool } from "./tools/AiAssistTool";
|
|
15
15
|
import { UndoManager } from "./core";
|
|
16
|
+
import type { UndoEntry } from "./core";
|
|
16
17
|
/**
|
|
17
18
|
* DrawToolCore — Tool orchestration and event routing.
|
|
18
19
|
*
|
|
@@ -188,6 +189,16 @@ export declare class DrawToolCore {
|
|
|
188
189
|
* Undo the last drawing operation on the active layer.
|
|
189
190
|
*/
|
|
190
191
|
undoLastPainting(): void;
|
|
192
|
+
/**
|
|
193
|
+
* Undo `entry` on its own layer if it is still that layer's latest operation, whichever
|
|
194
|
+
* layer is active; otherwise change nothing.
|
|
195
|
+
*
|
|
196
|
+
* @returns Whether it was undone. False when a later operation is stacked on top of it, or
|
|
197
|
+
* when it has already been undone.
|
|
198
|
+
*/
|
|
199
|
+
undoEntry(entry: UndoEntry): boolean;
|
|
200
|
+
/** Write an entry's "before" state back into its volume, repaint, and report the change. */
|
|
201
|
+
private applyUndo;
|
|
191
202
|
/**
|
|
192
203
|
* Redo the last undone operation on the active layer.
|
|
193
204
|
*/
|
|
@@ -2,6 +2,7 @@ import { nrrdSliceType, storeExportPaintImageType, loadingBarType } from "../../
|
|
|
2
2
|
import { GUI } from "dat.gui";
|
|
3
3
|
import { IMaskData, IDragOpts, IKeyBoardSettings, ToolMode, IGuiMeta, MaskRenderMode } from "./core/types";
|
|
4
4
|
import { DragOperator } from "./DragOperator";
|
|
5
|
+
import type { ChannelClear } from "./core/UndoManager";
|
|
5
6
|
import type { ChannelValue, RGBAColor, ChannelColorMap } from "./core";
|
|
6
7
|
import type { SphereType } from "./tools/SphereTool";
|
|
7
8
|
import type { AiPromptTool, AiPromptPayload, AiMaskResult } from "./tools/AiAssistTool";
|
|
@@ -129,12 +130,27 @@ export declare class NrrdTools {
|
|
|
129
130
|
*
|
|
130
131
|
* @param layerId Layer whose mask to edit.
|
|
131
132
|
* @param channel Label to erase, 1-255.
|
|
133
|
+
* @returns The clear, for `undoChannelClear`; null when the channel held nothing.
|
|
132
134
|
* @throws {Error} If `layerId` names no layer. Deliberately NOT routed through
|
|
133
135
|
* `getVolumeForLayer`, which warns and falls back to the first layer — for a
|
|
134
136
|
* destructive call that would quietly erase a different layer's annotation.
|
|
135
137
|
* @throws {RangeError} If `channel` is outside [1, 255] (from `MaskVolume`).
|
|
136
138
|
*/
|
|
137
|
-
clearChannel(layerId: string, channel: number):
|
|
139
|
+
clearChannel(layerId: string, channel: number): ChannelClear | null;
|
|
140
|
+
/**
|
|
141
|
+
* Undo one `clearChannel`, on its own layer, whatever layer is active now.
|
|
142
|
+
*
|
|
143
|
+
* `undo()` acts on the active layer's latest operation, and by the time a caller offers to
|
|
144
|
+
* reverse a clear the active layer may have changed. This names the clear instead, and
|
|
145
|
+
* reverses it only while it is still the latest operation on its layer: a later edit there is
|
|
146
|
+
* newer work, never undone in passing -- `undo()` steps back through it in order.
|
|
147
|
+
*
|
|
148
|
+
* Reported through `onMaskChanged` with the channels it restored, exactly as `undo()` reports.
|
|
149
|
+
*
|
|
150
|
+
* @returns Whether the clear was undone. False when a later operation is stacked on it, or
|
|
151
|
+
* it has already been undone.
|
|
152
|
+
*/
|
|
153
|
+
undoChannelClear(clear: ChannelClear): boolean;
|
|
138
154
|
undo(): void;
|
|
139
155
|
redo(): void;
|
|
140
156
|
enterKeyboardConfig(): void;
|
|
@@ -33,6 +33,17 @@ export interface VolumeSnapshot {
|
|
|
33
33
|
}
|
|
34
34
|
/** A slice-delta group or a whole-volume snapshot. `Array.isArray` discriminates. */
|
|
35
35
|
export type UndoEntry = MaskDelta[] | VolumeSnapshot;
|
|
36
|
+
/**
|
|
37
|
+
* One channel clear, as `NrrdTools.clearChannel` returns it, for `NrrdTools.undoChannelClear`.
|
|
38
|
+
* `entry` is the undo entry the clear pushed and is compared by identity.
|
|
39
|
+
*/
|
|
40
|
+
export interface ChannelClear {
|
|
41
|
+
readonly layerId: string;
|
|
42
|
+
readonly channel: number;
|
|
43
|
+
readonly entry: UndoEntry;
|
|
44
|
+
}
|
|
45
|
+
/** The layer an entry belongs to. */
|
|
46
|
+
export declare function entryLayer(entry: UndoEntry): string | undefined;
|
|
36
47
|
export declare class UndoManager {
|
|
37
48
|
private undoStacks;
|
|
38
49
|
private redoStacks;
|
|
@@ -67,6 +78,13 @@ export declare class UndoManager {
|
|
|
67
78
|
* @returns The delta(s) that were undone, or undefined if nothing to undo.
|
|
68
79
|
*/
|
|
69
80
|
undo(): UndoEntry | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Undo the last operation on `layerId`, whichever layer is active. The entry moves to that
|
|
83
|
+
* layer's redo stack, exactly as `undo` does for the active one.
|
|
84
|
+
*/
|
|
85
|
+
undoOn(layerId: string): UndoEntry | undefined;
|
|
86
|
+
/** The entry an undo on `layerId` would take next, left in place. */
|
|
87
|
+
peek(layerId: string): UndoEntry | undefined;
|
|
70
88
|
/**
|
|
71
89
|
* Redo the last undone operation on the active layer.
|
|
72
90
|
* @returns The delta(s) that were redone, or undefined if nothing to redo.
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
export type { Dimensions, RGBAColor, ChannelColorMap, SliceRenderOptions, LayerId, ChannelValue, ICommXYZ, ICommXY, ISkipSlicesDictType, ToolMode, IDragPrameters, IDrawingEvents, IContrastEvents, IPaintImages, IPaintImage, ILayerRenderTarget, IDownloadImageConfig, INewMaskData, IMaskData, IProtected, IToolModeState, IDrawingConfig, IViewConfig, ILayerChannelState, IGUIStates, IGuiMeta, IGuiParameterSettings, IImageMetadata, IViewState, IInteractionState, ISphereState, IInternalFlags, INrrdStates, IAnnotationCallbacks, IMaskHistoryChange, IConvertObjType, ICursorPage, IDragOpts, IDrawOpts, IKeyBoardSettings, MaskRenderMode, } from './types';
|
|
71
71
|
export { RenderMode, MAX_ENGINE_CHANNEL, MASK_CHANNEL_COLORS, MASK_CHANNEL_CSS_COLORS, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, } from './types';
|
|
72
72
|
export { MaskVolume } from './MaskVolume';
|
|
73
|
-
export type { MaskDelta, UndoEntry } from './UndoManager';
|
|
74
|
-
export { UndoManager } from './UndoManager';
|
|
73
|
+
export type { MaskDelta, UndoEntry, ChannelClear } from './UndoManager';
|
|
74
|
+
export { UndoManager, entryLayer } from './UndoManager';
|
|
75
75
|
export type { ContourBBox, ContourPolygon } from './MarchingSquares';
|
|
76
76
|
export { extractLabelBoundarySegments, extractLabelContours, extractLabelOutline, extractLabelPolygons, findLabelsInSlice, } from './MarchingSquares';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ import { NrrdState } from "./Utils/segmentation/coreTools/NrrdState";
|
|
|
58
58
|
import { GuiState } from "./Utils/segmentation/coreTools/GuiState";
|
|
59
59
|
import type { ToolMode, IAnnotationCallbacks, IMaskHistoryChange, MaskRenderMode } from "./Utils/segmentation/core/types";
|
|
60
60
|
import { CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss } from "./Utils/segmentation/core/index";
|
|
61
|
-
import type { LayerId, ChannelValue } from "./Utils/segmentation/core/index";
|
|
61
|
+
import type { LayerId, ChannelValue, ChannelClear } from "./Utils/segmentation/core/index";
|
|
62
62
|
import { MAX_ENGINE_CHANNEL } from "./Utils/segmentation/core/index";
|
|
63
63
|
import type { AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult } from "./Utils/segmentation/tools/AiAssistTool";
|
|
64
64
|
import { OrientationError, canonicalTransform, geometryFromNrrd, readNrrdOrientationFields, reorientVoxels, reorientedGeometry, viewLabels } from "./Utils/orientation";
|
|
@@ -66,5 +66,5 @@ import type { NrrdOrientationFields, OrientationErrorCode, OrientationTransform,
|
|
|
66
66
|
import "./css/style.css";
|
|
67
67
|
export declare const REVISION: string;
|
|
68
68
|
export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, loadKiwrious, NrrdTools, registerNiftiMaskGrid, loading, Copper3dTrackballControls, Copper3dOrbitControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, MAX_ENGINE_CHANNEL, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, GaussianSmoother, SurfaceAnnotator, exposureExponent, DEFAULT_TARGET_GREY, disposeObject3D, disposeMaterial, collectFadeTargets, setFade, restoreFade, createSceneBudget, defaultBudgetBytes, disposeScene, removeSceneFromMap, fitDistance, fitView, isRotateEnabled, setRotateEnabled, isPanEnabled, setPanEnabled, isZoomEnabled, setZoomEnabled, beginGesture, isGestureActive, setCameraPose, addVolumeBoundingBox, VOLUME_BOUNDS_NAME, rasDimensions, DEFAULT_AXES, ensureAxisExtracted, prepareVolumeSlices, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, OrientationError, canonicalTransform, geometryFromNrrd, readNrrdOrientationFields, reorientVoxels, reorientedGeometry, viewLabels, };
|
|
69
|
-
export type { positionType, screenPosType, optsType, NrrdHeaderLike, GltfLoadOpts, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, aligned4DSurfaceType, aligned4DOptsType, Aligned4DController, raw4DVolumeTransformType, raw4DVolumeOptsType, Raw4DVolumeController, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, NrrdState, GuiState, IGuiMeta, ToolMode, IAnnotationCallbacks, IMaskHistoryChange, MaskRenderMode, LayerId, ChannelValue, AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult, SurfaceAnnotatorOptions, Annotation, AnnotationMode, ExportOptions, ExposureVolume, DisposableObject3D, DisposableMaterial, FadeTarget, FadeableMaterial, SceneBudget, DisposableScene, SceneDisposalHost, FitBounds, FitViewScene, AxisGatedControls, GestureAxes, PosableScene, BoundingBoxHost, VolumeBoundingBoxOpts, NrrdAxis, Pose, NrrdOrientationFields, OrientationErrorCode, OrientationTransform, ViewAxis, ViewLabels, VolumeGeometry, VolumeOrientation, };
|
|
69
|
+
export type { positionType, screenPosType, optsType, NrrdHeaderLike, GltfLoadOpts, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, aligned4DSurfaceType, aligned4DOptsType, Aligned4DController, raw4DVolumeTransformType, raw4DVolumeOptsType, Raw4DVolumeController, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, NrrdState, GuiState, IGuiMeta, ToolMode, IAnnotationCallbacks, IMaskHistoryChange, MaskRenderMode, LayerId, ChannelValue, ChannelClear, AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult, SurfaceAnnotatorOptions, Annotation, AnnotationMode, ExportOptions, ExposureVolume, DisposableObject3D, DisposableMaterial, FadeTarget, FadeableMaterial, SceneBudget, DisposableScene, SceneDisposalHost, FitBounds, FitViewScene, AxisGatedControls, GestureAxes, PosableScene, BoundingBoxHost, VolumeBoundingBoxOpts, NrrdAxis, Pose, NrrdOrientationFields, OrientationErrorCode, OrientationTransform, ViewAxis, ViewLabels, VolumeGeometry, VolumeOrientation, };
|
|
70
70
|
export type { CameraViewPreset } from "./Controls/orbitFraming";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "copper3d",
|
|
3
3
|
"description": "A 3d visualisation package base on threejs provides multiple scenes and Nrrd image load funtion.",
|
|
4
|
-
"version": "4.1.
|
|
4
|
+
"version": "4.1.4",
|
|
5
5
|
"main": "dist/bundle.umd.js",
|
|
6
6
|
"module": "dist/bundle.esm.mjs",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|