vitessce 4.0.3 → 4.0.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.
@@ -1,15 +1,15 @@
1
1
  var xe = Object.defineProperty;
2
2
  var ye = (t, e, a) => e in t ? xe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
3
- var k = (t, e, a) => ye(t, typeof e != "symbol" ? e + "" : e, a);
4
- import { jsxs as $, jsx as p, Fragment as be } from "react/jsx-runtime";
5
- import ae, { useRef as Q, useState as G, useEffect as q, Suspense as ee, forwardRef as Se } from "react";
3
+ var O = (t, e, a) => ye(t, typeof e != "symbol" ? e + "" : e, a);
4
+ import { jsxs as H, jsx as _, Fragment as be } from "react/jsx-runtime";
5
+ import ae, { useRef as Q, useState as X, useEffect as q, Suspense as ee, forwardRef as Se } from "react";
6
6
  import { Canvas as Ce } from "@react-three/fiber";
7
7
  import { Center as ze, Text as ve, Line as Te, Bvh as we, OrbitControls as Me } from "@react-three/drei";
8
- import { Matrix3 as Le, Matrix4 as ie, Vector3 as L, Vector2 as j, UniformsUtils as Pe, Data3DTexture as Ae, RedFormat as De, FloatType as Ie, LinearFilter as ge, FrontSide as _e, Scene as Fe, Group as Ee, MeshPhysicalMaterial as Re, MeshBasicMaterial as Ve, MeshStandardMaterial as Oe, BackSide as ke } from "three";
9
- import { C as N, g as Ue } from "./index-C0mQDzdh.js";
8
+ import { Matrix3 as Le, Matrix4 as ie, Vector3 as P, Vector2 as G, UniformsUtils as Pe, Data3DTexture as Ae, RedFormat as De, FloatType as Ie, LinearFilter as ge, FrontSide as _e, Scene as Fe, Group as Ee, MeshPhysicalMaterial as Re, MeshBasicMaterial as Ve, MeshStandardMaterial as Oe, BackSide as ke } from "three";
9
+ import { C as j, g as Ue } from "./index-BxR_MGzQ.js";
10
10
  function Ne({ currentLine: t, scale: e }) {
11
11
  const a = Q(null);
12
- return $("group", { children: [p(ze, { bottom: !0, right: !0, position: [t.midPoint.x, t.midPoint.y, t.midPoint.z], rotation: [0, 0, 0], children: p(ve, { color: "gray", scale: 0.05, ref: a, children: `${(t.startPoint.distanceTo(t.endPoint) * e).toFixed(2)} µm` }) }), p(Te, {
12
+ return H("group", { children: [_(ze, { bottom: !0, right: !0, position: [t.midPoint.x, t.midPoint.y, t.midPoint.z], rotation: [0, 0, 0], children: _(ve, { color: "gray", scale: 0.05, ref: a, children: `${(t.startPoint.distanceTo(t.endPoint) * e).toFixed(2)} µm` }) }), _(Te, {
13
13
  points: [t.startPoint, t.endPoint],
14
14
  color: "white",
15
15
  lineWidth: 2,
@@ -26,39 +26,39 @@ class je {
26
26
  * @param {ArrayBuffer} arrayBuffer The buffer with volume data
27
27
  */
28
28
  constructor(e, a, o, i, l) {
29
- k(this, "spacing", [1, 1, 1]);
29
+ O(this, "spacing", [1, 1, 1]);
30
30
  // Offset of the volume in the RAS coordinate system
31
- k(this, "offset", [0, 0, 0]);
31
+ O(this, "offset", [0, 0, 0]);
32
32
  // The IJK to RAS matrix
33
- k(this, "matrix", new Le().identity());
33
+ O(this, "matrix", new Le().identity());
34
34
  // The list of all the slices associated to this volume
35
- k(this, "sliceList", []);
35
+ O(this, "sliceList", []);
36
36
  /**
37
37
  * The voxels with values under this
38
38
  * threshold won't appear in the slices.
39
39
  * If changed, geometryNeedsUpdate is automatically set to true on all
40
40
  * the slices associated to this volume
41
41
  */
42
- k(this, "lowerThresholdValue", -1 / 0);
42
+ O(this, "lowerThresholdValue", -1 / 0);
43
43
  /**
44
44
  * The voxels with values over this
45
45
  * threshold won't appear in the slices.
46
46
  * If changed, geometryNeedsUpdate is automatically set to true on all
47
47
  * the slices associated to this volume
48
48
  */
49
- k(this, "upperThresholdValue", 1 / 0);
49
+ O(this, "upperThresholdValue", 1 / 0);
50
50
  // Width of the volume in the IJK coordinate system
51
- k(this, "xLength", 1);
51
+ O(this, "xLength", 1);
52
52
  // Height of the volume in the IJK coordinate system
53
- k(this, "yLength", 1);
53
+ O(this, "yLength", 1);
54
54
  // Depth of the volume in the IJK coordinate system
55
- k(this, "zLength", 1);
55
+ O(this, "zLength", 1);
56
56
  // Data of the volume
57
- k(this, "data");
58
- k(this, "RASDimensions");
59
- k(this, "inverseMatrix");
60
- k(this, "min");
61
- k(this, "max");
57
+ O(this, "data");
58
+ O(this, "RASDimensions");
59
+ O(this, "inverseMatrix");
60
+ O(this, "min");
61
+ O(this, "max");
62
62
  if (e !== void 0) {
63
63
  switch (this.xLength = Number(e) || 1, this.yLength = Number(a) || 1, this.zLength = Number(o) || 1, i) {
64
64
  case "Uint8":
@@ -192,35 +192,35 @@ class je {
192
192
  */
193
193
  extractPerpendicularPlane(e, a) {
194
194
  const o = new ie().identity(), i = this;
195
- let l, n, m, x;
196
- const g = new L(), r = new L(), c = new L(), T = new L(this.xLength, this.yLength, this.zLength);
195
+ let l, n, g, p;
196
+ const m = new P(), c = new P(), s = new P(), w = new P(this.xLength, this.yLength, this.zLength);
197
197
  switch (e) {
198
198
  case "x":
199
- g.set(1, 0, 0), r.set(0, 0, -1), c.set(0, -1, 0), l = this.spacing[2], n = this.spacing[1], x = new L(a, 0, 0), o.multiply(new ie().makeRotationY(Math.PI / 2)), m = (i.RASDimensions[0] - 1) / 2, o.setPosition(new L(a - m, 0, 0));
199
+ m.set(1, 0, 0), c.set(0, 0, -1), s.set(0, -1, 0), l = this.spacing[2], n = this.spacing[1], p = new P(a, 0, 0), o.multiply(new ie().makeRotationY(Math.PI / 2)), g = (i.RASDimensions[0] - 1) / 2, o.setPosition(new P(a - g, 0, 0));
200
200
  break;
201
201
  case "y":
202
- g.set(0, 1, 0), r.set(1, 0, 0), c.set(0, 0, 1), l = this.spacing[0], n = this.spacing[2], x = new L(0, a, 0), o.multiply(new ie().makeRotationX(-Math.PI / 2)), m = (i.RASDimensions[1] - 1) / 2, o.setPosition(new L(0, a - m, 0));
202
+ m.set(0, 1, 0), c.set(1, 0, 0), s.set(0, 0, 1), l = this.spacing[0], n = this.spacing[2], p = new P(0, a, 0), o.multiply(new ie().makeRotationX(-Math.PI / 2)), g = (i.RASDimensions[1] - 1) / 2, o.setPosition(new P(0, a - g, 0));
203
203
  break;
204
204
  case "z":
205
205
  default:
206
- g.set(0, 0, 1), r.set(1, 0, 0), c.set(0, -1, 0), l = this.spacing[0], n = this.spacing[1], x = new L(0, 0, a), m = (i.RASDimensions[2] - 1) / 2, o.setPosition(new L(0, 0, a - m));
206
+ m.set(0, 0, 1), c.set(1, 0, 0), s.set(0, -1, 0), l = this.spacing[0], n = this.spacing[1], p = new P(0, 0, a), g = (i.RASDimensions[2] - 1) / 2, o.setPosition(new P(0, 0, a - g));
207
207
  break;
208
208
  }
209
- r.applyMatrix4(i.inverseMatrix).normalize(), r.argVar = "i", c.applyMatrix4(i.inverseMatrix).normalize(), c.argVar = "j", g.applyMatrix4(i.inverseMatrix).normalize();
210
- const d = Math.floor(Math.abs(r.dot(T))), I = Math.floor(Math.abs(c.dot(T))), y = Math.abs(d * l), w = Math.abs(I * n);
211
- x = Math.abs(Math.round(x.applyMatrix4(i.inverseMatrix).dot(g)));
212
- const _ = [new L(1, 0, 0), new L(0, 1, 0), new L(0, 0, 1)], v = [r, c, g].find((P) => Math.abs(P.dot(_[0])) > 0.9), C = [r, c, g].find((P) => Math.abs(P.dot(_[1])) > 0.9), h = [r, c, g].find((P) => Math.abs(P.dot(_[2])) > 0.9);
213
- function R(P, f) {
214
- const z = v === g ? x : v.argVar === "i" ? P : f, U = C === g ? x : C.argVar === "i" ? P : f, F = h === g ? x : h.argVar === "i" ? P : f, H = v.dot(_[0]) > 0 ? z : i.xLength - 1 - z, W = C.dot(_[1]) > 0 ? U : i.yLength - 1 - U, Z = h.dot(_[2]) > 0 ? F : i.zLength - 1 - F;
215
- return i.access(H, W, Z);
209
+ c.applyMatrix4(i.inverseMatrix).normalize(), c.argVar = "i", s.applyMatrix4(i.inverseMatrix).normalize(), s.argVar = "j", m.applyMatrix4(i.inverseMatrix).normalize();
210
+ const x = Math.floor(Math.abs(c.dot(w))), z = Math.floor(Math.abs(s.dot(w))), f = Math.abs(x * l), M = Math.abs(z * n);
211
+ p = Math.abs(Math.round(p.applyMatrix4(i.inverseMatrix).dot(m)));
212
+ const v = [new P(1, 0, 0), new P(0, 1, 0), new P(0, 0, 1)], h = [c, s, m].find((A) => Math.abs(A.dot(v[0])) > 0.9), C = [c, s, m].find((A) => Math.abs(A.dot(v[1])) > 0.9), d = [c, s, m].find((A) => Math.abs(A.dot(v[2])) > 0.9);
213
+ function F(A, y) {
214
+ const T = h === m ? p : h.argVar === "i" ? A : y, k = C === m ? p : C.argVar === "i" ? A : y, U = d === m ? p : d.argVar === "i" ? A : y, N = h.dot(v[0]) > 0 ? T : i.xLength - 1 - T, W = C.dot(v[1]) > 0 ? k : i.yLength - 1 - k, Z = d.dot(v[2]) > 0 ? U : i.zLength - 1 - U;
215
+ return i.access(N, W, Z);
216
216
  }
217
217
  return {
218
- iLength: d,
219
- jLength: I,
220
- sliceAccess: R,
218
+ iLength: x,
219
+ jLength: z,
220
+ sliceAccess: F,
221
221
  matrix: o,
222
- planeWidth: y,
223
- planeHeight: w
222
+ planeWidth: f,
223
+ planeHeight: M
224
224
  };
225
225
  }
226
226
  /**
@@ -242,24 +242,24 @@ class je {
242
242
  }
243
243
  const Ge = {
244
244
  uniforms: {
245
- u_size: { value: new L(1, 1, 1) },
245
+ u_size: { value: new P(1, 1, 1) },
246
246
  u_renderstyle: { value: 0 },
247
247
  u_renderthreshold: { value: 0.5 },
248
248
  u_opacity: { value: 0.5 },
249
- u_clim: { value: new j(0.2, 0.8) },
250
- u_clim2: { value: new j(0.2, 0.8) },
251
- u_clim3: { value: new j(0.2, 0.8) },
252
- u_clim4: { value: new j(0.2, 0.8) },
253
- u_clim5: { value: new j(0.2, 0.8) },
254
- u_clim6: { value: new j(0.2, 0.8) },
255
- u_xClip: { value: new j(-1, 1e6) },
256
- u_yClip: { value: new j(-1, 1e6) },
257
- u_zClip: { value: new j(-1, 1e6) },
249
+ u_clim: { value: new G(0.2, 0.8) },
250
+ u_clim2: { value: new G(0.2, 0.8) },
251
+ u_clim3: { value: new G(0.2, 0.8) },
252
+ u_clim4: { value: new G(0.2, 0.8) },
253
+ u_clim5: { value: new G(0.2, 0.8) },
254
+ u_clim6: { value: new G(0.2, 0.8) },
255
+ u_xClip: { value: new G(-1, 1e6) },
256
+ u_yClip: { value: new G(-1, 1e6) },
257
+ u_zClip: { value: new G(-1, 1e6) },
258
258
  u_data: { value: null },
259
259
  u_stop_geom: { value: null },
260
260
  u_geo_color: { value: null },
261
- u_window_size: { value: new j(1, 1) },
262
- u_vol_scale: { value: new L(1, 1, 1) },
261
+ u_window_size: { value: new G(1, 1) },
262
+ u_vol_scale: { value: new P(1, 1, 1) },
263
263
  u_physical_Pixel: { value: 0.5 },
264
264
  volumeTex: { value: null },
265
265
  volumeTex2: { value: null },
@@ -267,12 +267,12 @@ const Ge = {
267
267
  volumeTex4: { value: null },
268
268
  volumeTex5: { value: null },
269
269
  volumeTex6: { value: null },
270
- u_color: { value: new L(0, 0, 0) },
271
- u_color2: { value: new L(0, 0, 0) },
272
- u_color3: { value: new L(0, 0, 0) },
273
- u_color4: { value: new L(0, 0, 0) },
274
- u_color5: { value: new L(0, 0, 0) },
275
- u_color6: { value: new L(0, 0, 0) },
270
+ u_color: { value: new P(0, 0, 0) },
271
+ u_color2: { value: new P(0, 0, 0) },
272
+ u_color3: { value: new P(0, 0, 0) },
273
+ u_color4: { value: new P(0, 0, 0) },
274
+ u_color5: { value: new P(0, 0, 0) },
275
+ u_color6: { value: new P(0, 0, 0) },
276
276
  u_cmdata: { value: null },
277
277
  near: { value: 0.1 },
278
278
  far: { value: 1e4 },
@@ -280,7 +280,7 @@ const Ge = {
280
280
  dtScale: { value: 1 },
281
281
  volumeCount: { value: 0 },
282
282
  finalGamma: { value: 0 },
283
- boxSize: { value: new L(1, 1, 1) }
283
+ boxSize: { value: new P(1, 1, 1) }
284
284
  },
285
285
  vertexShader: [
286
286
  "out vec3 rayDirUnnorm;",
@@ -524,8 +524,8 @@ const Ge = {
524
524
  additive: 2
525
525
  };
526
526
  function $e(t, e, a, o, i, l) {
527
- const { spatialRenderingMode: n } = l, m = i?.image?.instance?.getData();
528
- if (!m)
527
+ const { spatialRenderingMode: n } = l, p = i?.image?.instance?.getData(!1);
528
+ if (!p)
529
529
  return {
530
530
  channelsVisible: null,
531
531
  resolution: null,
@@ -541,122 +541,122 @@ function $e(t, e, a, o, i, l) {
541
541
  ySlice: null,
542
542
  zSlice: null
543
543
  };
544
- const x = i.image.instance, g = n === "3D", r = e[N.PHOTOMETRIC_INTERPRETATION] === "RGB", c = e[N.VOLUMETRIC_RENDERING_ALGORITHM], T = Xe[c], d = e[N.SPATIAL_LAYER_VISIBLE], I = e[N.SPATIAL_LAYER_OPACITY];
545
- x.isInterleaved();
546
- const y = r ? [
544
+ const m = i.image.instance, c = n === "3D", s = e[j.PHOTOMETRIC_INTERPRETATION] === "RGB", w = e[j.VOLUMETRIC_RENDERING_ALGORITHM], x = Xe[w], z = e[j.SPATIAL_LAYER_VISIBLE], f = e[j.SPATIAL_LAYER_OPACITY];
545
+ m.isInterleaved();
546
+ const M = s ? [
547
547
  [255, 0, 0],
548
548
  [0, 255, 0],
549
549
  [0, 0, 255]
550
- ] : a.map((F) => o[F][N.SPATIAL_CHANNEL_COLOR]), w = r ? [
550
+ ] : a.map((N) => o[N][j.SPATIAL_CHANNEL_COLOR]), v = s ? [
551
551
  [0, 255],
552
552
  [0, 255],
553
553
  [0, 255]
554
- ] : a.map((F) => o[F][N.SPATIAL_CHANNEL_WINDOW] || [0, 255]), _ = r ? [
554
+ ] : a.map((N) => o[N][j.SPATIAL_CHANNEL_WINDOW] || [0, 255]), h = s ? [
555
555
  // Layer visible AND channel visible
556
- d && !0,
557
- d && !0,
558
- d && !0
559
- ] : a.map((F) => (
556
+ z && !0,
557
+ z && !0,
558
+ z && !0
559
+ ] : a.map((N) => (
560
560
  // Layer visible AND channel visible
561
- d && o[F][N.SPATIAL_CHANNEL_VISIBLE]
562
- )), v = r ? [
561
+ z && o[N][j.SPATIAL_CHANNEL_VISIBLE]
562
+ )), C = s ? [
563
563
  // Layer visible AND channel visible
564
- d && !0,
565
- d && !0,
566
- d && !0
567
- ] : a.map((F) => (
564
+ z && !0,
565
+ z && !0,
566
+ z && !0
567
+ ] : a.map((N) => (
568
568
  // Layer visible AND channel visible
569
- d && x.getChannelIndex(o[F][N.SPATIAL_TARGET_C])
570
- )), C = x.getAutoTargetResolution(), h = e[N.SPATIAL_TARGET_RESOLUTION], R = h === null || Number.isNaN(h) ? C : h, P = i.image.loaders[0].channels ?? [];
571
- let f = e[N.SPATIAL_SLICE_X], z = e[N.SPATIAL_SLICE_Y], U = e[N.SPATIAL_SLICE_Z];
572
- return f = f !== null ? f : [-1, 1e5], z = z !== null ? z : [-1, 1e5], U = U !== null ? U : [-1, 1e5], {
573
- channelsVisible: _,
574
- allChannels: P,
575
- channelTargetC: v,
576
- resolution: R,
577
- data: m,
578
- colors: y,
579
- contrastLimits: w,
580
- is3dMode: g,
581
- renderingMode: T,
582
- layerTransparency: I,
583
- xSlice: f,
584
- ySlice: z,
569
+ z && m.getChannelIndex(o[N][j.SPATIAL_TARGET_C])
570
+ )), d = m.getAutoTargetResolution(), F = e[j.SPATIAL_TARGET_RESOLUTION], A = F === null || Number.isNaN(F) ? d : F, y = i.image.loaders[0].channels ?? [];
571
+ let T = e[j.SPATIAL_SLICE_X], k = e[j.SPATIAL_SLICE_Y], U = e[j.SPATIAL_SLICE_Z];
572
+ return T = T !== null ? T : [-1, 1e5], k = k !== null ? k : [-1, 1e5], U = U !== null ? U : [-1, 1e5], {
573
+ channelsVisible: h,
574
+ allChannels: y,
575
+ channelTargetC: C,
576
+ resolution: A,
577
+ data: p,
578
+ colors: M,
579
+ contrastLimits: v,
580
+ is3dMode: c,
581
+ renderingMode: x,
582
+ layerTransparency: f,
583
+ xSlice: T,
584
+ ySlice: k,
585
585
  zSlice: U
586
586
  };
587
587
  }
588
588
  function He(t, e, a, o, i) {
589
- const { images: l = {}, imageLayerScopes: n, imageLayerCoordination: m, imageChannelScopesByLayer: x, imageChannelCoordination: g } = t, r = n[0], c = x[r], T = m[0][r], d = g[0][r], { channelsVisible: I, allChannels: y, channelTargetC: w, resolution: _, data: v, colors: C, contrastLimits: h, is3dMode: R, renderingMode: P, layerTransparency: f, xSlice: z, ySlice: U, zSlice: F } = $e(r, T, c, d, l[r], t);
590
- return w !== null && (e.channelTargetC?.length !== 0 && (e.channelTargetC?.toString() !== w.toString() || e.resolution?.toString() !== _.toString()) ? o || i(!0) : (e.channelsVisible?.toString() !== I?.toString() || e.colors?.toString() !== C?.toString() || e.is3dMode !== R || e.contrastLimits?.toString() !== h?.toString() || e.renderingMode?.toString() !== P.toString() || e.layerTransparency.toString() !== f.toString() || e.xSlice?.toString() !== z.toString() || e.ySlice?.toString() !== U.toString() || e.zSlice?.toString() !== F.toString()) && (a({
591
- channelsVisible: I,
592
- allChannels: y,
593
- channelTargetC: w,
594
- resolution: _,
595
- data: v,
589
+ const { images: l = {}, imageLayerScopes: n, imageLayerCoordination: g, imageChannelScopesByLayer: p, imageChannelCoordination: m } = t, c = n[0], s = p[c], w = g[0][c], x = m[0][c], { channelsVisible: z, allChannels: f, channelTargetC: M, resolution: v, data: h, colors: C, contrastLimits: d, is3dMode: F, renderingMode: A, layerTransparency: y, xSlice: T, ySlice: k, zSlice: U } = $e(c, w, s, x, l[c], t);
590
+ return M !== null && (e.channelTargetC?.length !== 0 && (e.channelTargetC?.toString() !== M.toString() || e.resolution?.toString() !== v.toString()) ? o || i(!0) : (e.channelsVisible?.toString() !== z?.toString() || e.colors?.toString() !== C?.toString() || e.is3dMode !== F || e.contrastLimits?.toString() !== d?.toString() || e.renderingMode?.toString() !== A.toString() || e.layerTransparency.toString() !== y.toString() || e.xSlice?.toString() !== T.toString() || e.ySlice?.toString() !== k.toString() || e.zSlice?.toString() !== U.toString()) && (a({
591
+ channelsVisible: z,
592
+ allChannels: f,
593
+ channelTargetC: M,
594
+ resolution: v,
595
+ data: h,
596
596
  colors: C,
597
- contrastLimits: h,
598
- is3dMode: R,
599
- renderingMode: P,
600
- layerTransparency: f,
601
- xSlice: z,
602
- ySlice: U,
603
- zSlice: F
597
+ contrastLimits: d,
598
+ is3dMode: F,
599
+ renderingMode: A,
600
+ layerTransparency: y,
601
+ xSlice: T,
602
+ ySlice: k,
603
+ zSlice: U
604
604
  }), i(!1))), {
605
605
  images: l,
606
- layerScope: r,
606
+ layerScope: c,
607
607
  imageLayerScopes: n,
608
- imageLayerCoordination: m,
609
- imageChannelScopesByLayer: x,
610
- imageChannelCoordination: g,
611
- channelsVisible: I,
612
- allChannels: y,
613
- channelTargetC: w,
614
- resolution: _,
615
- data: v,
608
+ imageLayerCoordination: g,
609
+ imageChannelScopesByLayer: p,
610
+ imageChannelCoordination: m,
611
+ channelsVisible: z,
612
+ allChannels: f,
613
+ channelTargetC: M,
614
+ resolution: v,
615
+ data: h,
616
616
  colors: C,
617
- contrastLimits: h,
618
- is3dMode: R,
619
- renderingMode: P,
620
- layerTransparency: f,
621
- xSlice: z,
622
- ySlice: U,
623
- zSlice: F
617
+ contrastLimits: d,
618
+ is3dMode: F,
619
+ renderingMode: A,
620
+ layerTransparency: y,
621
+ xSlice: T,
622
+ ySlice: k,
623
+ zSlice: U
624
624
  };
625
625
  }
626
626
  function K(t, e) {
627
627
  const [a, o] = e;
628
628
  return (t - a) / Math.sqrt(o ** 2 - a ** 2);
629
629
  }
630
- function Ye(t, e, a, o, i, l, n, m, x, g, r, c, T) {
631
- t.boxSize.value.set(a.xLength, a.yLength, a.zLength), t.volumeTex.value = e.length > 0 ? e[0] : null, t.volumeTex2.value = e.length > 1 ? e[1] : null, t.volumeTex3.value = e.length > 2 ? e[2] : null, t.volumeTex4.value = e.length > 3 ? e[3] : null, t.volumeTex5.value = e.length > 4 ? e[4] : null, t.volumeTex6.value = e.length > 5 ? e[5] : null, t.near.value = 0.1, t.far.value = 3e3, t.alphaScale.value = 1, t.dtScale.value = m, t.finalGamma.value = 4.5, t.volumeCount.value = e.length, t.u_size.value.set(a.xLength, a.yLength, a.zLength), t.u_stop_geom.value = null, t.u_window_size.value.set(0, 0), t.u_vol_scale.value.set(1 / a.xLength, 1 / a.yLength, 1 / a.zLength * 2), t.u_renderstyle.value = i, t.u_clim.value.set(l.length > 0 ? l[0][0] : null, l.length > 0 ? l[0][1] : null), t.u_clim2.value.set(l.length > 1 ? l[1][0] : null, l.length > 1 ? l[1][1] : null), t.u_clim3.value.set(l.length > 2 ? l[2][0] : null, l.length > 2 ? l[2][1] : null), t.u_clim4.value.set(l.length > 3 ? l[3][0] : null, l.length > 3 ? l[3][1] : null), t.u_clim5.value.set(l.length > 4 ? l[4][0] : null, l.length > 4 ? l[4][1] : null), t.u_clim6.value.set(l.length > 5 ? l[5][0] : null, l.length > 5 ? l[5][1] : null), t.u_xClip.value.set(x[0] * (1 / c[0]) / T[0] * a.xLength, x[1] * (1 / c[0]) / T[0] * a.xLength), t.u_yClip.value.set(g[0] * (1 / c[1]) / T[1] * a.yLength, g[1] * (1 / c[1]) / T[1] * a.yLength), t.u_zClip.value.set(r[0] * (1 / c[2]) / T[2] * a.zLength, r[1] * (1 / c[1]) / T[2] * a.zLength), t.u_color.value.set(n.length > 0 ? n[0][0] : null, n.length > 0 ? n[0][1] : null, n.length > 0 ? n[0][2] : null), t.u_color2.value.set(n.length > 1 ? n[1][0] : null, n.length > 1 ? n[1][1] : null, n.length > 1 ? n[1][2] : null), t.u_color3.value.set(n.length > 2 ? n[2][0] : null, n.length > 2 ? n[2][1] : null, n.length > 2 ? n[2][2] : null), t.u_color4.value.set(n.length > 3 ? n[3][0] : null, n.length > 3 ? n[3][1] : null, n.length > 3 ? n[3][2] : null), t.u_color5.value.set(n.length > 4 ? n[4][0] : null, n.length > 4 ? n[4][1] : null, n.length > 4 ? n[4][2] : null), t.u_color6.value.set(n.length > 5 ? n[5][0] : null, n.length > 5 ? n[5][1] : null, n.length > 5 ? n[5][2] : null);
630
+ function Ye(t, e, a, o, i, l, n, g, p, m, c, s, w) {
631
+ t.boxSize.value.set(a.xLength, a.yLength, a.zLength), t.volumeTex.value = e.length > 0 ? e[0] : null, t.volumeTex2.value = e.length > 1 ? e[1] : null, t.volumeTex3.value = e.length > 2 ? e[2] : null, t.volumeTex4.value = e.length > 3 ? e[3] : null, t.volumeTex5.value = e.length > 4 ? e[4] : null, t.volumeTex6.value = e.length > 5 ? e[5] : null, t.near.value = 0.1, t.far.value = 3e3, t.alphaScale.value = 1, t.dtScale.value = g, t.finalGamma.value = 4.5, t.volumeCount.value = e.length, t.u_size.value.set(a.xLength, a.yLength, a.zLength), t.u_stop_geom.value = null, t.u_window_size.value.set(0, 0), t.u_vol_scale.value.set(1 / a.xLength, 1 / a.yLength, 1 / a.zLength * 2), t.u_renderstyle.value = i, t.u_clim.value.set(l.length > 0 ? l[0][0] : null, l.length > 0 ? l[0][1] : null), t.u_clim2.value.set(l.length > 1 ? l[1][0] : null, l.length > 1 ? l[1][1] : null), t.u_clim3.value.set(l.length > 2 ? l[2][0] : null, l.length > 2 ? l[2][1] : null), t.u_clim4.value.set(l.length > 3 ? l[3][0] : null, l.length > 3 ? l[3][1] : null), t.u_clim5.value.set(l.length > 4 ? l[4][0] : null, l.length > 4 ? l[4][1] : null), t.u_clim6.value.set(l.length > 5 ? l[5][0] : null, l.length > 5 ? l[5][1] : null), t.u_xClip.value.set(p[0] * (1 / s[0]) / w[0] * a.xLength, p[1] * (1 / s[0]) / w[0] * a.xLength), t.u_yClip.value.set(m[0] * (1 / s[1]) / w[1] * a.yLength, m[1] * (1 / s[1]) / w[1] * a.yLength), t.u_zClip.value.set(c[0] * (1 / s[2]) / w[2] * a.zLength, c[1] * (1 / s[1]) / w[2] * a.zLength), t.u_color.value.set(n.length > 0 ? n[0][0] : null, n.length > 0 ? n[0][1] : null, n.length > 0 ? n[0][2] : null), t.u_color2.value.set(n.length > 1 ? n[1][0] : null, n.length > 1 ? n[1][1] : null, n.length > 1 ? n[1][2] : null), t.u_color3.value.set(n.length > 2 ? n[2][0] : null, n.length > 2 ? n[2][1] : null, n.length > 2 ? n[2][2] : null), t.u_color4.value.set(n.length > 3 ? n[3][0] : null, n.length > 3 ? n[3][1] : null, n.length > 3 ? n[3][2] : null), t.u_color5.value.set(n.length > 4 ? n[4][0] : null, n.length > 4 ? n[4][1] : null, n.length > 4 ? n[4][2] : null), t.u_color6.value.set(n.length > 5 ? n[5][0] : null, n.length > 5 ? n[5][1] : null, n.length > 5 ? n[5][2] : null);
632
632
  }
633
- function de(t, e, a, o, i, l, n, m, x, g, r, c, T, d) {
634
- const I = [], y = [], w = [];
635
- let _ = null, v = m;
636
- if (v == null || !Array.isArray(v) || v.length < 3)
637
- v = [
638
- { size: v?.[0]?.size ?? 1 },
639
- { size: v?.[1]?.size ?? 1 },
640
- { size: v?.[2]?.size ?? 1 }
633
+ function de(t, e, a, o, i, l, n, g, p, m, c, s, w, x) {
634
+ const z = [], f = [], M = [];
635
+ let v = null, h = g;
636
+ if (h == null || !Array.isArray(h) || h.length < 3)
637
+ h = [
638
+ { size: h?.[0]?.size ?? 1 },
639
+ { size: h?.[1]?.size ?? 1 },
640
+ { size: h?.[2]?.size ?? 1 }
641
641
  ];
642
642
  else
643
- for (let f = 0; f < v.length; f++)
644
- (!v[f] || v[f].size === void 0 || v[f].size === null) && (v[f] = { size: 1 });
645
- if (e.forEach((f, z) => {
646
- a[z] && (_ = t.get(f), I.push(i.get(f)), y.push([o[z][0] / 255, o[z][1] / 255, o[z][2] / 255]), l[z][0] === 0 && l[z][1] === 255 ? w.push([
647
- K(n.get(f)[0], n.get(f)),
648
- K(n.get(f)[1], n.get(f))
649
- ]) : w.push([
650
- K(l[z][0], n.get(f)),
651
- K(l[z][1], n.get(f))
643
+ for (let y = 0; y < h.length; y++)
644
+ (!h[y] || h[y].size === void 0 || h[y].size === null) && (h[y] = { size: 1 });
645
+ if (e.forEach((y, T) => {
646
+ a[T] && (v = t.get(y), z.push(i.get(y)), f.push([o[T][0] / 255, o[T][1] / 255, o[T][2] / 255]), l[T][0] === 0 && l[T][1] === 255 ? M.push([
647
+ K(n.get(y)[0], n.get(y)),
648
+ K(n.get(y)[1], n.get(y))
649
+ ]) : M.push([
650
+ K(l[T][0], n.get(y)),
651
+ K(l[T][1], n.get(y))
652
652
  ]));
653
- }), _ === null)
653
+ }), v === null)
654
654
  return null;
655
- const C = _, h = {}, R = Ge, P = Pe.clone(R.uniforms);
656
- return Ye(P, I, C, h, x, w, y, g, r, c, T, [v[0].size, v[1].size, v[2] ? v[2].size : 1], d), [
657
- P,
658
- R,
659
- [1, v[1].size / v[0].size, v[2] ? v[2].size / v[0].size : 1],
655
+ const C = v, d = {}, F = Ge, A = Pe.clone(F.uniforms);
656
+ return Ye(A, z, C, d, p, M, f, m, c, s, w, [h[0].size, h[1].size, h[2] ? h[2].size : 1], x), [
657
+ A,
658
+ F,
659
+ [1, h[1].size / h[0].size, h[2] ? h[2].size / h[0].size : 1],
660
660
  [C.xLength, C.yLength, C.zLength],
661
661
  [1, C.yLength / C.xLength, C.zLength / C.xLength]
662
662
  ];
@@ -680,26 +680,26 @@ async function Ze({
680
680
  downsampleDepth: o = 1,
681
681
  signal: i
682
682
  }) {
683
- const { shape: l, labels: n, dtype: m } = t, { height: x, width: g } = Ue(t), r = l[n.indexOf("z")], c = Math.max(1, Math.floor(r / o)), T = x * g, d = We[m], I = new d(T * c);
684
- return await Promise.all(new Array(c).fill(0).map(async (y, w) => {
685
- const _ = {
683
+ const { shape: l, labels: n, dtype: g } = t, { height: p, width: m } = Ue(t), c = l[n.indexOf("z")], s = Math.max(1, Math.floor(c / o)), w = p * m, x = We[g], z = new x(w * s);
684
+ return await Promise.all(new Array(s).fill(0).map(async (f, M) => {
685
+ const v = {
686
686
  ...e,
687
- z: w * o
688
- }, { data: v } = await t.getRaster({
689
- selection: _,
687
+ z: M * o
688
+ }, { data: h } = await t.getRaster({
689
+ selection: v,
690
690
  signal: i
691
691
  });
692
692
  let C = 0;
693
- for (a({ z: w, total: c, progress: 0.5 }); C < T; ) {
694
- const h = w * T + (T - C - 1), R = (g - C - 1) % g + g * Math.floor(C / g);
695
- I[h] = v[R], C += 1;
693
+ for (a({ z: M, total: s, progress: 0.5 }); C < w; ) {
694
+ const d = M * w + (w - C - 1), F = (m - C - 1) % m + m * Math.floor(C / m);
695
+ z[d] = h[F], C += 1;
696
696
  }
697
- a({ z: w, total: c, progress: 1 });
697
+ a({ z: M, total: s, progress: 1 });
698
698
  })), {
699
- data: I,
700
- height: x,
701
- width: g,
702
- depth: c
699
+ data: z,
700
+ height: p,
701
+ width: m,
702
+ depth: s
703
703
  };
704
704
  }
705
705
  function Be(t, e, a) {
@@ -733,19 +733,19 @@ function Qe(t) {
733
733
  return o;
734
734
  }
735
735
  async function et(t, e, a, o, i, l, n) {
736
- let m = null, x = null;
737
- const { shape: g, labels: r } = a[0], c = t.filter((d) => !o.has(d) || e !== n), T = await Promise.all(c.map((d) => Be(d, e, a)));
738
- return c.forEach((d, I) => {
739
- const y = T[I];
740
- m = Je(y);
741
- const w = m.computeMinMax();
742
- m.data = Qe(m), o.set(d, m), i.set(d, Ke(m)), l.set(d, w), x = qe(a[e]);
736
+ let g = null, p = null;
737
+ const { shape: m, labels: c } = a[0], s = t.filter((x) => !o.has(x) || e !== n), w = await Promise.all(s.map((x) => Be(x, e, a)));
738
+ return s.forEach((x, z) => {
739
+ const f = w[z];
740
+ g = Je(f);
741
+ const M = g.computeMinMax();
742
+ g.data = Qe(g), o.set(x, g), i.set(x, Ke(g)), l.set(x, M), p = qe(a[e]);
743
743
  }), [
744
744
  o,
745
745
  i,
746
746
  l,
747
- x,
748
- [g[r.indexOf("x")], g[r.indexOf("y")], g[r.indexOf("z")]]
747
+ p,
748
+ [m[c.indexOf("x")], m[c.indexOf("y")], m[c.indexOf("z")]]
749
749
  ];
750
750
  }
751
751
  function tt(t) {
@@ -755,29 +755,29 @@ function ft(t) {
755
755
  return !Array.isArray(t) || t.length !== 3 ? !1 : t.every((e) => typeof e == "number" && Number.isFinite(e));
756
756
  }
757
757
  function re(t) {
758
- const { segmentationGroup: e, segmentationSettings: a, segmentationSceneScale: o, renderingSettings: i, materialRef: l, highlightEntity: n, setObsHighlight: m } = t, x = Q(null), [g] = G([]);
759
- return $("group", { children: [$("group", { children: [e?.visible ? $("group", { children: [p("hemisphereLight", { color: 8421504, groundColor: 6316128 }), p("directionalLight", { color: 16777215, position: [0, -800, 0] }), p("directionalLight", { color: 16777215, position: [0, 800, 0] }), p(we, { firstHitOnly: !0, children: p("primitive", { ref: x, object: e, position: [0, 0, 0], onClick: (r) => {
760
- r.object.parent?.userData.name === "finalPass" && n(r.object.name, r.object.userData.layerScope, r.object.userData.channelScope);
761
- }, onPointerOver: (r) => {
762
- m(r.object.name);
763
- }, onPointerOut: () => m(null) }) })] }) : null, i.uniforms && i.shader && i.meshScale && i.geometrySize ? p("group", { children: $("mesh", { scale: i.meshScale, ref: l, children: [p("boxGeometry", { args: i.geometrySize }), p("shaderMaterial", { customProgramCacheKey: () => "1", side: _e, uniforms: i.uniforms, needsUpdate: !0, transparent: !0, vertexShader: i.shader.vertexShader, fragmentShader: i.shader.fragmentShader })] }) }) : null] }), p("group", { name: "lines", children: g.map((r) => p(Ne, { currentLine: r, scale: 1 }, tt(r))) })] });
758
+ const { segmentationGroup: e, segmentationSettings: a, segmentationSceneScale: o, renderingSettings: i, materialRef: l, highlightEntity: n, setObsHighlight: g } = t, p = Q(null), [m] = X([]);
759
+ return H("group", { children: [H("group", { children: [e?.visible ? H("group", { children: [_("hemisphereLight", { color: 8421504, groundColor: 6316128 }), _("directionalLight", { color: 16777215, position: [0, -800, 0] }), _("directionalLight", { color: 16777215, position: [0, 800, 0] }), _(we, { firstHitOnly: !0, children: _("primitive", { ref: p, object: e, position: [0, 0, 0], onClick: (c) => {
760
+ c.object.parent?.userData.name === "finalPass" && n(c.object.name, c.object.userData.layerScope, c.object.userData.channelScope);
761
+ }, onPointerOver: (c) => {
762
+ g(c.object.name);
763
+ }, onPointerOut: () => g(null) }) })] }) : null, i.uniforms && i.shader && i.meshScale && i.geometrySize ? _("group", { children: H("mesh", { scale: i.meshScale, ref: l, children: [_("boxGeometry", { args: i.geometrySize }), _("shaderMaterial", { customProgramCacheKey: () => "1", side: _e, uniforms: i.uniforms, needsUpdate: !0, transparent: !0, vertexShader: i.shader.vertexShader, fragmentShader: i.shader.fragmentShader })] }) }) : null] }), _("group", { name: "lines", children: m.map((c) => _(Ne, { currentLine: c, scale: 1 }, tt(c))) })] });
764
764
  }
765
- const at = ae.lazy(() => import("./GeometryAndMeshXR-CF4RAuxf.js").catch(() => ({ default: re }))), lt = ae.lazy(() => import("./XRSceneComponents-Cir_GRKI.js").catch(() => ({ default: () => null })));
765
+ const at = ae.lazy(() => import("./GeometryAndMeshXR-Q7wh5iGx.js").catch(() => ({ default: re }))), lt = ae.lazy(() => import("./XRSceneComponents-ChFIeY21.js").catch(() => ({ default: () => null })));
766
766
  function oe(t) {
767
- const e = Q(null), a = Q(null), [o, i] = G(!1), [l, n] = G(!1), [m, x] = G(null), [g, r] = G([1, 1, 1]), [c, T] = G({
767
+ const e = Q(null), a = Q(null), [o, i] = X(!1), [l, n] = X(!1), [g, p] = X(null), [m, c] = X([1, 1, 1]), [s, w] = X({
768
768
  uniforms: null,
769
769
  shader: null,
770
770
  meshScale: null,
771
771
  geometrySize: null,
772
772
  boxSize: null
773
- }), [d, I] = G({
773
+ }), [x, z] = X({
774
774
  volumes: /* @__PURE__ */ new Map(),
775
775
  textures: /* @__PURE__ */ new Map(),
776
776
  volumeMinMax: /* @__PURE__ */ new Map(),
777
777
  scale: null,
778
778
  resolution: null,
779
779
  originalScale: null
780
- }), [y, w] = G({
780
+ }), [f, M] = X({
781
781
  channelsVisible: [],
782
782
  allChannels: [],
783
783
  channelTargetC: [],
@@ -788,7 +788,7 @@ function oe(t) {
788
788
  is3dMode: !1,
789
789
  renderingMode: null,
790
790
  layerTransparency: 1
791
- }), [_, v] = G({
791
+ }), [v, h] = X({
792
792
  visible: !0,
793
793
  color: [1, 1, 1],
794
794
  opacity: 1,
@@ -797,77 +797,77 @@ function oe(t) {
797
797
  multiColor: "",
798
798
  data: null,
799
799
  obsSets: []
800
- }), { images: C, layerScope: h, channelsVisible: R, allChannels: P, channelTargetC: f, resolution: z, data: U, colors: F, contrastLimits: H, is3dMode: W, renderingMode: Z, layerTransparency: se, xSlice: ue, ySlice: ce, zSlice: me } = He(t, y, w, l, n), { obsSegmentations: B, onEntitySelected: fe, segmentationLayerCoordination: st, segmentationChannelCoordination: X, segmentationChannelScopesByLayer: J } = t;
800
+ }), { images: C, layerScope: d, channelsVisible: F, allChannels: A, channelTargetC: y, resolution: T, data: k, colors: U, contrastLimits: N, is3dMode: W, renderingMode: Z, layerTransparency: se, xSlice: ue, ySlice: ce, zSlice: me } = He(t, f, M, l, n), { obsSegmentations: B, onEntitySelected: fe, segmentationLayerCoordination: st, segmentationChannelCoordination: $, segmentationChannelScopesByLayer: J } = t;
801
801
  let he = () => {
802
802
  };
803
803
  const Y = [];
804
- if (X[0][h] !== void 0) {
805
- const s = X[0][h][h];
806
- he = X[1][h][h].setObsHighlight;
807
- const { additionalObsSets: b } = s;
808
- b !== null && s.obsSetSelection.forEach((D) => {
809
- const S = D[1];
810
- b.tree[0].children.forEach((V) => {
811
- V.name === S && V.set.forEach(([A]) => {
812
- const M = { name: "", id: "", color: [255, 255, 255] };
813
- M.name = S, M.id = A, s.obsSetColor.forEach((E) => {
814
- E.path[1] === S && (M.color = E.color);
815
- }), Y.push(M);
804
+ if ($[0][d] !== void 0) {
805
+ const r = $[0][d][d];
806
+ he = $[1][d][d].setObsHighlight;
807
+ const { additionalObsSets: b } = r;
808
+ b !== null && r.obsSetSelection.forEach((I) => {
809
+ const S = I[1];
810
+ b.tree[0].children.forEach((R) => {
811
+ R.name === S && R.set.forEach(([D]) => {
812
+ const L = { name: "", id: "", color: [255, 255, 255] };
813
+ L.name = S, L.id = D, r.obsSetColor.forEach((E) => {
814
+ E.path[1] === S && (L.color = E.color);
815
+ }), Y.push(L);
816
816
  });
817
817
  });
818
- }), s.obsHighlight !== null && Y.push({ name: "", id: s.obsHighlight, color: [255, 34, 0] });
818
+ }), r.obsHighlight !== null && Y.push({ name: "", id: r.obsHighlight, color: [255, 34, 0] });
819
819
  }
820
- if (B?.[h]?.obsSegmentations && m == null) {
821
- const { scene: s, sceneOptions: u } = B[h].obsSegmentations;
822
- if (s?.children) {
823
- const b = new Fe(), D = new Ee();
824
- D.userData.name = "finalPass", s.children.forEach((V) => {
825
- const A = "material" in V ? V : V.children[0];
826
- (A.material instanceof Re || A.material instanceof Ve) && (A.material = new Oe());
827
- const M = A.material;
828
- let E = A.name.replace("mesh_", "").replace("mesh", "").replace("glb", "").replace("_dec", "").replace("_Decobj", "").replace("obj", "").replace("_DEc", "").replace(".", "").replace("_Dec", "");
829
- E.includes("_") && (E = E.split("_")[0]), A.name = E, A.userData.name = E, A.userData.layerScope = h, M.transparent = !0, M.depthTest = !0, M.depthWrite = !0, M.needsUpdate = !0, M.side = u?.materialSide === "back" ? ke : _e;
830
- const O = A.clone();
831
- O.geometry = A.geometry.clone(), O.geometry.translate(u?.targetX ?? 0, u?.targetY ?? 0, u?.targetZ ?? 0), O.geometry.scale(u?.scaleX ?? 1, u?.scaleY ?? 1, u?.scaleZ ?? 1), O.geometry.rotateX(u?.rotationX ?? 0), O.geometry.rotateY(u?.rotationY ?? 0), O.geometry.rotateZ(u?.rotationZ ?? 0);
832
- const ne = A.clone();
833
- ne.material = M.clone(), ne.geometry = O.geometry.clone(), D.add(ne);
834
- }), b.add(D), b.scale.set(u?.sceneScaleX ?? 1, u?.sceneScaleY ?? 1, u?.sceneScaleZ ?? 1);
820
+ if (B?.[d]?.obsSegmentations && g == null) {
821
+ const { scene: r, sceneOptions: u } = B[d].obsSegmentations;
822
+ if (r?.children) {
823
+ const b = new Fe(), I = new Ee();
824
+ I.userData.name = "finalPass", r.children.forEach((R) => {
825
+ const D = "material" in R ? R : R.children[0];
826
+ (D.material instanceof Re || D.material instanceof Ve) && (D.material = new Oe());
827
+ const L = D.material;
828
+ let E = D.name.replace("mesh_", "").replace("mesh", "").replace("glb", "").replace("_dec", "").replace("_Decobj", "").replace("obj", "").replace("_DEc", "").replace(".", "").replace("_Dec", "");
829
+ E.includes("_") && (E = E.split("_")[0]), D.name = E, D.userData.name = E, D.userData.layerScope = d, L.transparent = !0, L.depthTest = !0, L.depthWrite = !0, L.needsUpdate = !0, L.side = u?.materialSide === "back" ? ke : _e;
830
+ const V = D.clone();
831
+ V.geometry = D.geometry.clone(), V.geometry.translate(u?.targetX ?? 0, u?.targetY ?? 0, u?.targetZ ?? 0), V.geometry.scale(u?.scaleX ?? 1, u?.scaleY ?? 1, u?.scaleZ ?? 1), V.geometry.rotateX(u?.rotationX ?? 0), V.geometry.rotateY(u?.rotationY ?? 0), V.geometry.rotateZ(u?.rotationZ ?? 0);
832
+ const ne = D.clone();
833
+ ne.material = L.clone(), ne.geometry = V.geometry.clone(), I.add(ne);
834
+ }), b.add(I), b.scale.set(u?.sceneScaleX ?? 1, u?.sceneScaleY ?? 1, u?.sceneScaleZ ?? 1);
835
835
  const S = [
836
836
  u?.sceneScaleX ?? 1,
837
837
  u?.sceneScaleY ?? 1,
838
838
  u?.sceneScaleZ ?? 1
839
839
  ];
840
- r(S), b.rotateX(u?.sceneRotationX ?? 0), b.rotateY(u?.sceneRotationY ?? 0), b.rotateZ(u?.sceneRotationZ ?? 0), x(b);
840
+ c(S), b.rotateX(u?.sceneRotationX ?? 0), b.rotateY(u?.sceneRotationY ?? 0), b.rotateZ(u?.sceneRotationZ ?? 0), p(b);
841
841
  }
842
842
  }
843
- if (X[0] !== void 0 && X[0][h] !== void 0) {
844
- const s = X[0][h][h];
843
+ if ($[0] !== void 0 && $[0][d] !== void 0) {
844
+ const r = $[0][d][d];
845
845
  let u = "";
846
- Y.forEach((D) => {
847
- u += `${D.id};${D.color.toString()};${D.name}`;
846
+ Y.forEach((I) => {
847
+ u += `${I.id};${I.color.toString()};${I.name}`;
848
848
  });
849
849
  let b = "";
850
- if (_.obsSets.forEach((D) => {
851
- b += `${D.id};${D.color.toString()};${D.name}`;
852
- }), J[h].length > 1) {
853
- let D = "", S = "", V = "", A = !1, M = 0;
854
- J[h].forEach((E) => {
855
- const O = X[0][h][E];
856
- D += `${O.spatialChannelColor.toString()};`, S += `${O.spatialChannelOpacity};`, V += `${O.spatialChannelVisible};`, A = A || O.spatialChannelVisible, M += O.spatialChannelOpacity;
857
- }), (D !== _.multiColor || S !== _.multiOpacity || V !== _.multiVisible) && v({
858
- color: s.spatialChannelColor,
859
- opacity: M,
860
- visible: A,
861
- multiColor: D,
862
- multiVisible: V,
850
+ if (v.obsSets.forEach((I) => {
851
+ b += `${I.id};${I.color.toString()};${I.name}`;
852
+ }), J[d].length > 1) {
853
+ let I = "", S = "", R = "", D = !1, L = 0;
854
+ J[d].forEach((E) => {
855
+ const V = $[0][d][E];
856
+ I += `${V.spatialChannelColor.toString()};`, S += `${V.spatialChannelOpacity};`, R += `${V.spatialChannelVisible};`, D = D || V.spatialChannelVisible, L += V.spatialChannelOpacity;
857
+ }), (I !== v.multiColor || S !== v.multiOpacity || R !== v.multiVisible) && h({
858
+ color: r.spatialChannelColor,
859
+ opacity: L,
860
+ visible: D,
861
+ multiColor: I,
862
+ multiVisible: R,
863
863
  multiOpacity: S,
864
864
  data: B ?? null,
865
865
  obsSets: Y
866
866
  });
867
- } else (s.spatialChannelColor.toString() !== _.color.toString() || s.spatialChannelVisible !== _.visible || s.spatialChannelOpacity !== _.opacity || u !== b) && v({
868
- color: s.spatialChannelColor,
869
- opacity: s.spatialChannelOpacity,
870
- visible: s.spatialChannelVisible,
867
+ } else (r.spatialChannelColor.toString() !== v.color.toString() || r.spatialChannelVisible !== v.visible || r.spatialChannelOpacity !== v.opacity || u !== b) && h({
868
+ color: r.spatialChannelColor,
869
+ opacity: r.spatialChannelOpacity,
870
+ visible: r.spatialChannelVisible,
871
871
  multiColor: "",
872
872
  multiVisible: "",
873
873
  multiOpacity: "",
@@ -876,46 +876,46 @@ function oe(t) {
876
876
  });
877
877
  }
878
878
  if (q(() => {
879
- if (m !== null) {
880
- let s = 0, u = 0;
881
- for (let b = 0; b < m.children.length; b++)
882
- m.children[b].userData.name === "finalPass" ? u = b : s = b;
883
- m.children[u].children.forEach((b, D) => {
879
+ if (g !== null) {
880
+ let r = 0, u = 0;
881
+ for (let b = 0; b < g.children.length; b++)
882
+ g.children[b].userData.name === "finalPass" ? u = b : r = b;
883
+ g.children[u].children.forEach((b, I) => {
884
884
  const S = b;
885
- let { color: V } = _;
886
- const A = S.userData.name;
887
- if (_.obsSets.forEach((M) => {
888
- M.id === A && (V = M.color);
889
- }), J[h].length > 1)
890
- J[h].forEach((M) => {
891
- const E = X[0][h][M];
892
- if (E.spatialTargetC === A) {
893
- S.material.color.r = E.spatialChannelColor[0] / 255, S.material.color.g = E.spatialChannelColor[1] / 255, S.material.color.b = E.spatialChannelColor[2] / 255, S.material.opacity = E.spatialChannelOpacity, S.visible = E.spatialChannelVisible, S.material.needsUpdate = !0, S.userData.layerScope = h, S.userData.channelScope = M;
894
- const O = m.children[s].children[D];
895
- O.material.needsUpdate = !0;
885
+ let { color: R } = v;
886
+ const D = S.userData.name;
887
+ if (v.obsSets.forEach((L) => {
888
+ L.id === D && (R = L.color);
889
+ }), J[d].length > 1)
890
+ J[d].forEach((L) => {
891
+ const E = $[0][d][L];
892
+ if (E.spatialTargetC === D) {
893
+ S.material.color.r = E.spatialChannelColor[0] / 255, S.material.color.g = E.spatialChannelColor[1] / 255, S.material.color.b = E.spatialChannelColor[2] / 255, S.material.opacity = E.spatialChannelOpacity, S.visible = E.spatialChannelVisible, S.material.needsUpdate = !0, S.userData.layerScope = d, S.userData.channelScope = L;
894
+ const V = g.children[r].children[I];
895
+ V.material.needsUpdate = !0;
896
896
  }
897
897
  });
898
898
  else {
899
- S.material.color.r = V[0] / 255, S.material.color.g = V[1] / 255, S.material.color.b = V[2] / 255, S.material.opacity = _.opacity, S.material.visible = _.visible, S.material.needsUpdate = !0, S.userData.layerScope = h;
900
- const M = Object.keys(X[0][h])?.[0];
901
- S.userData.channelScope = M;
899
+ S.material.color.r = R[0] / 255, S.material.color.g = R[1] / 255, S.material.color.b = R[2] / 255, S.material.opacity = v.opacity, S.material.visible = v.visible, S.material.needsUpdate = !0, S.userData.layerScope = d;
900
+ const L = Object.keys($[0][d])?.[0];
901
+ S.userData.channelScope = L;
902
902
  }
903
903
  });
904
904
  }
905
- }, [_, m]), C[h]?.image?.instance?.getData() !== void 0 && !l && !o && H !== null && H[0][1] !== 255 && W && (n(!0), i(!0)), q(() => {
906
- const s = async () => {
907
- const u = await et(f, z, U, d.volumes, d.textures, d.volumeMinMax, d.resolution);
905
+ }, [v, g]), C[d]?.image?.instance?.getData() !== void 0 && !l && !o && N !== null && N[0][1] !== 255 && W && (n(!0), i(!0)), q(() => {
906
+ const r = async () => {
907
+ const u = await et(y, T, k, x.volumes, x.textures, x.volumeMinMax, x.resolution);
908
908
  if (u[0] !== null)
909
- if (I({
910
- resolution: z,
909
+ if (z({
910
+ resolution: T,
911
911
  volumes: u[0],
912
912
  textures: u[1],
913
913
  volumeMinMax: u[2],
914
- scale: u[3] !== null ? u[3] : d.scale,
914
+ scale: u[3] !== null ? u[3] : x.scale,
915
915
  originalScale: u[4]
916
- }), !c.uniforms || !c.shader) {
917
- const b = de(u[0], f, R, F, u[1], H, u[2], u[3], Z, se, ue, ce, me, u[4]);
918
- b !== null && T({
916
+ }), !s.uniforms || !s.shader) {
917
+ const b = de(u[0], y, F, U, u[1], N, u[2], u[3], Z, se, ue, ce, me, u[4]);
918
+ b !== null && w({
919
919
  uniforms: b[0],
920
920
  shader: b[1],
921
921
  meshScale: b[2],
@@ -923,14 +923,14 @@ function oe(t) {
923
923
  boxSize: b[4]
924
924
  });
925
925
  } else
926
- w({
927
- channelsVisible: R,
928
- allChannels: P,
929
- channelTargetC: f,
930
- resolution: z,
931
- data: U,
932
- colors: F,
933
- contrastLimits: H,
926
+ M({
927
+ channelsVisible: F,
928
+ allChannels: A,
929
+ channelTargetC: y,
930
+ resolution: T,
931
+ data: k,
932
+ colors: U,
933
+ contrastLimits: N,
934
934
  is3dMode: W,
935
935
  renderingMode: Z,
936
936
  layerTransparency: se,
@@ -939,31 +939,31 @@ function oe(t) {
939
939
  zSlice: me
940
940
  });
941
941
  };
942
- l && (z !== y.resolution && e.current && (e.current.material.uniforms.volumeCount.value = 0, e.current.material.uniforms.volumeTex.value = null), s(), n(!1));
942
+ l && (T !== f.resolution && e.current && (e.current.material.uniforms.volumeCount.value = 0, e.current.material.uniforms.volumeTex.value = null), r(), n(!1));
943
943
  }, [l]), q(() => {
944
- if (c.uniforms && c.shader) {
945
- const s = de(d.volumes, y.channelTargetC, y.channelsVisible, y.colors, d.textures, y.contrastLimits, d.volumeMinMax, d.scale, y.renderingMode, y.layerTransparency, y.xSlice, y.ySlice, y.zSlice, d.originalScale);
946
- if (s !== null) {
944
+ if (s.uniforms && s.shader) {
945
+ const r = de(x.volumes, f.channelTargetC, f.channelsVisible, f.colors, x.textures, f.contrastLimits, x.volumeMinMax, x.scale, f.renderingMode, f.layerTransparency, f.xSlice, f.ySlice, f.zSlice, x.originalScale);
946
+ if (r !== null) {
947
947
  let u = 0;
948
- y.channelsVisible?.forEach((b) => {
948
+ f.channelsVisible?.forEach((b) => {
949
949
  b && u++;
950
- }), n(!1), e?.current?.material?.uniforms && (e.current.material.uniforms.u_clim.value = s[0].u_clim.value, e.current.material.uniforms.u_clim2.value = s[0].u_clim2.value, e.current.material.uniforms.u_clim3.value = s[0].u_clim3.value, e.current.material.uniforms.u_clim4.value = s[0].u_clim4.value, e.current.material.uniforms.u_clim5.value = s[0].u_clim5.value, e.current.material.uniforms.u_clim6.value = s[0].u_clim6.value, e.current.material.uniforms.u_xClip.value = s[0].u_xClip.value, e.current.material.uniforms.u_yClip.value = s[0].u_yClip.value, e.current.material.uniforms.u_zClip.value = s[0].u_zClip.value, e.current.material.uniforms.u_color.value = s[0].u_color.value, e.current.material.uniforms.u_color2.value = s[0].u_color2.value, e.current.material.uniforms.u_color3.value = s[0].u_color3.value, e.current.material.uniforms.u_color4.value = s[0].u_color4.value, e.current.material.uniforms.u_color5.value = s[0].u_color5.value, e.current.material.uniforms.u_color6.value = s[0].u_color6.value, e.current.material.uniforms.volumeTex.value = s[0].volumeTex.value, e.current.material.uniforms.volumeTex2.value = s[0].volumeTex2.value, e.current.material.uniforms.volumeTex3.value = s[0].volumeTex3.value, e.current.material.uniforms.volumeTex4.value = s[0].volumeTex4.value, e.current.material.uniforms.volumeTex5.value = s[0].volumeTex5.value, e.current.material.uniforms.volumeTex6.value = s[0].volumeTex6.value, e.current.material.uniforms.volumeCount.value = u, e.current.material.uniforms.u_renderstyle.value = y.renderingMode, e.current.material.uniforms.dtScale.value = y.layerTransparency);
950
+ }), n(!1), e?.current?.material?.uniforms && (e.current.material.uniforms.u_clim.value = r[0].u_clim.value, e.current.material.uniforms.u_clim2.value = r[0].u_clim2.value, e.current.material.uniforms.u_clim3.value = r[0].u_clim3.value, e.current.material.uniforms.u_clim4.value = r[0].u_clim4.value, e.current.material.uniforms.u_clim5.value = r[0].u_clim5.value, e.current.material.uniforms.u_clim6.value = r[0].u_clim6.value, e.current.material.uniforms.u_xClip.value = r[0].u_xClip.value, e.current.material.uniforms.u_yClip.value = r[0].u_yClip.value, e.current.material.uniforms.u_zClip.value = r[0].u_zClip.value, e.current.material.uniforms.u_color.value = r[0].u_color.value, e.current.material.uniforms.u_color2.value = r[0].u_color2.value, e.current.material.uniforms.u_color3.value = r[0].u_color3.value, e.current.material.uniforms.u_color4.value = r[0].u_color4.value, e.current.material.uniforms.u_color5.value = r[0].u_color5.value, e.current.material.uniforms.u_color6.value = r[0].u_color6.value, e.current.material.uniforms.volumeTex.value = r[0].volumeTex.value, e.current.material.uniforms.volumeTex2.value = r[0].volumeTex2.value, e.current.material.uniforms.volumeTex3.value = r[0].volumeTex3.value, e.current.material.uniforms.volumeTex4.value = r[0].volumeTex4.value, e.current.material.uniforms.volumeTex5.value = r[0].volumeTex5.value, e.current.material.uniforms.volumeTex6.value = r[0].volumeTex6.value, e.current.material.uniforms.volumeCount.value = u, e.current.material.uniforms.u_renderstyle.value = f.renderingMode, e.current.material.uniforms.dtScale.value = f.layerTransparency);
951
951
  } else e?.current?.material?.uniforms && (e.current.material.uniforms.volumeCount.value = 0, e.current.material.uniforms.volumeTex.value = null);
952
952
  }
953
- }, [y]), !y.is3dMode)
953
+ }, [f]), !f.is3dMode)
954
954
  return null;
955
- if (y.is3dMode && (!c.uniforms || !c.shader))
956
- return $("group", { children: [p("ambientLight", {}), p("pointLight", { position: [10, 10, 10] }), p(ve, { color: "white", scale: 20, fontWeight: 1e3, children: "Loading ..." })] });
955
+ if (f.is3dMode && (!s.uniforms || !s.shader))
956
+ return H("group", { children: [_("ambientLight", {}), _("pointLight", { position: [10, 10, 10] }), _(ve, { color: "white", scale: 20, fontWeight: 1e3, children: "Loading ..." })] });
957
957
  const le = {
958
- segmentationGroup: m,
959
- segmentationSettings: _,
960
- segmentationSceneScale: g,
961
- renderingSettings: c,
958
+ segmentationGroup: g,
959
+ segmentationSettings: v,
960
+ segmentationSceneScale: m,
961
+ renderingSettings: s,
962
962
  materialRef: e,
963
963
  highlightEntity: fe,
964
964
  setObsHighlight: he
965
965
  }, { xrEnabled: pe } = t;
966
- return $("group", { children: [pe ? $(be, { children: [p(ee, { fallback: null, children: p(lt, {}) }), p(ee, { fallback: p(re, { ...le }), children: p(at, { ...le }) })] }) : p(re, { ...le }), p(Me, { ref: a, enableDamping: !1, dampingFactor: 0 })] });
966
+ return H("group", { children: [pe ? H(be, { children: [_(ee, { fallback: null, children: _(lt, {}) }), _(ee, { fallback: _(re, { ...le }), children: _(at, { ...le }) })] }) : _(re, { ...le }), _(Me, { ref: a, enableDamping: !1, dampingFactor: 0 })] });
967
967
  }
968
968
  let te = null;
969
969
  async function nt() {
@@ -976,26 +976,26 @@ function pt() {
976
976
  }
977
977
  const it = ae.lazy(
978
978
  // eslint-disable-next-line implicit-arrow-linebreak, function-paren-newline
979
- () => import("./XRWrapper-BSmyqdbq.js").catch(() => ({
979
+ () => import("./XRWrapper-CCDKOKv7.js").catch(() => ({
980
980
  default: ({ children: t }) => t
981
981
  }))
982
982
  ), ot = ae.lazy(
983
983
  // eslint-disable-next-line implicit-arrow-linebreak, function-paren-newline
984
- () => import("./XREnterButton-CWhVmiO4.js").catch(() => ({
984
+ () => import("./XREnterButton-BpOerghW.js").catch(() => ({
985
985
  default: () => null
986
986
  }))
987
987
  ), rt = Se((t, e) => {
988
- const [a, o] = G(!1);
988
+ const [a, o] = X(!1);
989
989
  return q(() => {
990
990
  nt().then(() => o(!0)).catch(() => {
991
991
  });
992
- }, []), $("div", { style: { width: "100%", height: "100%" }, children: [a && p(ee, { fallback: null, children: p(ot, {}) }), p(Ce, { style: { position: "absolute", top: 0, left: 0 }, camera: {
992
+ }, []), H("div", { style: { width: "100%", height: "100%" }, children: [a && _(ee, { fallback: null, children: _(ot, {}) }), _(Ce, { style: { position: "absolute", top: 0, left: 0 }, camera: {
993
993
  fov: 50,
994
994
  up: [0, 1, 0],
995
995
  position: [0, 0, 800],
996
996
  near: 0.1,
997
997
  far: 3e3
998
- }, gl: { antialias: !0, logarithmicDepthBuffer: !1 }, ref: e, children: a ? p(ee, { fallback: p(oe, { ...t }), children: p(it, { children: p(oe, { ...t, xrEnabled: !0 }) }) }) : p(oe, { ...t }) })] });
998
+ }, gl: { antialias: !0, logarithmicDepthBuffer: !1 }, ref: e, children: a ? _(ee, { fallback: _(oe, { ...t }), children: _(it, { children: _(oe, { ...t, xrEnabled: !0 }) }) }) : _(oe, { ...t }) })] });
999
999
  }), xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1000
1000
  __proto__: null,
1001
1001
  SpatialWrapper: rt