copper3d 3.10.0 → 3.10.2

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.
@@ -106326,7 +106326,65 @@ void main() {
106326
106326
  * | 7 | Auxiliary annotation | Orange |
106327
106327
  * | 8 | Extended annotation | Purple |
106328
106328
  */
106329
- const MASK_CHANNEL_COLORS = {
106329
+ /**
106330
+ * The largest label a mask voxel can carry. `MaskVolume` stores one byte per voxel and the
106331
+ * value IS the label, so 0 is empty and 1-255 are annotation channels.
106332
+ */
106333
+ const MAX_ENGINE_CHANNEL = 255;
106334
+ /** Highest channel whose colour is delivered rather than generated. */
106335
+ const SEEDED_CHANNELS = 8;
106336
+ /**
106337
+ * Successive hues this far apart never revisit an earlier one, which is the whole reason to
106338
+ * use it: any prefix of the sequence is about as spread out as that many hues can be.
106339
+ */
106340
+ const GOLDEN_ANGLE_DEGREES = 137.508;
106341
+ /**
106342
+ * The colour for a channel past the delivered eight.
106343
+ *
106344
+ * Saturation and lightness are fixed so the only thing that varies is hue: these sit on
106345
+ * greyscale MRI, where a mask that changes brightness between channels reads as a difference
106346
+ * in the image rather than in the annotation.
106347
+ *
106348
+ * Distinct is not the same as distinguishable. Past roughly twenty, neighbouring hues stop
106349
+ * being tellable apart by eye on a greyscale background; that is a limit on how many findings
106350
+ * a product should offer at once, not on what this function will return.
106351
+ */
106352
+ function generatedChannelColor(channel) {
106353
+ const hue = ((channel - SEEDED_CHANNELS - 1) * GOLDEN_ANGLE_DEGREES) % 360;
106354
+ return hslToRgba(hue, 0.68, 0.55);
106355
+ }
106356
+ /** HSL (h in degrees, s and l in 0-1) to the 0-255 RGBA this module stores. */
106357
+ function hslToRgba(h, s, l) {
106358
+ const c = (1 - Math.abs(2 * l - 1)) * s;
106359
+ const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
106360
+ const m = l - c / 2;
106361
+ const [r, g, b] = h < 60 ? [c, x, 0] :
106362
+ h < 120 ? [x, c, 0] :
106363
+ h < 180 ? [0, c, x] :
106364
+ h < 240 ? [0, x, c] :
106365
+ h < 300 ? [x, 0, c] :
106366
+ [c, 0, x];
106367
+ const to255 = (v) => Math.round((v + m) * 255);
106368
+ return { r: to255(r), g: to255(g), b: to255(b), a: 255 };
106369
+ }
106370
+ /**
106371
+ * A delivered 0-8 table, continued to 255 with generated colours.
106372
+ *
106373
+ * The seeds are kept verbatim rather than regenerated: every delivered case's chips, 3D
106374
+ * overlay tints and printed report outlines are keyed on them, so a formula that happened to
106375
+ * produce different values would silently recolour work already read and signed off.
106376
+ *
106377
+ * Built eagerly rather than behind a Proxy. `applyLayerChannelColors` walks these with
106378
+ * `Object.entries`, which a Proxy's `get` trap would not serve.
106379
+ */
106380
+ function extendPalette(seed, from) {
106381
+ const table = Object.assign({}, seed);
106382
+ for (let channel = SEEDED_CHANNELS + 1; channel <= MAX_ENGINE_CHANNEL; channel++) {
106383
+ table[channel] = from(generatedChannelColor(channel));
106384
+ }
106385
+ return table;
106386
+ }
106387
+ const MASK_CHANNEL_COLORS_SEED = {
106330
106388
  0: { r: 0, g: 0, b: 0, a: 0 }, // Background (transparent)
106331
106389
  1: { r: 16, g: 185, b: 129, a: 255 }, // Emerald / Soft Green — Primary / Tumor
106332
106390
  2: { r: 244, g: 63, b: 94, a: 255 }, // Rose / Soft Red — Secondary / Edema
@@ -106340,7 +106398,7 @@ void main() {
106340
106398
  /**
106341
106399
  * CSS color strings for the default channel palette (for reference / UI).
106342
106400
  */
106343
- const MASK_CHANNEL_CSS_COLORS = {
106401
+ const MASK_CHANNEL_CSS_COLORS_SEED = {
106344
106402
  0: 'rgba(0,0,0,0)',
106345
106403
  1: 'rgba(16,185,129,1)', // Emerald
106346
106404
  2: 'rgba(244,63,94,1)', // Rose
@@ -106351,15 +106409,10 @@ void main() {
106351
106409
  7: 'rgba(249,115,22,1)', // Orange
106352
106410
  8: 'rgba(139,92,246,1)', // Violet
106353
106411
  };
106354
- /**
106355
- * Convenience alias for MASK_CHANNEL_CSS_COLORS.
106356
- * Used by Vue components via `Copper.CHANNEL_COLORS[channel]`.
106357
- */
106358
- const CHANNEL_COLORS = MASK_CHANNEL_CSS_COLORS;
106359
106412
  /**
106360
106413
  * Hex color strings for each channel (no alpha), used for fillColor/brushColor.
106361
106414
  */
106362
- const CHANNEL_HEX_COLORS = {
106415
+ const CHANNEL_HEX_COLORS_SEED = {
106363
106416
  0: '#000000',
106364
106417
  1: '#10b981', // Emerald
106365
106418
  2: '#f43f5e', // Rose
@@ -106378,7 +106431,7 @@ void main() {
106378
106431
  * Applied ONLY to the AI scratch layer (set per-volume in AiAssistTool.enter) —
106379
106432
  * the global palette above is untouched, so the clinician mask stays emerald.
106380
106433
  */
106381
- const AI_MASK_CHANNEL_COLORS = {
106434
+ const AI_MASK_CHANNEL_COLORS_SEED = {
106382
106435
  0: { r: 0, g: 0, b: 0, a: 0 },
106383
106436
  1: { r: 94, g: 200, b: 255, a: 255 }, // Cyan (#5ec8ff) — AI accent (was emerald)
106384
106437
  2: { r: 244, g: 63, b: 94, a: 255 }, // Rose
@@ -106389,7 +106442,7 @@ void main() {
106389
106442
  7: { r: 249, g: 115, b: 22, a: 255 }, // Orange
106390
106443
  8: { r: 139, g: 92, b: 246, a: 255 }, // Violet
106391
106444
  };
106392
- const AI_CHANNEL_HEX_COLORS = {
106445
+ const AI_CHANNEL_HEX_COLORS_SEED = {
106393
106446
  0: '#000000',
106394
106447
  1: '#5ec8ff', // Cyan — AI accent
106395
106448
  2: '#f43f5e', // Rose
@@ -106400,6 +106453,20 @@ void main() {
106400
106453
  7: '#f97316', // Orange
106401
106454
  8: '#8b5cf6', // Violet
106402
106455
  };
106456
+ // ── The four palettes, delivered through channel 8 and generated past it ──────
106457
+ const MASK_CHANNEL_COLORS = extendPalette(MASK_CHANNEL_COLORS_SEED, (c) => c);
106458
+ const MASK_CHANNEL_CSS_COLORS = extendPalette(MASK_CHANNEL_CSS_COLORS_SEED, rgbaToCss);
106459
+ const CHANNEL_HEX_COLORS = extendPalette(CHANNEL_HEX_COLORS_SEED, rgbaToHex);
106460
+ const AI_MASK_CHANNEL_COLORS = extendPalette(AI_MASK_CHANNEL_COLORS_SEED, (c) => c);
106461
+ const AI_CHANNEL_HEX_COLORS = extendPalette(AI_CHANNEL_HEX_COLORS_SEED, rgbaToHex);
106462
+ /**
106463
+ * Convenience alias for MASK_CHANNEL_CSS_COLORS.
106464
+ * Used by Vue components via `Copper.CHANNEL_COLORS[channel]`.
106465
+ *
106466
+ * Declared here, with the tables it aliases. It used to sit further up, which was fine while
106467
+ * those were object literals and is a temporal-dead-zone error now that they are built.
106468
+ */
106469
+ const CHANNEL_COLORS = MASK_CHANNEL_CSS_COLORS;
106403
106470
  // ── Color Conversion Utilities ──────────────────────────────────────────
106404
106471
  /**
106405
106472
  * Convert an RGBAColor to a hex string (no alpha), e.g. '#ff0000'.
@@ -106581,16 +106648,16 @@ void main() {
106581
106648
  * Update the color for a specific label/channel in the color map.
106582
106649
  *
106583
106650
  * For label-based volumes (1-channel), the channel parameter refers to
106584
- * the label value (0-8), not the storage channel index.
106651
+ * the label value, not the storage channel index.
106585
106652
  *
106586
- * @param channel Label/channel index to update (0-8).
106653
+ * @param channel Label/channel index to update (0-`MAX_ENGINE_CHANNEL`).
106587
106654
  * @param color New RGBA color.
106588
106655
  *
106589
- * @throws {RangeError} If channel is outside valid label range [0, 8].
106656
+ * @throws {RangeError} If channel is outside the storable label range.
106590
106657
  */
106591
106658
  setChannelColor(channel, color) {
106592
- if (channel < 0 || channel > 8) {
106593
- throw new RangeError(`Invalid channel/label: ${channel} (valid range: 0-8)`);
106659
+ if (channel < 0 || channel > MAX_ENGINE_CHANNEL) {
106660
+ throw new RangeError(`Invalid channel/label: ${channel} (valid range: 0-${MAX_ENGINE_CHANNEL})`);
106594
106661
  }
106595
106662
  this.colorMap[channel] = { r: color.r, g: color.g, b: color.b, a: color.a };
106596
106663
  }
@@ -106820,7 +106887,8 @@ void main() {
106820
106887
  * @param sliceIndex Index along the specified axis.
106821
106888
  * @param imageData Canvas ImageData (RGBA) to convert.
106822
106889
  * @param axis `'x'`, `'y'`, or `'z'`.
106823
- * @param activeChannel Fallback label for pixels whose RGB doesn't match any channel (1-8).
106890
+ * @param activeChannel Fallback label for pixels whose RGB matches no channel exactly,
106891
+ * and one of the candidates the nearest-colour search considers.
106824
106892
  * @param channelVisible Optional map of visible channels (true=visible, false=hidden).
106825
106893
  * If provided, data for hidden channels will be preserved
106826
106894
  * when the canvas pixel is transparent.
@@ -106867,6 +106935,29 @@ void main() {
106867
106935
  iStride = this.bytesPerSlice; // i → z
106868
106936
  break;
106869
106937
  }
106938
+ // Candidates for the nearest-colour fallback below: the labels already on this slice,
106939
+ // plus the one being committed. One cheap pass to collect them, in place of running the
106940
+ // fallback over the whole palette.
106941
+ //
106942
+ // Widening it to all 255 would not just be 255 distance computations per anti-aliased
106943
+ // edge pixel. It would be wrong: the more colours the guess can choose from, the more
106944
+ // readily a fringe resolves to a label that is nowhere on the slice, which puts voxels
106945
+ // into another finding's mask with nothing to show for it.
106946
+ const candidates = [activeChannel];
106947
+ {
106948
+ const seen = new Set([activeChannel]);
106949
+ for (let j = 0; j < expectedH; j++) {
106950
+ let idx = baseIndex + j * jStride;
106951
+ for (let i = 0; i < expectedW; i++) {
106952
+ const label = volData[idx];
106953
+ if (label !== 0 && !seen.has(label)) {
106954
+ seen.add(label);
106955
+ candidates.push(label);
106956
+ }
106957
+ idx += iStride;
106958
+ }
106959
+ }
106960
+ }
106870
106961
  let px = 0;
106871
106962
  for (let j = 0; j < expectedH; j++) {
106872
106963
  let idx = baseIndex + j * jStride;
@@ -106895,8 +106986,10 @@ void main() {
106895
106986
  if (matchedChannel === undefined) {
106896
106987
  let minDist = Infinity;
106897
106988
  let bestChannel = activeChannel;
106898
- // Find the nearest channel color (1-8) to handle Canvas anti-aliased edge pixels
106899
- for (let ch = 1; ch <= 8; ch++) {
106989
+ // Nearest among the labels that can legitimately be here (see `candidates`),
106990
+ // to handle Canvas anti-aliased edge pixels.
106991
+ for (let ci = 0; ci < candidates.length; ci++) {
106992
+ const ch = candidates[ci];
106900
106993
  const c = (_a = this.colorMap[ch]) !== null && _a !== void 0 ? _a : MASK_CHANNEL_COLORS[ch];
106901
106994
  if (!c)
106902
106995
  continue;
@@ -106920,19 +107013,25 @@ void main() {
106920
107013
  }
106921
107014
  /**
106922
107015
  * Build a Map from RGB packed integer to channel label for reverse lookup.
106923
- * Uses this instance's colorMap (channels 1-8, skips 0 = transparent).
107016
+ * Covers every label this instance has a colour for, skipping 0 (transparent).
106924
107017
  *
106925
107018
  * Instance method ensures custom per-layer colors are correctly reverse-mapped.
106926
107019
  */
106927
107020
  buildRgbToChannelMap() {
106928
- var _a;
106929
107021
  const map = new Map();
106930
- for (let ch = 1; ch <= 8; ch++) {
106931
- const color = (_a = this.colorMap[ch]) !== null && _a !== void 0 ? _a : MASK_CHANNEL_COLORS[ch];
106932
- if (color) {
106933
- const key = (color.r << 16) | (color.g << 8) | color.b;
106934
- map.set(key, ch);
106935
- }
107022
+ // Every label this volume has a colour for, not a fixed 1-8. A pixel painted in
107023
+ // channel 12's colour used to miss this table entirely and fall through to the
107024
+ // nearest-colour guess, which could only ever answer 1-8 -- so the channel could be
107025
+ // drawn and could never be read back. Size is not a cost here: it is built once per
107026
+ // readback and every lookup against it is O(1).
107027
+ for (const key of Object.keys(this.colorMap)) {
107028
+ const ch = Number(key);
107029
+ if (ch < 1)
107030
+ continue; // 0 is "empty", and it is transparent rather than a colour
107031
+ const color = this.colorMap[ch];
107032
+ if (!color)
107033
+ continue;
107034
+ map.set((color.r << 16) | (color.g << 8) | color.b, ch);
106936
107035
  }
106937
107036
  return map;
106938
107037
  }
@@ -106997,8 +107096,11 @@ void main() {
106997
107096
  pixels[px + 1] = 0;
106998
107097
  pixels[px + 2] = 0;
106999
107098
  pixels[px + 3] = 0;
107099
+ // `=== false`, not falsy: the map records what has been HIDDEN and never covers
107100
+ // every label. `setSliceLabelsFromImageData` already reads it this way; reading it
107101
+ // as falsy here made any label the map did not mention render as invisible.
107000
107102
  }
107001
- else if (channelVisible && !channelVisible[label]) {
107103
+ else if ((channelVisible === null || channelVisible === void 0 ? void 0 : channelVisible[label]) === false) {
107002
107104
  pixels[px] = 0;
107003
107105
  pixels[px + 1] = 0;
107004
107106
  pixels[px + 2] = 0;
@@ -107140,6 +107242,48 @@ void main() {
107140
107242
  this.data.fill(0);
107141
107243
  this.version++;
107142
107244
  }
107245
+ /**
107246
+ * Zero every voxel carrying one label, leaving every other label in place.
107247
+ *
107248
+ * The third member of the clear family: `clear()` takes the whole volume and
107249
+ * `clearSlice()` takes one slice, both regardless of label. Deleting a single
107250
+ * annotation needs neither — its mask is one label inside a volume it shares with
107251
+ * every other annotation on that layer, so anything coarser takes the neighbours
107252
+ * with it.
107253
+ *
107254
+ * Label-based volumes only, which is what `numChannels === 1` means here: the voxel
107255
+ * value IS the label. A multi-plane volume stores channels as separate planes and
107256
+ * would need a different sweep.
107257
+ *
107258
+ * The version is bumped only when a voxel actually changed. Every derived cache keyed
107259
+ * on it — the contour cache above all — is invalidated by a bump, so bumping for a
107260
+ * clear that found nothing would redraw the layer for no reason.
107261
+ *
107262
+ * @param channel Label to erase, 1-255. Zero is "empty", not a channel.
107263
+ * @throws {RangeError} If `channel` is outside [1, 255].
107264
+ *
107265
+ * @example
107266
+ * ```ts
107267
+ * vol.clearChannel(3); // finding 3's voxels go; 1, 2 and 4 stay
107268
+ * ```
107269
+ */
107270
+ clearChannel(channel) {
107271
+ // Upper bound is what a Uint8 label can hold. Task 5 of the channel-cap work
107272
+ // replaces both this and setChannelColor's guard with one MAX_ENGINE_CHANNEL.
107273
+ if (!Number.isInteger(channel) || channel < 1 || channel > 255) {
107274
+ throw new RangeError(`Invalid channel to clear: ${channel} (valid range: 1-255; 0 is empty)`);
107275
+ }
107276
+ const data = this.data;
107277
+ let changed = false;
107278
+ for (let i = 0; i < data.length; i++) {
107279
+ if (data[i] === channel) {
107280
+ data[i] = 0;
107281
+ changed = true;
107282
+ }
107283
+ }
107284
+ if (changed)
107285
+ this.version++;
107286
+ }
107143
107287
  /**
107144
107288
  * Check if the volume contains any non-zero voxel data.
107145
107289
  *
@@ -112829,6 +112973,70 @@ void main() {
112829
112973
  * Created by NrrdTools which passes in a shared CanvasState.
112830
112974
  */
112831
112975
  class DrawToolCore {
112976
+ setAnnotationSuspended(suspended) {
112977
+ this.annotationSuspended = suspended;
112978
+ }
112979
+ isAnnotationSuspended() {
112980
+ return this.annotationSuspended;
112981
+ }
112982
+ /**
112983
+ * Left/right button press on the drawing canvas.
112984
+ *
112985
+ * Named rather than inlined into `draw()` so the suspension gate below can be exercised
112986
+ * directly: it is the single point that decides whether an input may modify a mask.
112987
+ */
112988
+ onCanvasPointerDown(e) {
112989
+ if (this.drawingTool.isActive || this.panTool.isActive) {
112990
+ this.state.protectedData.ctxes.drawingLayerMasterCtx.closePath();
112991
+ return;
112992
+ }
112993
+ if (this.paintSliceIndex !== this.state.protectedData.mainPreSlices.index) {
112994
+ this.paintSliceIndex = this.state.protectedData.mainPreSlices.index;
112995
+ }
112996
+ // Suppress wheel only when starting a draw operation
112997
+ if (this.eventRouter.getMode() === 'draw') {
112998
+ this.activeWheelMode = 'none';
112999
+ }
113000
+ if (e.button === 0) {
113001
+ // Every branch that can write into a mask is gated; the crosshair below is a
113002
+ // read-only probe and stays available, as do pan (button 2) and the wheel.
113003
+ if (this.annotationSuspended && !this.eventRouter.isCrosshairEnabled()) {
113004
+ return;
113005
+ }
113006
+ if (this.eventRouter.getMode() === 'aiAssist') {
113007
+ this.aiAssistTool.onPointerDown(e);
113008
+ }
113009
+ else if (this.eventRouter.getMode() === 'draw') {
113010
+ this.drawingTool.onPointerDown(e);
113011
+ }
113012
+ else if (this.eventRouter.isCrosshairEnabled()) {
113013
+ this.state.nrrd_states.interaction.cursorPageX =
113014
+ e.offsetX / this.state.nrrd_states.view.sizeFactor;
113015
+ this.state.nrrd_states.interaction.cursorPageY =
113016
+ e.offsetY / this.state.nrrd_states.view.sizeFactor;
113017
+ this.enableCrosshair();
113018
+ }
113019
+ else if (this.state.gui_states.mode.sphereBrush && !this.eventRouter.isCrosshairEnabled()) {
113020
+ // SphereBrush: direct click (no Shift needed)
113021
+ this.activeWheelMode = 'sphereBrush';
113022
+ this.sphereBrushTool.onSphereBrushClick(e);
113023
+ }
113024
+ else if (this.state.gui_states.mode.sphereEraser && !this.eventRouter.isCrosshairEnabled()) {
113025
+ // SphereEraser: direct click (Shift handled at mode level)
113026
+ this.activeWheelMode = 'sphereBrush';
113027
+ this.sphereBrushTool.onSphereEraserClick(e);
113028
+ }
113029
+ else if (this.state.gui_states.mode.sphere && !this.eventRouter.isCrosshairEnabled()) {
113030
+ this.handleSphereClick(e);
113031
+ }
113032
+ }
113033
+ else if (e.button === 2) {
113034
+ this.panTool.onPointerDown(e);
113035
+ }
113036
+ else {
113037
+ return;
113038
+ }
113039
+ }
112832
113040
  constructor(container, state) {
112833
113041
  this.drawingPrameters = {
112834
113042
  handleOnDrawingMouseDown: (ev) => { },
@@ -112857,6 +113065,17 @@ void main() {
112857
113065
  this.undoManager = new UndoManager();
112858
113066
  /** Slice index recorded when paintOnCanvas() starts, guards stale-click */
112859
113067
  this.paintSliceIndex = 0;
113068
+ /**
113069
+ * While true, no input may modify a mask: the pencil, brush, eraser, sphere and
113070
+ * sphere-brush branches below all no-op. Slice scrubbing, zoom, pan and the crosshair
113071
+ * stay live, because this exists for the window while a case's images are still
113072
+ * arriving -- the reader may look, but must not annotate.
113073
+ *
113074
+ * A UI that merely greys its own buttons does not achieve this: a tool selected before
113075
+ * the load began stays armed, and `afterLoadSlice` clears the undo stack every time a
113076
+ * slice lands, so a stroke made during loading cannot be taken back.
113077
+ */
113078
+ this.annotationSuspended = false;
112860
113079
  /** Wheel event dispatch mode — replaces manual wheel add/remove (Phase 2) */
112861
113080
  this.activeWheelMode = 'zoom';
112862
113081
  /**
@@ -113237,55 +113456,11 @@ void main() {
113237
113456
  this.drawingTool.createBrushTrackingHandler();
113238
113457
  // drawing move — delegated to DrawingTool
113239
113458
  this.drawingPrameters.handleOnDrawingMouseMove = (e) => {
113240
- this.drawingTool.onPointerMove(e);
113241
- };
113242
- this.drawingPrameters.handleOnDrawingMouseDown = (e) => {
113243
- if (this.drawingTool.isActive || this.panTool.isActive) {
113244
- this.state.protectedData.ctxes.drawingLayerMasterCtx.closePath();
113459
+ if (this.annotationSuspended)
113245
113460
  return;
113246
- }
113247
- if (this.paintSliceIndex !== this.state.protectedData.mainPreSlices.index) {
113248
- this.paintSliceIndex = this.state.protectedData.mainPreSlices.index;
113249
- }
113250
- // Suppress wheel only when starting a draw operation
113251
- if (this.eventRouter.getMode() === 'draw') {
113252
- this.activeWheelMode = 'none';
113253
- }
113254
- if (e.button === 0) {
113255
- if (this.eventRouter.getMode() === 'aiAssist') {
113256
- this.aiAssistTool.onPointerDown(e);
113257
- }
113258
- else if (this.eventRouter.getMode() === 'draw') {
113259
- this.drawingTool.onPointerDown(e);
113260
- }
113261
- else if (this.eventRouter.isCrosshairEnabled()) {
113262
- this.state.nrrd_states.interaction.cursorPageX =
113263
- e.offsetX / this.state.nrrd_states.view.sizeFactor;
113264
- this.state.nrrd_states.interaction.cursorPageY =
113265
- e.offsetY / this.state.nrrd_states.view.sizeFactor;
113266
- this.enableCrosshair();
113267
- }
113268
- else if (this.state.gui_states.mode.sphereBrush && !this.eventRouter.isCrosshairEnabled()) {
113269
- // SphereBrush: direct click (no Shift needed)
113270
- this.activeWheelMode = 'sphereBrush';
113271
- this.sphereBrushTool.onSphereBrushClick(e);
113272
- }
113273
- else if (this.state.gui_states.mode.sphereEraser && !this.eventRouter.isCrosshairEnabled()) {
113274
- // SphereEraser: direct click (Shift handled at mode level)
113275
- this.activeWheelMode = 'sphereBrush';
113276
- this.sphereBrushTool.onSphereEraserClick(e);
113277
- }
113278
- else if (this.state.gui_states.mode.sphere && !this.eventRouter.isCrosshairEnabled()) {
113279
- this.handleSphereClick(e);
113280
- }
113281
- }
113282
- else if (e.button === 2) {
113283
- this.panTool.onPointerDown(e);
113284
- }
113285
- else {
113286
- return;
113287
- }
113461
+ this.drawingTool.onPointerMove(e);
113288
113462
  };
113463
+ this.drawingPrameters.handleOnDrawingMouseDown = (e) => this.onCanvasPointerDown(e);
113289
113464
  // Route pointerdown through EventRouter
113290
113465
  this.eventRouter.setPointerDownHandler((e) => {
113291
113466
  // On slice-drag start, temporarily borrow the wheel as Scroll:Slice
@@ -115600,6 +115775,67 @@ void main() {
115600
115775
  }
115601
115776
  }
115602
115777
  }
115778
+ /**
115779
+ * Erase one channel's mask on one layer, undoably.
115780
+ *
115781
+ * The missing third of the clear family that `executeAction` exposes:
115782
+ * `clearActiveSliceMask` takes one slice, `clearActiveLayerMask` takes a whole layer,
115783
+ * and neither can take a single label. Deleting one annotation needs exactly that —
115784
+ * its mask is one label inside a volume shared with every other annotation on the
115785
+ * layer.
115786
+ *
115787
+ * Not folded into `executeAction`: that signature is an action name plus an options
115788
+ * bag, and this needs two required arguments.
115789
+ *
115790
+ * Deltas go onto the engine's own undo stack, so a mistaken clear is recoverable for
115791
+ * as long as the case stays open. That is the whole reason this lives here rather
115792
+ * than in the app: writing zeros from outside and forcing a repaint by stepping the
115793
+ * slice would bypass the stack, and an accidental clear would be permanent.
115794
+ *
115795
+ * Only slices that actually carry the label are touched, so a small annotation in a
115796
+ * deep volume costs a scan and a handful of callbacks rather than one per slice.
115797
+ *
115798
+ * @param layerId Layer whose mask to edit.
115799
+ * @param channel Label to erase, 1-255.
115800
+ * @throws {Error} If `layerId` names no layer. Deliberately NOT routed through
115801
+ * `getVolumeForLayer`, which warns and falls back to the first layer — for a
115802
+ * destructive call that would quietly erase a different layer's annotation.
115803
+ * @throws {RangeError} If `channel` is outside [1, 255] (from `MaskVolume`).
115804
+ */
115805
+ clearChannel(layerId, channel) {
115806
+ const volume = this.state.protectedData.maskData.volumes[layerId];
115807
+ if (!volume) {
115808
+ const known = this.state.nrrd_states.image.layers.join(", ");
115809
+ throw new Error(`clearChannel: unknown layer "${layerId}" (known layers: ${known})`);
115810
+ }
115811
+ const { depth } = volume.getDimensions();
115812
+ // Snapshot before mutating: `oldSlice` is what undo restores.
115813
+ const deltas = [];
115814
+ for (let z = 0; z < depth; z++) {
115815
+ const slice = volume.getSliceUint8(z, "z").data;
115816
+ if (!slice.some((v) => v === channel))
115817
+ continue;
115818
+ deltas.push({
115819
+ layerId,
115820
+ axis: "z",
115821
+ sliceIndex: z,
115822
+ oldSlice: slice.slice(),
115823
+ newSlice: new Uint8Array(0), // filled below, once the clear has run
115824
+ });
115825
+ }
115826
+ if (deltas.length === 0)
115827
+ return; // nothing drawn on this channel
115828
+ volume.clearChannel(channel);
115829
+ for (const delta of deltas) {
115830
+ delta.newSlice = volume.getSliceUint8(delta.sliceIndex, "z").data.slice();
115831
+ }
115832
+ this.drawCore.undoManager.pushGroup(deltas);
115833
+ for (const delta of deltas) {
115834
+ const { data, width, height } = volume.getSliceUint8(delta.sliceIndex, "z");
115835
+ this.state.annotationCallbacks.onMaskChanged(data, layerId, channel, delta.sliceIndex, "z", width, height, false);
115836
+ }
115837
+ this.reloadMasksFromVolume();
115838
+ }
115603
115839
  // ═══════════════════════════════════════════════════════════════════════════
115604
115840
  // 4. Public API — Keyboard & History
115605
115841
  // ═══════════════════════════════════════════════════════════════════════════
@@ -116088,6 +116324,22 @@ void main() {
116088
116324
  this.reloadMasksFromVolume();
116089
116325
  }
116090
116326
  isAiAssistActive() { return this._aiAssistActive; }
116327
+ /**
116328
+ * Suspend or resume annotation input.
116329
+ *
116330
+ * While suspended the reader may still scrub slices, zoom, pan and place the crosshair,
116331
+ * but no input can write into a mask. This is the enforcement behind "during loading you
116332
+ * may preview, not annotate": greying the Operation panel's buttons does not achieve it,
116333
+ * because a tool selected before the load began stays armed on the canvas -- and a stroke
116334
+ * made then cannot even be undone, since `afterLoadSlice` clears the undo stack each time
116335
+ * a slice arrives.
116336
+ */
116337
+ setAnnotationSuspended(suspended) {
116338
+ this.drawCore.setAnnotationSuspended(suspended);
116339
+ }
116340
+ isAnnotationSuspended() {
116341
+ return this.drawCore.isAnnotationSuspended();
116342
+ }
116091
116343
  /**
116092
116344
  * Enter AI-assist mode (sandbox): hides the existing layer masks so ONLY the
116093
116345
  * AI overlay is shown, takes canvas ownership (left-click = prompt), and creates
@@ -117591,15 +117843,15 @@ void main() {
117591
117843
  }
117592
117844
 
117593
117845
  // import * as kiwrious from "copper3d_plugin_heart_k";
117594
- // "v3.10.0" is injected at build time by rollup @rollup/plugin-replace, sourced from package.json version.
117846
+ // "v3.10.2" is injected at build time by rollup @rollup/plugin-replace, sourced from package.json version.
117595
117847
  // When copper3d is consumed from local source (no rollup replace step), the identifier is undefined and
117596
117848
  // referencing it throws a ReferenceError — guard it so local loading still works.
117597
117849
  let _revision = "unknown";
117598
117850
  try {
117599
- _revision = "v3.10.0";
117851
+ _revision = "v3.10.2";
117600
117852
  }
117601
117853
  catch (_a) {
117602
- /* "v3.10.0" not injected (local source build) */
117854
+ /* "v3.10.2" not injected (local source build) */
117603
117855
  }
117604
117856
  const REVISION = _revision;
117605
117857
  // Expose on global so the version can be read in a production browser console via window.__COPPER3D_VERSION__
@@ -117620,6 +117872,7 @@ void main() {
117620
117872
  exports.DEFAULT_AXES = DEFAULT_AXES;
117621
117873
  exports.DEFAULT_TARGET_GREY = DEFAULT_TARGET_GREY;
117622
117874
  exports.GaussianSmoother = GaussianSmoother;
117875
+ exports.MAX_ENGINE_CHANNEL = MAX_ENGINE_CHANNEL;
117623
117876
  exports.MeshNodeTool = MeshNodeTool;
117624
117877
  exports.NrrdTools = NrrdTools;
117625
117878
  exports.REVISION = REVISION;
package/dist/index.d.ts CHANGED
@@ -58,9 +58,10 @@ import { GuiState } from "./Utils/segmentation/coreTools/GuiState";
58
58
  import type { ToolMode, IAnnotationCallbacks } from "./Utils/segmentation/core/types";
59
59
  import { CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss } from "./Utils/segmentation/core/index";
60
60
  import type { LayerId, ChannelValue } from "./Utils/segmentation/core/index";
61
+ import { MAX_ENGINE_CHANNEL } from "./Utils/segmentation/core/index";
61
62
  import type { AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult } from "./Utils/segmentation/tools/AiAssistTool";
62
63
  import "./css/style.css";
63
64
  export declare const REVISION: string;
64
- 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, 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, DEFAULT_AXES, ensureAxisExtracted, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, };
65
+ 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, DEFAULT_AXES, ensureAxisExtracted, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, };
65
66
  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, 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, };
66
67
  export type { CameraViewPreset } from "./Controls/orbitFraming";
package/dist/index.js CHANGED
@@ -38,6 +38,7 @@ import { easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPos
38
38
  import { installFastSliceRepaint } from "./Loader/fastSliceRepaint";
39
39
  import { SurfaceAnnotator } from "./Utils/surfaceAnnotation";
40
40
  import { CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss } from "./Utils/segmentation/core/index";
41
+ import { MAX_ENGINE_CHANNEL } from "./Utils/segmentation/core/index";
41
42
  import "./css/style.css";
42
43
  // __REVISION__ is injected at build time by rollup @rollup/plugin-replace, sourced from package.json version.
43
44
  // When copper3d is consumed from local source (no rollup replace step), the identifier is undefined and
@@ -57,5 +58,5 @@ if (typeof window !== "undefined") {
57
58
  if (typeof console !== "undefined") {
58
59
  console.log(`%cCopper3D Visualisation %c${REVISION}`, "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
59
60
  }
60
- 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, 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, DEFAULT_AXES, ensureAxisExtracted, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, };
61
+ 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, DEFAULT_AXES, ensureAxisExtracted, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, };
61
62
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD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ChB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,YAAY,EACZ,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,eAAe,EACf,uBAAuB,GACxB,CAAC"}
@@ -47,6 +47,26 @@ export declare class DrawToolCore {
47
47
  aiAssistTool: AiAssistTool;
48
48
  /** Slice index recorded when paintOnCanvas() starts, guards stale-click */
49
49
  private paintSliceIndex;
50
+ /**
51
+ * While true, no input may modify a mask: the pencil, brush, eraser, sphere and
52
+ * sphere-brush branches below all no-op. Slice scrubbing, zoom, pan and the crosshair
53
+ * stay live, because this exists for the window while a case's images are still
54
+ * arriving -- the reader may look, but must not annotate.
55
+ *
56
+ * A UI that merely greys its own buttons does not achieve this: a tool selected before
57
+ * the load began stays armed, and `afterLoadSlice` clears the undo stack every time a
58
+ * slice lands, so a stroke made during loading cannot be taken back.
59
+ */
60
+ private annotationSuspended;
61
+ setAnnotationSuspended(suspended: boolean): void;
62
+ isAnnotationSuspended(): boolean;
63
+ /**
64
+ * Left/right button press on the drawing canvas.
65
+ *
66
+ * Named rather than inlined into `draw()` so the suspension gate below can be exercised
67
+ * directly: it is the single point that decides whether an input may modify a mask.
68
+ */
69
+ onCanvasPointerDown(e: MouseEvent): void;
50
70
  /** Wheel event dispatch mode — replaces manual wheel add/remove (Phase 2) */
51
71
  private activeWheelMode;
52
72
  /**