@vitessce/all 3.9.6 → 3.9.8

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,4 +1,4 @@
1
- import { aG as getDefaultExportFromCjs, aH as Raycaster, W as OrthographicCamera, K as PerspectiveCamera, av as Scene, aI as PCFSoftShadowMap, aJ as VSMShadowMap, aK as PCFShadowMap, aL as BasicShadowMap, aM as NoToneMapping, aN as ACESFilmicToneMapping, e as Vector3, V as Vector2, aO as Clock, aP as WebGLRenderer, aQ as Camera, x as BufferGeometry, r as Material, aR as Layers, a1 as Texture, aC as RGBAFormat, ay as UnsignedByteType, C as Color, aj as _extends, aS as THREE, aT as EventDispatcher, aU as MOUSE, aV as TOUCH, aW as Spherical, Q as Quaternion, an as Ray, ak as Plane } from "./index-B1IhEdcb.js";
1
+ import { aG as getDefaultExportFromCjs, aH as Raycaster, W as OrthographicCamera, K as PerspectiveCamera, av as Scene, aI as PCFSoftShadowMap, aJ as VSMShadowMap, aK as PCFShadowMap, aL as BasicShadowMap, aM as NoToneMapping, aN as ACESFilmicToneMapping, e as Vector3, V as Vector2, aO as Clock, aP as WebGLRenderer, aQ as Camera, x as BufferGeometry, r as Material, aR as Layers, a1 as Texture, aC as RGBAFormat, ay as UnsignedByteType, C as Color, aj as _extends, aS as THREE, aT as EventDispatcher, aU as MOUSE, aV as TOUCH, aW as Spherical, Q as Quaternion, an as Ray, ak as Plane } from "./index-gbtRLRj5.js";
2
2
  import * as React from "react";
3
3
  import React__default, { useReducer, useRef, useEffect, useLayoutEffect, useDebugValue, useState, useMemo } from "react";
4
4
  var constants = { exports: {} };
@@ -1,4 +1,4 @@
1
- import { aG as getDefaultExportFromCjs, b1 as requireAssign, b2 as require_export, b3 as require_core, b4 as require_fails, b5 as require_toObject, b6 as require_objectKeys, b7 as require_cof, b8 as require_wks, b9 as require_iterators, ba as requireWeb_dom_iterable, bb as requireEs6_string_iterator, bc as require_anObject, bd as require_hide, be as require_ctx, bf as require_toLength, bg as require_global, bh as require_objectDp, bi as require_descriptors, bj as require_isObject, bk as require_objectCreate, bl as require_iterDefine, bm as require_iterStep, bn as require_meta, bo as require_isArray, bp as require_iobject, bq as require_setToStringTag, br as require_aFunction, bs as requireIterator, bt as require_propertyDesc, a_ as commonjsGlobal, bu as requireEs6_symbol, bv as requireDefineProperty, bw as require_toIobject, bx as require_objectGopd, by as require_html, bz as require_domCreate, bA as require_library, bB as requireSymbol, bC as require_objectPie, bD as require_has, bE as require_redefine, bF as require_objectAssign, bG as diffCameraState, ao as jsxRuntimeExports } from "./index-B1IhEdcb.js";
1
+ import { aG as getDefaultExportFromCjs, b1 as requireAssign, b2 as require_export, b3 as require_core, b4 as require_fails, b5 as require_toObject, b6 as require_objectKeys, b7 as require_cof, b8 as require_wks, b9 as require_iterators, ba as requireWeb_dom_iterable, bb as requireEs6_string_iterator, bc as require_anObject, bd as require_hide, be as require_ctx, bf as require_toLength, bg as require_global, bh as require_objectDp, bi as require_descriptors, bj as require_isObject, bk as require_objectCreate, bl as require_iterDefine, bm as require_iterStep, bn as require_meta, bo as require_isArray, bp as require_iobject, bq as require_setToStringTag, br as require_aFunction, bs as requireIterator, bt as require_propertyDesc, a_ as commonjsGlobal, bu as requireEs6_symbol, bv as requireDefineProperty, bw as require_toIobject, bx as require_objectGopd, by as require_html, bz as require_domCreate, bA as require_library, bB as requireSymbol, bC as require_objectPie, bD as require_has, bE as require_redefine, bF as require_objectAssign, bG as diffCameraState, ao as jsxRuntimeExports } from "./index-gbtRLRj5.js";
2
2
  import React__default from "react";
