@idetik/core 0.33.0 → 0.35.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
@@ -1,5 +1,5 @@
1
1
  import * as gl_matrix from 'gl-matrix';
2
- import { vec2, mat4, vec3, quat, vec4 } from 'gl-matrix';
2
+ import { vec2, mat4, vec3, vec4, quat } from 'gl-matrix';
3
3
  import * as zarr from 'zarrita';
4
4
  import { Location, Readable } from 'zarrita';
5
5
  import { z } from 'zod';
@@ -37,6 +37,12 @@ declare abstract class Texture extends Node {
37
37
  get type(): string;
38
38
  }
39
39
 
40
+ type SpatialAxis = "x" | "y" | "z";
41
+ type SliceAxes = {
42
+ u: SpatialAxis;
43
+ v: SpatialAxis;
44
+ w: SpatialAxis;
45
+ };
40
46
  type SliceOrientation = "XY" | "XZ" | "YZ";
41
47
 
42
48
  declare const chunkDataTypes: readonly [Int8ArrayConstructor, Int16ArrayConstructor, Int32ArrayConstructor, Uint8ArrayConstructor, Uint16ArrayConstructor, Uint32ArrayConstructor, Float32ArrayConstructor];
@@ -171,7 +177,7 @@ declare class ChunkStore {
171
177
  get channelCount(): number;
172
178
  get dimensions(): SourceDimensionMap;
173
179
  getLowestResLOD(): number;
174
- addView(policy: ImageSourcePolicy): ChunkStoreView;
180
+ addView(policy: ImageSourcePolicy, axes?: SliceAxes): ChunkStoreView;
175
181
  get views(): ReadonlyArray<ChunkStoreView>;
176
182
  canDispose(): boolean;
177
183
  updateAndCollectChunkChanges(): Set<Chunk>;
@@ -220,11 +226,12 @@ declare class ChunkStoreView {
220
226
  private readonly sourceMaxSquareDistance2D_;
221
227
  private readonly chunkViewStates_;
222
228
  private isDisposed_;
223
- constructor(store: ChunkStore, policy: ImageSourcePolicy);
229
+ constructor(store: ChunkStore, policy: ImageSourcePolicy, axes?: SliceAxes);
224
230
  get chunkViewStates(): ReadonlyMap<Chunk, ChunkViewState>;
225
231
  get isDisposed(): boolean;
226
232
  get lodCount(): number;
227
233
  get channelCount(): number;
234
+ getWholePlaneRect(): Box2;
228
235
  getChunksToRender(): Chunk[];
229
236
  updateChunksForImage(sliceCoords: SliceCoordinates, view: {
230
237
  worldViewRect: Box2;
@@ -278,7 +285,7 @@ declare class ChunkManager {
278
285
  cpuChunkBytes: number;
279
286
  cpuChunkCount: number;
280
287
  };
281
- addView(source: ChunkSource, policy: ImageSourcePolicy): ChunkStoreView;
288
+ addView(source: ChunkSource, policy: ImageSourcePolicy, axes?: SliceAxes): ChunkStoreView;
282
289
  update(): void;
283
290
  private releaseChunk;
284
291
  private enqueueWithinBudget;
@@ -289,6 +296,34 @@ declare class ChunkManager {
289
296
  private disposeChunkTexture;
290
297
  }
291
298
 
299
+ /** @group Layer Configuration */
300
+ type ColorLike = Color | vec3 | vec4 | string;
301
+ /** @group Layer Configuration */
302
+ declare class Color {
303
+ static readonly RED: Color;
304
+ static readonly GREEN: Color;
305
+ static readonly BLUE: Color;
306
+ static readonly YELLOW: Color;
307
+ static readonly MAGENTA: Color;
308
+ static readonly CYAN: Color;
309
+ static readonly BLACK: Color;
310
+ static readonly WHITE: Color;
311
+ static readonly TRANSPARENT: Color;
312
+ private readonly rgba_;
313
+ constructor(r: number, g: number, b: number, a?: number);
314
+ get rgb(): [number, number, number];
315
+ get rgba(): readonly [number, number, number, number];
316
+ get r(): number;
317
+ get g(): number;
318
+ get b(): number;
319
+ get a(): number;
320
+ get rgbHex(): string;
321
+ get packed(): number;
322
+ static from(colorLike: ColorLike): Color;
323
+ static fromRgbHex(hex: string): Color;
324
+ private toHexComponent;
325
+ }
326
+
292
327
  declare class Box3 {
293
328
  min: vec3;
294
329
  max: vec3;
@@ -360,34 +395,6 @@ declare class TrsTransform {
360
395
 
361
396
  type Shader = "floatScalarImage" | "floatVolume" | "intLabelImage" | "intScalarImage" | "intVolume" | "labelImage" | "points" | "projectedLine" | "uintScalarImage" | "uintVolume" | "wireframe";
362
397
 
363
- /** @group Layer Configuration */
364
- type ColorLike = Color | vec3 | vec4 | string;
365
- /** @group Layer Configuration */
366
- declare class Color {
367
- static readonly RED: Color;
368
- static readonly GREEN: Color;
369
- static readonly BLUE: Color;
370
- static readonly YELLOW: Color;
371
- static readonly MAGENTA: Color;
372
- static readonly CYAN: Color;
373
- static readonly BLACK: Color;
374
- static readonly WHITE: Color;
375
- static readonly TRANSPARENT: Color;
376
- private readonly rgba_;
377
- constructor(r: number, g: number, b: number, a?: number);
378
- get rgb(): [number, number, number];
379
- get rgba(): readonly [number, number, number, number];
380
- get r(): number;
381
- get g(): number;
382
- get b(): number;
383
- get a(): number;
384
- get rgbHex(): string;
385
- get packed(): number;
386
- static from(colorLike: ColorLike): Color;
387
- static fromRgbHex(hex: string): Color;
388
- private toHexComponent;
389
- }
390
-
391
398
  type CullingMode = "none" | "front" | "back" | "both";
392
399
 
393
400
  declare abstract class RenderableObject extends Node {
@@ -515,8 +522,9 @@ declare class OrthographicCamera extends Camera {
515
522
  private height_;
516
523
  private viewportAspectRatio_;
517
524
  private viewportSize_;
518
- private readonly axes_;
519
- private readonly rotation_;
525
+ private axes_;
526
+ private rotation_;
527
+ private orientation_;
520
528
  /**
521
529
  * Creates an orthographic camera framing the given world-space rectangle.
522
530
  *
@@ -532,6 +540,13 @@ declare class OrthographicCamera extends Camera {
532
540
  setAspectRatio(aspectRatio: number): void;
533
541
  setFrame(left: number, right: number, bottom: number, top: number): void;
534
542
  get type(): CameraType;
543
+ get orientation(): SliceOrientation;
544
+ /**
545
+ * Changes the slice orientation the camera faces. The current frame and
546
+ * zoom carry over numerically to the new plane axes. Call {@link setFrame}
547
+ * to reframe the view for the new plane.
548
+ */
549
+ setOrientation(orientation: SliceOrientation): void;
535
550
  zoom(factor: number): void;
536
551
  getWorldViewRect(): Box2;
537
552
  protected updateProjectionMatrix(): void;
@@ -692,6 +707,7 @@ type IdetikParams = {
692
707
  memoryLimitMB?: number;
693
708
  maxConcurrentRequests?: number;
694
709
  maxGpuUploadsPerUpdate?: number;
710
+ backgroundColor?: ColorLike;
695
711
  };
696
712
  type IdetikContext = {
697
713
  chunkManager: ChunkManager;
@@ -1490,6 +1506,7 @@ type ImageLayerProps = LayerOptions & {
1490
1506
  source: ChunkSource;
1491
1507
  sliceCoords: SliceCoordinates;
1492
1508
  policy: ImageSourcePolicy;
1509
+ orientation?: SliceOrientation;
1493
1510
  channelProps?: ChannelProps[];
1494
1511
  onPickValue?: (info: PointPickingResult) => void;
1495
1512
  };
@@ -1511,7 +1528,9 @@ declare class ImageLayer extends Layer implements ChannelsEnabled {
1511
1528
  readonly type = "ImageLayer";
1512
1529
  private readonly source_;
1513
1530
  private readonly sliceCoords_;
1514
- private readonly axes_;
1531
+ private axes_;
1532
+ private planeRotation_;
1533
+ private orientation_;
1515
1534
  private readonly onPickValue_?;
1516
1535
  private readonly visibleChunks_;
1517
1536
  private readonly pool_;
@@ -1520,16 +1539,23 @@ declare class ImageLayer extends Layer implements ChannelsEnabled {
1520
1539
  private policy_;
1521
1540
  private channelProps_?;
1522
1541
  private chunkStoreView_?;
1542
+ private context_?;
1523
1543
  private pointerDownPos_;
1524
1544
  private debugMode_;
1525
1545
  private static readonly STALE_PRESENTATION_MS_;
1526
1546
  private lastPresentationTimeStamp_?;
1527
1547
  private lastPresentationTimeCoord_?;
1528
1548
  private readonly wireframeColors_;
1529
- constructor({ source, sliceCoords, policy, channelProps, onPickValue, ...layerOptions }: ImageLayerProps);
1549
+ constructor({ source, sliceCoords, policy, orientation, channelProps, onPickValue, ...layerOptions }: ImageLayerProps);
1530
1550
  protected attach(context: IdetikContext): void;
1531
1551
  protected detach(_context: IdetikContext): void;
1532
1552
  update(viewport?: Viewport): void;
1553
+ get orientation(): SliceOrientation;
1554
+ /**
1555
+ * Changes the slice orientation at runtime. Visible renderables are rebuilt
1556
+ * for the new plane, chunks already resident in the shared cache are reused.
1557
+ */
1558
+ setOrientation(orientation: SliceOrientation): void;
1533
1559
  private updateChunks;
1534
1560
  hasMultipleLODs(): boolean;
1535
1561
  get lastPresentationTimeCoord(): number | undefined;
@@ -1619,6 +1645,7 @@ type LabelLayerProps = LayerOptions & {
1619
1645
  source: ChunkSource;
1620
1646
  sliceCoords: SliceCoordinates;
1621
1647
  policy: ImageSourcePolicy;
1648
+ orientation?: SliceOrientation;
1622
1649
  colorMap?: LabelColorMapProps;
1623
1650
  onPickValue?: (info: PointPickingResult) => void;
1624
1651
  outlineSelected?: boolean;
@@ -1628,7 +1655,9 @@ declare class LabelLayer extends Layer {
1628
1655
  readonly type = "LabelLayer";
1629
1656
  private readonly source_;
1630
1657
  private readonly sliceCoords_;
1631
- private readonly axes_;
1658
+ private axes_;
1659
+ private planeRotation_;
1660
+ private orientation_;
1632
1661
  private readonly onPickValue_?;
1633
1662
  private readonly outlineSelected_;
1634
1663
  private readonly visibleChunks_;
@@ -1637,14 +1666,21 @@ declare class LabelLayer extends Layer {
1637
1666
  private selectedValue_;
1638
1667
  private policy_;
1639
1668
  private chunkStoreView_?;
1669
+ private context_?;
1640
1670
  private pointerDownPos_;
1641
1671
  private static readonly STALE_PRESENTATION_MS_;
1642
1672
  private lastPresentationTimeStamp_?;
1643
1673
  private lastPresentationTimeCoord_?;
1644
- constructor({ source, sliceCoords, policy, colorMap, onPickValue, outlineSelected, ...layerOptions }: LabelLayerProps);
1674
+ constructor({ source, sliceCoords, policy, orientation, colorMap, onPickValue, outlineSelected, ...layerOptions }: LabelLayerProps);
1645
1675
  protected attach(context: IdetikContext): void;
1646
1676
  protected detach(_context: IdetikContext): void;
1647
1677
  update(viewport?: Viewport): void;
1678
+ get orientation(): SliceOrientation;
1679
+ /**
1680
+ * Changes the slice orientation at runtime. Visible renderables are rebuilt
1681
+ * for the new plane, chunks already resident in the shared cache are reused.
1682
+ */
1683
+ setOrientation(orientation: SliceOrientation): void;
1648
1684
  private updateChunks;
1649
1685
  hasMultipleLODs(): boolean;
1650
1686
  private isPresentationStale;
@@ -2039,4 +2075,4 @@ type Image = z.infer<typeof Image>;
2039
2075
  type OmeZarrImage = Image;
2040
2076
 
2041
2077
  export { AxesLayer, Color, Idetik, ImageLayer, ImageRenderable, LabelColorMap, LabelImageRenderable, LabelLayer, Layer, OmeZarrImageSource, OrbitControls, OrthographicCamera, PanZoomControls, PerspectiveCamera, Points, ProjectedLine, VolumeLayer, VolumeRenderable, createExplorationPolicy, createImageSourcePolicy, createNoPrefetchPolicy, createPlaybackPolicy, loadOmeZarrPlate, loadOmeZarrWell, loadOmeroChannels, loadOmeroDefaults };
2042
- export type { ChannelProps, ColorLike, LayerState, MemoryStats, OmeZarrImage, Overlay, SliceCoordinates };
2078
+ export type { ChannelProps, ColorLike, LayerState, MemoryStats, OmeZarrImage, Overlay, SliceCoordinates, SliceOrientation };