vitessce 4.0.0 → 4.0.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.
@@ -1,6 +1,6 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
2
  import { useState as s, useEffect as o } from "react";
3
- import { x as r } from "./xrStore-BtX9iGzw.js";
3
+ import { x as r } from "./xrStore-B29pxXky.js";
4
4
  function b() {
5
5
  const [i, u] = s(!1), [n, a] = s(!1);
6
6
  return o(() => {
@@ -1,13 +1,14 @@
1
1
  import { jsxs as a, Fragment as d, jsx as i } from "react/jsx-runtime";
2
2
  import { useRef as f } from "react";
3
- import { useXRInputSourceState as m, useXR as x } from "@react-three/xr";
4
- import { useThree as h, useFrame as g } from "@react-three/fiber";
3
+ import { useThree as g, useFrame as h } from "@react-three/fiber";
4
+ import { g as x } from "./index-DMfrc7N8.js";
5
+ const { useXRInputSourceState: m } = x();
5
6
  function l(n, r) {
6
7
  return n.get(r);
7
8
  }
8
9
  function S() {
9
- const n = m("hand", "right"), r = m("hand", "left"), t = f(null), o = f(null), { gl: p } = h();
10
- return g((R, b, c) => {
10
+ const n = m("hand", "right"), r = m("hand", "left"), t = f(null), o = f(null), { gl: p } = g();
11
+ return h((b, H, c) => {
11
12
  if (!c || !p.xr.isPresenting)
12
13
  return;
13
14
  const u = p.xr.getReferenceSpace();
@@ -29,9 +30,10 @@ function S() {
29
30
  }
30
31
  }), a(d, { children: [a("mesh", { name: "leftTipBbox", ref: o, children: [i("boxGeometry", { args: [0.02, 0.02, 0.02] }), i("meshStandardMaterial", { color: "blue", transparent: !0, opacity: 0 })] }), a("mesh", { name: "rightTipBbox", ref: t, children: [i("boxGeometry", { args: [0.02, 0.02, 0.02] }), i("meshStandardMaterial", { color: "orange", transparent: !0, opacity: 0 })] })] });
31
32
  }
33
+ const { useXR: R } = x();
32
34
  function y() {
33
- const n = x((t) => t.session), { scene: r } = h();
34
- return g(() => {
35
+ const n = R((t) => t.session), { scene: r } = g();
36
+ return h(() => {
35
37
  n && r.traverse((t) => {
36
38
  if (t.isMesh && t.material && t.userData?.xpiHand) {
37
39
  const o = t;
@@ -40,9 +42,9 @@ function y() {
40
42
  });
41
43
  }), null;
42
44
  }
43
- function J() {
45
+ function B() {
44
46
  return a(d, { children: [i(S, {}), i(y, {})] });
45
47
  }
46
48
  export {
47
- J as default
49
+ B as default
48
50
  };
@@ -0,0 +1,10 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { g as t } from "./index-DMfrc7N8.js";
3
+ import { x as e } from "./xrStore-B29pxXky.js";
4
+ const { XR: m } = t();
5
+ function f({ children: r }) {
6
+ return o(m, { store: e, children: r });
7
+ }
8
+ export {
9
+ f as default
10
+ };
@@ -1,5 +1,5 @@
1
1
  import { i as r } from "./pako.esm-D68R8YXe.js";
2
- import { B as a } from "./index-9C30IDNz.js";
2
+ import { B as a } from "./index-DUwV52xk.js";
3
3
  class s extends a {
4
4
  decodeBlock(e) {
5
5
  return r(new Uint8Array(e)).buffer;
@@ -1,6 +1,6 @@
1
1
  import * as KY from "react";
2
2
  import I, { createContext as op, isValidElement as ZY, PureComponent as ap, Component as sp, useMemo as Zt, useState as Ur, useRef as Mt, useEffect as ar, useCallback as zt, memo as QY, useContext as nl, useReducer as JY, useLayoutEffect as eK } from "react";
3
- import { b as PB, e as e4, f as qO } from "./index-9C30IDNz.js";
3
+ import { b as PB, e as e4, f as qO } from "./index-DUwV52xk.js";
4
4
  import ga, { unstable_batchedUpdates as Yp, createPortal as tK } from "react-dom";
5
5
  import { jsx as Ic, jsxs as rK } from "react/jsx-runtime";
6
6
  function nK(t) {
@@ -4,7 +4,7 @@ import { useThree as ve, useFrame as Me, Canvas as Pe } from "@react-three/fiber
4
4
  import { OrbitControls as me } from "@react-three/drei";
5
5
  import * as M from "three";
6
6
  import { Data3DTexture as ge, RedFormat as Ae, UnsignedByteType as Be, LinearFilter as xe, RedIntegerFormat as Ne, UnsignedIntType as Ue, NearestFilter as pe, Vector3 as C, Vector2 as _, Vector4 as j, UniformsUtils as Le } from "three";
7
- import { l as n, i as Oe, a as ue, L as he, C as P, u as K } from "./index-9C30IDNz.js";
7
+ import { l as n, i as Oe, a as ue, L as he, C as P, u as K } from "./index-DUwV52xk.js";
8
8
  const w = 32, B = 64, Z = 64, fe = 4, ce = B * Z * fe, be = B * w, _e = Z * w, Ce = fe * w, V = {
9
9
  NOT_STARTED: "not_started",
10
10
  IN_PROGRESS: "in_progress",
@@ -1,15 +1,15 @@
1
- var pe = Object.defineProperty;
2
- var xe = (t, e, a) => e in t ? pe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
3
- var k = (t, e, a) => xe(t, typeof e != "symbol" ? e + "" : e, a);
4
- import { jsxs as X, jsx as p, Fragment as ye } from "react/jsx-runtime";
5
- import te, { useRef as Q, useState as G, useEffect as q, Suspense as ee, forwardRef as be } from "react";
6
- import { Canvas as Se } from "@react-three/fiber";
7
- import { Center as Ce, Text as de, Line as ze, Bvh as Te, OrbitControls as we } from "@react-three/drei";
8
- import { Matrix3 as Me, Matrix4 as ne, Vector3 as L, Vector2 as j, UniformsUtils as Le, Data3DTexture as Pe, RedFormat as Ae, FloatType as De, LinearFilter as he, FrontSide as ve, Scene as Ie, Group as Fe, MeshPhysicalMaterial as Ee, MeshBasicMaterial as Ve, MeshStandardMaterial as Re, BackSide as Oe } from "three";
9
- import { C as N, g as ke } from "./index-9C30IDNz.js";
10
- function Ue({ currentLine: t, scale: e }) {
1
+ var xe = Object.defineProperty;
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";
6
+ import { Canvas as Ce } from "@react-three/fiber";
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-DUwV52xk.js";
10
+ function Ne({ currentLine: t, scale: e }) {
11
11
  const a = Q(null);
12
- return X("group", { children: [p(Ce, { bottom: !0, right: !0, position: [t.midPoint.x, t.midPoint.y, t.midPoint.z], rotation: [0, 0, 0], children: p(de, { color: "gray", scale: 0.05, ref: a, children: `${(t.startPoint.distanceTo(t.endPoint) * e).toFixed(2)} µm` }) }), p(ze, {
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, {
13
13
  points: [t.startPoint, t.endPoint],
14
14
  color: "white",
15
15
  lineWidth: 2,
@@ -17,7 +17,7 @@ function Ue({ currentLine: t, scale: e }) {
17
17
  segments: !0
18
18
  })] });
19
19
  }
20
- class Ne {
20
+ class je {
21
21
  /**
22
22
  * @param {number} xLength Width of the volume
23
23
  * @param {number} yLength Length of the volume
@@ -30,7 +30,7 @@ class Ne {
30
30
  // Offset of the volume in the RAS coordinate system
31
31
  k(this, "offset", [0, 0, 0]);
32
32
  // The IJK to RAS matrix
33
- k(this, "matrix", new Me().identity());
33
+ k(this, "matrix", new Le().identity());
34
34
  // The list of all the slices associated to this volume
35
35
  k(this, "sliceList", []);
36
36
  /**
@@ -191,15 +191,15 @@ class Ne {
191
191
  * and the dimensions of the plane in both coordinate system.
192
192
  */
193
193
  extractPerpendicularPlane(e, a) {
194
- const o = new ne().identity(), i = this;
194
+ const o = new ie().identity(), i = this;
195
195
  let l, n, m, x;
196
196
  const g = new L(), r = new L(), c = new L(), T = new L(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 ne().makeRotationY(Math.PI / 2)), m = (i.RASDimensions[0] - 1) / 2, o.setPosition(new L(a - m, 0, 0));
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));
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 ne().makeRotationX(-Math.PI / 2)), m = (i.RASDimensions[1] - 1) / 2, o.setPosition(new L(0, a - m, 0));
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));
203
203
  break;
204
204
  case "z":
205
205
  default:
@@ -210,14 +210,14 @@ class Ne {
210
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
211
  x = Math.abs(Math.round(x.applyMatrix4(i.inverseMatrix).dot(g)));
212
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 V(P, f) {
213
+ function R(P, f) {
214
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
215
  return i.access(H, W, Z);
216
216
  }
217
217
  return {
218
218
  iLength: d,
219
219
  jLength: I,
220
- sliceAccess: V,
220
+ sliceAccess: R,
221
221
  matrix: o,
222
222
  planeWidth: y,
223
223
  planeHeight: w
@@ -240,7 +240,7 @@ class Ne {
240
240
  return this.min = e, this.max = a, [e, a];
241
241
  }
242
242
  }
243
- const je = {
243
+ const Ge = {
244
244
  uniforms: {
245
245
  u_size: { value: new L(1, 1, 1) },
246
246
  u_renderstyle: { value: 0 },
@@ -518,7 +518,7 @@ const je = {
518
518
  "}"
519
519
  ].join(`
520
520
  `)
521
- }, Ge = {
521
+ }, Xe = {
522
522
  maximumIntensityProjection: 0,
523
523
  minimumIntensityProjection: 1,
524
524
  additive: 2
@@ -541,7 +541,7 @@ 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 = Ge[c], d = e[N.SPATIAL_LAYER_VISIBLE], I = e[N.SPATIAL_LAYER_OPACITY];
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
545
  x.isInterleaved();
546
546
  const y = r ? [
547
547
  [255, 0, 0],
@@ -567,13 +567,13 @@ function $e(t, e, a, o, i, l) {
567
567
  ] : a.map((F) => (
568
568
  // Layer visible AND channel visible
569
569
  d && x.getChannelIndex(o[F][N.SPATIAL_TARGET_C])
570
- )), C = x.getAutoTargetResolution(), h = e[N.SPATIAL_TARGET_RESOLUTION], V = h === null || Number.isNaN(h) ? C : h, P = i.image.loaders[0].channels ?? [];
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
571
  let f = e[N.SPATIAL_SLICE_X], z = e[N.SPATIAL_SLICE_Y], U = e[N.SPATIAL_SLICE_Z];
572
572
  return f = f !== null ? f : [-1, 1e5], z = z !== null ? z : [-1, 1e5], U = U !== null ? U : [-1, 1e5], {
573
573
  channelsVisible: _,
574
574
  allChannels: P,
575
575
  channelTargetC: v,
576
- resolution: V,
576
+ resolution: R,
577
577
  data: m,
578
578
  colors: y,
579
579
  contrastLimits: w,
@@ -585,9 +585,9 @@ function $e(t, e, a, o, i, l) {
585
585
  zSlice: U
586
586
  };
587
587
  }
588
- function Xe(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: V, 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 !== V || 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({
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
591
  channelsVisible: I,
592
592
  allChannels: y,
593
593
  channelTargetC: w,
@@ -595,7 +595,7 @@ function Xe(t, e, a, o, i) {
595
595
  data: v,
596
596
  colors: C,
597
597
  contrastLimits: h,
598
- is3dMode: V,
598
+ is3dMode: R,
599
599
  renderingMode: P,
600
600
  layerTransparency: f,
601
601
  xSlice: z,
@@ -615,7 +615,7 @@ function Xe(t, e, a, o, i) {
615
615
  data: v,
616
616
  colors: C,
617
617
  contrastLimits: h,
618
- is3dMode: V,
618
+ is3dMode: R,
619
619
  renderingMode: P,
620
620
  layerTransparency: f,
621
621
  xSlice: z,
@@ -627,10 +627,10 @@ 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 He(t, e, a, o, i, l, n, m, x, g, r, c, T) {
630
+ function Ye(t, e, a, o, i, l, n, m, x, g, r, c, T) {
631
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);
632
632
  }
633
- function ge(t, e, a, o, i, l, n, m, x, g, r, c, T, d) {
633
+ function de(t, e, a, o, i, l, n, m, x, g, r, c, T, d) {
634
634
  const I = [], y = [], w = [];
635
635
  let _ = null, v = m;
636
636
  if (v == null || !Array.isArray(v) || v.length < 3)
@@ -652,16 +652,16 @@ function ge(t, e, a, o, i, l, n, m, x, g, r, c, T, d) {
652
652
  ]));
653
653
  }), _ === null)
654
654
  return null;
655
- const C = _, h = {}, V = je, P = Le.clone(V.uniforms);
656
- return He(P, I, C, h, x, w, y, g, r, c, T, [v[0].size, v[1].size, v[2] ? v[2].size : 1], d), [
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
657
  P,
658
- V,
658
+ R,
659
659
  [1, v[1].size / v[0].size, v[2] ? v[2].size / v[0].size : 1],
660
660
  [C.xLength, C.yLength, C.zLength],
661
661
  [1, C.yLength / C.xLength, C.zLength / C.xLength]
662
662
  ];
663
663
  }
664
- const Ye = {
664
+ const We = {
665
665
  Uint8: Uint8Array,
666
666
  Uint16: Uint16Array,
667
667
  Uint32: Uint32Array,
@@ -671,7 +671,7 @@ const Ye = {
671
671
  Float32: Float32Array,
672
672
  Float64: Float64Array
673
673
  };
674
- async function We({
674
+ async function Ze({
675
675
  source: t,
676
676
  selection: e,
677
677
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -680,7 +680,7 @@ async function We({
680
680
  downsampleDepth: o = 1,
681
681
  signal: i
682
682
  }) {
683
- const { shape: l, labels: n, dtype: m } = t, { height: x, width: g } = ke(t), r = l[n.indexOf("z")], c = Math.max(1, Math.floor(r / o)), T = x * g, d = Ye[m], I = new d(T * c);
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
684
  return await Promise.all(new Array(c).fill(0).map(async (y, w) => {
685
685
  const _ = {
686
686
  ...e,
@@ -691,8 +691,8 @@ async function We({
691
691
  });
692
692
  let C = 0;
693
693
  for (a({ z: w, total: c, progress: 0.5 }); C < T; ) {
694
- const h = w * T + (T - C - 1), V = (g - C - 1) % g + g * Math.floor(C / g);
695
- I[h] = v[V], C += 1;
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;
696
696
  }
697
697
  a({ z: w, total: c, progress: 1 });
698
698
  })), {
@@ -702,23 +702,23 @@ async function We({
702
702
  depth: c
703
703
  };
704
704
  }
705
- function Ze(t, e, a) {
706
- return We({
705
+ function Be(t, e, a) {
706
+ return Ze({
707
707
  source: a[e],
708
708
  selection: { t: 0, c: t },
709
709
  // corresponds to the first channel of the first timepoint
710
710
  downsampleDepth: 2 ** e
711
711
  });
712
712
  }
713
- function Be(t) {
714
- const e = new Ne();
715
- return e.xLength = t.width, e.yLength = t.height, e.zLength = t.depth, e.data = t.data, e;
716
- }
717
713
  function Je(t) {
718
- const e = new Pe(t.data, t.xLength, t.yLength, t.zLength);
719
- return e.format = Ae, e.type = De, e.generateMipmaps = !1, e.minFilter = he, e.magFilter = he, e.needsUpdate = !0, e;
714
+ const e = new je();
715
+ return e.xLength = t.width, e.yLength = t.height, e.zLength = t.depth, e.data = t.data, e;
720
716
  }
721
717
  function Ke(t) {
718
+ const e = new Ae(t.data, t.xLength, t.yLength, t.zLength);
719
+ return e.format = De, e.type = Ie, e.generateMipmaps = !1, e.minFilter = ge, e.magFilter = ge, e.needsUpdate = !0, e;
720
+ }
721
+ function qe(t) {
722
722
  const { x: e, y: a, z: o } = t?.meta?.physicalSizes ?? {};
723
723
  return [
724
724
  e ?? { size: 1 },
@@ -726,20 +726,20 @@ function Ke(t) {
726
726
  o ?? { size: 1 }
727
727
  ];
728
728
  }
729
- function qe(t) {
729
+ function Qe(t) {
730
730
  const [e, a] = t.computeMinMax(), o = new Float32Array(t.data.length);
731
731
  for (let i = 0; i < t.data.length; i++)
732
732
  o[i] = (t.data[i] - e) / Math.sqrt(a ** 2 - e ** 2);
733
733
  return o;
734
734
  }
735
- async function Qe(t, e, a, o, i, l, n) {
735
+ async function et(t, e, a, o, i, l, n) {
736
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) => Ze(d, e, a)));
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
738
  return c.forEach((d, I) => {
739
739
  const y = T[I];
740
- m = Be(y);
740
+ m = Je(y);
741
741
  const w = m.computeMinMax();
742
- m.data = qe(m), o.set(d, m), i.set(d, Je(m)), l.set(d, w), x = Ke(a[e]);
742
+ m.data = Qe(m), o.set(d, m), i.set(d, Ke(m)), l.set(d, w), x = qe(a[e]);
743
743
  }), [
744
744
  o,
745
745
  i,
@@ -748,22 +748,22 @@ async function Qe(t, e, a, o, i, l, n) {
748
748
  [g[r.indexOf("x")], g[r.indexOf("y")], g[r.indexOf("z")]]
749
749
  ];
750
750
  }
751
- function et(t) {
751
+ function tt(t) {
752
752
  return `${t.startPoint.x},${t.startPoint.y},${t.startPoint.z};${t.endPoint.x},${t.endPoint.y},${t.endPoint.z}`;
753
753
  }
754
- function vt(t) {
754
+ 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
- function oe(t) {
757
+ function re(t) {
758
758
  const { segmentationGroup: e, segmentationSettings: a, segmentationSceneScale: o, renderingSettings: i, materialRef: l, highlightEntity: n, setObsHighlight: m } = t, x = Q(null), [g] = G([]);
759
- return X("group", { children: [X("group", { children: [e?.visible ? X("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(Te, { firstHitOnly: !0, children: p("primitive", { ref: x, object: e, position: [0, 0, 0], onClick: (r) => {
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
760
  r.object.parent?.userData.name === "finalPass" && n(r.object.name, r.object.userData.layerScope, r.object.userData.channelScope);
761
761
  }, onPointerOver: (r) => {
762
762
  m(r.object.name);
763
- }, onPointerOut: () => m(null) }) })] }) : null, i.uniforms && i.shader && i.meshScale && i.geometrySize ? p("group", { children: X("mesh", { scale: i.meshScale, ref: l, children: [p("boxGeometry", { args: i.geometrySize }), p("shaderMaterial", { customProgramCacheKey: () => "1", side: ve, 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(Ue, { currentLine: r, scale: 1 }, et(r))) })] });
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))) })] });
764
764
  }
765
- const tt = te.lazy(() => import("./GeometryAndMeshXR-BtBduWk5.js").catch(() => ({ default: oe }))), at = te.lazy(() => import("./XRSceneComponents-BI1xgf_W.js").catch(() => ({ default: () => null })));
766
- function ie(t) {
765
+ const at = ae.lazy(() => import("./GeometryAndMeshXR-BNeGR2Hg.js").catch(() => ({ default: re }))), lt = ae.lazy(() => import("./XRSceneComponents-oSSGLN3o.js").catch(() => ({ default: () => null })));
766
+ function oe(t) {
767
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({
768
768
  uniforms: null,
769
769
  shader: null,
@@ -797,18 +797,18 @@ function ie(t) {
797
797
  multiColor: "",
798
798
  data: null,
799
799
  obsSets: []
800
- }), { images: C, layerScope: h, channelsVisible: V, allChannels: P, channelTargetC: f, resolution: z, data: U, colors: F, contrastLimits: H, is3dMode: W, renderingMode: Z, layerTransparency: re, xSlice: se, ySlice: ue, zSlice: ce } = Xe(t, y, w, l, n), { obsSegmentations: B, onEntitySelected: _e, segmentationLayerCoordination: ot, segmentationChannelCoordination: $, segmentationChannelScopesByLayer: J } = t;
801
- let me = () => {
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;
801
+ let he = () => {
802
802
  };
803
803
  const Y = [];
804
- if ($[0][h] !== void 0) {
805
- const s = $[0][h][h];
806
- me = $[1][h][h].setObsHighlight;
804
+ if (X[0][h] !== void 0) {
805
+ const s = X[0][h][h];
806
+ he = X[1][h][h].setObsHighlight;
807
807
  const { additionalObsSets: b } = s;
808
808
  b !== null && s.obsSetSelection.forEach((D) => {
809
809
  const S = D[1];
810
- b.tree[0].children.forEach((R) => {
811
- R.name === S && R.set.forEach(([A]) => {
810
+ b.tree[0].children.forEach((V) => {
811
+ V.name === S && V.set.forEach(([A]) => {
812
812
  const M = { name: "", id: "", color: [255, 255, 255] };
813
813
  M.name = S, M.id = A, s.obsSetColor.forEach((E) => {
814
814
  E.path[1] === S && (M.color = E.color);
@@ -820,17 +820,17 @@ function ie(t) {
820
820
  if (B?.[h]?.obsSegmentations && m == null) {
821
821
  const { scene: s, sceneOptions: u } = B[h].obsSegmentations;
822
822
  if (s?.children) {
823
- const b = new Ie(), D = new Fe();
824
- D.userData.name = "finalPass", s.children.forEach((R) => {
825
- const A = "material" in R ? R : R.children[0];
826
- (A.material instanceof Ee || A.material instanceof Ve) && (A.material = new Re());
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
827
  const M = A.material;
828
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" ? Oe : ve;
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
830
  const O = A.clone();
831
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 le = A.clone();
833
- le.material = M.clone(), le.geometry = O.geometry.clone(), D.add(le);
832
+ const ne = A.clone();
833
+ ne.material = M.clone(), ne.geometry = O.geometry.clone(), D.add(ne);
834
834
  }), b.add(D), b.scale.set(u?.sceneScaleX ?? 1, u?.sceneScaleY ?? 1, u?.sceneScaleZ ?? 1);
835
835
  const S = [
836
836
  u?.sceneScaleX ?? 1,
@@ -840,8 +840,8 @@ function ie(t) {
840
840
  r(S), b.rotateX(u?.sceneRotationX ?? 0), b.rotateY(u?.sceneRotationY ?? 0), b.rotateZ(u?.sceneRotationZ ?? 0), x(b);
841
841
  }
842
842
  }
843
- if ($[0] !== void 0 && $[0][h] !== void 0) {
844
- const s = $[0][h][h];
843
+ if (X[0] !== void 0 && X[0][h] !== void 0) {
844
+ const s = X[0][h][h];
845
845
  let u = "";
846
846
  Y.forEach((D) => {
847
847
  u += `${D.id};${D.color.toString()};${D.name}`;
@@ -850,16 +850,16 @@ function ie(t) {
850
850
  if (_.obsSets.forEach((D) => {
851
851
  b += `${D.id};${D.color.toString()};${D.name}`;
852
852
  }), J[h].length > 1) {
853
- let D = "", S = "", R = "", A = !1, M = 0;
853
+ let D = "", S = "", V = "", A = !1, M = 0;
854
854
  J[h].forEach((E) => {
855
- const O = $[0][h][E];
856
- D += `${O.spatialChannelColor.toString()};`, S += `${O.spatialChannelOpacity};`, R += `${O.spatialChannelVisible};`, A = A || O.spatialChannelVisible, M += O.spatialChannelOpacity;
857
- }), (D !== _.multiColor || S !== _.multiOpacity || R !== _.multiVisible) && v({
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
858
  color: s.spatialChannelColor,
859
859
  opacity: M,
860
860
  visible: A,
861
861
  multiColor: D,
862
- multiVisible: R,
862
+ multiVisible: V,
863
863
  multiOpacity: S,
864
864
  data: B ?? null,
865
865
  obsSets: Y
@@ -882,13 +882,13 @@ function ie(t) {
882
882
  m.children[b].userData.name === "finalPass" ? u = b : s = b;
883
883
  m.children[u].children.forEach((b, D) => {
884
884
  const S = b;
885
- let { color: R } = _;
885
+ let { color: V } = _;
886
886
  const A = S.userData.name;
887
887
  if (_.obsSets.forEach((M) => {
888
- M.id === A && (R = M.color);
888
+ M.id === A && (V = M.color);
889
889
  }), J[h].length > 1)
890
890
  J[h].forEach((M) => {
891
- const E = $[0][h][M];
891
+ const E = X[0][h][M];
892
892
  if (E.spatialTargetC === A) {
893
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
894
  const O = m.children[s].children[D];
@@ -896,15 +896,15 @@ function ie(t) {
896
896
  }
897
897
  });
898
898
  else {
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 = _.opacity, S.material.visible = _.visible, S.material.needsUpdate = !0, S.userData.layerScope = h;
900
- const M = Object.keys($[0][h])?.[0];
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
901
  S.userData.channelScope = M;
902
902
  }
903
903
  });
904
904
  }
905
905
  }, [_, m]), C[h]?.image?.instance?.getData() !== void 0 && !l && !o && H !== null && H[0][1] !== 255 && W && (n(!0), i(!0)), q(() => {
906
906
  const s = async () => {
907
- const u = await Qe(f, z, U, d.volumes, d.textures, d.volumeMinMax, d.resolution);
907
+ const u = await et(f, z, U, d.volumes, d.textures, d.volumeMinMax, d.resolution);
908
908
  if (u[0] !== null)
909
909
  if (I({
910
910
  resolution: z,
@@ -914,7 +914,7 @@ function ie(t) {
914
914
  scale: u[3] !== null ? u[3] : d.scale,
915
915
  originalScale: u[4]
916
916
  }), !c.uniforms || !c.shader) {
917
- const b = ge(u[0], f, V, F, u[1], H, u[2], u[3], Z, re, se, ue, ce, u[4]);
917
+ const b = de(u[0], f, R, F, u[1], H, u[2], u[3], Z, se, ue, ce, me, u[4]);
918
918
  b !== null && T({
919
919
  uniforms: b[0],
920
920
  shader: b[1],
@@ -924,7 +924,7 @@ function ie(t) {
924
924
  });
925
925
  } else
926
926
  w({
927
- channelsVisible: V,
927
+ channelsVisible: R,
928
928
  allChannels: P,
929
929
  channelTargetC: f,
930
930
  resolution: z,
@@ -933,16 +933,16 @@ function ie(t) {
933
933
  contrastLimits: H,
934
934
  is3dMode: W,
935
935
  renderingMode: Z,
936
- layerTransparency: re,
937
- xSlice: se,
938
- ySlice: ue,
939
- zSlice: ce
936
+ layerTransparency: se,
937
+ xSlice: ue,
938
+ ySlice: ce,
939
+ zSlice: me
940
940
  });
941
941
  };
942
942
  l && (z !== y.resolution && e.current && (e.current.material.uniforms.volumeCount.value = 0, e.current.material.uniforms.volumeTex.value = null), s(), n(!1));
943
943
  }, [l]), q(() => {
944
944
  if (c.uniforms && c.shader) {
945
- const s = ge(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);
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
946
  if (s !== null) {
947
947
  let u = 0;
948
948
  y.channelsVisible?.forEach((b) => {
@@ -953,47 +953,57 @@ function ie(t) {
953
953
  }, [y]), !y.is3dMode)
954
954
  return null;
955
955
  if (y.is3dMode && (!c.uniforms || !c.shader))
956
- return X("group", { children: [p("ambientLight", {}), p("pointLight", { position: [10, 10, 10] }), p(de, { color: "white", scale: 20, fontWeight: 1e3, children: "Loading ..." })] });
957
- const ae = {
956
+ return $("group", { children: [p("ambientLight", {}), p("pointLight", { position: [10, 10, 10] }), p(ve, { color: "white", scale: 20, fontWeight: 1e3, children: "Loading ..." })] });
957
+ const le = {
958
958
  segmentationGroup: m,
959
959
  segmentationSettings: _,
960
960
  segmentationSceneScale: g,
961
961
  renderingSettings: c,
962
962
  materialRef: e,
963
- highlightEntity: _e,
964
- setObsHighlight: me
965
- }, { xrEnabled: fe } = t;
966
- return X("group", { children: [fe ? X(ye, { children: [p(ee, { fallback: null, children: p(at, {}) }), p(ee, { fallback: p(oe, { ...ae }), children: p(tt, { ...ae }) })] }) : p(oe, { ...ae }), p(we, { ref: a, enableDamping: !1, dampingFactor: 0 })] });
963
+ highlightEntity: fe,
964
+ setObsHighlight: he
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 })] });
967
+ }
968
+ let te = null;
969
+ async function nt() {
970
+ return te = await import("@react-three/xr"), te;
971
+ }
972
+ function pt() {
973
+ if (!te)
974
+ throw new Error("@react-three/xr is not loaded; call loadXRModule() first.");
975
+ return te;
967
976
  }
968
- const lt = te.lazy(
977
+ const it = ae.lazy(
969
978
  // eslint-disable-next-line implicit-arrow-linebreak, function-paren-newline
970
- () => import("./XRWrapper-C5Rd9HYZ.js").catch(() => ({
979
+ () => import("./XRWrapper-Dvh9MuT0.js").catch(() => ({
971
980
  default: ({ children: t }) => t
972
981
  }))
973
- ), nt = te.lazy(
982
+ ), ot = ae.lazy(
974
983
  // eslint-disable-next-line implicit-arrow-linebreak, function-paren-newline
975
- () => import("./XREnterButton-CqJBXry_.js").catch(() => ({
984
+ () => import("./XREnterButton-CWptL6gh.js").catch(() => ({
976
985
  default: () => null
977
986
  }))
978
- ), it = be((t, e) => {
987
+ ), rt = Se((t, e) => {
979
988
  const [a, o] = G(!1);
980
989
  return q(() => {
981
- import("@react-three/xr").then(() => o(!0)).catch(() => {
990
+ nt().then(() => o(!0)).catch(() => {
982
991
  });
983
- }, []), X("div", { style: { width: "100%", height: "100%" }, children: [a && p(ee, { fallback: null, children: p(nt, {}) }), p(Se, { style: { position: "absolute", top: 0, left: 0 }, camera: {
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: {
984
993
  fov: 50,
985
994
  up: [0, 1, 0],
986
995
  position: [0, 0, 800],
987
996
  near: 0.1,
988
997
  far: 3e3
989
- }, gl: { antialias: !0, logarithmicDepthBuffer: !1 }, ref: e, children: a ? p(ee, { fallback: p(ie, { ...t }), children: p(lt, { children: p(ie, { ...t, xrEnabled: !0 }) }) }) : p(ie, { ...t }) })] });
990
- }), _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
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 }) })] });
999
+ }), xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
991
1000
  __proto__: null,
992
- SpatialWrapper: it
1001
+ SpatialWrapper: rt
993
1002
  }, Symbol.toStringTag, { value: "Module" }));
994
1003
  export {
995
- Ue as M,
996
- _t as a,
997
- vt as i,
998
- et as s
1004
+ Ne as M,
1005
+ xt as a,
1006
+ pt as g,
1007
+ ft as i,
1008
+ tt as s
999
1009
  };