@idetik/core 0.32.7 → 0.34.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,14 @@ 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
+ };
46
+ type SliceOrientation = "XY" | "XZ" | "YZ";
47
+
40
48
  declare const chunkDataTypes: readonly [Int8ArrayConstructor, Int16ArrayConstructor, Int32ArrayConstructor, Uint8ArrayConstructor, Uint16ArrayConstructor, Uint32ArrayConstructor, Float32ArrayConstructor];
41
49
  type ChunkDataConstructor = (typeof chunkDataTypes)[number];
42
50
  type ChunkData = InstanceType<ChunkDataConstructor>;
@@ -169,7 +177,7 @@ declare class ChunkStore {
169
177
  get channelCount(): number;
170
178
  get dimensions(): SourceDimensionMap;
171
179
  getLowestResLOD(): number;
172
- addView(policy: ImageSourcePolicy): ChunkStoreView;
180
+ addView(policy: ImageSourcePolicy, axes?: SliceAxes): ChunkStoreView;
173
181
  get views(): ReadonlyArray<ChunkStoreView>;
174
182
  canDispose(): boolean;
175
183
  updateAndCollectChunkChanges(): Set<Chunk>;
@@ -218,11 +226,12 @@ declare class ChunkStoreView {
218
226
  private readonly sourceMaxSquareDistance2D_;
219
227
  private readonly chunkViewStates_;
220
228
  private isDisposed_;
221
- constructor(store: ChunkStore, policy: ImageSourcePolicy);
229
+ constructor(store: ChunkStore, policy: ImageSourcePolicy, axes?: SliceAxes);
222
230
  get chunkViewStates(): ReadonlyMap<Chunk, ChunkViewState>;
223
231
  get isDisposed(): boolean;
224
232
  get lodCount(): number;
225
233
  get channelCount(): number;
234
+ getWholePlaneRect(): Box2;
226
235
  getChunksToRender(): Chunk[];
227
236
  updateChunksForImage(sliceCoords: SliceCoordinates, view: {
228
237
  worldViewRect: Box2;
@@ -276,7 +285,7 @@ declare class ChunkManager {
276
285
  cpuChunkBytes: number;
277
286
  cpuChunkCount: number;
278
287
  };
279
- addView(source: ChunkSource, policy: ImageSourcePolicy): ChunkStoreView;
288
+ addView(source: ChunkSource, policy: ImageSourcePolicy, axes?: SliceAxes): ChunkStoreView;
280
289
  update(): void;
281
290
  private releaseChunk;
282
291
  private enqueueWithinBudget;
@@ -287,6 +296,34 @@ declare class ChunkManager {
287
296
  private disposeChunkTexture;
288
297
  }
289
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
+
290
327
  declare class Box3 {
291
328
  min: vec3;
292
329
  max: vec3;
@@ -358,34 +395,6 @@ declare class TrsTransform {
358
395
 
359
396
  type Shader = "floatScalarImage" | "floatVolume" | "intLabelImage" | "intScalarImage" | "intVolume" | "labelImage" | "points" | "projectedLine" | "uintScalarImage" | "uintVolume" | "wireframe";
360
397
 
361
- /** @group Layer Configuration */
362
- type ColorLike = Color | vec3 | vec4 | string;
363
- /** @group Layer Configuration */
364
- declare class Color {
365
- static readonly RED: Color;
366
- static readonly GREEN: Color;
367
- static readonly BLUE: Color;
368
- static readonly YELLOW: Color;
369
- static readonly MAGENTA: Color;
370
- static readonly CYAN: Color;
371
- static readonly BLACK: Color;
372
- static readonly WHITE: Color;
373
- static readonly TRANSPARENT: Color;
374
- private readonly rgba_;
375
- constructor(r: number, g: number, b: number, a?: number);
376
- get rgb(): [number, number, number];
377
- get rgba(): readonly [number, number, number, number];
378
- get r(): number;
379
- get g(): number;
380
- get b(): number;
381
- get a(): number;
382
- get rgbHex(): string;
383
- get packed(): number;
384
- static from(colorLike: ColorLike): Color;
385
- static fromRgbHex(hex: string): Color;
386
- private toHexComponent;
387
- }
388
-
389
398
  type CullingMode = "none" | "front" | "back" | "both";
390
399
 
391
400
  declare abstract class RenderableObject extends Node {
@@ -490,6 +499,11 @@ declare class EventDispatcher {
490
499
  private readonly handleEvent;
491
500
  }
492
501
 
502
+ type OrthographicCameraOptions = {
503
+ near?: number;
504
+ far?: number;
505
+ orientation?: SliceOrientation;
506
+ };
493
507
  /**
494
508
  * A camera using an orthographic (parallel) projection.
495
509
  *
@@ -508,6 +522,8 @@ declare class OrthographicCamera extends Camera {
508
522
  private height_;
509
523
  private viewportAspectRatio_;
510
524
  private viewportSize_;
525
+ private readonly axes_;
526
+ private readonly rotation_;
511
527
  /**
512
528
  * Creates an orthographic camera framing the given world-space rectangle.
513
529
  *
@@ -515,10 +531,10 @@ declare class OrthographicCamera extends Camera {
515
531
  * @param right - Right edge of the view frame, in world units.
516
532
  * @param top - Top edge of the view frame, in world units.
517
533
  * @param bottom - Bottom edge of the view frame, in world units.
518
- * @param near - Near clipping plane distance. Defaults to `-1e6`.
519
- * @param far - Far clipping plane distance. Defaults to `1e6`.
534
+ * @param options - Near/far clipping plane distances (default `-1e6` and
535
+ * `1e6`) and the slice orientation the camera faces (default `"XY"`).
520
536
  */
521
- constructor(left: number, right: number, top: number, bottom: number, near?: number, far?: number);
537
+ constructor(left: number, right: number, top: number, bottom: number, options?: OrthographicCameraOptions);
522
538
  get viewportSize(): [number, number];
523
539
  setAspectRatio(aspectRatio: number): void;
524
540
  setFrame(left: number, right: number, bottom: number, top: number): void;
@@ -683,6 +699,7 @@ type IdetikParams = {
683
699
  memoryLimitMB?: number;
684
700
  maxConcurrentRequests?: number;
685
701
  maxGpuUploadsPerUpdate?: number;
702
+ backgroundColor?: ColorLike;
686
703
  };
687
704
  type IdetikContext = {
688
705
  chunkManager: ChunkManager;
@@ -1481,6 +1498,7 @@ type ImageLayerProps = LayerOptions & {
1481
1498
  source: ChunkSource;
1482
1499
  sliceCoords: SliceCoordinates;
1483
1500
  policy: ImageSourcePolicy;
1501
+ orientation?: SliceOrientation;
1484
1502
  channelProps?: ChannelProps[];
1485
1503
  onPickValue?: (info: PointPickingResult) => void;
1486
1504
  };
@@ -1503,6 +1521,7 @@ declare class ImageLayer extends Layer implements ChannelsEnabled {
1503
1521
  private readonly source_;
1504
1522
  private readonly sliceCoords_;
1505
1523
  private readonly axes_;
1524
+ private readonly planeRotation_;
1506
1525
  private readonly onPickValue_?;
1507
1526
  private readonly visibleChunks_;
1508
1527
  private readonly pool_;
@@ -1517,7 +1536,7 @@ declare class ImageLayer extends Layer implements ChannelsEnabled {
1517
1536
  private lastPresentationTimeStamp_?;
1518
1537
  private lastPresentationTimeCoord_?;
1519
1538
  private readonly wireframeColors_;
1520
- constructor({ source, sliceCoords, policy, channelProps, onPickValue, ...layerOptions }: ImageLayerProps);
1539
+ constructor({ source, sliceCoords, policy, orientation, channelProps, onPickValue, ...layerOptions }: ImageLayerProps);
1521
1540
  protected attach(context: IdetikContext): void;
1522
1541
  protected detach(_context: IdetikContext): void;
1523
1542
  update(viewport?: Viewport): void;
@@ -1610,6 +1629,7 @@ type LabelLayerProps = LayerOptions & {
1610
1629
  source: ChunkSource;
1611
1630
  sliceCoords: SliceCoordinates;
1612
1631
  policy: ImageSourcePolicy;
1632
+ orientation?: SliceOrientation;
1613
1633
  colorMap?: LabelColorMapProps;
1614
1634
  onPickValue?: (info: PointPickingResult) => void;
1615
1635
  outlineSelected?: boolean;
@@ -1620,6 +1640,7 @@ declare class LabelLayer extends Layer {
1620
1640
  private readonly source_;
1621
1641
  private readonly sliceCoords_;
1622
1642
  private readonly axes_;
1643
+ private readonly planeRotation_;
1623
1644
  private readonly onPickValue_?;
1624
1645
  private readonly outlineSelected_;
1625
1646
  private readonly visibleChunks_;
@@ -1632,7 +1653,7 @@ declare class LabelLayer extends Layer {
1632
1653
  private static readonly STALE_PRESENTATION_MS_;
1633
1654
  private lastPresentationTimeStamp_?;
1634
1655
  private lastPresentationTimeCoord_?;
1635
- constructor({ source, sliceCoords, policy, colorMap, onPickValue, outlineSelected, ...layerOptions }: LabelLayerProps);
1656
+ constructor({ source, sliceCoords, policy, orientation, colorMap, onPickValue, outlineSelected, ...layerOptions }: LabelLayerProps);
1636
1657
  protected attach(context: IdetikContext): void;
1637
1658
  protected detach(_context: IdetikContext): void;
1638
1659
  update(viewport?: Viewport): void;
@@ -2030,4 +2051,4 @@ type Image = z.infer<typeof Image>;
2030
2051
  type OmeZarrImage = Image;
2031
2052
 
2032
2053
  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 };
2033
- export type { ChannelProps, ColorLike, LayerState, MemoryStats, OmeZarrImage, Overlay, SliceCoordinates };
2054
+ export type { ChannelProps, ColorLike, LayerState, MemoryStats, OmeZarrImage, Overlay, SliceCoordinates, SliceOrientation };