@idetik/core 0.44.0 → 0.45.1

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
  *
@@ -353,7 +325,8 @@ declare class ChunkStoreView {
353
325
  bufferWidthPx: number;
354
326
  }): void;
355
327
  updateChunksForVolume(sliceCoords: SliceCoordinates, viewProjection: mat4): void;
356
- allVisibleFallbackLODLoaded(): boolean;
328
+ hasCompleteVisibleLOD(): boolean;
329
+ private allVisibleLoadedAt;
357
330
  get currentLOD(): number;
358
331
  maybeForgetChunk(chunk: Chunk): void;
359
332
  dispose(): void;
@@ -377,6 +350,94 @@ declare class ChunkStoreView {
377
350
  private squareDistance2D;
378
351
  }
379
352
 
353
+ declare class ChunkStore {
354
+ private readonly chunks_;
355
+ private readonly lowestResLOD_;
356
+ private readonly dimensions_;
357
+ private readonly views_;
358
+ private hasHadViews_;
359
+ private readonly resident_;
360
+ constructor(dimensions: SourceDimensionMap);
361
+ getChunkGrid(lod: number, t: number, c: number): Chunk[][][] | undefined;
362
+ hasChunksAtTime(timeIndex: number): boolean;
363
+ get lodCount(): number;
364
+ get channelCount(): number;
365
+ get dimensions(): SourceDimensionMap;
366
+ getLowestResLOD(): number;
367
+ addView(policy: ImageSourcePolicy, axes?: SliceAxes): ChunkStoreView;
368
+ get views(): ReadonlyArray<ChunkStoreView>;
369
+ get residentChunks(): ReadonlySet<Chunk>;
370
+ setChunkTexture(chunk: Chunk, texture: Texture): void;
371
+ clearChunkTexture(chunk: Chunk): Texture | undefined;
372
+ canDispose(): boolean;
373
+ updateAndCollectChunkChanges(): Set<Chunk>;
374
+ private removeDisposedViews;
375
+ private aggregateChunkViewStates;
376
+ private validateXYScaleRatios;
377
+ private getAndValidateTimeDimension;
378
+ private getAndValidateChannelDimension;
379
+ }
380
+
381
+ /**
382
+ * A snapshot of chunk demand and GPU residency.
383
+ *
384
+ * Requested counts include prefetch. When the memory limit cannot hold every
385
+ * requested chunk, some are never fetched and `resident` stays below
386
+ * `requested`.
387
+ */
388
+ type ChunkStats = {
389
+ /** Cache state per source. */
390
+ sources: readonly SourceChunkStats[];
391
+ /** Loading progress per viewport. Viewports without chunked layers are omitted. */
392
+ viewports: readonly ViewportChunkStats[];
393
+ };
394
+ /** Cache state for one source, combined across all of its views. */
395
+ type SourceChunkStats = {
396
+ /** The source the counts describe. */
397
+ source: ChunkSource;
398
+ /**
399
+ * Chunks requested by any view, visible or prefetch, at any LOD. A chunk
400
+ * requested by several views counts once. The budget may defer fetching.
401
+ */
402
+ requested: number;
403
+ /** How many of `requested` are on the GPU and drawable. */
404
+ resident: number;
405
+ /**
406
+ * The same counts by timepoint index, the position along the source's time
407
+ * axis rather than the world `t` coordinate. A timepoint is fully loaded for
408
+ * every view of the source when its two counts are equal.
409
+ */
410
+ timepoints: {
411
+ /** `requested[t]` is the chunks requested at timepoint index `t`. */
412
+ requested: Uint32Array;
413
+ /** `resident[t]` is how many of `requested[t]` are on the GPU. */
414
+ resident: Uint32Array;
415
+ };
416
+ };
417
+ /** Loading progress for one viewport, summed across its chunked layers. */
418
+ type ViewportChunkStats = {
419
+ /** The viewport the counts describe. */
420
+ viewportId: string;
421
+ /**
422
+ * Visible and prefetch chunks at any LOD, including the fallback LOD
423
+ * drawn while the current one loads.
424
+ */
425
+ requested: number;
426
+ /** How many of `requested` are on the GPU. */
427
+ resident: number;
428
+ /**
429
+ * The same counts excluding fallback and prefetch: chunks visible at each
430
+ * layer's current LOD and timepoint. The viewport is fully drawn at its
431
+ * selected LOD when these are equal.
432
+ */
433
+ current: {
434
+ /** Chunks visible at each layer's current LOD and timepoint. */
435
+ requested: number;
436
+ /** How many of `requested` are on the GPU. */
437
+ resident: number;
438
+ };
439
+ };
440
+
380
441
  /**
381
442
  * A snapshot of the chunk request queue.
382
443
  */
