@idetik/core 0.44.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,34 +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
- private readonly resident_;
252
- constructor(dimensions: SourceDimensionMap);
253
- getChunkGrid(lod: number, t: number, c: number): Chunk[][][] | undefined;
254
- hasChunksAtTime(timeIndex: number): boolean;
255
- get lodCount(): number;
256
- get channelCount(): number;
257
- get dimensions(): SourceDimensionMap;
258
- getLowestResLOD(): number;
259
- addView(policy: ImageSourcePolicy, axes?: SliceAxes): ChunkStoreView;
260
- get views(): ReadonlyArray<ChunkStoreView>;
261
- get residentChunks(): ReadonlySet<Chunk>;
262
- setChunkTexture(chunk: Chunk, texture: Texture): void;
263
- clearChunkTexture(chunk: Chunk): Texture | undefined;
264
- canDispose(): boolean;
265
- updateAndCollectChunkChanges(): Set<Chunk>;
266
- private removeDisposedViews;
267
- private aggregateChunkViewStates;
268
- private validateXYScaleRatios;
269
- private getAndValidateTimeDimension;
270
- private getAndValidateChannelDimension;
271
- }
272
-
273
245
  /**
274
246
  * Axis-aligned bounding box defined by minimum and maximum corners.
275
247
  *
@@ -377,6 +349,94 @@ declare class ChunkStoreView {
377
349
  private squareDistance2D;
378
350
  }
379
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
+
380
440
  /**
381
441
  * A snapshot of the chunk request queue.
382
442
  */
@@ -402,6 +462,7 @@ declare class ChunkManager {
402
462
  cpuChunkBytes: number;
403
463
  cpuChunkCount: number;
404
464
  };
465
+ get sourceChunkStats(): SourceChunkStats[];
405
466
  addView(source: ChunkSource, policy: ImageSourcePolicy, axes?: SliceAxes): ChunkStoreView;
406
467
  update(): void;
407
468
  private releaseChunk;
