@loaders.gl/geotiff 4.0.0-alpha.4 → 4.0.0-alpha.5

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export { loadGeoTiff } from './lib/load-geotiff';
2
+ export { default as TiffPixelSource } from './lib/tiff-pixel-source';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { GeoTIFF } from 'geotiff';
2
+ import type TiffPixelSource from './tiff-pixel-source';
3
+ /** Options for initializing a tiff pixel source. */
4
+ interface GeoTIFFOptions {
5
+ /** Headers passed to each underlying request. */
6
+ headers?: Record<string, unknown>;
7
+ /** Performance enhancment to index the remote tiff source using pre-computed byte-offsets. Generated via https://github.com/ilan-gold/generate-tiff-offsets */
8
+ offsets?: number[];
9
+ /** Indicates whether a multi-threaded pool of image decoders should be used to decode tiles. */
10
+ pool?: boolean;
11
+ }
12
+ interface GeoTIFFData {
13
+ data: TiffPixelSource<string[]>[];
14
+ metadata: Record<string, unknown>;
15
+ }
16
+ /**
17
+ * Opens an OME-TIFF via URL and returns data source and associated metadata for first image.
18
+ *
19
+ * @param source url string, File/Blob object, or GeoTIFF object
20
+ * @param opts options for initializing a tiff pixel source.
21
+ * - `opts.headers` are passed to each underlying fetch request.
22
+ * - `opts.offsets` are a performance enhancment to index the remote tiff source using pre-computed byte-offsets.
23
+ * - `opts.pool` indicates whether a multi-threaded pool of image decoders should be used to decode tiles (default = true).
24
+ * @return data source and associated OME-Zarr metadata.
25
+ */
26
+ export declare function loadGeoTiff(source: string | Blob | GeoTIFF, opts?: GeoTIFFOptions): Promise<GeoTIFFData>;
27
+ export {};
28
+ //# sourceMappingURL=load-geotiff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-geotiff.d.ts","sourceRoot":"","sources":["../../src/lib/load-geotiff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,OAAO,EAAC,MAAM,SAAS,CAAC;AAUnD,OAAO,KAAK,eAAe,MAAM,qBAAqB,CAAC;AAEvD,oDAAoD;AACpD,UAAU,cAAc;IACtB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,+JAA+J;IAC/J,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gGAAgG;IAChG,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,EAC/B,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,WAAW,CAAC,CA2CtB"}
@@ -0,0 +1,50 @@
1
+ import type { GeoTIFF, GeoTIFFImage } from 'geotiff';
2
+ import TiffPixelSource from '../tiff-pixel-source';
3
+ export declare const isOmeTiff: (img: GeoTIFFImage) => boolean;
4
+ export declare function loadOmeTiff(tiff: GeoTIFF, firstImage: GeoTIFFImage): Promise<{
5
+ data: TiffPixelSource<["t", "c", "z"] | ["c", "t", "z"] | ["z", "t", "c"] | ["t", "z", "c"] | ["z", "c", "t"] | ["c", "z", "t"]>[];
6
+ metadata: {
7
+ format(): {
8
+ 'Acquisition Date': string;
9
+ 'Dimensions (XY)': string;
10
+ 'Pixels Type': "uint8" | "uint16" | "uint32" | "float" | "double" | "int8" | "int16" | "int32" | "bit" | "complex" | "double-complex";
11
+ 'Pixels Size (XYZ)': string;
12
+ 'Z-sections/Timepoints': string;
13
+ Channels: number;
14
+ };
15
+ AquisitionDate: string;
16
+ Description: string;
17
+ Pixels: {
18
+ Channels: ({
19
+ Color: [number, number, number, number];
20
+ ID: string;
21
+ SamplesPerPixel: number;
22
+ Name?: string | undefined;
23
+ } | {
24
+ ID: string;
25
+ SamplesPerPixel: number;
26
+ Name?: string | undefined;
27
+ })[];
28
+ PhysicalSizeX: number;
29
+ PhysicalSizeY: number;
30
+ PhysicalSizeZ: number;
31
+ SignificantBits: number;
32
+ SizeX: number;
33
+ SizeY: number;
34
+ SizeZ: number;
35
+ SizeT: number;
36
+ SizeC: number;
37
+ PhysicalSizeXUnit: import("./omexml").UnitsLength;
38
+ PhysicalSizeYUnit: import("./omexml").UnitsLength;
39
+ PhysicalSizeZUnit: import("./omexml").UnitsLength;
40
+ BigEndian: boolean;
41
+ Interleaved: boolean;
42
+ ID: string;
43
+ DimensionOrder: import("./omexml").DimensionOrder;
44
+ Type: "uint8" | "uint16" | "uint32" | "float" | "double" | "int8" | "int16" | "int32" | "bit" | "complex" | "double-complex";
45
+ };
46
+ ID: string;
47
+ Name: string;
48
+ };
49
+ }>;
50
+ //# sourceMappingURL=load-ome-tiff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-ome-tiff.d.ts","sourceRoot":"","sources":["../../../src/lib/ome/load-ome-tiff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC;AAEnD,OAAO,eAAe,MAAM,sBAAsB,CAAC;AAMnD,eAAO,MAAM,SAAS,QAAS,YAAY,YAAwD,CAAC;AAEpG,wBAAsB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCxE"}
@@ -0,0 +1,11 @@
1
+ import type { GeoTIFFImage, GeoTIFF } from 'geotiff';
2
+ import type { OMEXML } from '../ome/omexml';
3
+ export declare type OmeTiffSelection = {
4
+ t: number;
5
+ c: number;
6
+ z: number;
7
+ };
8
+ export declare type OmeTiffIndexer = (sel: OmeTiffSelection, z: number) => Promise<GeoTIFFImage>;
9
+ export declare function getOmeLegacyIndexer(tiff: GeoTIFF, rootMeta: OMEXML): OmeTiffIndexer;
10
+ export declare function getOmeSubIFDIndexer(tiff: GeoTIFF, rootMeta: OMEXML): OmeTiffIndexer;
11
+ //# sourceMappingURL=ome-indexers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ome-indexers.d.ts","sourceRoot":"","sources":["../../../src/lib/ome/ome-indexers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAqB,MAAM,SAAS,CAAC;AACvE,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAE1C,oBAAY,gBAAgB,GAAG;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC;AACjE,oBAAY,cAAc,GAAG,CAAC,GAAG,EAAE,gBAAgB,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAqBzF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAanF;AAgBD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAuCnF"}
@@ -0,0 +1,28 @@
1
+ import type { OMEXML, UnitsLength } from './omexml';
2
+ export declare const DTYPE_LOOKUP: {
3
+ readonly uint8: "Uint8";
4
+ readonly uint16: "Uint16";
5
+ readonly uint32: "Uint32";
6
+ readonly float: "Float32";
7
+ readonly double: "Float64";
8
+ readonly int8: "Int8";
9
+ readonly int16: "Int16";
10
+ readonly int32: "Int32";
11
+ };
12
+ export declare function getOmePixelSourceMeta({ Pixels }: OMEXML[0]): {
13
+ labels: import("../../types").Labels<["t", "c", "z"] | ["c", "t", "z"] | ["z", "t", "c"] | ["t", "z", "c"] | ["z", "c", "t"] | ["c", "z", "t"]>;
14
+ getShape: (level: number) => number[];
15
+ physicalSizes: {
16
+ [k: string]: {
17
+ size: number;
18
+ unit: UnitsLength;
19
+ };
20
+ };
21
+ dtype: "Uint8" | "Uint16" | "Uint32" | "Float32" | "Float64" | "Int8" | "Int16" | "Int32";
22
+ } | {
23
+ labels: import("../../types").Labels<["t", "c", "z"] | ["c", "t", "z"] | ["z", "t", "c"] | ["t", "z", "c"] | ["z", "c", "t"] | ["c", "z", "t"]>;
24
+ getShape: (level: number) => number[];
25
+ dtype: "Uint8" | "Uint16" | "Uint32" | "Float32" | "Float64" | "Int8" | "Int16" | "Int32";
26
+ physicalSizes?: undefined;
27
+ };
28
+ //# sourceMappingURL=ome-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ome-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/ome/ome-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,UAAU,CAAC;AAElD,eAAO,MAAM,YAAY;;;;;;;;;CASf,CAAC;AAEX,wBAAgB,qBAAqB,CAAC,EAAC,MAAM,EAAC,EAAE,MAAM,CAAC,CAAC,CAAC;;sBAoB9B,MAAM;;;kBAcP,MAAM;kBAAQ,WAAW;;;;;;sBAdxB,MAAM;;;EAmChC"}
@@ -0,0 +1,49 @@
1
+ export declare function fromString(str: string): {
2
+ format(): {
3
+ 'Acquisition Date': string;
4
+ 'Dimensions (XY)': string;
5
+ 'Pixels Type': PixelType;
6
+ 'Pixels Size (XYZ)': string;
7
+ 'Z-sections/Timepoints': string;
8
+ Channels: number;
9
+ };
10
+ AquisitionDate: string;
11
+ Description: string;
12
+ Pixels: {
13
+ Channels: ({
14
+ Color: [number, number, number, number];
15
+ ID: string;
16
+ SamplesPerPixel: number;
17
+ Name?: string | undefined;
18
+ } | {
19
+ ID: string;
20
+ SamplesPerPixel: number;
21
+ Name?: string | undefined;
22
+ })[];
23
+ PhysicalSizeX: number;
24
+ PhysicalSizeY: number;
25
+ PhysicalSizeZ: number;
26
+ SignificantBits: number;
27
+ SizeX: number;
28
+ SizeY: number;
29
+ SizeZ: number;
30
+ SizeT: number;
31
+ SizeC: number;
32
+ PhysicalSizeXUnit: UnitsLength;
33
+ PhysicalSizeYUnit: UnitsLength;
34
+ PhysicalSizeZUnit: UnitsLength;
35
+ BigEndian: boolean;
36
+ Interleaved: boolean;
37
+ ID: string;
38
+ DimensionOrder: DimensionOrder;
39
+ Type: PixelType;
40
+ };
41
+ ID: string;
42
+ Name: string;
43
+ }[];
44
+ export declare type OMEXML = ReturnType<typeof fromString>;
45
+ export declare type DimensionOrder = 'XYZCT' | 'XYZTC' | 'XYCTZ' | 'XYCZT' | 'XYTCZ' | 'XYTZC';
46
+ declare type PixelType = 'int8' | 'int16' | 'int32' | 'uint8' | 'uint16' | 'uint32' | 'float' | 'bit' | 'double' | 'complex' | 'double-complex';
47
+ export declare type UnitsLength = 'Ym' | 'Zm' | 'Em' | 'Pm' | 'Tm' | 'Gm' | 'Mm' | 'km' | 'hm' | 'dam' | 'm' | 'dm' | 'cm' | 'mm' | 'µm' | 'nm' | 'pm' | 'fm' | 'am' | 'zm' | 'ym' | 'Å' | 'thou' | 'li' | 'in' | 'ft' | 'yd' | 'mi' | 'ua' | 'ly' | 'pc' | 'pt' | 'pixel' | 'reference frame';
48
+ export {};
49
+ //# sourceMappingURL=omexml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"omexml.d.ts","sourceRoot":"","sources":["../../../src/lib/ome/omexml.ts"],"names":[],"mappings":"AAmBA,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8CrC;AAED,oBAAY,MAAM,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AACnD,oBAAY,cAAc,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAuBvF,aAAK,SAAS,GACV,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,KAAK,GACL,QAAQ,GACR,SAAS,GACT,gBAAgB,CAAC;AAErB,oBAAY,WAAW,GACnB,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,GAAG,GACH,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,GAAG,GACH,MAAM,GACN,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,OAAO,GACP,iBAAiB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { OMEXML } from '../ome/omexml';
2
+ import type { Labels } from '../../types';
3
+ export declare function getLabels(dimOrder: OMEXML[0]['Pixels']['DimensionOrder']): Labels<["t", "c", "z"] | ["c", "t", "z"] | ["z", "t", "c"] | ["t", "z", "c"] | ["z", "c", "t"] | ["c", "z", "t"]>;
4
+ export declare function getDims<S extends string>(labels: S[]): (name: S) => number;
5
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/ome/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAYxC,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,gBAAgB,CAAC,qHAExE;AAWD,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,UAKrC,CAAC,YAOhB"}
@@ -0,0 +1,18 @@
1
+ import type { GeoTIFFImage } from 'geotiff';
2
+ import type { PixelSource, PixelSourceSelection, PixelSourceMeta, Dtype, Labels, RasterSelection, TileSelection, PixelData } from '../types';
3
+ declare class TiffPixelSource<S extends string[]> implements PixelSource<S> {
4
+ dtype: Dtype;
5
+ tileSize: number;
6
+ shape: number[];
7
+ labels: Labels<S>;
8
+ meta: PixelSourceMeta | undefined;
9
+ private _indexer;
10
+ constructor(indexer: (sel: PixelSourceSelection<S>) => Promise<GeoTIFFImage>, dtype: Dtype, tileSize: number, shape: number[], labels: Labels<S>, meta?: PixelSourceMeta);
11
+ getRaster({ selection, signal }: RasterSelection<S>): Promise<PixelData>;
12
+ getTile({ x, y, selection, signal }: TileSelection<S>): Promise<PixelData>;
13
+ private _readRasters;
14
+ private _getTileExtent;
15
+ onTileError(err: Error): void;
16
+ }
17
+ export default TiffPixelSource;
18
+ //# sourceMappingURL=tiff-pixel-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tiff-pixel-source.d.ts","sourceRoot":"","sources":["../../src/lib/tiff-pixel-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAgB,MAAM,SAAS,CAAC;AAGzD,OAAO,KAAK,EACV,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,KAAK,EACL,MAAM,EACN,eAAe,EACf,aAAa,EACb,SAAS,EAEV,MAAM,UAAU,CAAC;AAElB,cAAM,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,CAAE,YAAW,WAAW,CAAC,CAAC,CAAC;IAC1D,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAClB,IAAI,EAAE,eAAe,GAAG,SAAS,CAAC;IACzC,OAAO,CAAC,QAAQ,CAA0D;gBAIxE,OAAO,EAAE,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,YAAY,CAAC,EAChE,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EACjB,IAAI,CAAC,EAAE,eAAe;IAUlB,SAAS,CAAC,EAAC,SAAS,EAAE,MAAM,EAAC,EAAE,eAAe,CAAC,CAAC,CAAC;IAKjD,OAAO,CAAC,EAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAC,EAAE,aAAa,CAAC,CAAC,CAAC;YAU3C,YAAY;IAuB1B,OAAO,CAAC,cAAc;IAetB,WAAW,CAAC,GAAG,EAAE,KAAK;CAGvB;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1,29 @@
1
+ /** eslint-disable */
2
+ import type { FileDirectory } from 'geotiff';
3
+ /**
4
+ * Pool for workers to decode chunks of the images.
5
+ * This is a line-for-line copy of GeoTIFFs old implementation: https://github.com/geotiffjs/geotiff.js/blob/v1.0.0-beta.6/src/pool.js
6
+ */
7
+ export default class Pool {
8
+ workers: Worker[];
9
+ idleWorkers: Worker[];
10
+ waitQueue: any[];
11
+ decoder: null;
12
+ /**
13
+ * @constructor
14
+ * @param {Number} size The size of the pool. Defaults to the number of CPUs
15
+ * available. When this parameter is `null` or 0, then the
16
+ * decoding will be done in the main thread.
17
+ */
18
+ constructor(size?: number);
19
+ /**
20
+ * Decode the given block of bytes with the set compression method.
21
+ * @param {ArrayBuffer} buffer the array buffer of bytes to decode.
22
+ * @returns {Promise.<ArrayBuffer>} the decoded result as a `Promise`
23
+ */
24
+ decode(fileDirectory: FileDirectory, buffer: ArrayBuffer): Promise<unknown>;
25
+ waitForWorker(): Promise<Worker>;
26
+ finishTask(currentWorker: Worker): Promise<void>;
27
+ destroy(): void;
28
+ }
29
+ //# sourceMappingURL=Pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pool.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/Pool.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AAU3C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,IAAI;IACvB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,EAAE,GAAG,EAAE,CAAC;IACjB,OAAO,EAAE,IAAI,CAAC;IAEd;;;;;OAKG;gBACS,IAAI,SAAkB;IAclC;;;;OAIG;IACG,MAAM,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW;IAmBxD,aAAa;IAcb,UAAU,CAAC,aAAa,EAAE,MAAM;IAStC,OAAO;CAMR"}
@@ -0,0 +1,6 @@
1
+ import type { GeoTIFF } from 'geotiff';
2
+ import type Pool from './Pool';
3
+ export declare function checkProxies(tiff: GeoTIFF): void;
4
+ export declare function createOffsetsProxy(tiff: GeoTIFF, offsets: number[]): GeoTIFF;
5
+ export declare function createPoolProxy(tiff: GeoTIFF, pool: Pool): GeoTIFF;
6
+ //# sourceMappingURL=proxies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxies.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/proxies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAU/B,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,QAQzC;AAqBD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAsBlE;AAUD,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,WAmBxD"}
@@ -0,0 +1,10 @@
1
+ import type { PixelSource } from '../../types';
2
+ export declare function ensureArray<T>(x: T | T[]): T[];
3
+ export declare function intToRgba(int: number): [number, number, number, number];
4
+ export declare function isInterleaved(shape: number[]): boolean;
5
+ export declare function getImageSize<T extends string[]>(source: PixelSource<T>): {
6
+ height: number;
7
+ width: number;
8
+ };
9
+ export declare const SIGNAL_ABORTED = "__vivSignalAborted";
10
+ //# sourceMappingURL=tiff-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tiff-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/tiff-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAE7C,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,OAExC;AASD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,oCAapC;AAOD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,WAG5C;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;;;EAItE;AAED,eAAO,MAAM,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { DTYPE_LOOKUP } from './lib/ome/ome-utils';
2
+ export declare type Dtype = typeof DTYPE_LOOKUP[keyof typeof DTYPE_LOOKUP];
3
+ export declare type TypedArray = InstanceType<typeof globalThis[`${Dtype}Array`]>;
4
+ export interface PixelData {
5
+ data: TypedArray;
6
+ width: number;
7
+ height: number;
8
+ }
9
+ export declare type PixelSourceSelection<S extends string[]> = {
10
+ [K in S[number]]: number;
11
+ };
12
+ export interface RasterSelection<S extends string[]> {
13
+ selection: PixelSourceSelection<S>;
14
+ signal?: AbortSignal;
15
+ }
16
+ export interface TileSelection<S extends string[]> {
17
+ x: number;
18
+ y: number;
19
+ selection: PixelSourceSelection<S>;
20
+ signal?: AbortSignal;
21
+ }
22
+ interface PhysicalSize {
23
+ size: number;
24
+ unit: string;
25
+ }
26
+ export interface PixelSourceMeta {
27
+ physicalSizes?: Record<string, PhysicalSize>;
28
+ photometricInterpretation?: number;
29
+ }
30
+ export declare type Labels<S extends string[]> = [...S, 'y', 'x'] | [...S, 'y', 'x', '_c'];
31
+ /**
32
+ * Interface to load tiles from a data source
33
+ */
34
+ export interface PixelSource<S extends string[]> {
35
+ /** Loads a 2D plane */
36
+ getRaster(sel: RasterSelection<S>): Promise<PixelData>;
37
+ /** Loads a tile */
38
+ getTile(sel: TileSelection<S>): Promise<PixelData>;
39
+ onTileError(err: Error): void;
40
+ shape: number[];
41
+ dtype: Dtype;
42
+ labels: Labels<S>;
43
+ tileSize: number;
44
+ meta?: PixelSourceMeta;
45
+ }
46
+ export {};
47
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,oBAAY,KAAK,GAAG,OAAO,YAAY,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AACnE,oBAAY,UAAU,GAAG,YAAY,CAAC,OAAO,UAAU,CAAC,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC;AAE1E,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,o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B,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB"}
@@ -0,0 +1,60 @@
1
+ declare type TypedArray = import('../types').TypedArray;
2
+ declare module 'geotiff' {
3
+ function fromUrl(url: string, headers?: Record<string, unknown>): Promise<GeoTIFF>;
4
+ function fromBlob(blob: Blob): Promise<GeoTIFF>;
5
+ function fromFile(path: string): Promise<GeoTIFF>;
6
+ class GeoTIFF {
7
+ readRasters(options?: RasterOptions): Promise<TypedArray>;
8
+ getImage(index: number): Promise<GeoTIFFImage>;
9
+ parseFileDirectoryAt(offset: number): Promise<ImageFileDirectory>;
10
+ ifdRequests: {
11
+ [key: number]: Promise<ImageFileDirectory>;
12
+ };
13
+ dataView: DataView;
14
+ littleEndian: boolean;
15
+ cache: any;
16
+ source: any;
17
+ }
18
+ interface Pool {
19
+ decode(fileDirectory: FileDirectory, buffer: ArrayBuffer): Promise<ArrayBuffer>;
20
+ }
21
+ interface RasterOptions {
22
+ window?: number[];
23
+ bbox?: number[];
24
+ samples?: number[];
25
+ interleave?: boolean;
26
+ pool?: Pool;
27
+ width?: number;
28
+ height?: number;
29
+ resampleMethod?: string;
30
+ enableAlpha?: boolean;
31
+ signal?: AbortSignal;
32
+ }
33
+ type RasterData = (TypedArray | TypedArray[]) & {
34
+ width: number;
35
+ height: number;
36
+ };
37
+ class GeoTIFFImage {
38
+ constructor(fileDirectory: FileDirectory, geoKeyDirectory: any, dataView: DataView, littleEndian: boolean, cache: any, source: any);
39
+ fileDirectory: FileDirectory;
40
+ getBoundingBox(): number[];
41
+ getFileDirectory(): FileDirectory;
42
+ getBytesPerPixel(): number;
43
+ getHeight(): number;
44
+ getSamplesPerPixel(): number;
45
+ getTileHeight(): number;
46
+ getTileWidth(): number;
47
+ getWidth(): number;
48
+ readRasters(options?: RasterOptions): Promise<RasterData>;
49
+ }
50
+ interface FileDirectory {
51
+ ImageDescription: string;
52
+ SubIFDs?: number[];
53
+ PhotometricInterpretation?: number;
54
+ }
55
+ interface ImageFileDirectory {
56
+ fileDirectory: FileDirectory;
57
+ geoKeyDirectory: any;
58
+ }
59
+ }
60
+ //# sourceMappingURL=geotiff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geotiff.d.ts","sourceRoot":"","sources":["../../src/typings/geotiff.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,UAAU,GAAG,OAAO,UAAU,EAAE,UAAU,CAAC;AAExD,OAAO,QAAQ,SAAS,CAAC;IACvB,SAAS,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnF,SAAS,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,SAAS,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAElD,MAAM,OAAO;QACX,WAAW,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC;QACzD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;QAC9C,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACjE,WAAW,EAAE;YAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;SAAC,CAAC;QAC1D,QAAQ,EAAE,QAAQ,CAAC;QACnB,YAAY,EAAE,OAAO,CAAC;QACtB,KAAK,EAAE,GAAG,CAAC;QACX,MAAM,EAAE,GAAG,CAAC;KACb;IAED,UAAU,IAAI;QACZ,MAAM,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW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C7B,eAAe,EAAE,GAAG,CAAC;KACtB;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/geotiff",
3
- "version": "4.0.0-alpha.4",
3
+ "version": "4.0.0-alpha.5",
4
4
  "description": "Framework-independent loaders for tiff and geotiff",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -18,7 +18,7 @@