@@ -402,6 +463,7 @@ declare class ChunkManager {
402
463
  cpuChunkBytes: number;
403
464
  cpuChunkCount: number;
404
465
  };
466
+ get sourceChunkStats(): SourceChunkStats[];
405
467
  addView(source: ChunkSource, policy: ImageSourcePolicy, axes?: SliceAxes): ChunkStoreView;
406
468
  update(): void;
407
469
  private releaseChunk;
@@ -1614,6 +1676,12 @@ declare class Idetik {
1614
1676
  constructor(params: IdetikProps);
1615
1677
  /** Counts of queued and in-flight chunk requests. */
1616
1678
  get chunkQueueStats(): QueueStats;
1679
+ /**
1680
+ * Chunk demand and GPU residency per source, by timepoint, and loading
1681
+ * progress per viewport. Each read walks every view's chunk states and returns a
1682
+ * new snapshot, so poll it at the rate you need rather than every frame.
1683
+ */
1684
+ get chunkStats(): ChunkStats;
1617
1685
  /** A snapshot of current CPU/GPU/JS heap memory usage. */
1618
1686
  get memoryStats(): MemoryStats;
1619
1687
  /** The number of objects drawn in the last rendered frame. */
@@ -1740,24 +1808,24 @@ declare const Image: z.ZodObject<{
1740
1808
  active: z.ZodOptional<z.ZodBoolean>;
1741
1809
  }, "strip", z.ZodTypeAny, {
1742
1810
  color?: string | undefined;
1811
+ label?: string | undefined;
1743
1812
  window?: {
1744
1813
  min: number;
1745
1814
  max: number;
1746
1815
  end: number;
1747
1816
  start: number;
1748
1817
  } | undefined;
1749
- label?: string | undefined;
1750
1818
  family?: string | undefined;
1751
1819
  active?: boolean | undefined;
1752
1820
  }, {
1753
1821
  color?: string | undefined;
1822
+ label?: string | undefined;
1754
1823
  window?: {
1755
1824
  min: number;
1756
1825
  max: number;
1757
1826
  end: number;
1758
1827
  start: number;
1759
1828
  } | undefined;
1760
- label?: string | undefined;
1761
1829
  family?: string | undefined;
1762
1830
  active?: boolean | undefined;
1763
1831
  }>, "many">;
@@ -1780,13 +1848,13 @@ declare const Image: z.ZodObject<{
1780
1848
  }, "strip", z.ZodTypeAny, {
1781
1849
  channels: {
1782
1850
  color?: string | undefined;
1851
+ label?: string | undefined;
1783
1852
  window?: {
1784
1853
  min: number;
1785
1854
  max: number;
1786
1855
  end: number;
1787
1856
  start: number;
1788
1857
  } | undefined;
1789
- label?: string | undefined;
1790
1858
  family?: string | undefined;
1791
1859
  active?: boolean | undefined;
1792
1860
  }[];
@@ -1799,13 +1867,13 @@ declare const Image: z.ZodObject<{
1799
1867
  }, {
1800
1868
  channels: {
1801
1869
  color?: string | undefined;
1870
+ label?: string | undefined;
1802
1871
  window?: {
1803
1872
  min: number;
1804
1873
  max: number;
1805
1874
  end: number;
1806
1875
  start: number;
1807
1876
  } | undefined;
1808
- label?: string | undefined;
1809
1877
  family?: string | undefined;
1810
1878
  active?: boolean | undefined;
1811
1879
  }[];
@@ -1832,13 +1900,13 @@ declare const Image: z.ZodObject<{
1832
1900
  omero?: {
1833
1901
  channels: {
1834
1902
  color?: string | undefined;
1903
+ label?: string | undefined;
1835
1904
  window?: {
1836
1905
  min: number;
1837
1906
  max: number;
1838
1907
  end: number;
1839
1908
  start: number;
1840
1909
  } | undefined;
1841
- label?: string | undefined;
1842
1910
  family?: string | undefined;
1843
1911
  active?: boolean | undefined;
1844
1912
  }[];
@@ -1863,13 +1931,13 @@ declare const Image: z.ZodObject<{
1863
1931
  omero?: {
1864
1932
  channels: {
1865
1933
  color?: string | undefined;
1934
+ label?: string | undefined;
1866
1935
  window?: {
1867
1936
  min: number;
1868
1937
  max: number;
1869
1938
  end: number;
1870
1939
  start: number;
1871
1940
  } | undefined;
1872
- label?: string | undefined;
1873
1941
  family?: string | undefined;
1874
1942
  active?: boolean | undefined;
1875
1943
  }[];
@@ -1896,13 +1964,13 @@ declare const Image: z.ZodObject<{
1896
1964
  omero?: {
1897
1965
  channels: {
1898
1966
  color?: string | undefined;
1967
+ label?: string | undefined;
1899
1968
  window?: {
1900
1969
  min: number;
1901
1970
  max: number;
1902
1971
  end: number;
1903
1972
  start: number;
1904
1973
  } | undefined;
1905
- label?: string | undefined;
1906
1974
  family?: string | undefined;
1907
1975
  active?: boolean | undefined;
1908
1976
  }[];
@@ -1929,13 +1997,13 @@ declare const Image: z.ZodObject<{
1929
1997
  omero?: {
1930
1998
  channels: {
1931
1999
  color?: string | undefined;
2000
+ label?: string | undefined;
1932
2001
  window?: {
1933
2002
  min: number;
1934
2003
  max: number;
1935
2004
  end: number;
1936
2005
  start: number;
1937
2006
  } | undefined;
1938
- label?: string | undefined;
1939
2007
  family?: string | undefined;
1940
2008
  active?: boolean | undefined;
1941
2009
  }[];
@@ -2564,7 +2632,7 @@ declare class ImageLayer extends Layer implements ChannelsEnabled {
2564
2632
  */
2565
2633
  onEvent(event: EventContext): void;
2566
2634
  private pickAtRay;
2567
- /** The layer's chunk store view for diagnostic overlays. */
2635
+ /** @hidden */
2568
2636
  get chunkStoreView(): ChunkStoreView | undefined;
2569
2637
  /**
2570
2638
  * The slice coordinates the layer displays. This is the object passed
@@ -2753,6 +2821,8 @@ declare class VolumeLayer extends Layer implements ChannelsEnabled {
2753
2821
  */
2754
2822
  update(viewport?: Viewport): void;
2755
2823
  private rebuildObjects;
2824
+ /** @hidden */
2825
+ get chunkStoreView(): ChunkStoreView | undefined;
2756
2826
  /** Returns the ray marching uniforms for this layer. */
2757
2827
  getUniforms(): Record<string, unknown>;
2758
2828
  }
@@ -2999,7 +3069,7 @@ declare class LabelLayer extends Layer {
2999
3069
  get imageSourcePolicy(): Readonly<ImageSourcePolicy>;
3000
3070
  /** @param newPolicy - The policy to apply. */
3001
3071
  set imageSourcePolicy(newPolicy: ImageSourcePolicy);
3002
- /** The layer's chunk store view for diagnostic overlays. */
3072
+ /** @hidden */
3003
3073
  get chunkStoreView(): ChunkStoreView | undefined;
3004
3074
  /** The `t` coordinate of the most recently presented slice. */
3005
3075
  get lastPresentationTimeCoord(): number | undefined;
@@ -3463,4 +3533,4 @@ declare class OrbitControls implements CameraControls {
3463
3533
  }
3464
3534
 
3465
3535
  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 };
3536
+ 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 };