3
3
  var assignExports = requireAssign();
4
4
  const _Object$assign = /* @__PURE__ */ getDefaultExportFromCjs(assignExports);
@@ -30147,9 +30147,7 @@ const svg_bin = '<svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0
30147
30147
  function makeDeleteButton(options = {}) {
30148
30148
  const icon = makeIcon(_Object$assign({ svg: svg_bin }, options));
30149
30149
  const svg = icon.firstElementChild;
30150
- if (svg) {
30151
- svg.style.fill = "white";
30152
- }
30150
+ if (svg) svg.style.fill = "white";
30153
30151
  return icon;
30154
30152
  }
30155
30153
  var es6_string_raw = {};
@@ -45794,6 +45792,18 @@ class DataManagementContext extends RefCounted {
45794
45792
  this.frameNumberCounter = frameNumberCounter;
45795
45793
  const chunk_worker_url = bundleRoot + "chunk_worker.bundle.js";
45796
45794
  this.worker = typeof bundleRoot === "string" ? new Worker(chunk_worker_url) : bundleRoot;
45795
+ if (typeof bundleRoot !== "string") {
45796
+ this.worker.addEventListener("message", (msg) => {
45797
+ if (msg.data?.functionName === "Worker" && msg.data?.path === "async_computation.bundle.js") {
45798
+ msg.stopImmediatePropagation();
45799
+ const AsyncWorker = bundleRoot.AsyncComputationWorker;
45800
+ if (AsyncWorker) {
45801
+ const asyncWorker = new AsyncWorker();
45802
+ asyncWorker.postMessage({ port: msg.data.port }, [msg.data.port]);
45803
+ }
45804
+ }
45805
+ }, true);
45806
+ }
45797
45807
  this.chunkQueueManager = this.registerDisposer(new ChunkQueueManager(new RPC(this.worker), this.gl, this.frameNumberCounter, {
45798
45808
  gpuMemory: new CapacitySpecification({ defaultItemLimit: 1e6, defaultSizeLimit: 1e9 }),
45799
45809
  systemMemory: new CapacitySpecification({ defaultItemLimit: 1e7, defaultSizeLimit: 2e9 }),
@@ -65431,6 +65441,7 @@ class Neuroglancer extends React__default.Component {
65431
65441
  onVisibleChanged: null,
65432
65442
  onSelectionDetailsStateChanged: null,
65433
65443
  onViewerStateChanged: null,
65444
+ onLayerLoadingChange: null,
65434
65445
  key: null,
65435
65446
  callbacks: [],
65436
65447
  ngServer: "https://neuroglancer-demo.appspot.com/"
@@ -65445,7 +65456,7 @@ class Neuroglancer extends React__default.Component {
65445
65456
  this.disposers = [];
65446
65457
  this.prevColorOverrides = /* @__PURE__ */ new Set();
65447
65458
  this.overrideColorsById = /* @__PURE__ */ Object.create(null);
65448
- this.allKnownIds = /* @__PURE__ */ new Set();
65459
+ this.allKnownIdsByLayer = {};
65449
65460
  }
65450
65461
  minimalPoseSnapshot = () => {
65451
65462
  const v = this.viewer;
@@ -65495,24 +65506,26 @@ class Neuroglancer extends React__default.Component {
65495
65506
  return JSON.stringify(prevLayers) !== JSON.stringify(nextLayers);
65496
65507
  };
65497
65508
  /* To add colors to the segments, turning unselected to grey */
65498
- applyColorsAndVisibility = (cellColorMapping) => {
65509
+ applyColorsAndVisibility = (cellColorMappingByLayer) => {
65499
65510
  if (!this.viewer)
65500
65511
  return;
65501
- const selected = { ...cellColorMapping || {} };
65502
- for (const id of Object.keys(selected))
65503
- this.allKnownIds.add(id);
65504
- if (this.allKnownIds.size === 0) {
65505
- const init = this.props.viewerState?.layers?.[0]?.segmentColors || {};
65506
- for (const id of Object.keys(init))
65507
- this.allKnownIds.add(id);
65508
- }
65509
- const fullSegmentColors = {};
65510
- for (const id of this.allKnownIds) {
65511
- fullSegmentColors[id] = selected[id] || GREY_HEX;
65512
- }
65513
65512
  const baseLayers = this.props.viewerState?.layers ?? (this.viewer.state.toJSON().layers || []);
65514
- const newLayers = baseLayers.map((layer, idx) => {
65515
- if (idx === 0 || layer?.type === "segmentation") {
65513
+ const newLayers = baseLayers.map((layer) => {
65514
+ const layerScope = Object.keys(cellColorMappingByLayer).find((scope) => layer.name?.includes(scope));
65515
+ const selected = { ...cellColorMappingByLayer[layerScope]?.colors || {} };
65516
+ if (!this.allKnownIdsByLayer)
65517
+ this.allKnownIdsByLayer = {};
65518
+ if (!this.allKnownIdsByLayer[layerScope]) {
65519
+ this.allKnownIdsByLayer[layerScope] = /* @__PURE__ */ new Set();
65520
+ }
65521
+ for (const id of Object.keys(selected)) {
65522
+ this.allKnownIdsByLayer[layerScope].add(id);
65523
+ }
65524
+ const fullSegmentColors = {};
65525
+ for (const id of this.allKnownIdsByLayer[layerScope] || []) {
65526
+ fullSegmentColors[id] = selected[id] || GREY_HEX;
65527
+ }
65528
+ if (layer.type === "segmentation") {
65516
65529
  return { ...layer, segmentColors: fullSegmentColors };
65517
65530
  }
65518
65531
  return layer;
@@ -65559,9 +65572,37 @@ class Neuroglancer extends React__default.Component {
65559
65572
  } else {
65560
65573
  viewerNoKey = this.viewer;
65561
65574
  }
65575
+ const { visibleChunksChanged } = this.viewer.chunkQueueManager;
65576
+ let firstChunkLoaded = false;
65577
+ this.disposers.push(visibleChunksChanged.add(() => {
65578
+ if (!firstChunkLoaded) {
65579
+ for (const layer of this.viewer.layerManager.managedLayers) {
65580
+ if (layer.layer instanceof SegmentationUserLayer) {
65581
+ const hasVisibleChunk = layer.layer.renderLayers?.some((rl) => {
65582
+ const { numVisibleChunksAvailable, numVisibleChunksNeeded } = rl.layerChunkProgressInfo || {};
65583
+ if (!numVisibleChunksNeeded || !numVisibleChunksAvailable)
65584
+ return false;
65585
+ return numVisibleChunksAvailable / numVisibleChunksNeeded > 0.25;
65586
+ });
65587
+ if (hasVisibleChunk) {
65588
+ firstChunkLoaded = true;
65589
+ requestAnimationFrame(() => {
65590
+ requestAnimationFrame(() => {
65591
+ this.props.onLayerLoadingChange?.(true);
65592
+ });
65593
+ });
65594
+ return;
65595
+ }
65596
+ }
65597
+ }
65598
+ }
65599
+ }));
65600
+ this.disposers.push(() => {
65601
+ firstChunkLoaded = false;
65602
+ });
65562
65603
  }
65563
65604
  componentDidUpdate(prevProps, prevState) {
65564
- const { viewerState, cellColorMapping } = this.props;
65605
+ const { viewerState, cellColorMapping: cellColorMappingByLayer } = this.props;
65565
65606
  const selectedSegments = {};
65566
65607
  for (const layer of this.viewer.layerManager.managedLayers) {
65567
65608
  if (layer.layer instanceof SegmentationUserLayer) {
@@ -65573,6 +65614,20 @@ class Neuroglancer extends React__default.Component {
65573
65614
  if (layer.layer instanceof SegmentationUserLayer) {
65574
65615
  const { segmentSelectionState } = layer.layer.displayState;
65575
65616
  segmentSelectionState.set(selectedSegments[layer.name]);
65617
+ const layerScope = Object.keys(cellColorMappingByLayer).find((scope) => layer.name?.includes(scope));
65618
+ if (layerScope) {
65619
+ const opacity = cellColorMappingByLayer[layerScope]?.opacity ?? 1;
65620
+ layer.layer.displayState.objectAlpha.value = opacity;
65621
+ }
65622
+ }
65623
+ if (layer.layer instanceof AnnotationUserLayer) {
65624
+ const matchingLayer = (viewerState?.layers || []).find((l) => l.name === layer.name);
65625
+ if (matchingLayer?.shader) {
65626
+ const currentShader = layer.layer.annotationDisplayState.shader.value_;
65627
+ if (currentShader !== matchingLayer.shader) {
65628
+ layer.layer.annotationDisplayState.shader.value = matchingLayer.shader;
65629
+ }
65630
+ }
65576
65631
  }
65577
65632
  }
65578
65633
  if (!viewerState)
@@ -65596,23 +65651,23 @@ class Neuroglancer extends React__default.Component {
65596
65651
  this.withoutEmitting(() => {
65597
65652
  const layers = Array.isArray(viewerState.layers) ? viewerState.layers : [];
65598
65653
  this.viewer.state.restoreState({ layers });
65599
- if (cellColorMapping && Object.keys(cellColorMapping).length) {
65600
- this.applyColorsAndVisibility(cellColorMapping);
65654
+ if (cellColorMappingByLayer && Object.keys(cellColorMappingByLayer).length) {
65655
+ this.applyColorsAndVisibility(cellColorMappingByLayer);
65601
65656
  }
65602
65657
  });
65603
65658
  }
65604
- const prevSize = prevProps.cellColorMapping ? Object.keys(prevProps.cellColorMapping).length : 0;
65605
- const currSize = cellColorMapping ? Object.keys(cellColorMapping).length : 0;
65606
- const mappingRefChanged = prevProps.cellColorMapping !== cellColorMapping;
65659
+ const prevSize = prevProps.cellColorMapping ? Object.values(prevProps.cellColorMapping).reduce((acc, v) => acc + Object.keys(v?.colors || {}).length, 0) : 0;
65660
+ const currSize = cellColorMappingByLayer ? Object.values(cellColorMappingByLayer).reduce((acc, v) => acc + Object.keys(v?.colors || {}).length, 0) : 0;
65661
+ const mappingRefChanged = prevProps.cellColorMapping !== this.props.cellColorMapping;
65607
65662
  if (!this.didLayersChange(prevVS, viewerState) && (mappingRefChanged || prevSize !== currSize)) {
65608
65663
  this.withoutEmitting(() => {
65609
- this.applyColorsAndVisibility(cellColorMapping);
65664
+ this.applyColorsAndVisibility(cellColorMappingByLayer);
65610
65665
  });
65611
65666
  }
65612
65667
  const stripSegFields = (layers) => (layers || []).map((l) => {
65613
65668
  if (!l)
65614
65669
  return l;
65615
- const { segments, segmentColors, ...rest } = l;
65670
+ const { segments, segmentColors, objectAlpha, ...rest } = l;
65616
65671
  return rest;
65617
65672
  });
65618
65673
  const prevLayers = prevProps.viewerState?.layers;
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-SxljTded.js";
2
- import { aX as BaseDecoder } from "./index-B1IhEdcb.js";
2
+ import { aX as BaseDecoder } from "./index-gbtRLRj5.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -1,7 +1,7 @@
1
1
  import * as React$7 from "react";
2
2
  import React__default, { isValidElement, PureComponent, Component, createElement, createContext, createRef } from "react";
3
3
  import ReactDOM__default, { findDOMNode as findDOMNode$1 } from "react-dom";
4
- import { a_ as commonjsGlobal$1, a$ as requireObjectAssign, aG as getDefaultExportFromCjs$1, b0 as earcut } from "./index-B1IhEdcb.js";
4
+ import { a_ as commonjsGlobal$1, a$ as requireObjectAssign, aG as getDefaultExportFromCjs$1, b0 as earcut } from "./index-gbtRLRj5.js";
5
5
  var promise = {};
6
6
  var hasRequiredPromise;
7
7
  function requirePromise() {
@@ -1,6 +1,6 @@
1
- import { aw as log, ax as isEqual, ar as Data3DTexture, as as RedFormat, ay as UnsignedByteType, l as LinearFilter, az as RedIntegerFormat, aA as UnsignedIntType, m as NearestFilter, e as Vector3, V as Vector2, ag as Vector4, ae as UniformsUtils, aq as CoordinationType, aB as WebGLMultipleRenderTargets, aC as RGBAFormat, av as Scene, W as OrthographicCamera, ad as ShaderMaterial, z as Mesh, aD as PlaneGeometry, aE as useEventCallback, ao as jsxRuntimeExports, aF as GLSL3, am as BackSide } from "./index-B1IhEdcb.js";
1
+ import { aw as log, ax as isEqual, ar as Data3DTexture, as as RedFormat, ay as UnsignedByteType, l as LinearFilter, az as RedIntegerFormat, aA as UnsignedIntType, m as NearestFilter, e as Vector3, V as Vector2, ag as Vector4, ae as UniformsUtils, aq as CoordinationType, aB as WebGLMultipleRenderTargets, aC as RGBAFormat, av as Scene, W as OrthographicCamera, ad as ShaderMaterial, z as Mesh, aD as PlaneGeometry, aE as useEventCallback, ao as jsxRuntimeExports, aF as GLSL3, am as BackSide } from "./index-gbtRLRj5.js";
2
2
  import { useRef, useState, useMemo, useEffect, Suspense } from "react";
3
- import { u as useThree, a as useFrame, O as OrbitControls, C as Canvas } from "./OrbitControls-BGcAu271.js";
3
+ import { u as useThree, a as useFrame, O as OrbitControls, C as Canvas } from "./OrbitControls-BSs_Q5On.js";
4
4
  const LogLevel = {
5
5
  INFO: "info",
6
6
  WARN: "warn",
@@ -1,7 +1,7 @@
1
- import { G as Group, M as Matrix4, T as TrianglesDrawMode, a as TriangleFanDrawMode, b as TriangleStripDrawMode, R as REVISION, L as Loader, c as LoaderUtils, F as FileLoader, d as MeshPhysicalMaterial, V as Vector2, C as Color, S as SpotLight, P as PointLight, D as DirectionalLight, e as Vector3, I as InstancedMesh, Q as Quaternion, O as Object3D, f as TextureLoader, g as ImageBitmapLoader, B as BufferAttribute, h as InterleavedBuffer, i as LinearMipmapLinearFilter, N as NearestMipmapLinearFilter, j as LinearMipmapNearestFilter, k as NearestMipmapNearestFilter, l as LinearFilter, m as NearestFilter, n as RepeatWrapping, o as MirroredRepeatWrapping, p as ClampToEdgeWrapping, q as PointsMaterial, r as Material, s as LineBasicMaterial, t as MeshStandardMaterial, u as DoubleSide, v as MeshBasicMaterial, w as PropertyBinding, x as BufferGeometry, y as SkinnedMesh, z as Mesh, A as LineSegments, E as Line$1, H as LineLoop, J as Points, K as PerspectiveCamera, U as MathUtils, W as OrthographicCamera, X as Skeleton, Y as InterpolateDiscrete, Z as InterpolateLinear, _ as AnimationClip, $ as Bone, a0 as InterleavedBufferAttribute, a1 as Texture, a2 as VectorKeyframeTrack, a3 as QuaternionKeyframeTrack, a4 as NumberKeyframeTrack, a5 as FrontSide, a6 as Interpolant, a7 as Box3, a8 as Sphere, a9 as InstancedBufferGeometry, aa as Float32BufferAttribute, ab as InstancedInterleavedBuffer, ac as WireframeGeometry, ad as ShaderMaterial, ae as UniformsUtils, af as UniformsLib, ag as Vector4, ah as Line3, ai as SphereGeometry, aj as _extends, ak as Plane, al as Triangle, am as BackSide, an as Ray$1, ao as jsxRuntimeExports, ap as Matrix3, aq as CoordinationType, ar as Data3DTexture, as as RedFormat, at as FloatType, au as getImageSize, av as Scene } from "./index-B1IhEdcb.js";
1
+ import { G as Group, M as Matrix4, T as TrianglesDrawMode, a as TriangleFanDrawMode, b as TriangleStripDrawMode, R as REVISION, L as Loader, c as LoaderUtils, F as FileLoader, d as MeshPhysicalMaterial, V as Vector2, C as Color, S as SpotLight, P as PointLight, D as DirectionalLight, e as Vector3, I as InstancedMesh, Q as Quaternion, O as Object3D, f as TextureLoader, g as ImageBitmapLoader, B as BufferAttribute, h as InterleavedBuffer, i as LinearMipmapLinearFilter, N as NearestMipmapLinearFilter, j as LinearMipmapNearestFilter, k as NearestMipmapNearestFilter, l as LinearFilter, m as NearestFilter, n as RepeatWrapping, o as MirroredRepeatWrapping, p as ClampToEdgeWrapping, q as PointsMaterial, r as Material, s as LineBasicMaterial, t as MeshStandardMaterial, u as DoubleSide, v as MeshBasicMaterial, w as PropertyBinding, x as BufferGeometry, y as SkinnedMesh, z as Mesh, A as LineSegments, E as Line$1, H as LineLoop, J as Points, K as PerspectiveCamera, U as MathUtils, W as OrthographicCamera, X as Skeleton, Y as InterpolateDiscrete, Z as InterpolateLinear, _ as AnimationClip, $ as Bone, a0 as InterleavedBufferAttribute, a1 as Texture, a2 as VectorKeyframeTrack, a3 as QuaternionKeyframeTrack, a4 as NumberKeyframeTrack, a5 as FrontSide, a6 as Interpolant, a7 as Box3, a8 as Sphere, a9 as InstancedBufferGeometry, aa as Float32BufferAttribute, ab as InstancedInterleavedBuffer, ac as WireframeGeometry, ad as ShaderMaterial, ae as UniformsUtils, af as UniformsLib, ag as Vector4, ah as Line3, ai as SphereGeometry, aj as _extends, ak as Plane, al as Triangle, am as BackSide, an as Ray$1, ao as jsxRuntimeExports, ap as Matrix3, aq as CoordinationType, ar as Data3DTexture, as as RedFormat, at as FloatType, au as getImageSize, av as Scene } from "./index-gbtRLRj5.js";
2
2
  import * as React from "react";
3
3
  import { useRef, useEffect, useState, forwardRef } from "react";
4
- import { u as useThree, a as useFrame, c as create, e as extend, b as createPortal, O as OrbitControls, C as Canvas } from "./OrbitControls-BGcAu271.js";
4
+ import { u as useThree, a as useFrame, c as create, e as extend, b as createPortal, O as OrbitControls, C as Canvas } from "./OrbitControls-BSs_Q5On.js";
5
5
  const isPromise = (promise) => typeof promise === "object" && typeof promise.then === "function";
6
6
  const globalCache = [];
7
7
  function shallowEqualArrays(arrA, arrB, equal = (a, b) => a === b) {
@@ -5027,7 +5027,7 @@ const Text = /* @__PURE__ */ React.forwardRef(({
5027
5027
  const {
5028
5028
  Text: TextMeshImpl,
5029
5029
  preloadFont
5030
- } = suspend(async () => import("./troika-three-text.esm-BKSLyjBY.js"), []);
5030
+ } = suspend(async () => import("./troika-three-text.esm-DK1u2spU.js"), []);
5031
5031
  const invalidate = useThree(({
5032
5032
  invalidate: invalidate2
5033
5033
  }) => invalidate2);