18
18
  "tiff",
19
19
  "geotiff"
20
20
  ],
21
- "types": "src/index.ts",
21
+ "types": "dist/index.d.ts",
22
22
  "main": "dist/index.js",
23
23
  "module": "dist/index.js",
24
24
  "sideEffects": false,
@@ -29,8 +29,8 @@
29
29
  "README.md"
30
30
  ],
31
31
  "scripts": {
32
- "pre-build": "npm run build-bundle",
33
- "build-bundle": "webpack --display=minimal --config ../../scripts/webpack/bundle.js"
32
+ "pre-build": "# npm run build-bundle",
33
+ "build-bundle": "esbuild src/bundle.ts --outfile=dist/dist.min.js --bundle --minify --sourcemap --external:{fs,http,https}"
34
34
  },
35
35
  "dependencies-disabled": {
36
36
  "geotiff": "ilan-gold/geotiff.js#ilan-gold/viv_094"
@@ -39,5 +39,5 @@
39
39
  "fast-xml-parser": "^3.16.0",
40
40
  "geotiff": "^1.0.4"
41
41
  },
42
- "gitHead": "53026061b3c8871f7e96d3a5826125cc6613bddc"
42
+ "gitHead": "7a71a54bdf1ddf985cc3af3db90b82e7fa97d025"
43
43
  }