@loaders.gl/geotiff 4.3.0 → 4.3.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/dist.min.js +4 -4
- package/dist/geotiff-loader.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +2 -2
- package/dist/loaders.js +1 -1
- package/package.json +4 -4
package/dist/geotiff-loader.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { fromArrayBuffer } from 'geotiff';
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "4.3.0
|
|
7
|
+
const VERSION = typeof "4.3.0" !== 'undefined' ? "4.3.0" : 'latest';
|
|
8
8
|
/** GeoTIFF loader */
|
|
9
9
|
export const GeoTIFFLoader = {
|
|
10
10
|
dataType: null,
|
package/dist/index.cjs
CHANGED
|
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(dist_exports);
|
|
|
28
28
|
|
|
29
29
|
// dist/geotiff-loader.js
|
|
30
30
|
var import_geotiff = require("geotiff");
|
|
31
|
-
var VERSION = true ? "4.3.0
|
|
31
|
+
var VERSION = true ? "4.3.0" : "latest";
|
|
32
32
|
var GeoTIFFLoader = {
|
|
33
33
|
dataType: null,
|
|
34
34
|
batchType: null,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.js", "geotiff-loader.js", "lib/load-geotiff.js", "lib/utils/tiff-utils.js", "lib/tiff-pixel-source.js", "lib/ome/ome-indexers.js", "lib/ome/utils.js", "lib/ome/ome-utils.js", "lib/ome/omexml.js", "lib/ome/load-ome-tiff.js"],
|
|
4
|
-
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { GeoTIFFLoader } from \"./geotiff-loader.js\";\nexport { loadGeoTiff } from \"./lib/load-geotiff.js\";\nexport { TiffPixelSource } from \"./lib/tiff-pixel-source.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { fromArrayBuffer } from 'geotiff';\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.3.0-beta.3\" !== 'undefined' ? \"4.3.0-beta.3\" : 'latest';\n/** GeoTIFF loader */\nexport const GeoTIFFLoader = {\n dataType: null,\n batchType: null,\n id: 'geotiff',\n name: 'GeoTIFF',\n module: 'geotiff',\n version: VERSION,\n options: {\n enableAlpha: true\n },\n mimeTypes: ['image/tiff', 'image/geotiff'],\n extensions: ['geotiff', 'tiff', 'geotif', 'tif'],\n parse: parseGeoTIFF\n};\nexport function isTiff(arrayBuffer) {\n const dataView = new DataView(arrayBuffer);\n // Byte offset\n const endianness = dataView.getUint16(0);\n let littleEndian;\n switch (endianness) {\n case 0x4949:\n littleEndian = true;\n break;\n case 0x4d4d:\n littleEndian = false;\n break;\n default:\n return false;\n // throw new Error(`invalid byte order: 0x${endianness.toString(16)}`);\n }\n // Magic number\n if (dataView.getUint16(2, littleEndian) !== 42) {\n return false;\n }\n return true;\n}\n/**\n * Loads a GeoTIFF file containing a RGB image.\n */\nasync function parseGeoTIFF(data, options) {\n // Load using Geotiff.js\n const tiff = await fromArrayBuffer(data);\n // Assumes we only have one image inside TIFF\n const image = await tiff.getImage();\n // Read image and size\n // TODO: Add support for worker pools here.\n // TODO: Add support for more image formats.\n const rgbData = await image.readRGB({\n enableAlpha: options?.geotiff?.enableAlpha\n });\n const width = image.getWidth();\n const height = image.getHeight();\n // Create a new ImageData object\n const imageData = new Uint8ClampedArray(rgbData);\n // Get geo data\n const bounds = image.getBoundingBox();\n const metadata = image.getGeoKeys();\n // ProjectedCSTypeGeoKey is the only key we support for now, we assume it is an EPSG code\n let crs;\n if (metadata?.ProjectedCSTypeGeoKey) {\n crs = `EPSG:${metadata.ProjectedCSTypeGeoKey}`;\n }\n // Return GeoReferenced image data\n return {\n crs,\n bounds,\n width,\n height,\n data: imageData,\n metadata\n };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { fromUrl, fromBlob, GeoTIFF } from 'geotiff';\n// import {\n// // createPoolProxy,\n// createOffsetsProxy,\n// checkProxies\n// } from './utils/proxies.ts.disabled';\n// import Pool from './lib/Pool';\nimport { loadOmeTiff, isOmeTiff } from \"./ome/load-ome-tiff.js\";\n/**\n * Opens an OME-TIFF via URL and returns data source and associated metadata for first image.\n *\n * @param source url string, File/Blob object, or GeoTIFF object\n * @param opts options for initializing a tiff pixel source.\n * - `opts.headers` are passed to each underlying fetch request.\n * - `opts.offsets` are a performance enhancment to index the remote tiff source using pre-computed byte-offsets.\n * - `opts.pool` indicates whether a multi-threaded pool of image decoders should be used to decode tiles (default = true).\n * @return data source and associated OME-Zarr metadata.\n */\nexport async function loadGeoTiff(source, opts = {}) {\n const { headers, offsets } = opts;\n // Create tiff source\n let tiff;\n if (source instanceof GeoTIFF) {\n tiff = source;\n }\n else if (typeof source === 'string') {\n tiff = await fromUrl(source, headers);\n }\n else {\n tiff = await fromBlob(source);\n }\n // if (pool) {\n /*\n * Creates a worker pool to decode tiff tiles. Wraps tiff\n * in a Proxy that injects 'pool' into `tiff.readRasters`.\n */\n // tiff = createPoolProxy(tiff, new Pool());\n // }\n if (offsets) {\n /*\n * Performance enhancement. If offsets are provided, we\n * create a proxy that intercepts calls to `tiff.getImage`\n * and injects the pre-computed offsets.\n */\n // tiff = createOffsetsProxy(tiff, offsets);\n }\n /*\n * Inspect tiff source for our performance enhancing proxies.\n * Prints warnings to console if `offsets` or `pool` are missing.\n */\n // checkProxies(tiff);\n const firstImage = await tiff.getImage(0);\n if (isOmeTiff(firstImage)) {\n return loadOmeTiff(tiff, firstImage);\n }\n throw new Error('GeoTIFF not recognized.');\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport function ensureArray(x) {\n return Array.isArray(x) ? x : [x];\n}\n/*\n * Converts 32-bit integer color representation to RGBA tuple.\n * Used to serialize colors from OME-XML metadata.\n *\n * > console.log(intToRgba(100100));\n * > // [0, 1, 135, 4]\n */\nexport function intToRgba(int) {\n if (!Number.isInteger(int)) {\n throw Error('Not an integer.');\n }\n // Write number to int32 representation (4 bytes).\n const buffer = new ArrayBuffer(4);\n const view = new DataView(buffer);\n view.setInt32(0, int, false); // offset === 0, littleEndian === false\n // Take u8 view and extract number for each byte (1 byte for R/G/B/A).\n const bytes = new Uint8Array(buffer);\n return Array.from(bytes);\n}\n/*\n * Helper method to determine whether pixel data is interleaved or not.\n * > isInterleaved([1, 24, 24]) === false;\n * > isInterleaved([1, 24, 24, 3]) === true;\n */\nexport function isInterleaved(shape) {\n const lastDimSize = shape[shape.length - 1];\n return lastDimSize === 3 || lastDimSize === 4;\n}\nexport function getImageSize(source) {\n const interleaved = isInterleaved(source.shape);\n const [height, width] = source.shape.slice(interleaved ? -3 : -2);\n return { height, width };\n}\nexport const SIGNAL_ABORTED = '__vivSignalAborted';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getImageSize, isInterleaved, SIGNAL_ABORTED } from \"./utils/tiff-utils.js\";\nexport class TiffPixelSource {\n dtype;\n tileSize;\n shape;\n labels;\n meta;\n _indexer;\n // eslint-disable-next-line max-params\n constructor(indexer, dtype, tileSize, shape, labels, meta) {\n this._indexer = indexer;\n this.dtype = dtype;\n this.tileSize = tileSize;\n this.shape = shape;\n this.labels = labels;\n this.meta = meta;\n }\n async getRaster({ selection, signal }) {\n const image = await this._indexer(selection);\n return this._readRasters(image, { signal });\n }\n async getTile({ x, y, selection, signal }) {\n const { height, width } = this._getTileExtent(x, y);\n const x0 = x * this.tileSize;\n const y0 = y * this.tileSize;\n const window = [x0, y0, x0 + width, y0 + height];\n const image = await this._indexer(selection);\n return this._readRasters(image, { window, width, height, signal });\n }\n async _readRasters(image, props) {\n const interleave = isInterleaved(this.shape);\n const raster = await image.readRasters({ interleave, ...props });\n if (props?.signal?.aborted) {\n throw SIGNAL_ABORTED;\n }\n /*\n * geotiff.js returns objects with different structure\n * depending on `interleave`. It's weird, but this seems to work.\n */\n const data = (interleave ? raster : raster[0]);\n return {\n data,\n width: raster.width,\n height: raster.height\n };\n }\n /*\n * Computes tile size given x, y coord.\n */\n _getTileExtent(x, y) {\n const { height: zoomLevelHeight, width: zoomLevelWidth } = getImageSize(this);\n let height = this.tileSize;\n let width = this.tileSize;\n const maxXTileCoord = Math.floor(zoomLevelWidth / this.tileSize);\n const maxYTileCoord = Math.floor(zoomLevelHeight / this.tileSize);\n if (x === maxXTileCoord) {\n width = zoomLevelWidth % this.tileSize;\n }\n if (y === maxYTileCoord) {\n height = zoomLevelHeight % this.tileSize;\n }\n return { height, width };\n }\n onTileError(err) {\n console.error(err); // eslint-disable-line no-console\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/*\n * An \"indexer\" for a GeoTIFF-based source is a function that takes a\n * \"selection\" (e.g. { z, t, c }) and returns a Promise for the GeoTIFFImage\n * object corresponding to that selection.\n *\n * For OME-TIFF images, the \"selection\" object is the same regardless of\n * the format version. However, modern version of Bioformats have a different\n * memory layout for pyramidal resolutions. Thus, we have two different \"indexers\"\n * depending on which format version is detected.\n *\n * TODO: We currently only support indexing the first image in the OME-TIFF with\n * our indexers. There can be multiple images in an OME-TIFF, so supporting these\n * images will require extending these indexers or creating new methods.\n */\n/*\n * Returns an indexer for legacy Bioformats images. This assumes that\n * downsampled resolutions are stored sequentially in the OME-TIFF.\n */\nexport function getOmeLegacyIndexer(tiff, rootMeta) {\n const imgMeta = rootMeta[0];\n const { SizeT, SizeC, SizeZ } = imgMeta.Pixels;\n const ifdIndexer = getOmeIFDIndexer(imgMeta);\n return (sel, pyramidLevel) => {\n // Get IFD index at base pyramid level\n const index = ifdIndexer(sel);\n // Get index of first image at pyramidal level\n const pyramidIndex = pyramidLevel * SizeZ * SizeT * SizeC;\n // Return image at IFD index for pyramidal level\n return tiff.getImage(index + pyramidIndex);\n };\n}\n/*\n * Returns an indexer for modern Bioforamts images that store multiscale\n * resolutions using SubIFDs.\n *\n * The ifdIndexer returns the 'index' to the base resolution for a\n * particular 'selection'. The SubIFDs to the downsampled resolutions\n * of the 'selection' are stored within the `baseImage.fileDirectory`.\n * We use the SubIFDs to get the IFD for the corresponding sub-resolution.\n *\n * NOTE: This function create a custom IFD cache rather than mutating\n * `GeoTIFF.ifdRequests` with a random offset. The IFDs are cached in\n * an ES6 Map that maps a string key that identifies the selection uniquely\n * to the corresponding IFD.\n */\nexport function getOmeSubIFDIndexer(tiff, rootMeta) {\n const imgMeta = rootMeta[0];\n const ifdIndexer = getOmeIFDIndexer(imgMeta);\n const ifdCache = new Map();\n return async (sel, pyramidLevel) => {\n const index = ifdIndexer(sel);\n const baseImage = await tiff.getImage(index);\n // It's the highest resolution, no need to look up SubIFDs.\n if (pyramidLevel === 0) {\n return baseImage;\n }\n const { SubIFDs } = baseImage.fileDirectory;\n if (!SubIFDs) {\n throw Error('Indexing Error: OME-TIFF is missing SubIFDs.');\n }\n // Get IFD for the selection at the pyramidal level\n const key = `${sel.t}-${sel.c}-${sel.z}-${pyramidLevel}`;\n if (!ifdCache.has(key)) {\n // Only create a new request if we don't have the key.\n const subIfdOffset = SubIFDs[pyramidLevel - 1];\n ifdCache.set(key, tiff.parseFileDirectoryAt(subIfdOffset));\n }\n const ifd = await ifdCache.get(key);\n // Create a new image object manually from IFD\n // https://github.com/geotiffjs/geotiff.js/blob/8ef472f41b51d18074aece2300b6a8ad91a21ae1/src/geotiff.js#L447-L453\n return new baseImage.constructor(ifd.fileDirectory, ifd.geoKeyDirectory, \n // @ts-expect-error\n tiff.dataView, tiff.littleEndian, tiff.cache, tiff.source);\n };\n}\n/*\n * Returns a function that computes the image index based on the dimension\n * order and dimension sizes.\n */\nfunction getOmeIFDIndexer(imgMeta) {\n const { SizeC, SizeZ, SizeT, DimensionOrder } = imgMeta.Pixels;\n switch (DimensionOrder) {\n case 'XYZCT': {\n return ({ t, c, z }) => t * SizeZ * SizeC + c * SizeZ + z;\n }\n case 'XYZTC': {\n return ({ t, c, z }) => c * SizeZ * SizeT + t * SizeZ + z;\n }\n case 'XYCTZ': {\n return ({ t, c, z }) => z * SizeC * SizeT + t * SizeC + c;\n }\n case 'XYCZT': {\n return ({ t, c, z }) => t * SizeC * SizeZ + z * SizeC + c;\n }\n case 'XYTCZ': {\n return ({ t, c, z }) => z * SizeT * SizeC + c * SizeT + t;\n }\n case 'XYTZC': {\n return ({ t, c, z }) => c * SizeT * SizeZ + z * SizeT + t;\n }\n default: {\n throw new Error(`Invalid OME-XML DimensionOrder, got ${DimensionOrder}.`);\n }\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport function getLabels(dimOrder) {\n return dimOrder.toLowerCase().split('').reverse();\n}\n/*\n * Creates an ES6 map of 'label' -> index\n * > const labels = ['a', 'b', 'c', 'd'];\n * > const dims = getDims(labels);\n * > dims('a') === 0;\n * > dims('b') === 1;\n * > dims('c') === 2;\n * > dims('hi!'); // throws\n */\nexport function getDims(labels) {\n const lookup = new Map(labels.map((name, i) => [name, i]));\n if (lookup.size !== labels.length) {\n throw Error('Labels must be unique, found duplicated label.');\n }\n return (name) => {\n const index = lookup.get(name);\n if (index === undefined) {\n throw Error('Invalid dimension.');\n }\n return index;\n };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getDims, getLabels } from \"./utils.js\";\nexport const DTYPE_LOOKUP = {\n uint8: 'Uint8',\n uint16: 'Uint16',\n uint32: 'Uint32',\n float: 'Float32',\n double: 'Float64',\n int8: 'Int8',\n int16: 'Int16',\n int32: 'Int32'\n};\nexport function getOmePixelSourceMeta({ Pixels }) {\n // e.g. 'XYZCT' -> ['t', 'c', 'z', 'y', 'x']\n const labels = getLabels(Pixels.DimensionOrder);\n // Compute \"shape\" of image\n const dims = getDims(labels);\n const shape = Array(labels.length).fill(0);\n shape[dims('t')] = Pixels.SizeT;\n shape[dims('c')] = Pixels.SizeC;\n shape[dims('z')] = Pixels.SizeZ;\n // Push extra dimension if data are interleaved.\n if (Pixels.Interleaved) {\n // @ts-ignore\n labels.push('_c');\n shape.push(3);\n }\n // Creates a new shape for different level of pyramid.\n // Assumes factor-of-two downsampling.\n const getShape = (level) => {\n const s = [...shape];\n s[dims('x')] = Pixels.SizeX >> level;\n s[dims('y')] = Pixels.SizeY >> level;\n return s;\n };\n if (!(Pixels.Type in DTYPE_LOOKUP)) {\n throw Error(`Pixel type ${Pixels.Type} not supported.`);\n }\n const dtype = DTYPE_LOOKUP[Pixels.Type];\n if (Pixels.PhysicalSizeX && Pixels.PhysicalSizeY) {\n const physicalSizes = {\n x: {\n size: Pixels.PhysicalSizeX,\n unit: Pixels.PhysicalSizeXUnit\n },\n y: {\n size: Pixels.PhysicalSizeY,\n unit: Pixels.PhysicalSizeYUnit\n }\n };\n if (Pixels.PhysicalSizeZ) {\n physicalSizes.z = {\n size: Pixels.PhysicalSizeZ,\n unit: Pixels.PhysicalSizeZUnit\n };\n }\n return { labels, getShape, physicalSizes, dtype };\n }\n return { labels, getShape, dtype };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { XMLParser } from 'fast-xml-parser';\nimport { ensureArray, intToRgba } from \"../utils/tiff-utils.js\";\n// WARNING: Changes to the parser options _will_ effect the types in types/omexml.d.ts.\nconst xmlParser = new XMLParser({\n // Nests attributes withtout prefix under 'attr' key for each node\n attributeNamePrefix: '',\n attributesGroupName: 'attr',\n // Parses numbers for both attributes and nodes\n parseTagValue: true,\n parseAttributeValue: true,\n // Forces attributes to be parsed\n ignoreAttributes: false\n});\nconst parse = (str) => xmlParser.parse(str);\nexport function fromString(str) {\n const res = parse(str);\n if (!res.OME) {\n throw Error('Failed to parse OME-XML metadata.');\n }\n return ensureArray(res.OME.Image).map((img) => {\n const Channels = ensureArray(img.Pixels.Channel).map((c) => {\n if ('Color' in c.attr) {\n return { ...c.attr, Color: intToRgba(c.attr.Color) };\n }\n return { ...c.attr };\n });\n const { AquisitionDate = '', Description = '' } = img;\n const image = {\n ...img.attr,\n AquisitionDate,\n Description,\n Pixels: {\n ...img.Pixels.attr,\n Channels\n }\n };\n return {\n ...image,\n format() {\n const { Pixels } = image;\n const sizes = ['X', 'Y', 'Z']\n .map((name) => {\n const size = Pixels[`PhysicalSize${name}`];\n const unit = Pixels[`PhysicalSize${name}Unit`];\n return size && unit ? `${size} ${unit}` : '-';\n })\n .join(' x ');\n return {\n 'Acquisition Date': image.AquisitionDate,\n 'Dimensions (XY)': `${Pixels.SizeX} x ${Pixels.SizeY}`,\n 'Pixels Type': Pixels.Type,\n 'Pixels Size (XYZ)': sizes,\n 'Z-sections/Timepoints': `${Pixels.SizeZ} x ${Pixels.SizeT}`,\n Channels: Pixels.SizeC\n };\n }\n };\n });\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { TiffPixelSource } from \"../tiff-pixel-source.js\";\nimport { getOmeLegacyIndexer, getOmeSubIFDIndexer } from \"./ome-indexers.js\";\nimport { getOmePixelSourceMeta } from \"./ome-utils.js\";\nimport { fromString } from \"./omexml.js\";\nexport const isOmeTiff = (img) => img.fileDirectory.ImageDescription.includes('<OME');\nexport async function loadOmeTiff(tiff, firstImage) {\n // Get first image from tiff and inspect OME-XML metadata\n const { ImageDescription, SubIFDs, PhotometricInterpretation: photometricInterpretation } = firstImage.fileDirectory;\n const omexml = fromString(ImageDescription);\n /*\n * Image pyramids are stored differently between versions of Bioformats.\n * Thus we need a different indexer depending on which format we have.\n */\n let levels;\n let pyramidIndexer;\n if (SubIFDs) {\n // Image is >= Bioformats 6.0 and resolutions are stored using SubIFDs.\n levels = SubIFDs.length + 1;\n pyramidIndexer = getOmeSubIFDIndexer(tiff, omexml);\n }\n else {\n // Image is legacy format; resolutions are stored as separate images.\n levels = omexml.length;\n pyramidIndexer = getOmeLegacyIndexer(tiff, omexml);\n }\n // TODO: The OmeTIFF loader only works for the _first_ image in the metadata.\n const imgMeta = omexml[0];\n const { labels, getShape, physicalSizes, dtype } = getOmePixelSourceMeta(imgMeta);\n const tileSize = firstImage.getTileWidth();\n const meta = { photometricInterpretation, physicalSizes };\n const data = Array.from({ length: levels }).map((_, resolution) => {\n const shape = getShape(resolution);\n const indexer = (sel) => pyramidIndexer(sel, resolution);\n const source = new TiffPixelSource(indexer, dtype, tileSize, shape, labels, meta);\n return source;\n });\n return { data, metadata: imgMeta };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,qBAAgC;AAGhC,IAAM,UAAU,
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { GeoTIFFLoader } from \"./geotiff-loader.js\";\nexport { loadGeoTiff } from \"./lib/load-geotiff.js\";\nexport { TiffPixelSource } from \"./lib/tiff-pixel-source.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { fromArrayBuffer } from 'geotiff';\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.3.0\" !== 'undefined' ? \"4.3.0\" : 'latest';\n/** GeoTIFF loader */\nexport const GeoTIFFLoader = {\n dataType: null,\n batchType: null,\n id: 'geotiff',\n name: 'GeoTIFF',\n module: 'geotiff',\n version: VERSION,\n options: {\n enableAlpha: true\n },\n mimeTypes: ['image/tiff', 'image/geotiff'],\n extensions: ['geotiff', 'tiff', 'geotif', 'tif'],\n parse: parseGeoTIFF\n};\nexport function isTiff(arrayBuffer) {\n const dataView = new DataView(arrayBuffer);\n // Byte offset\n const endianness = dataView.getUint16(0);\n let littleEndian;\n switch (endianness) {\n case 0x4949:\n littleEndian = true;\n break;\n case 0x4d4d:\n littleEndian = false;\n break;\n default:\n return false;\n // throw new Error(`invalid byte order: 0x${endianness.toString(16)}`);\n }\n // Magic number\n if (dataView.getUint16(2, littleEndian) !== 42) {\n return false;\n }\n return true;\n}\n/**\n * Loads a GeoTIFF file containing a RGB image.\n */\nasync function parseGeoTIFF(data, options) {\n // Load using Geotiff.js\n const tiff = await fromArrayBuffer(data);\n // Assumes we only have one image inside TIFF\n const image = await tiff.getImage();\n // Read image and size\n // TODO: Add support for worker pools here.\n // TODO: Add support for more image formats.\n const rgbData = await image.readRGB({\n enableAlpha: options?.geotiff?.enableAlpha\n });\n const width = image.getWidth();\n const height = image.getHeight();\n // Create a new ImageData object\n const imageData = new Uint8ClampedArray(rgbData);\n // Get geo data\n const bounds = image.getBoundingBox();\n const metadata = image.getGeoKeys();\n // ProjectedCSTypeGeoKey is the only key we support for now, we assume it is an EPSG code\n let crs;\n if (metadata?.ProjectedCSTypeGeoKey) {\n crs = `EPSG:${metadata.ProjectedCSTypeGeoKey}`;\n }\n // Return GeoReferenced image data\n return {\n crs,\n bounds,\n width,\n height,\n data: imageData,\n metadata\n };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { fromUrl, fromBlob, GeoTIFF } from 'geotiff';\n// import {\n// // createPoolProxy,\n// createOffsetsProxy,\n// checkProxies\n// } from './utils/proxies.ts.disabled';\n// import Pool from './lib/Pool';\nimport { loadOmeTiff, isOmeTiff } from \"./ome/load-ome-tiff.js\";\n/**\n * Opens an OME-TIFF via URL and returns data source and associated metadata for first image.\n *\n * @param source url string, File/Blob object, or GeoTIFF object\n * @param opts options for initializing a tiff pixel source.\n * - `opts.headers` are passed to each underlying fetch request.\n * - `opts.offsets` are a performance enhancment to index the remote tiff source using pre-computed byte-offsets.\n * - `opts.pool` indicates whether a multi-threaded pool of image decoders should be used to decode tiles (default = true).\n * @return data source and associated OME-Zarr metadata.\n */\nexport async function loadGeoTiff(source, opts = {}) {\n const { headers, offsets } = opts;\n // Create tiff source\n let tiff;\n if (source instanceof GeoTIFF) {\n tiff = source;\n }\n else if (typeof source === 'string') {\n tiff = await fromUrl(source, headers);\n }\n else {\n tiff = await fromBlob(source);\n }\n // if (pool) {\n /*\n * Creates a worker pool to decode tiff tiles. Wraps tiff\n * in a Proxy that injects 'pool' into `tiff.readRasters`.\n */\n // tiff = createPoolProxy(tiff, new Pool());\n // }\n if (offsets) {\n /*\n * Performance enhancement. If offsets are provided, we\n * create a proxy that intercepts calls to `tiff.getImage`\n * and injects the pre-computed offsets.\n */\n // tiff = createOffsetsProxy(tiff, offsets);\n }\n /*\n * Inspect tiff source for our performance enhancing proxies.\n * Prints warnings to console if `offsets` or `pool` are missing.\n */\n // checkProxies(tiff);\n const firstImage = await tiff.getImage(0);\n if (isOmeTiff(firstImage)) {\n return loadOmeTiff(tiff, firstImage);\n }\n throw new Error('GeoTIFF not recognized.');\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport function ensureArray(x) {\n return Array.isArray(x) ? x : [x];\n}\n/*\n * Converts 32-bit integer color representation to RGBA tuple.\n * Used to serialize colors from OME-XML metadata.\n *\n * > console.log(intToRgba(100100));\n * > // [0, 1, 135, 4]\n */\nexport function intToRgba(int) {\n if (!Number.isInteger(int)) {\n throw Error('Not an integer.');\n }\n // Write number to int32 representation (4 bytes).\n const buffer = new ArrayBuffer(4);\n const view = new DataView(buffer);\n view.setInt32(0, int, false); // offset === 0, littleEndian === false\n // Take u8 view and extract number for each byte (1 byte for R/G/B/A).\n const bytes = new Uint8Array(buffer);\n return Array.from(bytes);\n}\n/*\n * Helper method to determine whether pixel data is interleaved or not.\n * > isInterleaved([1, 24, 24]) === false;\n * > isInterleaved([1, 24, 24, 3]) === true;\n */\nexport function isInterleaved(shape) {\n const lastDimSize = shape[shape.length - 1];\n return lastDimSize === 3 || lastDimSize === 4;\n}\nexport function getImageSize(source) {\n const interleaved = isInterleaved(source.shape);\n const [height, width] = source.shape.slice(interleaved ? -3 : -2);\n return { height, width };\n}\nexport const SIGNAL_ABORTED = '__vivSignalAborted';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getImageSize, isInterleaved, SIGNAL_ABORTED } from \"./utils/tiff-utils.js\";\nexport class TiffPixelSource {\n dtype;\n tileSize;\n shape;\n labels;\n meta;\n _indexer;\n // eslint-disable-next-line max-params\n constructor(indexer, dtype, tileSize, shape, labels, meta) {\n this._indexer = indexer;\n this.dtype = dtype;\n this.tileSize = tileSize;\n this.shape = shape;\n this.labels = labels;\n this.meta = meta;\n }\n async getRaster({ selection, signal }) {\n const image = await this._indexer(selection);\n return this._readRasters(image, { signal });\n }\n async getTile({ x, y, selection, signal }) {\n const { height, width } = this._getTileExtent(x, y);\n const x0 = x * this.tileSize;\n const y0 = y * this.tileSize;\n const window = [x0, y0, x0 + width, y0 + height];\n const image = await this._indexer(selection);\n return this._readRasters(image, { window, width, height, signal });\n }\n async _readRasters(image, props) {\n const interleave = isInterleaved(this.shape);\n const raster = await image.readRasters({ interleave, ...props });\n if (props?.signal?.aborted) {\n throw SIGNAL_ABORTED;\n }\n /*\n * geotiff.js returns objects with different structure\n * depending on `interleave`. It's weird, but this seems to work.\n */\n const data = (interleave ? raster : raster[0]);\n return {\n data,\n width: raster.width,\n height: raster.height\n };\n }\n /*\n * Computes tile size given x, y coord.\n */\n _getTileExtent(x, y) {\n const { height: zoomLevelHeight, width: zoomLevelWidth } = getImageSize(this);\n let height = this.tileSize;\n let width = this.tileSize;\n const maxXTileCoord = Math.floor(zoomLevelWidth / this.tileSize);\n const maxYTileCoord = Math.floor(zoomLevelHeight / this.tileSize);\n if (x === maxXTileCoord) {\n width = zoomLevelWidth % this.tileSize;\n }\n if (y === maxYTileCoord) {\n height = zoomLevelHeight % this.tileSize;\n }\n return { height, width };\n }\n onTileError(err) {\n console.error(err); // eslint-disable-line no-console\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/*\n * An \"indexer\" for a GeoTIFF-based source is a function that takes a\n * \"selection\" (e.g. { z, t, c }) and returns a Promise for the GeoTIFFImage\n * object corresponding to that selection.\n *\n * For OME-TIFF images, the \"selection\" object is the same regardless of\n * the format version. However, modern version of Bioformats have a different\n * memory layout for pyramidal resolutions. Thus, we have two different \"indexers\"\n * depending on which format version is detected.\n *\n * TODO: We currently only support indexing the first image in the OME-TIFF with\n * our indexers. There can be multiple images in an OME-TIFF, so supporting these\n * images will require extending these indexers or creating new methods.\n */\n/*\n * Returns an indexer for legacy Bioformats images. This assumes that\n * downsampled resolutions are stored sequentially in the OME-TIFF.\n */\nexport function getOmeLegacyIndexer(tiff, rootMeta) {\n const imgMeta = rootMeta[0];\n const { SizeT, SizeC, SizeZ } = imgMeta.Pixels;\n const ifdIndexer = getOmeIFDIndexer(imgMeta);\n return (sel, pyramidLevel) => {\n // Get IFD index at base pyramid level\n const index = ifdIndexer(sel);\n // Get index of first image at pyramidal level\n const pyramidIndex = pyramidLevel * SizeZ * SizeT * SizeC;\n // Return image at IFD index for pyramidal level\n return tiff.getImage(index + pyramidIndex);\n };\n}\n/*\n * Returns an indexer for modern Bioforamts images that store multiscale\n * resolutions using SubIFDs.\n *\n * The ifdIndexer returns the 'index' to the base resolution for a\n * particular 'selection'. The SubIFDs to the downsampled resolutions\n * of the 'selection' are stored within the `baseImage.fileDirectory`.\n * We use the SubIFDs to get the IFD for the corresponding sub-resolution.\n *\n * NOTE: This function create a custom IFD cache rather than mutating\n * `GeoTIFF.ifdRequests` with a random offset. The IFDs are cached in\n * an ES6 Map that maps a string key that identifies the selection uniquely\n * to the corresponding IFD.\n */\nexport function getOmeSubIFDIndexer(tiff, rootMeta) {\n const imgMeta = rootMeta[0];\n const ifdIndexer = getOmeIFDIndexer(imgMeta);\n const ifdCache = new Map();\n return async (sel, pyramidLevel) => {\n const index = ifdIndexer(sel);\n const baseImage = await tiff.getImage(index);\n // It's the highest resolution, no need to look up SubIFDs.\n if (pyramidLevel === 0) {\n return baseImage;\n }\n const { SubIFDs } = baseImage.fileDirectory;\n if (!SubIFDs) {\n throw Error('Indexing Error: OME-TIFF is missing SubIFDs.');\n }\n // Get IFD for the selection at the pyramidal level\n const key = `${sel.t}-${sel.c}-${sel.z}-${pyramidLevel}`;\n if (!ifdCache.has(key)) {\n // Only create a new request if we don't have the key.\n const subIfdOffset = SubIFDs[pyramidLevel - 1];\n ifdCache.set(key, tiff.parseFileDirectoryAt(subIfdOffset));\n }\n const ifd = await ifdCache.get(key);\n // Create a new image object manually from IFD\n // https://github.com/geotiffjs/geotiff.js/blob/8ef472f41b51d18074aece2300b6a8ad91a21ae1/src/geotiff.js#L447-L453\n return new baseImage.constructor(ifd.fileDirectory, ifd.geoKeyDirectory, \n // @ts-expect-error\n tiff.dataView, tiff.littleEndian, tiff.cache, tiff.source);\n };\n}\n/*\n * Returns a function that computes the image index based on the dimension\n * order and dimension sizes.\n */\nfunction getOmeIFDIndexer(imgMeta) {\n const { SizeC, SizeZ, SizeT, DimensionOrder } = imgMeta.Pixels;\n switch (DimensionOrder) {\n case 'XYZCT': {\n return ({ t, c, z }) => t * SizeZ * SizeC + c * SizeZ + z;\n }\n case 'XYZTC': {\n return ({ t, c, z }) => c * SizeZ * SizeT + t * SizeZ + z;\n }\n case 'XYCTZ': {\n return ({ t, c, z }) => z * SizeC * SizeT + t * SizeC + c;\n }\n case 'XYCZT': {\n return ({ t, c, z }) => t * SizeC * SizeZ + z * SizeC + c;\n }\n case 'XYTCZ': {\n return ({ t, c, z }) => z * SizeT * SizeC + c * SizeT + t;\n }\n case 'XYTZC': {\n return ({ t, c, z }) => c * SizeT * SizeZ + z * SizeT + t;\n }\n default: {\n throw new Error(`Invalid OME-XML DimensionOrder, got ${DimensionOrder}.`);\n }\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport function getLabels(dimOrder) {\n return dimOrder.toLowerCase().split('').reverse();\n}\n/*\n * Creates an ES6 map of 'label' -> index\n * > const labels = ['a', 'b', 'c', 'd'];\n * > const dims = getDims(labels);\n * > dims('a') === 0;\n * > dims('b') === 1;\n * > dims('c') === 2;\n * > dims('hi!'); // throws\n */\nexport function getDims(labels) {\n const lookup = new Map(labels.map((name, i) => [name, i]));\n if (lookup.size !== labels.length) {\n throw Error('Labels must be unique, found duplicated label.');\n }\n return (name) => {\n const index = lookup.get(name);\n if (index === undefined) {\n throw Error('Invalid dimension.');\n }\n return index;\n };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getDims, getLabels } from \"./utils.js\";\nexport const DTYPE_LOOKUP = {\n uint8: 'Uint8',\n uint16: 'Uint16',\n uint32: 'Uint32',\n float: 'Float32',\n double: 'Float64',\n int8: 'Int8',\n int16: 'Int16',\n int32: 'Int32'\n};\nexport function getOmePixelSourceMeta({ Pixels }) {\n // e.g. 'XYZCT' -> ['t', 'c', 'z', 'y', 'x']\n const labels = getLabels(Pixels.DimensionOrder);\n // Compute \"shape\" of image\n const dims = getDims(labels);\n const shape = Array(labels.length).fill(0);\n shape[dims('t')] = Pixels.SizeT;\n shape[dims('c')] = Pixels.SizeC;\n shape[dims('z')] = Pixels.SizeZ;\n // Push extra dimension if data are interleaved.\n if (Pixels.Interleaved) {\n // @ts-ignore\n labels.push('_c');\n shape.push(3);\n }\n // Creates a new shape for different level of pyramid.\n // Assumes factor-of-two downsampling.\n const getShape = (level) => {\n const s = [...shape];\n s[dims('x')] = Pixels.SizeX >> level;\n s[dims('y')] = Pixels.SizeY >> level;\n return s;\n };\n if (!(Pixels.Type in DTYPE_LOOKUP)) {\n throw Error(`Pixel type ${Pixels.Type} not supported.`);\n }\n const dtype = DTYPE_LOOKUP[Pixels.Type];\n if (Pixels.PhysicalSizeX && Pixels.PhysicalSizeY) {\n const physicalSizes = {\n x: {\n size: Pixels.PhysicalSizeX,\n unit: Pixels.PhysicalSizeXUnit\n },\n y: {\n size: Pixels.PhysicalSizeY,\n unit: Pixels.PhysicalSizeYUnit\n }\n };\n if (Pixels.PhysicalSizeZ) {\n physicalSizes.z = {\n size: Pixels.PhysicalSizeZ,\n unit: Pixels.PhysicalSizeZUnit\n };\n }\n return { labels, getShape, physicalSizes, dtype };\n }\n return { labels, getShape, dtype };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { XMLParser } from 'fast-xml-parser';\nimport { ensureArray, intToRgba } from \"../utils/tiff-utils.js\";\n// WARNING: Changes to the parser options _will_ effect the types in types/omexml.d.ts.\nconst xmlParser = new XMLParser({\n // Nests attributes withtout prefix under 'attr' key for each node\n attributeNamePrefix: '',\n attributesGroupName: 'attr',\n // Parses numbers for both attributes and nodes\n parseTagValue: true,\n parseAttributeValue: true,\n // Forces attributes to be parsed\n ignoreAttributes: false\n});\nconst parse = (str) => xmlParser.parse(str);\nexport function fromString(str) {\n const res = parse(str);\n if (!res.OME) {\n throw Error('Failed to parse OME-XML metadata.');\n }\n return ensureArray(res.OME.Image).map((img) => {\n const Channels = ensureArray(img.Pixels.Channel).map((c) => {\n if ('Color' in c.attr) {\n return { ...c.attr, Color: intToRgba(c.attr.Color) };\n }\n return { ...c.attr };\n });\n const { AquisitionDate = '', Description = '' } = img;\n const image = {\n ...img.attr,\n AquisitionDate,\n Description,\n Pixels: {\n ...img.Pixels.attr,\n Channels\n }\n };\n return {\n ...image,\n format() {\n const { Pixels } = image;\n const sizes = ['X', 'Y', 'Z']\n .map((name) => {\n const size = Pixels[`PhysicalSize${name}`];\n const unit = Pixels[`PhysicalSize${name}Unit`];\n return size && unit ? `${size} ${unit}` : '-';\n })\n .join(' x ');\n return {\n 'Acquisition Date': image.AquisitionDate,\n 'Dimensions (XY)': `${Pixels.SizeX} x ${Pixels.SizeY}`,\n 'Pixels Type': Pixels.Type,\n 'Pixels Size (XYZ)': sizes,\n 'Z-sections/Timepoints': `${Pixels.SizeZ} x ${Pixels.SizeT}`,\n Channels: Pixels.SizeC\n };\n }\n };\n });\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { TiffPixelSource } from \"../tiff-pixel-source.js\";\nimport { getOmeLegacyIndexer, getOmeSubIFDIndexer } from \"./ome-indexers.js\";\nimport { getOmePixelSourceMeta } from \"./ome-utils.js\";\nimport { fromString } from \"./omexml.js\";\nexport const isOmeTiff = (img) => img.fileDirectory.ImageDescription.includes('<OME');\nexport async function loadOmeTiff(tiff, firstImage) {\n // Get first image from tiff and inspect OME-XML metadata\n const { ImageDescription, SubIFDs, PhotometricInterpretation: photometricInterpretation } = firstImage.fileDirectory;\n const omexml = fromString(ImageDescription);\n /*\n * Image pyramids are stored differently between versions of Bioformats.\n * Thus we need a different indexer depending on which format we have.\n */\n let levels;\n let pyramidIndexer;\n if (SubIFDs) {\n // Image is >= Bioformats 6.0 and resolutions are stored using SubIFDs.\n levels = SubIFDs.length + 1;\n pyramidIndexer = getOmeSubIFDIndexer(tiff, omexml);\n }\n else {\n // Image is legacy format; resolutions are stored as separate images.\n levels = omexml.length;\n pyramidIndexer = getOmeLegacyIndexer(tiff, omexml);\n }\n // TODO: The OmeTIFF loader only works for the _first_ image in the metadata.\n const imgMeta = omexml[0];\n const { labels, getShape, physicalSizes, dtype } = getOmePixelSourceMeta(imgMeta);\n const tileSize = firstImage.getTileWidth();\n const meta = { photometricInterpretation, physicalSizes };\n const data = Array.from({ length: levels }).map((_, resolution) => {\n const shape = getShape(resolution);\n const indexer = (sel) => pyramidIndexer(sel, resolution);\n const source = new TiffPixelSource(indexer, dtype, tileSize, shape, labels, meta);\n return source;\n });\n return { data, metadata: imgMeta };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;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
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "4.3.0
|
|
7
|
+
const VERSION = typeof "4.3.0" !== 'undefined' ? "4.3.0" : 'latest';
|
|
8
8
|
/**
|
|
9
9
|
* Loads a GeoTIFF file containing a RGB image.
|
|
10
10
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/geotiff",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "Framework-independent loaders for tiff and geotiff",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"geotiff": "ilan-gold/geotiff.js#ilan-gold/viv_094"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@loaders.gl/loader-utils": "4.3.
|
|
49
|
+
"@loaders.gl/loader-utils": "4.3.1",
|
|
50
50
|
"fast-xml-parser": "^4.2.5",
|
|
51
51
|
"geotiff": "^2.1.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@loaders.gl/core": "^4.
|
|
54
|
+
"@loaders.gl/core": "^4.3.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "70a883ab6bc84647c49963215dd6ff62d4d61de3"
|
|
57
57
|
}
|