@vitessce/dev 3.8.10 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{OrbitControls-CWfDh9F3.js → OrbitControls-XnzJtnMh.js} +1 -1
- package/dist/{ReactNeuroglancer-DSXzAFHD.js → ReactNeuroglancer-BTLpuV09.js} +1 -1
- package/dist/{deflate-Nz0blktd.js → deflate-0UC3wUc7.js} +1 -1
- package/dist/{higlass-BSYe98wz.js → higlass-DTBEnOUt.js} +1 -1
- package/dist/{index-DMKFK_xq.js → index-4EtK005E.js} +181 -63
- package/dist/{index-x9jj_7-2.js → index-B-7qLcpV.js} +3 -3
- package/dist/{index-BjpiwjRf.js → index-P1FfHDqS.js} +3465 -2031
- package/dist/index.js +38 -38
- package/dist/{jpeg-BYACNTpB.js → jpeg-B-cJrwmt.js} +1 -1
- package/dist/{lerc-DJjWAaxL.js → lerc-BdcQu2oQ.js} +1 -1
- package/dist/{lzw-DMfiHSb8.js → lzw-CdFWMxJD.js} +1 -1
- package/dist/{packbits-B0Er8O1M.js → packbits-C-CYBJdL.js} +1 -1
- package/dist/{raw-BFK8nawV.js → raw-DgICW0IR.js} +1 -1
- package/dist/{troika-three-text.esm-CJL_2PSA.js → troika-three-text.esm-Cz3t4bdh.js} +1 -1
- package/dist/{webimage-DgB3AHvK.js → webimage-B0Qn48pR.js} +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aI as getDefaultExportFromCjs, aJ as Raycaster, W as OrthographicCamera, K as PerspectiveCamera, av as Scene, aK as PCFSoftShadowMap, aL as VSMShadowMap, aM as PCFShadowMap, aN as BasicShadowMap, aO as NoToneMapping, aP as ACESFilmicToneMapping, e as Vector3, V as Vector2, aQ as Clock, aR as WebGLRenderer, aS as Camera, x as BufferGeometry, r as Material, aT as Layers, a1 as Texture, aE as RGBAFormat, az as UnsignedByteType, C as Color, aj as _extends, aU as THREE, aV as EventDispatcher, aW as MOUSE, aX as TOUCH, aY as Spherical, Q as Quaternion, an as Ray, ak as Plane } from "./index-P1FfHDqS.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,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import {
|
|
4
|
+
import { aI as getDefaultExportFromCjs, b3 as requireAssign, b4 as require_export, b5 as require_core, b6 as require_fails, b7 as require_toObject, b8 as require_objectKeys, b9 as require_cof, ba as require_wks, bb as require_iterators, bc as requireWeb_dom_iterable, bd as requireEs6_string_iterator, be as require_anObject, bf as require_hide, bg as require_ctx, bh as require_toLength, bi as require_global, bj as require_objectDp, bk as require_descriptors, bl as require_isObject, bm as require_objectCreate, bn as require_iterDefine, bo as require_iterStep, bp as require_meta, bq as require_isArray, br as require_iobject, bs as require_setToStringTag, bt as require_aFunction, bu as requireIterator, bv as require_propertyDesc, bw as require_root, bx as require_baseGetTag, by as requireIsObjectLike, bz as requireIsObject, bA as requireEs6_symbol, bB as requireDefineProperty, bC as require_toIobject, bD as require_objectGopd, bE as require_html, bF as require_domCreate, bG as require_library, bH as requireSymbol, bI as require_objectPie, bJ as require_has, bK as require_redefine, bL as require_objectAssign, bM as diffCameraState, ao as jsxRuntimeExports } from "./index-P1FfHDqS.js";
|
|
5
5
|
import React__default from "react";
|
|
6
6
|
var assignExports = requireAssign();
|
|
7
7
|
const _Object$assign = /* @__PURE__ */ getDefaultExportFromCjs(assignExports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as inflate_1 } from "./pako.esm-SxljTded.js";
|
|
2
|
-
import {
|
|
2
|
+
import { aZ as BaseDecoder } from "./index-P1FfHDqS.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 {
|
|
4
|
+
import { b0 as commonjsGlobal$1, b1 as requireObjectAssign, aI as getDefaultExportFromCjs$1, b2 as earcut } from "./index-P1FfHDqS.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, ay as atLeastLogLevel, ar as Data3DTexture, as as RedFormat, az as UnsignedByteType, l as LinearFilter, aA as RedIntegerFormat, aB as UnsignedIntType, m as NearestFilter, aC as LogLevel, e as Vector3, V as Vector2, ag as Vector4, ae as UniformsUtils, aq as CoordinationType, aD as WebGLMultipleRenderTargets, aE as RGBAFormat, av as Scene, W as OrthographicCamera, ad as ShaderMaterial, z as Mesh, aF as PlaneGeometry, ao as jsxRuntimeExports,
|
|
2
|
-
import { useRef, useState, useMemo, useEffect,
|
|
3
|
-
import { u as useThree, a as useFrame, O as OrbitControls, C as Canvas } from "./OrbitControls-
|
|
1
|
+
import { aw as log, ax as isEqual, ay as atLeastLogLevel, ar as Data3DTexture, as as RedFormat, az as UnsignedByteType, l as LinearFilter, aA as RedIntegerFormat, aB as UnsignedIntType, m as NearestFilter, aC as LogLevel, e as Vector3, V as Vector2, ag as Vector4, ae as UniformsUtils, aq as CoordinationType, aD as WebGLMultipleRenderTargets, aE as RGBAFormat, av as Scene, W as OrthographicCamera, ad as ShaderMaterial, z as Mesh, aF as PlaneGeometry, aG as useEventCallback, ao as jsxRuntimeExports, aH as GLSL3, am as BackSide } from "./index-P1FfHDqS.js";
|
|
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-XnzJtnMh.js";
|
|
4
4
|
const BRICK_SIZE = 32;
|
|
5
5
|
const BRICK_CACHE_SIZE_X = 64;
|
|
6
6
|
const BRICK_CACHE_SIZE_Y = 64;
|
|
@@ -322,12 +322,55 @@ class VolumeDataManager {
|
|
|
322
322
|
this.timeStamp = 0;
|
|
323
323
|
this.k = 40;
|
|
324
324
|
this.noNewRequests = false;
|
|
325
|
+
this.manuallyStopped = false;
|
|
325
326
|
this.needsBailout = false;
|
|
326
327
|
this.initStatus = INIT_STATUS.NOT_STARTED;
|
|
327
328
|
this.initError = null;
|
|
328
329
|
this._lastChannelConfig = null;
|
|
330
|
+
this.currentRequestCount = 0;
|
|
331
|
+
this.totalBricksRequested = 0;
|
|
329
332
|
logWithColor$2("VolumeDataManager constructor complete");
|
|
330
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Get loading progress information
|
|
336
|
+
* @returns {Object} Loading progress with bricksLoaded, totalBricks, isLoading, and percentage
|
|
337
|
+
*/
|
|
338
|
+
getLoadingProgress() {
|
|
339
|
+
const bricksLoaded = this.bricksEverLoaded.size;
|
|
340
|
+
const isLoading = !this.noNewRequests && this.currentRequestCount > 0;
|
|
341
|
+
const percentage = this.totalBricksRequested > 0 ? (this.totalBricksRequested - this.currentRequestCount) / this.totalBricksRequested * 100 : 0;
|
|
342
|
+
return {
|
|
343
|
+
bricksLoaded,
|
|
344
|
+
currentRequestCount: this.currentRequestCount,
|
|
345
|
+
totalBricksRequested: this.totalBricksRequested,
|
|
346
|
+
isLoading,
|
|
347
|
+
percentage,
|
|
348
|
+
noNewRequests: this.noNewRequests
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Manually stop loading and render at highest resolution
|
|
353
|
+
*/
|
|
354
|
+
stopLoading() {
|
|
355
|
+
log.debug("Manually stopping data loading");
|
|
356
|
+
this.noNewRequests = true;
|
|
357
|
+
this.manuallyStopped = true;
|
|
358
|
+
this.needsBailout = true;
|
|
359
|
+
this.currentRequestCount = 0;
|
|
360
|
+
this.totalBricksRequested = 0;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Manually restart loading
|
|
364
|
+
*/
|
|
365
|
+
restartLoading() {
|
|
366
|
+
log.debug("Manually restarting data loading");
|
|
367
|
+
this.noNewRequests = false;
|
|
368
|
+
this.manuallyStopped = false;
|
|
369
|
+
this.needsBailout = false;
|
|
370
|
+
this.triggerUsage = true;
|
|
371
|
+
this.currentRequestCount = 0;
|
|
372
|
+
this.totalBricksRequested = 0;
|
|
373
|
+
}
|
|
331
374
|
/**
|
|
332
375
|
* Handle WebGL context loss
|
|
333
376
|
*/
|
|
@@ -598,16 +641,11 @@ class VolumeDataManager {
|
|
|
598
641
|
this.bcTHREE = bcTHREE;
|
|
599
642
|
logWithColor$2("initMRMCPT() COMPLETE");
|
|
600
643
|
}
|
|
601
|
-
/*
|
|
602
|
-
testTexture() {
|
|
603
|
-
log.debug('testTexture pt', this.ptTHREE);
|
|
604
|
-
log.debug('testTexture bc', this.bcTHREE);
|
|
605
|
-
}
|
|
606
|
-
*/
|
|
607
644
|
async initTexture() {
|
|
608
645
|
const requests = [
|
|
609
646
|
{ x: 0, y: 0, z: 1 }
|
|
610
647
|
];
|
|
648
|
+
logWithColor$2("initTexture - loading first brick");
|
|
611
649
|
await this.handleBrickRequests(requests);
|
|
612
650
|
}
|
|
613
651
|
updateChannels(channelProps) {
|
|
@@ -793,6 +831,7 @@ class VolumeDataManager {
|
|
|
793
831
|
if (!this.zarrStore || !this.zarrStore.arrays[resolution]) {
|
|
794
832
|
throw new Error("Zarr store or resolution not initialized");
|
|
795
833
|
}
|
|
834
|
+
log.debug("loadZarrChunk", { t, c, z, y, x, resolution });
|
|
796
835
|
const array = this.zarrStore.arrays[resolution];
|
|
797
836
|
const chunkEntry = await array.getChunk([t, c, z, y, x]);
|
|
798
837
|
if (!chunkEntry) {
|
|
@@ -808,6 +847,10 @@ class VolumeDataManager {
|
|
|
808
847
|
log.debug("processRequestData: already busy, skipping");
|
|
809
848
|
return;
|
|
810
849
|
}
|
|
850
|
+
if (this.noNewRequests) {
|
|
851
|
+
log.debug("processRequestData: loading stopped by user, skipping");
|
|
852
|
+
return;
|
|
853
|
+
}
|
|
811
854
|
if (this.isContextLost()) {
|
|
812
855
|
log.debug("processRequestData: WebGL context is lost, skipping");
|
|
813
856
|
return;
|
|
@@ -1009,6 +1052,7 @@ class VolumeDataManager {
|
|
|
1009
1052
|
}
|
|
1010
1053
|
log.debug("starting to load zarr chunk", { resolution, z, y, x, zarrChannel });
|
|
1011
1054
|
let chunk = await this.loadZarrChunk(0, zarrChannel, z, y, x, resolution);
|
|
1055
|
+
log.debug("chunk", chunk);
|
|
1012
1056
|
if (chunk instanceof Uint16Array) {
|
|
1013
1057
|
log.debug("chunk is Uint16Array, converting to Uint8Array");
|
|
1014
1058
|
if (this.channels.downsampleMin[channel] === void 0) {
|
|
@@ -1019,9 +1063,15 @@ class VolumeDataManager {
|
|
|
1019
1063
|
log.debug("this.channels.downsampleMin[channel]", this.channels.downsampleMin[channel]);
|
|
1020
1064
|
log.debug("this.channels.downsampleMax[channel]", this.channels.downsampleMax[channel]);
|
|
1021
1065
|
}
|
|
1066
|
+
const uint16View = new Uint16Array(chunk.buffer);
|
|
1022
1067
|
const uint8Chunk = new Uint8Array(chunk.length);
|
|
1023
|
-
|
|
1024
|
-
|
|
1068
|
+
const minVal = this.channels.downsampleMin[channel];
|
|
1069
|
+
const maxVal = this.channels.downsampleMax[channel];
|
|
1070
|
+
const range = maxVal - minVal;
|
|
1071
|
+
for (let i = 0; i < uint16View.length; i++) {
|
|
1072
|
+
const val = uint16View[i];
|
|
1073
|
+
const clamped = Math.max(minVal, Math.min(maxVal, val));
|
|
1074
|
+
uint8Chunk[i] = (clamped - minVal) * 255 / range | 0;
|
|
1025
1075
|
}
|
|
1026
1076
|
chunk = uint8Chunk;
|
|
1027
1077
|
}
|
|
@@ -1074,12 +1124,14 @@ class VolumeDataManager {
|
|
|
1074
1124
|
async handleBrickRequests(ptRequests) {
|
|
1075
1125
|
if (ptRequests.length === 0)
|
|
1076
1126
|
return;
|
|
1127
|
+
this.totalBricksRequested = ptRequests.length;
|
|
1128
|
+
this.currentRequestCount = ptRequests.length;
|
|
1077
1129
|
const slots = this._allocateBCSlots(ptRequests.length);
|
|
1078
1130
|
log.debug("Handling brick requests:", { requestCount: ptRequests.length, slotCount: slots.length });
|
|
1079
1131
|
log.debug("handleBrickRequests: starting for loop");
|
|
1080
1132
|
for (let i = 0; i < ptRequests.length; ++i) {
|
|
1081
|
-
log.debug("uploading brick", ptRequests[i], slots[i]);
|
|
1082
1133
|
await this._uploadBrick(ptRequests[i], slots[i]);
|
|
1134
|
+
this.currentRequestCount = ptRequests.length - i - 1;
|
|
1083
1135
|
const rlength = this.bricksEverLoaded.size;
|
|
1084
1136
|
this.bricksEverLoaded.add(`${ptRequests[i].x},${ptRequests[i].y},${ptRequests[i].z}`);
|
|
1085
1137
|
if (rlength === this.bricksEverLoaded.size) {
|
|
@@ -1088,9 +1140,11 @@ class VolumeDataManager {
|
|
|
1088
1140
|
if (this.needsBailout) {
|
|
1089
1141
|
log.debug("Bailing out of handleBrickRequests early due to needsBailout flag");
|
|
1090
1142
|
this.needsBailout = false;
|
|
1143
|
+
this.currentRequestCount = 0;
|
|
1091
1144
|
break;
|
|
1092
1145
|
}
|
|
1093
1146
|
}
|
|
1147
|
+
this.currentRequestCount = 0;
|
|
1094
1148
|
log.debug("this.bricksEverLoaded", this.bricksEverLoaded);
|
|
1095
1149
|
}
|
|
1096
1150
|
/* --------------------------------------------------------- *
|
|
@@ -1188,7 +1242,7 @@ uniform usampler3D pageTableTex;
|
|
|
1188
1242
|
// ========================================
|
|
1189
1243
|
// RENDERING PARAMETERS/CONSTANTS
|
|
1190
1244
|
// ========================================
|
|
1191
|
-
// Rendering style: 0=MIP, 1=MinIP, 2=standard volume rendering
|
|
1245
|
+
// Rendering style: 0=MIP, 1=MinIP, 2=standard volume rendering, 3=DEBUG
|
|
1192
1246
|
uniform int u_renderstyle;
|
|
1193
1247
|
// Global opacity multiplier for volume rendering
|
|
1194
1248
|
uniform float opacity;
|
|
@@ -2200,7 +2254,19 @@ void main(void) {
|
|
|
2200
2254
|
// TODO: figure out how to hook it up with frontend
|
|
2201
2255
|
int [] c_res_min = int[7](getRes(0).x, getRes(1).x, getRes(2).x, getRes(3).x, getRes(4).x, getRes(5).x, getRes(6).x);
|
|
2202
2256
|
int [] c_res_max = int[7](getRes(0).y, getRes(1).y, getRes(2).y, getRes(3).y, getRes(4).y, getRes(5).y, getRes(6).y);
|
|
2203
|
-
|
|
2257
|
+
vec3 [] res_color = vec3[10](
|
|
2258
|
+
vec3(1.0, 0.0, 0.0),
|
|
2259
|
+
vec3(0.0, 0.0, 1.0),
|
|
2260
|
+
vec3(0.0, 1.0, 0.0),
|
|
2261
|
+
vec3(1.0, 0.0, 1.0),
|
|
2262
|
+
vec3(0.0, 1.0, 1.0),
|
|
2263
|
+
vec3(1.0, 1.0, 0.0),
|
|
2264
|
+
vec3(1.0, 0.5, 0.5),
|
|
2265
|
+
vec3(0.5, 0.5, 1.0),
|
|
2266
|
+
vec3(0.5, 1.0, 0.5),
|
|
2267
|
+
vec3(0.5, 0.5, 0.5)
|
|
2268
|
+
);
|
|
2269
|
+
|
|
2204
2270
|
// ========================================
|
|
2205
2271
|
// PER-CHANNEL STATE ARRAYS
|
|
2206
2272
|
// ========================================
|
|
@@ -2638,7 +2704,13 @@ void main(void) {
|
|
|
2638
2704
|
// Accumulate this channel's contribution.
|
|
2639
2705
|
// sum up the values onto the slice values
|
|
2640
2706
|
total += c_val_current[c];
|
|
2641
|
-
|
|
2707
|
+
if (u_renderstyle == 3) {
|
|
2708
|
+
rgbCombo += c_val_current[c] * res_color[targetRes];
|
|
2709
|
+
} else if (u_renderstyle == 4) {
|
|
2710
|
+
rgbCombo += c_val_current[c] * res_color[c_res_current[c]];
|
|
2711
|
+
} else {
|
|
2712
|
+
rgbCombo += c_val_current[c] * c_color[c];
|
|
2713
|
+
}
|
|
2642
2714
|
|
|
2643
2715
|
}
|
|
2644
2716
|
|
|
@@ -2725,6 +2797,7 @@ const VolumeShader = {
|
|
|
2725
2797
|
zClip: { value: new Vector2(0, 1e6) },
|
|
2726
2798
|
u_window_size: { value: new Vector2(1, 1) },
|
|
2727
2799
|
u_vol_scale: { value: new Vector3(1, 1, 1) },
|
|
2800
|
+
// Set renderstyle to 3 or 4 for debugging modes
|
|
2728
2801
|
u_renderstyle: { value: 2 },
|
|
2729
2802
|
brickCacheTex: { type: "sampler3D", value: null },
|
|
2730
2803
|
pageTableTex: { type: "usampler3D", value: null },
|
|
@@ -2827,10 +2900,10 @@ class VolumeRenderManager {
|
|
|
2827
2900
|
* @returns {Object} Extracted rendering settings
|
|
2828
2901
|
*/
|
|
2829
2902
|
extractRenderingSettingsFromProps(props) {
|
|
2830
|
-
logWithColor$1("Extracting rendering settings from props");
|
|
2831
2903
|
const { images = {}, imageLayerScopes = [], imageLayerCoordination = [{}], imageChannelScopesByLayer = {}, imageChannelCoordination = [{}], spatialRenderingMode } = props;
|
|
2832
2904
|
const layerScope = imageLayerScopes[0];
|
|
2833
2905
|
if (!layerScope) {
|
|
2906
|
+
logWithColor$1("Extracting rendering settings from props - no layer scope");
|
|
2834
2907
|
return {
|
|
2835
2908
|
valid: false
|
|
2836
2909
|
};
|
|
@@ -2840,11 +2913,13 @@ class VolumeRenderManager {
|
|
|
2840
2913
|
const channelCoordination = imageChannelCoordination[0][layerScope];
|
|
2841
2914
|
const data = images[layerScope]?.image?.instance?.getData();
|
|
2842
2915
|
if (!data) {
|
|
2916
|
+
logWithColor$1("Extracting rendering settings from props - no image data");
|
|
2843
2917
|
return {
|
|
2844
2918
|
valid: false
|
|
2845
2919
|
};
|
|
2846
2920
|
}
|
|
2847
2921
|
if (!channelCoordination[channelScopes?.[0]][CoordinationType.SPATIAL_CHANNEL_WINDOW]) {
|
|
2922
|
+
logWithColor$1("Extracting rendering settings from props - no channel window set");
|
|
2848
2923
|
return {
|
|
2849
2924
|
valid: false
|
|
2850
2925
|
};
|
|
@@ -2886,10 +2961,12 @@ class VolumeRenderManager {
|
|
|
2886
2961
|
let xSlice = layerCoordination[CoordinationType.SPATIAL_SLICE_X];
|
|
2887
2962
|
let ySlice = layerCoordination[CoordinationType.SPATIAL_SLICE_Y];
|
|
2888
2963
|
let zSlice = layerCoordination[CoordinationType.SPATIAL_SLICE_Z];
|
|
2964
|
+
const lodFactor = layerCoordination[CoordinationType.SPATIAL_LOD_FACTOR] ?? 1;
|
|
2889
2965
|
xSlice = xSlice !== null ? xSlice : new Vector2(-1, 1e5);
|
|
2890
2966
|
ySlice = ySlice !== null ? ySlice : new Vector2(-1, 1e5);
|
|
2891
2967
|
zSlice = zSlice !== null ? zSlice : new Vector2(-1, 1e5);
|
|
2892
2968
|
const allChannels = images[layerScope].image.loaders[0].channels;
|
|
2969
|
+
logWithColor$1("Extracting rendering settings from props - success");
|
|
2893
2970
|
return {
|
|
2894
2971
|
valid: true,
|
|
2895
2972
|
channelsVisible,
|
|
@@ -2903,7 +2980,8 @@ class VolumeRenderManager {
|
|
|
2903
2980
|
layerTransparency,
|
|
2904
2981
|
xSlice,
|
|
2905
2982
|
ySlice,
|
|
2906
|
-
zSlice
|
|
2983
|
+
zSlice,
|
|
2984
|
+
lodFactor
|
|
2907
2985
|
};
|
|
2908
2986
|
}
|
|
2909
2987
|
/**
|
|
@@ -2912,9 +2990,9 @@ class VolumeRenderManager {
|
|
|
2912
2990
|
* @returns {boolean} True if settings were successfully updated
|
|
2913
2991
|
*/
|
|
2914
2992
|
updateFromProps(props) {
|
|
2915
|
-
logWithColor$1("Updating from props");
|
|
2916
2993
|
const settings = this.extractRenderingSettingsFromProps(props);
|
|
2917
2994
|
if (!settings.valid) {
|
|
2995
|
+
logWithColor$1("Updating from props - invalid settings");
|
|
2918
2996
|
return false;
|
|
2919
2997
|
}
|
|
2920
2998
|
this.channelsVisible = settings.channelsVisible;
|
|
@@ -2927,6 +3005,10 @@ class VolumeRenderManager {
|
|
|
2927
3005
|
this.xSlice = settings.xSlice;
|
|
2928
3006
|
this.ySlice = settings.ySlice;
|
|
2929
3007
|
this.zSlice = settings.zSlice;
|
|
3008
|
+
this.uniforms.lodFactor.value = settings.lodFactor;
|
|
3009
|
+
logWithColor$1(`lodFactor ${settings.lodFactor}`);
|
|
3010
|
+
this.shader.uniforms.lodFactor.value = settings.lodFactor;
|
|
3011
|
+
logWithColor$1("Updating from props - success");
|
|
2930
3012
|
return true;
|
|
2931
3013
|
}
|
|
2932
3014
|
/**
|
|
@@ -3331,7 +3413,7 @@ function performBlitPass(_gl, { screenSceneRef, screenCameraRef }) {
|
|
|
3331
3413
|
function handleRequests(_gl, { frameRef, dataManager, mrtRef, bufRequest, bufUsage }) {
|
|
3332
3414
|
const ctx = _gl.getContext();
|
|
3333
3415
|
const f = frameRef.current;
|
|
3334
|
-
if (dataManager.noNewRequests === true && f % 100 === 0 && f < 500) {
|
|
3416
|
+
if (dataManager.noNewRequests === true && !dataManager.manuallyStopped && f % 100 === 0 && f < 500) {
|
|
3335
3417
|
dataManager.noNewRequests = false;
|
|
3336
3418
|
}
|
|
3337
3419
|
if (dataManager.triggerRequest === true && dataManager.noNewRequests === false) {
|
|
@@ -3356,8 +3438,10 @@ function handleAdaptiveQuality(clock, params) {
|
|
|
3356
3438
|
}
|
|
3357
3439
|
}
|
|
3358
3440
|
if (isInteracting) {
|
|
3359
|
-
dataManager.
|
|
3360
|
-
|
|
3441
|
+
if (!dataManager.manuallyStopped) {
|
|
3442
|
+
dataManager.noNewRequests = false;
|
|
3443
|
+
dataManager.triggerUsage = true;
|
|
3444
|
+
}
|
|
3361
3445
|
return;
|
|
3362
3446
|
}
|
|
3363
3447
|
if (spatialRenderingModeChanging)
|
|
@@ -3415,7 +3499,8 @@ function VolumeView(props) {
|
|
|
3415
3499
|
imageChannelCoordination,
|
|
3416
3500
|
// onInitComplete,
|
|
3417
3501
|
spatialRenderingMode,
|
|
3418
|
-
spatialRenderingModeChanging
|
|
3502
|
+
spatialRenderingModeChanging,
|
|
3503
|
+
onVolumeLoadingUpdate
|
|
3419
3504
|
} = props;
|
|
3420
3505
|
const {
|
|
3421
3506
|
gl
|
|
@@ -3434,11 +3519,11 @@ function VolumeView(props) {
|
|
|
3434
3519
|
meshScale: [1, 1, 1],
|
|
3435
3520
|
geometrySize: [1, 1, 1]
|
|
3436
3521
|
});
|
|
3437
|
-
const
|
|
3522
|
+
const is3D = spatialRenderingMode === "3D";
|
|
3438
3523
|
const screenSceneRef = useRef(null);
|
|
3439
3524
|
const screenCameraRef = useRef(null);
|
|
3440
3525
|
const screenQuadRef = useRef(null);
|
|
3441
|
-
const [isInteracting,
|
|
3526
|
+
const [isInteracting, _setIsInteracting] = useState(false);
|
|
3442
3527
|
const interactionTimeoutRef = useRef(null);
|
|
3443
3528
|
const stillRef = useRef(false);
|
|
3444
3529
|
const frameRef = useRef(0);
|
|
@@ -3491,6 +3576,7 @@ function VolumeView(props) {
|
|
|
3491
3576
|
const firstImageLayerChannelCoordination = imageChannelCoordination?.[0]?.[firstImageLayerScope];
|
|
3492
3577
|
useEffect(() => {
|
|
3493
3578
|
logWithColor("useEffect INIT");
|
|
3579
|
+
let hasRerun = false;
|
|
3494
3580
|
if (!dataManager || !renderManager) {
|
|
3495
3581
|
log.debug("dataManager or renderManager not initialized yet");
|
|
3496
3582
|
return;
|
|
@@ -3503,24 +3589,32 @@ function VolumeView(props) {
|
|
|
3503
3589
|
log.debug("no firstImageLayerChannelCoordination yet");
|
|
3504
3590
|
return;
|
|
3505
3591
|
}
|
|
3506
|
-
|
|
3592
|
+
const initializeDataManager = async () => {
|
|
3593
|
+
if (dataManager.initStatus === INIT_STATUS.COMPLETE) {
|
|
3594
|
+
log.debug("dataManager already initialized, skipping");
|
|
3595
|
+
return;
|
|
3596
|
+
}
|
|
3507
3597
|
dataManager.initImages(images, imageLayerScopes);
|
|
3508
3598
|
await dataManager.init(firstImageLayerChannelCoordination);
|
|
3599
|
+
if (hasRerun) {
|
|
3600
|
+
log.debug("Initialization useEffect has rerun, aborting remaining initialization");
|
|
3601
|
+
return;
|
|
3602
|
+
}
|
|
3603
|
+
log.debug("dataManager initialized");
|
|
3509
3604
|
renderManager.setZarrUniforms(dataManager.zarrStore, dataManager.PT);
|
|
3510
3605
|
renderManager.setChannelMapping(dataManager.channels.colorMappings);
|
|
3511
3606
|
log.debug("rm.uniforms", renderManager.uniforms);
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
]);
|
|
3607
|
+
invalidate();
|
|
3608
|
+
};
|
|
3609
|
+
initializeDataManager();
|
|
3610
|
+
return () => {
|
|
3611
|
+
hasRerun = true;
|
|
3612
|
+
};
|
|
3613
|
+
}, [dataManager, renderManager, images, imageLayerScopes]);
|
|
3519
3614
|
useEffect(() => {
|
|
3520
|
-
logWithColor("useEffect spatialRenderingMode");
|
|
3521
3615
|
const on3D = spatialRenderingMode === "3D";
|
|
3522
|
-
setIs3D(on3D);
|
|
3523
3616
|
if (on3D && dataManager && renderManager) {
|
|
3617
|
+
logWithColor("useEffect spatialRenderingMode");
|
|
3524
3618
|
const propsForRenderManager = {
|
|
3525
3619
|
images,
|
|
3526
3620
|
imageLayerScopes,
|
|
@@ -3553,33 +3647,15 @@ function VolumeView(props) {
|
|
|
3553
3647
|
}
|
|
3554
3648
|
}
|
|
3555
3649
|
}
|
|
3556
|
-
}, [
|
|
3557
|
-
dataManager,
|
|
3558
|
-
renderManager,
|
|
3559
|
-
images,
|
|
3560
|
-
imageLayerScopes,
|
|
3561
|
-
imageLayerCoordination,
|
|
3562
|
-
imageChannelScopesByLayer,
|
|
3563
|
-
imageChannelCoordination,
|
|
3564
|
-
spatialRenderingMode
|
|
3565
|
-
]);
|
|
3566
|
-
useEffect(() => {
|
|
3567
|
-
logWithColor("useEffect isInteracting");
|
|
3568
|
-
if (isInteracting) {
|
|
3569
|
-
const meshRefUniforms = meshRef.current?.material?.uniforms;
|
|
3570
|
-
if (meshRefUniforms) {
|
|
3571
|
-
meshRefUniforms.renderRes.value = dataManager.PT.lowestDataRes;
|
|
3572
|
-
}
|
|
3573
|
-
stillRef.current = false;
|
|
3574
|
-
invalidate();
|
|
3575
|
-
}
|
|
3576
|
-
}, [invalidate, isInteracting]);
|
|
3650
|
+
}, [dataManager, renderManager, images, imageLayerScopes, imageLayerCoordination, imageChannelScopesByLayer, imageChannelCoordination, spatialRenderingMode]);
|
|
3577
3651
|
const RENDER_PRIORITY = 1;
|
|
3578
3652
|
useFrame((state, delta, xrFrame) => {
|
|
3579
|
-
if (!mrtRef.current || !dataManager || !renderManager)
|
|
3653
|
+
if (!mrtRef.current || !dataManager || !renderManager) {
|
|
3580
3654
|
return;
|
|
3581
|
-
|
|
3655
|
+
}
|
|
3656
|
+
if (!renderState.shader) {
|
|
3582
3657
|
return;
|
|
3658
|
+
}
|
|
3583
3659
|
const { gl: frameGl, camera: frameCamera, scene: frameScene, clock } = state;
|
|
3584
3660
|
if (!stillRef.current) {
|
|
3585
3661
|
performGeometryPass(frameGl, frameCamera, frameScene, { mrtRef });
|
|
@@ -3600,15 +3676,27 @@ function VolumeView(props) {
|
|
|
3600
3676
|
});
|
|
3601
3677
|
frameRef.current += 1;
|
|
3602
3678
|
}, RENDER_PRIORITY);
|
|
3603
|
-
const
|
|
3679
|
+
const setIsInteracting = useEventCallback((interacting) => {
|
|
3680
|
+
logWithColor("invalidateOnInteraction callback");
|
|
3681
|
+
_setIsInteracting(interacting);
|
|
3682
|
+
if (interacting) {
|
|
3683
|
+
const meshRefUniforms = meshRef.current?.material?.uniforms;
|
|
3684
|
+
if (meshRefUniforms) {
|
|
3685
|
+
meshRefUniforms.renderRes.value = dataManager.PT.lowestDataRes;
|
|
3686
|
+
}
|
|
3687
|
+
stillRef.current = false;
|
|
3688
|
+
invalidate();
|
|
3689
|
+
}
|
|
3690
|
+
});
|
|
3691
|
+
const onOrbitControlsStart = useEventCallback((e) => {
|
|
3604
3692
|
setIsInteracting(true);
|
|
3605
|
-
}
|
|
3606
|
-
const onOrbitControlsEnd =
|
|
3693
|
+
});
|
|
3694
|
+
const onOrbitControlsEnd = useEventCallback((e) => {
|
|
3607
3695
|
clearTimeout(interactionTimeoutRef.current);
|
|
3608
3696
|
interactionTimeoutRef.current = setTimeout(() => {
|
|
3609
3697
|
setIsInteracting(false);
|
|
3610
3698
|
}, 300);
|
|
3611
|
-
}
|
|
3699
|
+
});
|
|
3612
3700
|
useEffect(() => {
|
|
3613
3701
|
logWithColor("useEffect firstImageLayerChannelCoordination");
|
|
3614
3702
|
setIsInteracting(true);
|
|
@@ -3619,7 +3707,37 @@ function VolumeView(props) {
|
|
|
3619
3707
|
interactionTimeoutRef.current = setTimeout(() => {
|
|
3620
3708
|
setIsInteracting(false);
|
|
3621
3709
|
}, 300);
|
|
3622
|
-
}, [firstImageLayerChannelCoordination]);
|
|
3710
|
+
}, [dataManager, firstImageLayerChannelCoordination, renderManager, setIsInteracting]);
|
|
3711
|
+
const stopLoading = useEventCallback(() => {
|
|
3712
|
+
if (dataManager) {
|
|
3713
|
+
dataManager.stopLoading();
|
|
3714
|
+
}
|
|
3715
|
+
});
|
|
3716
|
+
const restartLoading = useEventCallback(() => {
|
|
3717
|
+
if (dataManager) {
|
|
3718
|
+
dataManager.restartLoading();
|
|
3719
|
+
}
|
|
3720
|
+
});
|
|
3721
|
+
const getLoadingProgress = useEventCallback(() => {
|
|
3722
|
+
if (dataManager) {
|
|
3723
|
+
return dataManager.getLoadingProgress();
|
|
3724
|
+
}
|
|
3725
|
+
return null;
|
|
3726
|
+
});
|
|
3727
|
+
useEffect(() => {
|
|
3728
|
+
if (!onVolumeLoadingUpdate)
|
|
3729
|
+
return void 0;
|
|
3730
|
+
const intervalId = setInterval(() => {
|
|
3731
|
+
const loadingProgress = getLoadingProgress();
|
|
3732
|
+
onVolumeLoadingUpdate({
|
|
3733
|
+
loadingProgress,
|
|
3734
|
+
stillRef,
|
|
3735
|
+
onStopLoading: stopLoading,
|
|
3736
|
+
onRestartLoading: restartLoading
|
|
3737
|
+
});
|
|
3738
|
+
}, 1e3);
|
|
3739
|
+
return () => clearInterval(intervalId);
|
|
3740
|
+
}, [onVolumeLoadingUpdate, stillRef]);
|
|
3623
3741
|
if (!is3D || !dataManager || !renderManager)
|
|
3624
3742
|
return null;
|
|
3625
3743
|
if (!renderState.shader) {
|
|
@@ -3656,7 +3774,7 @@ function SpatialWrapper(props) {
|
|
|
3656
3774
|
logarithmicDepthBuffer: false,
|
|
3657
3775
|
preserveDrawingBuffer: false,
|
|
3658
3776
|
autoClear: false
|
|
3659
|
-
}, children: jsxRuntimeExports.jsx(VolumeView, { ...props }) });
|
|
3777
|
+
}, children: jsxRuntimeExports.jsx(Suspense, { fallback: "Initializing Volume View...", children: jsxRuntimeExports.jsx(VolumeView, { ...props }) }) });
|
|
3660
3778
|
}
|
|
3661
3779
|
export {
|
|
3662
3780
|
SpatialWrapper
|
|
@@ -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-
|
|
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-P1FfHDqS.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-
|
|
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-XnzJtnMh.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-
|
|
5030
|
+
} = suspend(async () => import("./troika-three-text.esm-Cz3t4bdh.js"), []);
|
|
5031
5031
|
const invalidate = useThree(({
|
|
5032
5032
|
invalidate: invalidate2
|
|
5033
5033
|
}) => invalidate2);
|