import type { ImageInfo } from "../ImageInfo.js"; import type { VolumeDims } from "../VolumeDims.js"; import VolumeCache from "../VolumeCache.js"; import SubscribableRequestQueue from "../utils/SubscribableRequestQueue.js"; import { ThreadableVolumeLoader, LoadSpec, type RawChannelDataCallback, type LoadedVolumeInfo } from "./IVolumeLoader.js"; import type { PrefetchDirection } from "./zarr_utils/types.js"; export type ZarrLoaderFetchOptions = { /** The max. number of requests the loader can issue at a time. Ignored if the constructor also receives a queue. */ concurrencyLimit?: number; /** * The max. number of *prefetch* requests the loader can issue at a time. Set lower than `concurrencyLimit` to ensure * that prefetching leaves room in the queue for actual loads. Ignored if the constructor also receives a queue. */ prefetchConcurrencyLimit?: number; /** * The max. number of chunks to prefetch outward in either direction. E.g. if a load requests chunks with z coords 3 * and 4 and `maxPrefetchDistance` in z is 2, the loader will prefetch similar chunks with z coords 1, 2, 5, and 6 * (or until it hits `maxPrefetchChunks`). Ordered TZYX. */ maxPrefetchDistance: [number, number, number, number]; /** The max. number of total chunks that can be prefetched after any load. */ maxPrefetchChunks: number; /** The initial directions to prioritize when prefetching */ priorityDirections?: PrefetchDirection[]; /** only use priority directions */ onlyPriorityDirections?: boolean; }; declare class OMEZarrLoader extends ThreadableVolumeLoader { /** * Array of records, each containing the objects and metadata we need to load from one source of multiscale zarr * data. See documentation on `ZarrSource` for more. */ private sources; /** Handle to a `SubscribableRequestQueue` for smart concurrency management and request cancelling/reissuing. */ private requestQueue; /** Options to configure (pre)fetching behavior. */ private fetchOptions; /** Direction(s) to prioritize when prefetching. Stored separate from `fetchOptions` since it may be mutated. */ private priorityDirections; /** The ID of the subscriber responsible for "actual loads" (non-prefetch requests) */ private loadSubscriber; /** The ID of the subscriber responsible for prefetches, so that requests can be cancelled and reissued */ private prefetchSubscriber; private maxExtent?; private syncChannels; private constructor(); /** * Creates a new `OMEZarrLoader`. * * @param urls The URL(s) of the OME-Zarr data to load. If `urls` is an array, the loader will attempt to find scale * levels with exactly the same size in every source. If matching level(s) are available, the loader will produce a * volume containing all channels from every provided zarr in the order they appear in `urls`. If no matching sets * of scale levels are available, creation fails. * @param scenes The scene(s) to load from each URL. If `urls` is an array, `scenes` may either be an array of values * corresponding to each URL, or a single value to apply to all URLs. Default 0. * @param cache A cache to use for storing fetched data. If not provided, a new cache will be created. * @param queue A queue to use for managing requests. If not provided, a new queue will be created. * @param fetchOptions Options to configure (pre)fetching behavior. */ static createLoader(urls: string | string[], scenes?: number | number[], cache?: VolumeCache, queue?: SubscribableRequestQueue, fetchOptions?: ZarrLoaderFetchOptions): Promise; private getUnitSymbols; private getLevelShapesZYX; private getScale; private orderByDimension; private orderByTCZYX; /** * Converts a volume channel index to the index of its zarr source and its channel index within that zarr. * e.g., if the loader has 2 sources, the first with 3 channels and the second with 2, then `matchChannelToSource(4)` * returns `[1, 1]` (the second channel of the second source). */ private matchChannelToSource; /** * Change which directions to prioritize when prefetching. All chunks will be prefetched in these directions before * any chunks are prefetched in any other directions. */ setPrefetchPriority(directions: PrefetchDirection[]): void; syncMultichannelLoading(sync: boolean): void; updateFetchOptions(options: Partial): void; loadDims(loadSpec: LoadSpec): Promise; createImageInfo(loadSpec: LoadSpec): Promise; private prefetchChunk; /** Reads a list of chunk keys requested by a `loadVolumeData` call and sets up appropriate prefetch requests. */ private beginPrefetch; private updateImageInfoForLoad; loadRawChannelData(imageInfo: ImageInfo, loadSpec: LoadSpec, onUpdateMetadata: (imageInfo: ImageInfo) => void, onData: RawChannelDataCallback): Promise; } export { OMEZarrLoader };