copper3d 3.11.5 → 3.11.6
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 +6 -0
- package/ai-index/guides/4D-MRI-LV-rendering.md +1 -1
- package/ai-index/guides/copper3d-rendering-optimization.md +37 -0
- package/ai-index/guides/load-callbacks.md +35 -0
- package/ai-index/guides/nrrd-tools.md +10 -0
- package/ai-index/manifest.json +7 -7
- package/ai-index/symbols.json +1 -1
- package/dist/Loader/copperNrrdLoader.d.ts +33 -0
- package/dist/Loader/copperNrrdLoader.js +27 -5
- package/dist/Loader/copperNrrdLoader.js.map +1 -1
- package/dist/Renderer/copperRenderer.js +2 -2
- package/dist/Renderer/copperRenderer.js.map +1 -1
- package/dist/Scene/copperScene.d.ts +1 -1
- package/dist/Scene/copperScene.js +4 -1
- package/dist/Scene/copperScene.js.map +1 -1
- package/dist/Utils/segmentation/RenderingUtils.d.ts +2 -1
- package/dist/Utils/segmentation/RenderingUtils.js +4 -1
- package/dist/Utils/segmentation/RenderingUtils.js.map +1 -1
- package/dist/Utils/segmentation/tools/SliceRenderPipeline.js +3 -0
- package/dist/Utils/segmentation/tools/SliceRenderPipeline.js.map +1 -1
- package/dist/bundle.esm.js +44 -13
- package/dist/bundle.umd.js +44 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/types/Loader/copperNrrdLoader.d.ts +33 -0
- package/dist/types/Scene/copperScene.d.ts +1 -1
- package/dist/types/Utils/segmentation/RenderingUtils.d.ts +2 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -238,6 +238,12 @@ Skipped a plane and need it later? `ensureAxisExtracted(slices, axis, meshes?)`
|
|
|
238
238
|
demand, mutating `slices` (and `meshes`) in place. `NrrdTools.setSliceOrientation()` already
|
|
239
239
|
calls it for you, so an axial-only load can still switch to sagittal or coronal.
|
|
240
240
|
|
|
241
|
+
Extracting a slice yourself with `Volume.extractSlice`? Run `prepareVolumeSlices(...slices)`
|
|
242
|
+
on the result. It gives the slice's readback buffer a `willReadFrequently` context (three
|
|
243
|
+
creates it without the flag, so every repaint copies the canvas back from the GPU) and
|
|
244
|
+
restores the geometry three's `VolumeSlice` constructor wipes. The loader does this for
|
|
245
|
+
everything it extracts.
|
|
246
|
+
|
|
241
247
|
---
|
|
242
248
|
|
|
243
249
|
## NrrdTools Usage Guide
|
|
@@ -440,7 +440,7 @@ Versus `setInterval`, rAF syncs to the display refresh and auto-pauses when the
|
|
|
440
440
|
animate = (time?) => {
|
|
441
441
|
if (!this.running) return;
|
|
442
442
|
requestAnimationFrame(this.animate); // self-scheduling
|
|
443
|
-
this.delta += this.renderClock.getDelta();
|
|
443
|
+
this.delta += this.renderClock.update().getDelta(); // THREE.Timer: advance, then read
|
|
444
444
|
if (this.delta > this.interval) { // only draw once enough time has accumulated (frame-rate cap)
|
|
445
445
|
this.render();
|
|
446
446
|
}
|
|
@@ -118,6 +118,43 @@ All lighting and rendering parameters are exposed through a dat.GUI panel for re
|
|
|
118
118
|
|
|
119
119
|
---
|
|
120
120
|
|
|
121
|
+
## 7. Frame timing — `THREE.Timer` <Badge type="tip" text="3.11.6" />
|
|
122
|
+
|
|
123
|
+
three r185 deprecates `THREE.Clock` and warns on **every construction**. copper3d built one
|
|
124
|
+
per renderer and one per scene, so a viewer panel produced a warning pair each time it was
|
|
125
|
+
created. Both are now `THREE.Timer`.
|
|
126
|
+
|
|
127
|
+
::: warning Breaking: `copperScene.clock` is a `THREE.Timer`
|
|
128
|
+
It is a public field, so code that types or constructs it has to change:
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
scene.clock; // THREE.Clock → THREE.Timer
|
|
132
|
+
scene.clock.getDelta(); // unchanged, but see below
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The behavioural difference is that a `Timer` **only advances when you call `update()`** —
|
|
136
|
+
`getDelta()` on its own returns the same value twice.
|
|
137
|
+
:::
|
|
138
|
+
|
|
139
|
+
Both call sites update before reading:
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
// copperRenderer.animate
|
|
143
|
+
this.delta += this.renderClock.update().getDelta();
|
|
144
|
+
|
|
145
|
+
// copperScene.render — every frame, not only once a model is ready
|
|
146
|
+
this.clock.update();
|
|
147
|
+
if (this.modelReady) this.mixer?.update(this.clock.getDelta() * this.playRate);
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`copperScene` updating unconditionally is a **fix**, not bookkeeping. `Clock.getDelta()`
|
|
151
|
+
measured from the previous `getDelta()` — or, on the first call, from construction. A scene
|
|
152
|
+
whose model finished loading five seconds after the scene was built therefore handed its
|
|
153
|
+
mixer a five-second first step, and the animation jumped. Updating every frame makes the
|
|
154
|
+
first step one frame long.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
121
158
|
## Architecture Diagram
|
|
122
159
|
|
|
123
160
|
```
|
|
@@ -182,6 +182,41 @@ Two consequences worth knowing:
|
|
|
182
182
|
asset file to serve. A UMD bundle mounted at a base path unknown at build time still
|
|
183
183
|
works.
|
|
184
184
|
|
|
185
|
+
## `prepareVolumeSlices()`: the fixups every slice needs <Badge type="tip" text="3.11.6" />
|
|
186
|
+
|
|
187
|
+
`loadNrrd` and `ensureAxisExtracted` already call this on everything they extract. You only
|
|
188
|
+
need it if you call `Volume.extractSlice` yourself — for a preview plane, say:
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
import { prepareVolumeSlices } from "copper3d";
|
|
192
|
+
|
|
193
|
+
const slice = volume.extractSlice("z", index * spacing[2]);
|
|
194
|
+
prepareVolumeSlices(slice); // variadic; `undefined` entries are skipped
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
It does two things.
|
|
198
|
+
|
|
199
|
+
**1. Gives the readback buffer a `willReadFrequently` context.** Stock
|
|
200
|
+
`VolumeSlice.repaint` reads `ctxBuffer` back with `getImageData` on *every* repaint, and
|
|
201
|
+
three creates that context without the flag — so the canvas may live on the GPU and each
|
|
202
|
+
repaint copies it back to the CPU. Chrome warns once per such context.
|
|
203
|
+
|
|
204
|
+
A context's attributes are fixed by the first `getContext` call on its canvas, so the flag
|
|
205
|
+
cannot be added afterwards; the buffer canvas is replaced with one whose context is created
|
|
206
|
+
with it. A later `updateGeometry` re-fetches the same context, so the flag survives.
|
|
207
|
+
|
|
208
|
+
**2. Restores the geometry three's constructor wipes.** `VolumeSlice`'s constructor calls
|
|
209
|
+
`updateGeometry()` and `repaint()` and *then* assigns `iLength = 0`, `jLength = 0`,
|
|
210
|
+
`sliceAccess = null`, undoing what it just computed. `repaint()` only recomputes them after an
|
|
211
|
+
`index` change, so any repaint not preceded by one calls `ctx.getImageData(0, 0, 0, 0)` and
|
|
212
|
+
throws `IndexSizeError: The source width is 0`. Present in three r175 through at least r185;
|
|
213
|
+
a harmless recompute on r174 and earlier.
|
|
214
|
+
|
|
215
|
+
::: tip Renamed from `repairSliceGeometry`
|
|
216
|
+
It was internal and only did (2). It is exported now because the preview-slice flow builds
|
|
217
|
+
slices outside the loader and needs both.
|
|
218
|
+
:::
|
|
219
|
+
|
|
185
220
|
## Detecting a stalled download
|
|
186
221
|
|
|
187
222
|
A flat timeout is the wrong instrument for a large volume: a 53MB NRRD on a
|
|
@@ -126,6 +126,16 @@ Slice scrubbing, zoom, pan, window/level and the crosshair all work as usual. Th
|
|
|
126
126
|
tools have no layer to target and skip their work rather than failing: `setCurrentLayer()`
|
|
127
127
|
returns `null` and every caller checks it.
|
|
128
128
|
|
|
129
|
+
The rest of the pipeline follows the same rule <Badge type="tip" text="3.11.6" />:
|
|
130
|
+
`getVolumeForLayer()` returns `undefined` **without** the "unknown layer, falling back to…"
|
|
131
|
+
warning — there is no first layer to fall back to, and the warning was noise on a viewer that
|
|
132
|
+
is working as designed — and `reloadMasksFromVolume()` returns early, since there is nothing
|
|
133
|
+
to reload. An unknown layer id on a viewer that *does* have layers still warns and falls back,
|
|
134
|
+
as before.
|
|
135
|
+
|
|
136
|
+
Pairs naturally with `setMaskMirror` (§6.7): a layerless viewer still composites, so it can
|
|
137
|
+
show another viewer's masks over its own image.
|
|
138
|
+
|
|
129
139
|
::: tip Which one to reach for
|
|
130
140
|
`layers: []` is a **structural** choice — this instance will never annotate.
|
|
131
141
|
`setAnnotationSuspended(true)` (§5.6) is a **temporary** one on an instance that will, such as
|
package/ai-index/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"copper3dVersion": "3.11.
|
|
4
|
-
"generatedAt": "2026-
|
|
5
|
-
"symbolCount":
|
|
3
|
+
"copper3dVersion": "3.11.6",
|
|
4
|
+
"generatedAt": "2026-10-07T11:14:00.570Z",
|
|
5
|
+
"symbolCount": 1203,
|
|
6
6
|
"guides": [
|
|
7
7
|
{
|
|
8
8
|
"id": "4D-MRI-LV-rendering",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"title": "4D Heart (MRI + LV Surfaces) Aligned Rendering — Deep Dive",
|
|
11
11
|
"summary": "Using `src/pages/example15_mri_lv_4d.vue` as the worked example, this explains how \"32 MRI images + 64 VTK models\" are loaded, aligned, and played back together on a single cardiac clock.",
|
|
12
12
|
"lang": "en",
|
|
13
|
-
"bytes":
|
|
13
|
+
"bytes": 27306
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"id": "ai-assist-api",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"title": "Copper3D GLB Rendering Optimization",
|
|
51
51
|
"summary": "This document describes the rendering optimizations applied to the Copper3D library's Three.js pipeline to improve GLB model visual quality in the medical image annotator. The original rendering produced dull, dark, and detail-less models.…",
|
|
52
52
|
"lang": "en",
|
|
53
|
-
"bytes":
|
|
53
|
+
"bytes": 8193
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
"id": "gltf-decoders",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"title": "Load Progress & Errors",
|
|
75
75
|
"summary": "Every loader in copper3d gained `onProgress` and `onError` in **3.9.0**. Before that there was no way to find out that a load had failed — a broken URL, a 404, a corrupt file and a very slow download all looked identical from outside: the …",
|
|
76
76
|
"lang": "en",
|
|
77
|
-
"bytes":
|
|
77
|
+
"bytes": 11087
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
"id": "mcp-server",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"title": "NrrdTools Usage Guide",
|
|
91
91
|
"summary": "Copper3D `NrrdTools` — Medical Image Segmentation Annotation Engine",
|
|
92
92
|
"lang": "en",
|
|
93
|
-
"bytes":
|
|
93
|
+
"bytes": 81653
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
"id": "on-demand-controls",
|