@@ -1614,6 +1675,12 @@ declare class Idetik {
1614
1675
  constructor(params: IdetikProps);
1615
1676
  /** Counts of queued and in-flight chunk requests. */
1616
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;
1617
1684
  /** A snapshot of current CPU/GPU/JS heap memory usage. */
1618
1685
  get memoryStats(): MemoryStats;
1619
1686
  /** The number of objects drawn in the last rendered frame. */
@@ -1740,24 +1807,24 @@ declare const Image: z.ZodObject<{
1740
1807
  active: z.ZodOptional<z.ZodBoolean>;
1741
1808
  }, "strip", z.ZodTypeAny, {
1742
1809
  color?: string | undefined;
1810
+ label?: string | undefined;
1743
1811
  window?: {
1744
1812
  min: number;
1745
1813
  max: number;
1746
1814
  end: number;
1747
1815
  start: number;
1748
1816
  } | undefined;
1749
- label?: string | undefined;
1750
1817
  family?: string | undefined;
1751
1818
  active?: boolean | undefined;
1752
1819
  }, {
1753
1820
  color?: string | undefined;
1821
+ label?: string | undefined;
1754
1822
  window?: {
1755
1823
  min: number;
1756
1824
  max: number;
1757
1825
  end: number;
1758
1826
  start: number;
1759
1827
  } | undefined;
1760
- label?: string | undefined;
1761
1828
  family?: string | undefined;
1762
1829
  active?: boolean | undefined;
1763
1830
  }>, "many">;
@@ -1780,13 +1847,13 @@ declare const Image: z.ZodObject<{
1780
1847
  }, "strip", z.ZodTypeAny, {
1781
1848
  channels: {
1782
1849
  color?: string | undefined;
1850
+ label?: string | undefined;
1783
1851
  window?: {
1784
1852
  min: number;
1785
1853
  max: number;
1786
1854
  end: number;
1787
1855
  start: number;
1788
1856
  } | undefined;
1789
- label?: string | undefined;
1790
1857
  family?: string | undefined;
1791
1858
  active?: boolean | undefined;
1792
1859
  }[];
@@ -1799,13 +1866,13 @@ declare const Image: z.ZodObject<{
1799
1866
  }, {
1800
1867
  channels: {
1801
1868
  color?: string | undefined;
1869
+ label?: string | undefined;
1802
1870
  window?: {
1803
1871
  min: number;
1804
1872
  max: number;
1805
1873
  end: number;
1806
1874
  start: number;
1807
1875
  } | undefined;
1808
- label?: string | undefined;
1809
1876
  family?: string | undefined;
1810
1877
  active?: boolean | undefined;
1811
1878
  }[];
@@ -1832,13 +1899,13 @@ declare const Image: z.ZodObject<{
1832
1899
  omero?: {
1833
1900
  channels: {
1834
1901
  color?: string | undefined;
1902
+ label?: string | undefined;
1835
1903
  window?: {
1836
1904
  min: number;
1837
1905
  max: number;
1838
1906
  end: number;
1839
1907
  start: number;
1840
1908
  } | undefined;
1841
- label?: string | undefined;
1842
1909
  family?: string | undefined;
1843
1910
  active?: boolean | undefined;
1844
1911
  }[];
@@ -1863,13 +1930,13 @@ declare const Image: z.ZodObject<{
1863
1930
  omero?: {
1864
1931
  channels: {
1865
1932
  color?: string | undefined;
1933
+ label?: string | undefined;
1866
1934
  window?: {
1867
1935
  min: number;
1868
1936
  max: number;
1869
1937
  end: number;
1870
1938
  start: number;
1871
1939
  } | undefined;
1872
- label?: string | undefined;
1873
1940
  family?: string | undefined;
1874
1941
  active?: boolean | undefined;
1875
1942
  }[];
@@ -1896,13 +1963,13 @@ declare const Image: z.ZodObject<{
1896
1963
  omero?: {
1897
1964
  channels: {
1898
1965
  color?: string | undefined;
1966
+ label?: string | undefined;
1899
1967
  window?: {
1900
1968
  min: number;
1901
1969
  max: number;
1902
1970
  end: number;
1903
1971
  start: number;
1904
1972
  } | undefined;
1905
- label?: string | undefined;
1906
1973
  family?: string | undefined;
1907
1974
  active?: boolean | undefined;
1908
1975
  }[];
@@ -1929,13 +1996,13 @@ declare const Image: z.ZodObject<{
1929
1996
  omero?: {
1930
1997
  channels: {
1931
1998
  color?: string | undefined;
1999
+ label?: string | undefined;
1932
2000
  window?: {
1933
2001
  min: number;
1934
2002
  max: number;
1935
2003
  end: number;
1936
2004
  start: number;
1937
2005
  } | undefined;
1938
- label?: string | undefined;
1939
2006
  family?: string | undefined;
1940
2007
  active?: boolean | undefined;
1941
2008
  }[];
@@ -2564,7 +2631,7 @@ declare class ImageLayer extends Layer implements ChannelsEnabled {
2564
2631
  */
2565
2632
  onEvent(event: EventContext): void;
2566
2633
  private pickAtRay;
2567
- /** The layer's chunk store view for diagnostic overlays. */
2634
+ /** @hidden */
2568
2635
  get chunkStoreView(): ChunkStoreView | undefined;
2569
2636
  /**
2570
2637
  * The slice coordinates the layer displays. This is the object passed
@@ -2753,6 +2820,8 @@ declare class VolumeLayer extends Layer implements ChannelsEnabled {
2753
2820
  */
2754
2821
  update(viewport?: Viewport): void;
2755
2822
  private rebuildObjects;
2823
+ /** @hidden */
2824
+ get chunkStoreView(): ChunkStoreView | undefined;
2756
2825
  /** Returns the ray marching uniforms for this layer. */
2757
2826
  getUniforms(): Record<string, unknown>;
2758
2827
  }
@@ -2999,7 +3068,7 @@ declare class LabelLayer extends Layer {
2999
3068
  get imageSourcePolicy(): Readonly<ImageSourcePolicy>;
3000
3069
  /** @param newPolicy - The policy to apply. */
3001
3070
  set imageSourcePolicy(newPolicy: ImageSourcePolicy);
3002
- /** The layer's chunk store view for diagnostic overlays. */
3071
+ /** @hidden */
3003
3072
  get chunkStoreView(): ChunkStoreView | undefined;
3004
3073
  /** The `t` coordinate of the most recently presented slice. */
3005
3074
  get lastPresentationTimeCoord(): number | undefined;
@@ -3463,4 +3532,4 @@ declare class OrbitControls implements CameraControls {
3463
3532
  }
3464
3533
 
3465
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 };
3466
- 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 };