@idetik/core 0.43.0 → 0.45.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/index.d.ts CHANGED
@@ -242,30 +242,6 @@ declare function createNoPrefetchPolicy(overrides?: Partial<ImageSourcePolicyPro
242
242
  */
243
243
  declare function createImageSourcePolicy(config: ImageSourcePolicyProps): ImageSourcePolicy;
244
244
 
245
- declare class ChunkStore {
246
- private readonly chunks_;
247
- private readonly lowestResLOD_;
248
- private readonly dimensions_;
249
- private readonly views_;
250
- private hasHadViews_;
251
- constructor(dimensions: SourceDimensionMap);
252
- getChunkGrid(lod: number, t: number, c: number): Chunk[][][] | undefined;
253
- hasChunksAtTime(timeIndex: number): boolean;
254
- get lodCount(): number;
255
- get channelCount(): number;
256
- get dimensions(): SourceDimensionMap;
257
- getLowestResLOD(): number;
258
- addView(policy: ImageSourcePolicy, axes?: SliceAxes): ChunkStoreView;
259
- get views(): ReadonlyArray<ChunkStoreView>;
260
- canDispose(): boolean;
261
- updateAndCollectChunkChanges(): Set<Chunk>;
262
- private removeDisposedViews;
263
- private aggregateChunkViewStates;
264
- private validateXYScaleRatios;
265
- private getAndValidateTimeDimension;
266
- private getAndValidateChannelDimension;
267
- }
268
-
269
245
  /**
270
246
  * Axis-aligned bounding box defined by minimum and maximum corners.
271
247
  *
@@ -323,12 +299,13 @@ declare class ChunkStoreView {
323
299
  private readonly store_;
324
300
  private policy_;
325
301
  private policyChanged_;
326
- private currentLOD_;
302
+ private targetLOD_;
327
303
  private readonly axes_;
328
304
  private readonly scale0_;
305
+ private mode_;
329
306
  private lastViewBounds2D_;
330
307
  private lastViewProjection_;
331
- private lastSliceBounds_?;
308
+ private lastSliceCoordW_?;
332
309
  private lastTCoord_?;
333
310
  private lastCCoords_?;
334
311
  private readonly sourceMaxSquareDistance2D_;
@@ -341,6 +318,8 @@ declare class ChunkStoreView {
341
318
  get channelCount(): number;
342
319
  getWholePlaneRect(): Box2;
343
320
  getChunksToRender(): Chunk[];
321
+ private residentChunksMarkedVisible;
322
+ private residentChunksForSlice;
344
323
  updateChunksForImage(sliceCoords: SliceCoordinates, view: {
345
324
  worldViewRect: Box2;
346
325
  bufferWidthPx: number;
@@ -359,19 +338,105 @@ declare class ChunkStoreView {
359
338
  private chunkIndexRange;
360
339
  private iterateChunksInBox;
361
340
  private iterateAllChunksAtLod;
362
- private getChunkAabb;
363
- private fallbackLOD;
341
+ private lodRange;
364
342
  private timeIndex;
365
343
  private getSliceAxisBounds;
366
344
  private makeViewBounds3D;
367
345
  private viewBounds2DChanged;
368
346
  private hasViewProjectionChanged;
369
- private sliceBoundsChanged;
370
347
  private cCoordsChanged;
371
348
  private getPaddedBounds;
372
349
  private squareDistance2D;
373
350
  }
374
351
 
352
+ declare class ChunkStore {
353
+ private readonly chunks_;
354
+ private readonly lowestResLOD_;
355
+ private readonly dimensions_;
356
+ private readonly views_;
357
+ private hasHadViews_;
358
+ private readonly resident_;
359
+ constructor(dimensions: SourceDimensionMap);
360
+ getChunkGrid(lod: number, t: number, c: number): Chunk[][][] | undefined;
361
+ hasChunksAtTime(timeIndex: number): boolean;
362
+ get lodCount(): number;
363
+ get channelCount(): number;
364
+ get dimensions(): SourceDimensionMap;
365
+ getLowestResLOD(): number;
366
+ addView(policy: ImageSourcePolicy, axes?: SliceAxes): ChunkStoreView;
367
+ get views(): ReadonlyArray<ChunkStoreView>;
368
+ get residentChunks(): ReadonlySet<Chunk>;
369
+ setChunkTexture(chunk: Chunk, texture: Texture): void;
370
+ clearChunkTexture(chunk: Chunk): Texture | undefined;
371
+ canDispose(): boolean;
372
+ updateAndCollectChunkChanges(): Set<Chunk>;
373
+ private removeDisposedViews;
374
+ private aggregateChunkViewStates;
375
+ private validateXYScaleRatios;
376
+ private getAndValidateTimeDimension;
377
+ private getAndValidateChannelDimension;
378
+ }
379
+
380
+ /**
381
+ * A snapshot of chunk demand and GPU residency.
382
+ *
383
+ * Requested counts include prefetch. When the memory limit cannot hold every
384
+ * requested chunk, some are never fetched and `resident` stays below
385
+ * `requested`.
386
+ */
387
+ type ChunkStats = {
388
+ /** Cache state per source. */
389
+ sources: readonly SourceChunkStats[];
390
+ /** Loading progress per viewport. Viewports without chunked layers are omitted. */
391
+ viewports: readonly ViewportChunkStats[];
392
+ };
393
+ /** Cache state for one source, combined across all of its views. */
394
+ type SourceChunkStats = {
395
+ /** The source the counts describe. */
396
+ source: ChunkSource;
397
+ /**
398
+ * Chunks requested by any view, visible or prefetch, at any LOD. A chunk
399
+ * requested by several views counts once. The budget may defer fetching.
400
+ */
401
+ requested: number;
402
+ /** How many of `requested` are on the GPU and drawable. */
403
+ resident: number;
404
+ /**
405
+ * The same counts by timepoint index, the position along the source's time
406
+ * axis rather than the world `t` coordinate. A timepoint is fully loaded for
407
+ * every view of the source when its two counts are equal.
408
+ */
409
+ timepoints: {
410
+ /** `requested[t]` is the chunks requested at timepoint index `t`. */
411
+ requested: Uint32Array;
412
+ /** `resident[t]` is how many of `requested[t]` are on the GPU. */
413
+ resident: Uint32Array;
414
+ };
415
+ };
416
+ /** Loading progress for one viewport, summed across its chunked layers. */
417
+ type ViewportChunkStats = {
418
+ /** The viewport the counts describe. */
419
+ viewportId: string;
420
+ /**
421
+ * Visible and prefetch chunks at any LOD, including the fallback LOD
422
+ * drawn while the current one loads.
423
+ */
424
+ requested: number;
425
+ /** How many of `requested` are on the GPU. */
426
+ resident: number;
427
+ /**
428
+ * The same counts excluding fallback and prefetch: chunks visible at each
429
+ * layer's current LOD and timepoint. The viewport is fully drawn at its
430
+ * selected LOD when these are equal.
431
+ */
432
+ current: {
433
+ /** Chunks visible at each layer's current LOD and timepoint. */
434
+ requested: number;
435
+ /** How many of `requested` are on the GPU. */
436
+ resident: number;
437
+ };
438
+ };
439
+
375
440
  /**
376
441
  * A snapshot of the chunk request queue.
377
442
  */
@@ -389,7 +454,6 @@ declare class ChunkManager {
389
454
  private readonly getGpuResidentBytes_;
390
455
  private memoryLimitBytes_;
391
456
  private readonly maxGpuUploadsPerUpdate_;
392
- private readonly resident_;
393
457
  constructor(uploadTexture?: (texture: Texture) => void, disposeTexture?: (texture: Texture) => void, getGpuResidentBytes?: () => number, memoryLimitBytes?: number, maxConcurrentRequests?: number, maxGpuUploadsPerUpdate?: number);
394
458
  get memoryLimitBytes(): number;
395
459
  set memoryLimitBytes(value: number);
@@ -398,6 +462,7 @@ declare class ChunkManager {
398
462
  cpuChunkBytes: number;
399
463
  cpuChunkCount: number;
400
464
  };
465
+ get sourceChunkStats(): SourceChunkStats[];
401
466
  addView(source: ChunkSource, policy: ImageSourcePolicy, axes?: SliceAxes): ChunkStoreView;
402
467
  update(): void;
403
468
  private releaseChunk;
@@ -1610,6 +1675,12 @@ declare class Idetik {
1610
1675
  constructor(params: IdetikProps);
1611
1676
  /** Counts of queued and in-flight chunk requests. */
1612
1677
  get chunkQueueStats(): QueueStats;
1678
+ /**
1679
+ * Chunk demand and GPU residency per source, by timepoint, and loading
1680
+ * progress per viewport. Each read walks every view's chunk states and returns a
1681
+ * new snapshot, so poll it at the rate you need rather than every frame.
1682
+ */
1683
+ get chunkStats(): ChunkStats;
1613
1684
  /** A snapshot of current CPU/GPU/JS heap memory usage. */
1614
1685
  get memoryStats(): MemoryStats;
1615
1686
  /** The number of objects drawn in the last rendered frame. */
@@ -1736,24 +1807,24 @@ declare const Image: z.ZodObject<{
1736
1807
  active: z.ZodOptional<z.ZodBoolean>;
1737
1808
  }, "strip", z.ZodTypeAny, {
1738
1809
  color?: string | undefined;
1810
+ label?: string | undefined;
1739
1811
  window?: {
1740
1812
  min: number;
1741
1813
  max: number;
1742
1814
  end: number;
1743
1815
  start: number;
1744
1816
  } | undefined;
1745
- label?: string | undefined;
1746
1817
  family?: string | undefined;
1747
1818
  active?: boolean | undefined;
1748
1819
  }, {
1749
1820
  color?: string | undefined;
1821
+ label?: string | undefined;
1750
1822
  window?: {
1751
1823
  min: number;
1752
1824
  max: number;
1753
1825
  end: number;
1754
1826
  start: number;
1755
1827
  } | undefined;
1756
- label?: string | undefined;
1757
1828
  family?: string | undefined;
1758
1829
  active?: boolean | undefined;
1759
1830
  }>, "many">;
@@ -1776,13 +1847,13 @@ declare const Image: z.ZodObject<{
1776
1847
  }, "strip", z.ZodTypeAny, {
1777
1848
  channels: {
1778
1849
  color?: string | undefined;
1850
+ label?: string | undefined;
1779
1851
  window?: {
1780
1852
  min: number;
1781
1853
  max: number;
1782
1854
  end: number;
1783
1855
  start: number;
1784
1856
  } | undefined;
1785
- label?: string | undefined;
1786
1857
  family?: string | undefined;
1787
1858
  active?: boolean | undefined;
1788
1859
  }[];
@@ -1795,13 +1866,13 @@ declare const Image: z.ZodObject<{
1795
1866
  }, {
1796
1867
  channels: {
1797
1868
  color?: string | undefined;
1869
+ label?: string | undefined;
1798
1870
  window?: {
1799
1871
  min: number;
1800
1872
  max: number;
1801
1873
  end: number;
1802
1874
  start: number;
1803
1875
  } | undefined;
1804
- label?: string | undefined;
1805
1876
  family?: string | undefined;
1806
1877
  active?: boolean | undefined;
1807
1878
  }[];
@@ -1828,13 +1899,13 @@ declare const Image: z.ZodObject<{
1828
1899
  omero?: {
1829
1900
  channels: {
1830
1901
  color?: string | undefined;
1902
+ label?: string | undefined;
1831
1903
  window?: {
1832
1904
  min: number;
1833
1905
  max: number;
1834
1906
  end: number;
1835
1907
  start: number;
1836
1908
  } | undefined;
1837
- label?: string | undefined;
1838
1909
  family?: string | undefined;
1839
1910
  active?: boolean | undefined;
1840
1911
  }[];
@@ -1859,13 +1930,13 @@ declare const Image: z.ZodObject<{
1859
1930
  omero?: {
1860
1931
  channels: {
1861
1932
  color?: string | undefined;
1933
+ label?: string | undefined;
1862
1934
  window?: {
1863
1935
  min: number;
1864
1936
  max: number;
1865
1937
  end: number;
1866
1938
  start: number;
1867
1939
  } | undefined;
1868
- label?: string | undefined;
1869
1940
  family?: string | undefined;
1870
1941
  active?: boolean | undefined;
1871
1942
  }[];
@@ -1892,13 +1963,13 @@ declare const Image: z.ZodObject<{
1892
1963
  omero?: {
1893
1964
  channels: {
1894
1965
  color?: string | undefined;
1966
+ label?: string | undefined;
1895
1967
  window?: {
1896
1968
  min: number;
1897
1969
  max: number;
1898
1970
  end: number;
1899
1971
  start: number;
1900
1972
  } | undefined;
1901
- label?: string | undefined;
1902
1973
  family?: string | undefined;
1903
1974
  active?: boolean | undefined;
1904
1975
  }[];
@@ -1925,13 +1996,13 @@ declare const Image: z.ZodObject<{
1925
1996
  omero?: {
1926
1997
  channels: {
1927
1998
  color?: string | undefined;
1999
+ label?: string | undefined;
1928
2000
  window?: {
1929
2001
  min: number;
1930
2002
  max: number;
1931
2003
  end: number;
1932
2004
  start: number;
1933
2005
  } | undefined;
1934
- label?: string | undefined;
1935
2006
  family?: string | undefined;
1936
2007
  active?: boolean | undefined;
1937
2008
  }[];
@@ -2560,7 +2631,7 @@ declare class ImageLayer extends Layer implements ChannelsEnabled {
2560
2631
  */
2561
2632
  onEvent(event: EventContext): void;
2562
2633
  private pickAtRay;
2563
- /** The layer's chunk store view for diagnostic overlays. */
2634
+ /** @hidden */
2564
2635
  get chunkStoreView(): ChunkStoreView | undefined;
2565
2636
  /**
2566
2637
  * The slice coordinates the layer displays. This is the object passed
@@ -2749,6 +2820,8 @@ declare class VolumeLayer extends Layer implements ChannelsEnabled {
2749
2820
  */
2750
2821
  update(viewport?: Viewport): void;
2751
2822
  private rebuildObjects;
2823
+ /** @hidden */
2824
+ get chunkStoreView(): ChunkStoreView | undefined;
2752
2825
  /** Returns the ray marching uniforms for this layer. */
2753
2826
  getUniforms(): Record<string, unknown>;
2754
2827
  }
@@ -2995,7 +3068,7 @@ declare class LabelLayer extends Layer {
2995
3068
  get imageSourcePolicy(): Readonly<ImageSourcePolicy>;
2996
3069
  /** @param newPolicy - The policy to apply. */
2997
3070
  set imageSourcePolicy(newPolicy: ImageSourcePolicy);
2998
- /** The layer's chunk store view for diagnostic overlays. */
3071
+ /** @hidden */
2999
3072
  get chunkStoreView(): ChunkStoreView | undefined;
3000
3073
  /** The `t` coordinate of the most recently presented slice. */
3001
3074
  get lastPresentationTimeCoord(): number | undefined;
@@ -3459,4 +3532,4 @@ declare class OrbitControls implements CameraControls {
3459
3532
  }
3460
3533
 
3461
3534
  export { AxesLayer, Box2, Box3, Camera, Color, Frustum, Idetik, ImageLayer, ImageRenderable, LabelImageRenderable, LabelLayer, Layer, OmeZarrImageSource, OrbitControls, OrthographicCamera, PanZoomControls, PerspectiveCamera, PointsRenderable, ProjectedLineRenderable, RenderableObject, TrsTransform, Viewport, VolumeLayer, VolumeRenderable, createExplorationPolicy, createImageSourcePolicy, createNoPrefetchPolicy, createPlaybackPolicy, loadOmeZarrPlate, loadOmeZarrWell, loadOmeroChannels, loadOmeroDefaults };
3462
- export type { AxesLayerProps, BlendMode, CameraControls, CameraType, ChannelProps, ColorLike, FileSystemOmeZarrImageSourceProps, HttpOmeZarrImageSourceProps, IdetikProps, ImageLayerProps, ImageRenderableProps, ImageSourcePolicy, ImageSourcePolicyProps, LabelColorMap, LabelColorMapProps, LabelImageRenderableProps, LabelLayerProps, LayerProps, LayerState, MemoryStats, OrbitControlsProps, OrthographicCameraFrame, OrthographicCameraProps, Overlay, PanZoomControlsProps, PerspectiveCameraProps, PointPickingResult, PointProps, PriorityCategory, ProjectedLineRenderableProps, QueueStats, SliceCoordinates, SliceOrientation, SourceDimension, SourceDimensionLod, SourceDimensionMap, StateChangeCallback, ViewportProps, VolumeLayerProps, VolumeRenderableProps };
3535
+ export type { AxesLayerProps, BlendMode, CameraControls, CameraType, ChannelProps, ChunkStats, ColorLike, FileSystemOmeZarrImageSourceProps, HttpOmeZarrImageSourceProps, IdetikProps, ImageLayerProps, ImageRenderableProps, ImageSourcePolicy, ImageSourcePolicyProps, LabelColorMap, LabelColorMapProps, LabelImageRenderableProps, LabelLayerProps, LayerProps, LayerState, MemoryStats, OrbitControlsProps, OrthographicCameraFrame, OrthographicCameraProps, Overlay, PanZoomControlsProps, PerspectiveCameraProps, PointPickingResult, PointProps, PriorityCategory, ProjectedLineRenderableProps, QueueStats, SliceCoordinates, SliceOrientation, SourceChunkStats, SourceDimension, SourceDimensionLod, SourceDimensionMap, StateChangeCallback, ViewportChunkStats, ViewportProps, VolumeLayerProps, VolumeRenderableProps };