copper3d 3.11.2 → 3.11.3
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 +22 -1
- package/ai-index/guides/nrrd-tools.md +52 -1
- package/ai-index/guides/segmentation-module.md +5 -2
- package/ai-index/manifest.json +5 -5
- package/ai-index/symbols.json +1 -1
- package/dist/Utils/segmentation/NrrdTools.d.ts +13 -0
- package/dist/Utils/segmentation/NrrdTools.js +28 -2
- package/dist/Utils/segmentation/NrrdTools.js.map +1 -1
- package/dist/Utils/segmentation/core/types.d.ts +2 -0
- package/dist/Utils/segmentation/coreTools/NrrdState.d.ts +1 -1
- package/dist/Utils/segmentation/coreTools/NrrdState.js +3 -2
- package/dist/Utils/segmentation/coreTools/NrrdState.js.map +1 -1
- package/dist/Utils/segmentation/coreTools/gui.js +1 -1
- package/dist/Utils/segmentation/coreTools/gui.js.map +1 -1
- package/dist/Utils/segmentation/tools/SliceRenderPipeline.js +4 -2
- package/dist/Utils/segmentation/tools/SliceRenderPipeline.js.map +1 -1
- package/dist/Utils/segmentation/tools/ZoomTool.js +5 -2
- package/dist/Utils/segmentation/tools/ZoomTool.js.map +1 -1
- package/dist/bundle.esm.js +44 -12
- package/dist/bundle.umd.js +44 -12
- package/dist/types/Utils/segmentation/NrrdTools.d.ts +13 -0
- package/dist/types/Utils/segmentation/core/types.d.ts +2 -0
- package/dist/types/Utils/segmentation/coreTools/NrrdState.d.ts +1 -1
- package/package.json +1 -1
package/dist/bundle.esm.js
CHANGED
|
@@ -109144,7 +109144,7 @@ function setupGui(configs) {
|
|
|
109144
109144
|
},
|
|
109145
109145
|
mainAreaSize: {
|
|
109146
109146
|
name: "Zoom",
|
|
109147
|
-
min:
|
|
109147
|
+
min: configs.nrrd_states.view.minSizeFactor,
|
|
109148
109148
|
max: configs.gui_states.viewConfig.max_sensitive,
|
|
109149
109149
|
step: 1,
|
|
109150
109150
|
onFinished: null,
|
|
@@ -110752,6 +110752,8 @@ class ZoomTool extends BaseTool {
|
|
|
110752
110752
|
return;
|
|
110753
110753
|
const p = pending;
|
|
110754
110754
|
pending = null;
|
|
110755
|
+
// The host may have raised the minimum since the wheel event queued this target.
|
|
110756
|
+
p.moveDistance = Math.max(p.moveDistance, this.ctx.nrrd_states.view.minSizeFactor);
|
|
110755
110757
|
if (p.recenter) {
|
|
110756
110758
|
this.callbacks.resetPaintAreaUIPosition();
|
|
110757
110759
|
}
|
|
@@ -110793,8 +110795,9 @@ class ZoomTool extends BaseTool {
|
|
|
110793
110795
|
this.callbacks.setIsDrawFalse(1000);
|
|
110794
110796
|
return;
|
|
110795
110797
|
}
|
|
110796
|
-
|
|
110797
|
-
|
|
110798
|
+
const minFactor = this.ctx.nrrd_states.view.minSizeFactor;
|
|
110799
|
+
if (moveDistance < minFactor) {
|
|
110800
|
+
moveDistance = minFactor;
|
|
110798
110801
|
pending = { moveDistance, l: 0, t: 0, recenter: true };
|
|
110799
110802
|
}
|
|
110800
110803
|
else {
|
|
@@ -114260,6 +114263,7 @@ class NrrdState {
|
|
|
114260
114263
|
minIndex: 0,
|
|
114261
114264
|
contrastNum: 0,
|
|
114262
114265
|
sizeFactor: baseCanvasesSize,
|
|
114266
|
+
minSizeFactor: 1,
|
|
114263
114267
|
showContrast: false,
|
|
114264
114268
|
switchSliceFlag: false,
|
|
114265
114269
|
previousPanelL: -99999,
|
|
@@ -114291,9 +114295,9 @@ class NrrdState {
|
|
|
114291
114295
|
};
|
|
114292
114296
|
}
|
|
114293
114297
|
// ── Validated Setters ────────────────────────────────────────────────────
|
|
114294
|
-
/** Set zoom factor with clamping [
|
|
114298
|
+
/** Set zoom factor with clamping [minSizeFactor, 8] */
|
|
114295
114299
|
setZoomFactor(factor) {
|
|
114296
|
-
this.view.sizeFactor = Math.max(
|
|
114300
|
+
this.view.sizeFactor = Math.max(this.view.minSizeFactor, Math.min(8, factor));
|
|
114297
114301
|
}
|
|
114298
114302
|
/** Reset all sphere state to defaults */
|
|
114299
114303
|
resetSphereState() {
|
|
@@ -115233,8 +115237,10 @@ class SliceRenderPipeline extends BaseTool {
|
|
|
115233
115237
|
* @param factor number
|
|
115234
115238
|
*/
|
|
115235
115239
|
resizePaintArea(factor) {
|
|
115236
|
-
|
|
115237
|
-
const
|
|
115240
|
+
// A factor below 1 can floor a thin dimension to 0; keep a loaded image at least 1px.
|
|
115241
|
+
const { originWidth, originHeight } = this.ctx.nrrd_states.image;
|
|
115242
|
+
const newWidth = originWidth > 0 ? Math.max(1, Math.floor(originWidth * factor)) : 0;
|
|
115243
|
+
const newHeight = originHeight > 0 ? Math.max(1, Math.floor(originHeight * factor)) : 0;
|
|
115238
115244
|
const sizeChanged = newWidth !== this.ctx.nrrd_states.view.changedWidth ||
|
|
115239
115245
|
newHeight !== this.ctx.nrrd_states.view.changedHeight;
|
|
115240
115246
|
// Always clear display/drawing/origin canvases (needed for contrast updates)
|
|
@@ -116388,12 +116394,38 @@ class NrrdTools {
|
|
|
116388
116394
|
if (this.state.nrrd_states.view.sizeFactor >= 8) {
|
|
116389
116395
|
this.state.nrrd_states.view.sizeFactor = 8;
|
|
116390
116396
|
}
|
|
116391
|
-
else if (this.state.nrrd_states.view.sizeFactor <=
|
|
116392
|
-
this.state.nrrd_states.view.sizeFactor =
|
|
116397
|
+
else if (this.state.nrrd_states.view.sizeFactor <= this.state.nrrd_states.view.minSizeFactor) {
|
|
116398
|
+
this.state.nrrd_states.view.sizeFactor = this.state.nrrd_states.view.minSizeFactor;
|
|
116393
116399
|
}
|
|
116394
116400
|
this.resizePaintArea(this.state.nrrd_states.view.sizeFactor);
|
|
116395
116401
|
this.resetPaintAreaUIPosition();
|
|
116396
116402
|
}
|
|
116403
|
+
/**
|
|
116404
|
+
* Set the lower bound for the 2D zoom factor (`sizeFactor`), so the image can be shown
|
|
116405
|
+
* smaller than its original size. Clamped to [0.05, 1]; a non-finite value resets it to 1.
|
|
116406
|
+
* The default is 1. If the current factor is below the new minimum, it is raised to it and
|
|
116407
|
+
* the view repaints. The upper bound (8) is unchanged.
|
|
116408
|
+
*
|
|
116409
|
+
* The minimum survives `reset()` and case loads, and the engine never recomputes it: the
|
|
116410
|
+
* right value depends on the image/axis size and the host panel's size, which the engine
|
|
116411
|
+
* does not know. The host must re-apply it after each case load, axis switch and panel
|
|
116412
|
+
* resize.
|
|
116413
|
+
*/
|
|
116414
|
+
setMinSizeFactor(f) {
|
|
116415
|
+
const min = Number.isFinite(f) ? Math.min(1, Math.max(0.05, f)) : 1;
|
|
116416
|
+
const view = this.state.nrrd_states.view;
|
|
116417
|
+
view.minSizeFactor = min;
|
|
116418
|
+
if (this.guiParameterSettings)
|
|
116419
|
+
this.guiParameterSettings.advance.mainAreaSize.min = min;
|
|
116420
|
+
if (view.sizeFactor < min) {
|
|
116421
|
+
view.sizeFactor = min;
|
|
116422
|
+
this.resizePaintArea(min);
|
|
116423
|
+
this.resetPaintAreaUIPosition();
|
|
116424
|
+
}
|
|
116425
|
+
}
|
|
116426
|
+
getMinSizeFactor() {
|
|
116427
|
+
return this.state.nrrd_states.view.minSizeFactor;
|
|
116428
|
+
}
|
|
116397
116429
|
switchAllSlicesArrayData(allSlices) {
|
|
116398
116430
|
this.state.protectedData.allSlicesArray.length = 0;
|
|
116399
116431
|
this.state.protectedData.allSlicesArray = [...allSlices];
|
|
@@ -118180,15 +118212,15 @@ function installFastSliceRepaint(rawSlice_1) {
|
|
|
118180
118212
|
}
|
|
118181
118213
|
|
|
118182
118214
|
// import * as kiwrious from "copper3d_plugin_heart_k";
|
|
118183
|
-
// "v3.11.
|
|
118215
|
+
// "v3.11.3" is injected at build time by rollup @rollup/plugin-replace, sourced from package.json version.
|
|
118184
118216
|
// When copper3d is consumed from local source (no rollup replace step), the identifier is undefined and
|
|
118185
118217
|
// referencing it throws a ReferenceError — guard it so local loading still works.
|
|
118186
118218
|
let _revision = "unknown";
|
|
118187
118219
|
try {
|
|
118188
|
-
_revision = "v3.11.
|
|
118220
|
+
_revision = "v3.11.3";
|
|
118189
118221
|
}
|
|
118190
118222
|
catch (_a) {
|
|
118191
|
-
/* "v3.11.
|
|
118223
|
+
/* "v3.11.3" not injected (local source build) */
|
|
118192
118224
|
}
|
|
118193
118225
|
const REVISION = _revision;
|
|
118194
118226
|
// Expose on global so the version can be read in a production browser console via window.__COPPER3D_VERSION__
|
package/dist/bundle.umd.js
CHANGED
|
@@ -109152,7 +109152,7 @@ void main() {
|
|
|
109152
109152
|
},
|
|
109153
109153
|
mainAreaSize: {
|
|
109154
109154
|
name: "Zoom",
|
|
109155
|
-
min:
|
|
109155
|
+
min: configs.nrrd_states.view.minSizeFactor,
|
|
109156
109156
|
max: configs.gui_states.viewConfig.max_sensitive,
|
|
109157
109157
|
step: 1,
|
|
109158
109158
|
onFinished: null,
|
|
@@ -110760,6 +110760,8 @@ void main() {
|
|
|
110760
110760
|
return;
|
|
110761
110761
|
const p = pending;
|
|
110762
110762
|
pending = null;
|
|
110763
|
+
// The host may have raised the minimum since the wheel event queued this target.
|
|
110764
|
+
p.moveDistance = Math.max(p.moveDistance, this.ctx.nrrd_states.view.minSizeFactor);
|
|
110763
110765
|
if (p.recenter) {
|
|
110764
110766
|
this.callbacks.resetPaintAreaUIPosition();
|
|
110765
110767
|
}
|
|
@@ -110801,8 +110803,9 @@ void main() {
|
|
|
110801
110803
|
this.callbacks.setIsDrawFalse(1000);
|
|
110802
110804
|
return;
|
|
110803
110805
|
}
|
|
110804
|
-
|
|
110805
|
-
|
|
110806
|
+
const minFactor = this.ctx.nrrd_states.view.minSizeFactor;
|
|
110807
|
+
if (moveDistance < minFactor) {
|
|
110808
|
+
moveDistance = minFactor;
|
|
110806
110809
|
pending = { moveDistance, l: 0, t: 0, recenter: true };
|
|
110807
110810
|
}
|
|
110808
110811
|
else {
|
|
@@ -114268,6 +114271,7 @@ void main() {
|
|
|
114268
114271
|
minIndex: 0,
|
|
114269
114272
|
contrastNum: 0,
|
|
114270
114273
|
sizeFactor: baseCanvasesSize,
|
|
114274
|
+
minSizeFactor: 1,
|
|
114271
114275
|
showContrast: false,
|
|
114272
114276
|
switchSliceFlag: false,
|
|
114273
114277
|
previousPanelL: -99999,
|
|
@@ -114299,9 +114303,9 @@ void main() {
|
|
|
114299
114303
|
};
|
|
114300
114304
|
}
|
|
114301
114305
|
// ── Validated Setters ────────────────────────────────────────────────────
|
|
114302
|
-
/** Set zoom factor with clamping [
|
|
114306
|
+
/** Set zoom factor with clamping [minSizeFactor, 8] */
|
|
114303
114307
|
setZoomFactor(factor) {
|
|
114304
|
-
this.view.sizeFactor = Math.max(
|
|
114308
|
+
this.view.sizeFactor = Math.max(this.view.minSizeFactor, Math.min(8, factor));
|
|
114305
114309
|
}
|
|
114306
114310
|
/** Reset all sphere state to defaults */
|
|
114307
114311
|
resetSphereState() {
|
|
@@ -115241,8 +115245,10 @@ void main() {
|
|
|
115241
115245
|
* @param factor number
|
|
115242
115246
|
*/
|
|
115243
115247
|
resizePaintArea(factor) {
|
|
115244
|
-
|
|
115245
|
-
const
|
|
115248
|
+
// A factor below 1 can floor a thin dimension to 0; keep a loaded image at least 1px.
|
|
115249
|
+
const { originWidth, originHeight } = this.ctx.nrrd_states.image;
|
|
115250
|
+
const newWidth = originWidth > 0 ? Math.max(1, Math.floor(originWidth * factor)) : 0;
|
|
115251
|
+
const newHeight = originHeight > 0 ? Math.max(1, Math.floor(originHeight * factor)) : 0;
|
|
115246
115252
|
const sizeChanged = newWidth !== this.ctx.nrrd_states.view.changedWidth ||
|
|
115247
115253
|
newHeight !== this.ctx.nrrd_states.view.changedHeight;
|
|
115248
115254
|
// Always clear display/drawing/origin canvases (needed for contrast updates)
|
|
@@ -116396,12 +116402,38 @@ void main() {
|
|
|
116396
116402
|
if (this.state.nrrd_states.view.sizeFactor >= 8) {
|
|
116397
116403
|
this.state.nrrd_states.view.sizeFactor = 8;
|
|
116398
116404
|
}
|
|
116399
|
-
else if (this.state.nrrd_states.view.sizeFactor <=
|
|
116400
|
-
this.state.nrrd_states.view.sizeFactor =
|
|
116405
|
+
else if (this.state.nrrd_states.view.sizeFactor <= this.state.nrrd_states.view.minSizeFactor) {
|
|
116406
|
+
this.state.nrrd_states.view.sizeFactor = this.state.nrrd_states.view.minSizeFactor;
|
|
116401
116407
|
}
|
|
116402
116408
|
this.resizePaintArea(this.state.nrrd_states.view.sizeFactor);
|
|
116403
116409
|
this.resetPaintAreaUIPosition();
|
|
116404
116410
|
}
|
|
116411
|
+
/**
|
|
116412
|
+
* Set the lower bound for the 2D zoom factor (`sizeFactor`), so the image can be shown
|
|
116413
|
+
* smaller than its original size. Clamped to [0.05, 1]; a non-finite value resets it to 1.
|
|
116414
|
+
* The default is 1. If the current factor is below the new minimum, it is raised to it and
|
|
116415
|
+
* the view repaints. The upper bound (8) is unchanged.
|
|
116416
|
+
*
|
|
116417
|
+
* The minimum survives `reset()` and case loads, and the engine never recomputes it: the
|
|
116418
|
+
* right value depends on the image/axis size and the host panel's size, which the engine
|
|
116419
|
+
* does not know. The host must re-apply it after each case load, axis switch and panel
|
|
116420
|
+
* resize.
|
|
116421
|
+
*/
|
|
116422
|
+
setMinSizeFactor(f) {
|
|
116423
|
+
const min = Number.isFinite(f) ? Math.min(1, Math.max(0.05, f)) : 1;
|
|
116424
|
+
const view = this.state.nrrd_states.view;
|
|
116425
|
+
view.minSizeFactor = min;
|
|
116426
|
+
if (this.guiParameterSettings)
|
|
116427
|
+
this.guiParameterSettings.advance.mainAreaSize.min = min;
|
|
116428
|
+
if (view.sizeFactor < min) {
|
|
116429
|
+
view.sizeFactor = min;
|
|
116430
|
+
this.resizePaintArea(min);
|
|
116431
|
+
this.resetPaintAreaUIPosition();
|
|
116432
|
+
}
|
|
116433
|
+
}
|
|
116434
|
+
getMinSizeFactor() {
|
|
116435
|
+
return this.state.nrrd_states.view.minSizeFactor;
|
|
116436
|
+
}
|
|
116405
116437
|
switchAllSlicesArrayData(allSlices) {
|
|
116406
116438
|
this.state.protectedData.allSlicesArray.length = 0;
|
|
116407
116439
|
this.state.protectedData.allSlicesArray = [...allSlices];
|
|
@@ -118188,15 +118220,15 @@ void main() {
|
|
|
118188
118220
|
}
|
|
118189
118221
|
|
|
118190
118222
|
// import * as kiwrious from "copper3d_plugin_heart_k";
|
|
118191
|
-
// "v3.11.
|
|
118223
|
+
// "v3.11.3" is injected at build time by rollup @rollup/plugin-replace, sourced from package.json version.
|
|
118192
118224
|
// When copper3d is consumed from local source (no rollup replace step), the identifier is undefined and
|
|
118193
118225
|
// referencing it throws a ReferenceError — guard it so local loading still works.
|
|
118194
118226
|
let _revision = "unknown";
|
|
118195
118227
|
try {
|
|
118196
|
-
_revision = "v3.11.
|
|
118228
|
+
_revision = "v3.11.3";
|
|
118197
118229
|
}
|
|
118198
118230
|
catch (_a) {
|
|
118199
|
-
/* "v3.11.
|
|
118231
|
+
/* "v3.11.3" not injected (local source build) */
|
|
118200
118232
|
}
|
|
118201
118233
|
const REVISION = _revision;
|
|
118202
118234
|
// Expose on global so the version can be read in a production browser console via window.__COPPER3D_VERSION__
|
|
@@ -179,6 +179,19 @@ export declare class NrrdTools {
|
|
|
179
179
|
setContrastIndex(index: number): void;
|
|
180
180
|
setSliceMoving(step: number): void;
|
|
181
181
|
setMainAreaSize(factor: number): void;
|
|
182
|
+
/**
|
|
183
|
+
* Set the lower bound for the 2D zoom factor (`sizeFactor`), so the image can be shown
|
|
184
|
+
* smaller than its original size. Clamped to [0.05, 1]; a non-finite value resets it to 1.
|
|
185
|
+
* The default is 1. If the current factor is below the new minimum, it is raised to it and
|
|
186
|
+
* the view repaints. The upper bound (8) is unchanged.
|
|
187
|
+
*
|
|
188
|
+
* The minimum survives `reset()` and case loads, and the engine never recomputes it: the
|
|
189
|
+
* right value depends on the image/axis size and the host panel's size, which the engine
|
|
190
|
+
* does not know. The host must re-apply it after each case load, axis switch and panel
|
|
191
|
+
* resize.
|
|
192
|
+
*/
|
|
193
|
+
setMinSizeFactor(f: number): void;
|
|
194
|
+
getMinSizeFactor(): number;
|
|
182
195
|
switchAllSlicesArrayData(allSlices: Array<nrrdSliceType>): void;
|
|
183
196
|
/**
|
|
184
197
|
* Batched form of `setSkips` + `setContrastIndex` for a load that ends by reconciling skip
|
|
@@ -420,6 +420,8 @@ export interface IViewState {
|
|
|
420
420
|
minIndex: number;
|
|
421
421
|
contrastNum: number;
|
|
422
422
|
sizeFactor: number;
|
|
423
|
+
/** Lower bound for `sizeFactor`, in [0.05, 1]. Default 1 (never smaller than 1:1). */
|
|
424
|
+
minSizeFactor: number;
|
|
423
425
|
showContrast: boolean;
|
|
424
426
|
switchSliceFlag: boolean;
|
|
425
427
|
previousPanelL: number;
|
|
@@ -18,7 +18,7 @@ export declare class NrrdState {
|
|
|
18
18
|
readonly sphere: ISphereState;
|
|
19
19
|
readonly flags: IInternalFlags;
|
|
20
20
|
constructor(baseCanvasesSize?: number, layers?: string[]);
|
|
21
|
-
/** Set zoom factor with clamping [
|
|
21
|
+
/** Set zoom factor with clamping [minSizeFactor, 8] */
|
|
22
22
|
setZoomFactor(factor: number): void;
|
|
23
23
|
/** Reset all sphere state to defaults */
|
|
24
24
|
resetSphereState(): void;
|
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": "3.11.
|
|
4
|
+
"version": "3.11.3",
|
|
5
5
|
"main": "dist/bundle.umd.js",
|
|
6
6
|
"moudle": "dist/bundle.esm.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|