copper3d 3.10.3 → 3.11.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/README.md +162 -4
- package/ai-index/guides/4D-MRI-LV-rendering.md +580 -0
- package/ai-index/guides/ai-assist-api.md +382 -0
- package/ai-index/guides/camera-framing.md +238 -0
- package/ai-index/guides/control-axes.md +124 -0
- package/ai-index/guides/copper3d-4D-API.md +219 -0
- package/ai-index/guides/copper3d-rendering-optimization.md +155 -0
- package/ai-index/guides/gltf-decoders.md +105 -0
- package/ai-index/guides/heart-sensor.md +137 -0
- package/ai-index/guides/load-callbacks.md +244 -0
- package/ai-index/guides/nrrd-tools.md +1868 -0
- package/ai-index/guides/on-demand-controls.md +154 -0
- package/ai-index/guides/rotation-pivot.md +197 -0
- package/ai-index/guides/scene-resources.md +227 -0
- package/ai-index/guides/segmentation-module.md +1516 -0
- package/ai-index/guides/surface-annotation-api.md +388 -0
- package/ai-index/guides/volume-display.md +194 -0
- package/ai-index/manifest.json +136 -0
- package/ai-index/symbols.json +1 -0
- package/dist/Utils/segmentation/DrawToolCore.d.ts +8 -0
- package/dist/Utils/segmentation/DrawToolCore.js +11 -0
- package/dist/Utils/segmentation/DrawToolCore.js.map +1 -1
- package/dist/Utils/segmentation/NrrdTools.d.ts +8 -0
- package/dist/Utils/segmentation/NrrdTools.js +10 -0
- package/dist/Utils/segmentation/NrrdTools.js.map +1 -1
- package/dist/Utils/segmentation/core/UndoManager.d.ts +12 -1
- package/dist/Utils/segmentation/core/UndoManager.js +33 -17
- package/dist/Utils/segmentation/core/UndoManager.js.map +1 -1
- package/dist/bundle.esm.js +57 -20
- package/dist/bundle.umd.js +57 -20
- package/dist/types/Utils/segmentation/DrawToolCore.d.ts +8 -0
- package/dist/types/Utils/segmentation/NrrdTools.d.ts +8 -0
- package/dist/types/Utils/segmentation/core/UndoManager.d.ts +12 -1
- package/package.json +7 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UndoManager.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/core/UndoManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA4BH,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,MAAM,
|
|
1
|
+
{"version":3,"file":"UndoManager.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/core/UndoManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA4BH,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,MAAM,OAAO,WAAW;IAAxB;QACU,eAAU,GAAG,IAAI,GAAG,EAAuB,CAAC;QAC5C,eAAU,GAAG,IAAI,GAAG,EAAuB,CAAC;QAC5C,gBAAW,GAAW,QAAQ,CAAC;IAgHzC,CAAC;IA9GC;;;;;;;;;;OAUG;IACK,QAAQ,CAAC,MAAgC,EAAE,OAAe;QAChE,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,EAAE,CAAC;YACX,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,qFAAqF;IACrF,cAAc,CAAC,KAAa;QAC1B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED,uFAAuF;IACvF,IAAI,CAAC,KAAgB;QACnB,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED,8FAA8F;IAC9F,SAAS,CAAC,MAAmB;QAC3B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAChC,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CA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,CAAC;IAED,uEAAuE;IACvE,QAAQ;QACN,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;YAAE,KAAK,CAAC,MAAM,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"}
|
package/dist/bundle.esm.js
CHANGED
|
@@ -107741,12 +107741,30 @@ class MaskVolume {
|
|
|
107741
107741
|
* - Undo/redo operations also trigger backend sync via getMask callback.
|
|
107742
107742
|
*/
|
|
107743
107743
|
const MAX_STACK_SIZE = 50;
|
|
107744
|
-
const LAYER_IDS = ["layer1", "layer2", "layer3"];
|
|
107745
107744
|
class UndoManager {
|
|
107746
107745
|
constructor() {
|
|
107746
|
+
this.undoStacks = new Map();
|
|
107747
|
+
this.redoStacks = new Map();
|
|
107747
107748
|
this.activeLayer = "layer1";
|
|
107748
|
-
|
|
107749
|
-
|
|
107749
|
+
}
|
|
107750
|
+
/**
|
|
107751
|
+
* The stack for a layer, created on first use.
|
|
107752
|
+
*
|
|
107753
|
+
* Stacks used to be pre-created for exactly layer1/2/3, which broke in two ways at once for
|
|
107754
|
+
* any other id -- and `NrrdTools`'s constructor has always accepted `options.layers`, so any
|
|
107755
|
+
* other id is reachable. `push*` resolved with `?? get("layer1")` and silently appended to a
|
|
107756
|
+
* different layer's history, so an undo later popped a stroke the user never made there;
|
|
107757
|
+
* `undo`/`redo` asserted non-null on the same lookup and threw instead.
|
|
107758
|
+
*
|
|
107759
|
+
* Creating on demand removes both. Nothing else needs to know which layers exist.
|
|
107760
|
+
*/
|
|
107761
|
+
stackFor(stacks, layerId) {
|
|
107762
|
+
let stack = stacks.get(layerId);
|
|
107763
|
+
if (!stack) {
|
|
107764
|
+
stack = [];
|
|
107765
|
+
stacks.set(layerId, stack);
|
|
107766
|
+
}
|
|
107767
|
+
return stack;
|
|
107750
107768
|
}
|
|
107751
107769
|
/** Set the currently active layer (determines which stack undo/redo operates on). */
|
|
107752
107770
|
setActiveLayer(layer) {
|
|
@@ -107758,17 +107776,16 @@ class UndoManager {
|
|
|
107758
107776
|
}
|
|
107759
107777
|
/** Push a group of deltas as a single undo unit (e.g. 3D sphere spanning multiple slices). */
|
|
107760
107778
|
pushGroup(deltas) {
|
|
107761
|
-
var _a, _b;
|
|
107762
107779
|
if (deltas.length === 0)
|
|
107763
107780
|
return;
|
|
107764
107781
|
const layerId = deltas[0].layerId;
|
|
107765
|
-
const stack =
|
|
107782
|
+
const stack = this.stackFor(this.undoStacks, layerId);
|
|
107766
107783
|
stack.push(deltas);
|
|
107767
107784
|
if (stack.length > MAX_STACK_SIZE) {
|
|
107768
107785
|
stack.shift();
|
|
107769
107786
|
}
|
|
107770
107787
|
// Any new operation invalidates the redo history for that layer
|
|
107771
|
-
const redoStack =
|
|
107788
|
+
const redoStack = this.stackFor(this.redoStacks, layerId);
|
|
107772
107789
|
redoStack.length = 0;
|
|
107773
107790
|
}
|
|
107774
107791
|
/**
|
|
@@ -107778,8 +107795,7 @@ class UndoManager {
|
|
|
107778
107795
|
* an unbounded stack would be hundreds of megabytes. Slice deltas below it survive.
|
|
107779
107796
|
*/
|
|
107780
107797
|
pushVolumeSnapshot(layerId, oldVolume, newVolume) {
|
|
107781
|
-
|
|
107782
|
-
const stack = (_a = this.undoStacks.get(layerId)) !== null && _a !== void 0 ? _a : this.undoStacks.get("layer1");
|
|
107798
|
+
const stack = this.stackFor(this.undoStacks, layerId);
|
|
107783
107799
|
for (let i = stack.length - 1; i >= 0; i--) {
|
|
107784
107800
|
if (!Array.isArray(stack[i]))
|
|
107785
107801
|
stack.splice(i, 1);
|
|
@@ -107788,7 +107804,7 @@ class UndoManager {
|
|
|
107788
107804
|
if (stack.length > MAX_STACK_SIZE) {
|
|
107789
107805
|
stack.shift();
|
|
107790
107806
|
}
|
|
107791
|
-
const redoStack =
|
|
107807
|
+
const redoStack = this.stackFor(this.redoStacks, layerId);
|
|
107792
107808
|
redoStack.length = 0;
|
|
107793
107809
|
}
|
|
107794
107810
|
/**
|
|
@@ -107796,10 +107812,10 @@ class UndoManager {
|
|
|
107796
107812
|
* @returns The delta(s) that were undone, or undefined if nothing to undo.
|
|
107797
107813
|
*/
|
|
107798
107814
|
undo() {
|
|
107799
|
-
const stack = this.
|
|
107815
|
+
const stack = this.stackFor(this.undoStacks, this.activeLayer);
|
|
107800
107816
|
const entry = stack.pop();
|
|
107801
107817
|
if (entry) {
|
|
107802
|
-
this.
|
|
107818
|
+
this.stackFor(this.redoStacks, this.activeLayer).push(entry);
|
|
107803
107819
|
}
|
|
107804
107820
|
return entry;
|
|
107805
107821
|
}
|
|
@@ -107808,10 +107824,10 @@ class UndoManager {
|
|
|
107808
107824
|
* @returns The delta(s) that were redone, or undefined if nothing to redo.
|
|
107809
107825
|
*/
|
|
107810
107826
|
redo() {
|
|
107811
|
-
const stack = this.
|
|
107827
|
+
const stack = this.stackFor(this.redoStacks, this.activeLayer);
|
|
107812
107828
|
const entry = stack.pop();
|
|
107813
107829
|
if (entry) {
|
|
107814
|
-
this.
|
|
107830
|
+
this.stackFor(this.undoStacks, this.activeLayer).push(entry);
|
|
107815
107831
|
}
|
|
107816
107832
|
return entry;
|
|
107817
107833
|
}
|
|
@@ -107834,10 +107850,10 @@ class UndoManager {
|
|
|
107834
107850
|
}
|
|
107835
107851
|
/** Clear all stacks for all layers (called on full dataset reload). */
|
|
107836
107852
|
clearAll() {
|
|
107837
|
-
for (const
|
|
107838
|
-
|
|
107839
|
-
|
|
107840
|
-
|
|
107853
|
+
for (const stack of this.undoStacks.values())
|
|
107854
|
+
stack.length = 0;
|
|
107855
|
+
for (const stack of this.redoStacks.values())
|
|
107856
|
+
stack.length = 0;
|
|
107841
107857
|
}
|
|
107842
107858
|
}
|
|
107843
107859
|
|
|
@@ -114064,6 +114080,17 @@ class DrawToolCore {
|
|
|
114064
114080
|
this.state.annotationCallbacks.onLayerVolumeReplaced(layerId);
|
|
114065
114081
|
}
|
|
114066
114082
|
}
|
|
114083
|
+
/**
|
|
114084
|
+
* A copy of one layer's voxel buffer, or null if the layer has no volume.
|
|
114085
|
+
*
|
|
114086
|
+
* The read-only counterpart to replaceLayerVolume, and a copy rather than the live buffer:
|
|
114087
|
+
* handing out the renderer's own array would let a caller mutate the volume behind it, with
|
|
114088
|
+
* nothing invalidating the slice cache.
|
|
114089
|
+
*/
|
|
114090
|
+
getLayerVolume(layerId) {
|
|
114091
|
+
const vol = this.renderer.getVolumeForLayer(layerId);
|
|
114092
|
+
return vol ? new Uint8Array(vol.getRawData()) : null;
|
|
114093
|
+
}
|
|
114067
114094
|
/**
|
|
114068
114095
|
* Replace a layer's entire volume, optionally recording it as one undo step.
|
|
114069
114096
|
*
|
|
@@ -116900,6 +116927,16 @@ class NrrdTools {
|
|
|
116900
116927
|
// Refresh the display so all three axes reflect the new data
|
|
116901
116928
|
this.reloadMasksFromVolume();
|
|
116902
116929
|
}
|
|
116930
|
+
/**
|
|
116931
|
+
* A copy of one layer's voxel buffer, or null if the layer has no volume.
|
|
116932
|
+
*
|
|
116933
|
+
* Pairs with `replaceLayerVolume`, so a caller can move a mask from one layer to another
|
|
116934
|
+
* through the undoable path rather than through `copyLayerData`, which writes the target
|
|
116935
|
+
* buffer directly and leaves nothing for Ctrl+Z.
|
|
116936
|
+
*/
|
|
116937
|
+
getLayerVolume(layerId) {
|
|
116938
|
+
return this.drawCore.getLayerVolume(layerId);
|
|
116939
|
+
}
|
|
116903
116940
|
/**
|
|
116904
116941
|
* Replace a layer's entire voxel buffer.
|
|
116905
116942
|
*
|
|
@@ -118085,15 +118122,15 @@ function installFastSliceRepaint(rawSlice_1) {
|
|
|
118085
118122
|
}
|
|
118086
118123
|
|
|
118087
118124
|
// import * as kiwrious from "copper3d_plugin_heart_k";
|
|
118088
|
-
// "v3.
|
|
118125
|
+
// "v3.11.0" is injected at build time by rollup @rollup/plugin-replace, sourced from package.json version.
|
|
118089
118126
|
// When copper3d is consumed from local source (no rollup replace step), the identifier is undefined and
|
|
118090
118127
|
// referencing it throws a ReferenceError — guard it so local loading still works.
|
|
118091
118128
|
let _revision = "unknown";
|
|
118092
118129
|
try {
|
|
118093
|
-
_revision = "v3.
|
|
118130
|
+
_revision = "v3.11.0";
|
|
118094
118131
|
}
|
|
118095
118132
|
catch (_a) {
|
|
118096
|
-
/* "v3.
|
|
118133
|
+
/* "v3.11.0" not injected (local source build) */
|
|
118097
118134
|
}
|
|
118098
118135
|
const REVISION = _revision;
|
|
118099
118136
|
// Expose on global so the version can be read in a production browser console via window.__COPPER3D_VERSION__
|
package/dist/bundle.umd.js
CHANGED
|
@@ -107749,12 +107749,30 @@ void main() {
|
|
|
107749
107749
|
* - Undo/redo operations also trigger backend sync via getMask callback.
|
|
107750
107750
|
*/
|
|
107751
107751
|
const MAX_STACK_SIZE = 50;
|
|
107752
|
-
const LAYER_IDS = ["layer1", "layer2", "layer3"];
|
|
107753
107752
|
class UndoManager {
|
|
107754
107753
|
constructor() {
|
|
107754
|
+
this.undoStacks = new Map();
|
|
107755
|
+
this.redoStacks = new Map();
|
|
107755
107756
|
this.activeLayer = "layer1";
|
|
107756
|
-
|
|
107757
|
-
|
|
107757
|
+
}
|
|
107758
|
+
/**
|
|
107759
|
+
* The stack for a layer, created on first use.
|
|
107760
|
+
*
|
|
107761
|
+
* Stacks used to be pre-created for exactly layer1/2/3, which broke in two ways at once for
|
|
107762
|
+
* any other id -- and `NrrdTools`'s constructor has always accepted `options.layers`, so any
|
|
107763
|
+
* other id is reachable. `push*` resolved with `?? get("layer1")` and silently appended to a
|
|
107764
|
+
* different layer's history, so an undo later popped a stroke the user never made there;
|
|
107765
|
+
* `undo`/`redo` asserted non-null on the same lookup and threw instead.
|
|
107766
|
+
*
|
|
107767
|
+
* Creating on demand removes both. Nothing else needs to know which layers exist.
|
|
107768
|
+
*/
|
|
107769
|
+
stackFor(stacks, layerId) {
|
|
107770
|
+
let stack = stacks.get(layerId);
|
|
107771
|
+
if (!stack) {
|
|
107772
|
+
stack = [];
|
|
107773
|
+
stacks.set(layerId, stack);
|
|
107774
|
+
}
|
|
107775
|
+
return stack;
|
|
107758
107776
|
}
|
|
107759
107777
|
/** Set the currently active layer (determines which stack undo/redo operates on). */
|
|
107760
107778
|
setActiveLayer(layer) {
|
|
@@ -107766,17 +107784,16 @@ void main() {
|
|
|
107766
107784
|
}
|
|
107767
107785
|
/** Push a group of deltas as a single undo unit (e.g. 3D sphere spanning multiple slices). */
|
|
107768
107786
|
pushGroup(deltas) {
|
|
107769
|
-
var _a, _b;
|
|
107770
107787
|
if (deltas.length === 0)
|
|
107771
107788
|
return;
|
|
107772
107789
|
const layerId = deltas[0].layerId;
|
|
107773
|
-
const stack =
|
|
107790
|
+
const stack = this.stackFor(this.undoStacks, layerId);
|
|
107774
107791
|
stack.push(deltas);
|
|
107775
107792
|
if (stack.length > MAX_STACK_SIZE) {
|
|
107776
107793
|
stack.shift();
|
|
107777
107794
|
}
|
|
107778
107795
|
// Any new operation invalidates the redo history for that layer
|
|
107779
|
-
const redoStack =
|
|
107796
|
+
const redoStack = this.stackFor(this.redoStacks, layerId);
|
|
107780
107797
|
redoStack.length = 0;
|
|
107781
107798
|
}
|
|
107782
107799
|
/**
|
|
@@ -107786,8 +107803,7 @@ void main() {
|
|
|
107786
107803
|
* an unbounded stack would be hundreds of megabytes. Slice deltas below it survive.
|
|
107787
107804
|
*/
|
|
107788
107805
|
pushVolumeSnapshot(layerId, oldVolume, newVolume) {
|
|
107789
|
-
|
|
107790
|
-
const stack = (_a = this.undoStacks.get(layerId)) !== null && _a !== void 0 ? _a : this.undoStacks.get("layer1");
|
|
107806
|
+
const stack = this.stackFor(this.undoStacks, layerId);
|
|
107791
107807
|
for (let i = stack.length - 1; i >= 0; i--) {
|
|
107792
107808
|
if (!Array.isArray(stack[i]))
|
|
107793
107809
|
stack.splice(i, 1);
|
|
@@ -107796,7 +107812,7 @@ void main() {
|
|
|
107796
107812
|
if (stack.length > MAX_STACK_SIZE) {
|
|
107797
107813
|
stack.shift();
|
|
107798
107814
|
}
|
|
107799
|
-
const redoStack =
|
|
107815
|
+
const redoStack = this.stackFor(this.redoStacks, layerId);
|
|
107800
107816
|
redoStack.length = 0;
|
|
107801
107817
|
}
|
|
107802
107818
|
/**
|
|
@@ -107804,10 +107820,10 @@ void main() {
|
|
|
107804
107820
|
* @returns The delta(s) that were undone, or undefined if nothing to undo.
|
|
107805
107821
|
*/
|
|
107806
107822
|
undo() {
|
|
107807
|
-
const stack = this.
|
|
107823
|
+
const stack = this.stackFor(this.undoStacks, this.activeLayer);
|
|
107808
107824
|
const entry = stack.pop();
|
|
107809
107825
|
if (entry) {
|
|
107810
|
-
this.
|
|
107826
|
+
this.stackFor(this.redoStacks, this.activeLayer).push(entry);
|
|
107811
107827
|
}
|
|
107812
107828
|
return entry;
|
|
107813
107829
|
}
|
|
@@ -107816,10 +107832,10 @@ void main() {
|
|
|
107816
107832
|
* @returns The delta(s) that were redone, or undefined if nothing to redo.
|
|
107817
107833
|
*/
|
|
107818
107834
|
redo() {
|
|
107819
|
-
const stack = this.
|
|
107835
|
+
const stack = this.stackFor(this.redoStacks, this.activeLayer);
|
|
107820
107836
|
const entry = stack.pop();
|
|
107821
107837
|
if (entry) {
|
|
107822
|
-
this.
|
|
107838
|
+
this.stackFor(this.undoStacks, this.activeLayer).push(entry);
|
|
107823
107839
|
}
|
|
107824
107840
|
return entry;
|
|
107825
107841
|
}
|
|
@@ -107842,10 +107858,10 @@ void main() {
|
|
|
107842
107858
|
}
|
|
107843
107859
|
/** Clear all stacks for all layers (called on full dataset reload). */
|
|
107844
107860
|
clearAll() {
|
|
107845
|
-
for (const
|
|
107846
|
-
|
|
107847
|
-
|
|
107848
|
-
|
|
107861
|
+
for (const stack of this.undoStacks.values())
|
|
107862
|
+
stack.length = 0;
|
|
107863
|
+
for (const stack of this.redoStacks.values())
|
|
107864
|
+
stack.length = 0;
|
|
107849
107865
|
}
|
|
107850
107866
|
}
|
|
107851
107867
|
|
|
@@ -114072,6 +114088,17 @@ void main() {
|
|
|
114072
114088
|
this.state.annotationCallbacks.onLayerVolumeReplaced(layerId);
|
|
114073
114089
|
}
|
|
114074
114090
|
}
|
|
114091
|
+
/**
|
|
114092
|
+
* A copy of one layer's voxel buffer, or null if the layer has no volume.
|
|
114093
|
+
*
|
|
114094
|
+
* The read-only counterpart to replaceLayerVolume, and a copy rather than the live buffer:
|
|
114095
|
+
* handing out the renderer's own array would let a caller mutate the volume behind it, with
|
|
114096
|
+
* nothing invalidating the slice cache.
|
|
114097
|
+
*/
|
|
114098
|
+
getLayerVolume(layerId) {
|
|
114099
|
+
const vol = this.renderer.getVolumeForLayer(layerId);
|
|
114100
|
+
return vol ? new Uint8Array(vol.getRawData()) : null;
|
|
114101
|
+
}
|
|
114075
114102
|
/**
|
|
114076
114103
|
* Replace a layer's entire volume, optionally recording it as one undo step.
|
|
114077
114104
|
*
|
|
@@ -116908,6 +116935,16 @@ void main() {
|
|
|
116908
116935
|
// Refresh the display so all three axes reflect the new data
|
|
116909
116936
|
this.reloadMasksFromVolume();
|
|
116910
116937
|
}
|
|
116938
|
+
/**
|
|
116939
|
+
* A copy of one layer's voxel buffer, or null if the layer has no volume.
|
|
116940
|
+
*
|
|
116941
|
+
* Pairs with `replaceLayerVolume`, so a caller can move a mask from one layer to another
|
|
116942
|
+
* through the undoable path rather than through `copyLayerData`, which writes the target
|
|
116943
|
+
* buffer directly and leaves nothing for Ctrl+Z.
|
|
116944
|
+
*/
|
|
116945
|
+
getLayerVolume(layerId) {
|
|
116946
|
+
return this.drawCore.getLayerVolume(layerId);
|
|
116947
|
+
}
|
|
116911
116948
|
/**
|
|
116912
116949
|
* Replace a layer's entire voxel buffer.
|
|
116913
116950
|
*
|
|
@@ -118093,15 +118130,15 @@ void main() {
|
|
|
118093
118130
|
}
|
|
118094
118131
|
|
|
118095
118132
|
// import * as kiwrious from "copper3d_plugin_heart_k";
|
|
118096
|
-
// "v3.
|
|
118133
|
+
// "v3.11.0" is injected at build time by rollup @rollup/plugin-replace, sourced from package.json version.
|
|
118097
118134
|
// When copper3d is consumed from local source (no rollup replace step), the identifier is undefined and
|
|
118098
118135
|
// referencing it throws a ReferenceError — guard it so local loading still works.
|
|
118099
118136
|
let _revision = "unknown";
|
|
118100
118137
|
try {
|
|
118101
|
-
_revision = "v3.
|
|
118138
|
+
_revision = "v3.11.0";
|
|
118102
118139
|
}
|
|
118103
118140
|
catch (_a) {
|
|
118104
|
-
/* "v3.
|
|
118141
|
+
/* "v3.11.0" not injected (local source build) */
|
|
118105
118142
|
}
|
|
118106
118143
|
const REVISION = _revision;
|
|
118107
118144
|
// Expose on global so the version can be read in a production browser console via window.__COPPER3D_VERSION__
|
|
@@ -161,6 +161,14 @@ export declare class DrawToolCore {
|
|
|
161
161
|
* app persists the volume in a single request rather than one call per slice.
|
|
162
162
|
*/
|
|
163
163
|
private applyVolumeSnapshot;
|
|
164
|
+
/**
|
|
165
|
+
* A copy of one layer's voxel buffer, or null if the layer has no volume.
|
|
166
|
+
*
|
|
167
|
+
* The read-only counterpart to replaceLayerVolume, and a copy rather than the live buffer:
|
|
168
|
+
* handing out the renderer's own array would let a caller mutate the volume behind it, with
|
|
169
|
+
* nothing invalidating the slice cache.
|
|
170
|
+
*/
|
|
171
|
+
getLayerVolume(layerId: string): Uint8Array | null;
|
|
164
172
|
/**
|
|
165
173
|
* Replace a layer's entire volume, optionally recording it as one undo step.
|
|
166
174
|
*
|
|
@@ -445,6 +445,14 @@ export declare class NrrdTools {
|
|
|
445
445
|
* ```
|
|
446
446
|
*/
|
|
447
447
|
copyLayerData(sourceLayerId: string, targetLayerId: string): void;
|
|
448
|
+
/**
|
|
449
|
+
* A copy of one layer's voxel buffer, or null if the layer has no volume.
|
|
450
|
+
*
|
|
451
|
+
* Pairs with `replaceLayerVolume`, so a caller can move a mask from one layer to another
|
|
452
|
+
* through the undoable path rather than through `copyLayerData`, which writes the target
|
|
453
|
+
* buffer directly and leaves nothing for Ctrl+Z.
|
|
454
|
+
*/
|
|
455
|
+
getLayerVolume(layerId: string): Uint8Array | null;
|
|
448
456
|
/**
|
|
449
457
|
* Replace a layer's entire voxel buffer.
|
|
450
458
|
*
|
|
@@ -37,7 +37,18 @@ export declare class UndoManager {
|
|
|
37
37
|
private undoStacks;
|
|
38
38
|
private redoStacks;
|
|
39
39
|
private activeLayer;
|
|
40
|
-
|
|
40
|
+
/**
|
|
41
|
+
* The stack for a layer, created on first use.
|
|
42
|
+
*
|
|
43
|
+
* Stacks used to be pre-created for exactly layer1/2/3, which broke in two ways at once for
|
|
44
|
+
* any other id -- and `NrrdTools`'s constructor has always accepted `options.layers`, so any
|
|
45
|
+
* other id is reachable. `push*` resolved with `?? get("layer1")` and silently appended to a
|
|
46
|
+
* different layer's history, so an undo later popped a stroke the user never made there;
|
|
47
|
+
* `undo`/`redo` asserted non-null on the same lookup and threw instead.
|
|
48
|
+
*
|
|
49
|
+
* Creating on demand removes both. Nothing else needs to know which layers exist.
|
|
50
|
+
*/
|
|
51
|
+
private stackFor;
|
|
41
52
|
/** Set the currently active layer (determines which stack undo/redo operates on). */
|
|
42
53
|
setActiveLayer(layer: string): void;
|
|
43
54
|
/** Push a single delta onto the active layer's undo stack and clear the redo stack. */
|
package/package.json
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
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": "3.
|
|
4
|
+
"version": "3.11.0",
|
|
5
5
|
"main": "dist/bundle.umd.js",
|
|
6
6
|
"moudle": "dist/bundle.esm.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "tsc && rollup -c rollup.config.js",
|
|
9
|
+
"build": "tsc && rollup -c rollup.config.js && npm run build:ai-index",
|
|
10
10
|
"build:t": "rollup -c rollup.config.js",
|
|
11
11
|
"test": "vitest run",
|
|
12
12
|
"test:watch": "vitest",
|
|
13
|
-
"bench": "vitest bench"
|
|
13
|
+
"bench": "vitest bench",
|
|
14
|
+
"build:ai-index": "node scripts/build-ai-index.js"
|
|
14
15
|
},
|
|
15
16
|
"files": [
|
|
16
|
-
"dist"
|
|
17
|
+
"dist",
|
|
18
|
+
"ai-index"
|
|
17
19
|
],
|
|
18
20
|
"repository": {
|
|
19
21
|
"type": "git",
|
|
@@ -47,6 +49,7 @@
|
|
|
47
49
|
"rollup-plugin-sourcemaps": "^0.6.3",
|
|
48
50
|
"rollup-plugin-terser": "^7.0.2",
|
|
49
51
|
"rollup-plugin-typescript2": "^0.31.2",
|
|
52
|
+
"typedoc": "^0.28.20",
|
|
50
53
|
"typescript": "^5.9.3",
|
|
51
54
|
"vitest": "^4.1.10"
|
|
52
55
|
},
|