@loaders.gl/geotiff 3.4.14 → 3.4.15
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/es5/bundle.js +2 -3
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/index.js +2 -2
- package/dist/es5/lib/load-geotiff.js +23 -65
- package/dist/es5/lib/load-geotiff.js.map +1 -1
- package/dist/es5/lib/ome/load-ome-tiff.js +41 -51
- package/dist/es5/lib/ome/load-ome-tiff.js.map +1 -1
- package/dist/es5/lib/ome/ome-indexers.js +75 -88
- package/dist/es5/lib/ome/ome-indexers.js.map +1 -1
- package/dist/es5/lib/ome/ome-utils.js +18 -18
- package/dist/es5/lib/ome/ome-utils.js.map +1 -1
- package/dist/es5/lib/ome/omexml.js +34 -32
- package/dist/es5/lib/ome/omexml.js.map +1 -1
- package/dist/es5/lib/ome/utils.js +3 -5
- package/dist/es5/lib/ome/utils.js.map +1 -1
- package/dist/es5/lib/tiff-pixel-source.js +73 -136
- package/dist/es5/lib/tiff-pixel-source.js.map +1 -1
- package/dist/es5/lib/utils/Pool.js +45 -112
- package/dist/es5/lib/utils/Pool.js.map +1 -1
- package/dist/es5/lib/utils/proxies.js +14 -17
- package/dist/es5/lib/utils/proxies.js.map +1 -1
- package/dist/es5/lib/utils/tiff-utils.js +9 -14
- package/dist/es5/lib/utils/tiff-utils.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.DTYPE_LOOKUP = void 0;
|
|
8
7
|
exports.getOmePixelSourceMeta = getOmePixelSourceMeta;
|
|
9
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
8
|
var _utils = require("./utils");
|
|
11
|
-
|
|
9
|
+
const DTYPE_LOOKUP = {
|
|
12
10
|
uint8: 'Uint8',
|
|
13
11
|
uint16: 'Uint16',
|
|
14
12
|
uint32: 'Uint32',
|
|
@@ -20,10 +18,12 @@ var DTYPE_LOOKUP = {
|
|
|
20
18
|
};
|
|
21
19
|
exports.DTYPE_LOOKUP = DTYPE_LOOKUP;
|
|
22
20
|
function getOmePixelSourceMeta(_ref) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
let {
|
|
22
|
+
Pixels
|
|
23
|
+
} = _ref;
|
|
24
|
+
const labels = (0, _utils.getLabels)(Pixels.DimensionOrder);
|
|
25
|
+
const dims = (0, _utils.getDims)(labels);
|
|
26
|
+
const shape = Array(labels.length).fill(0);
|
|
27
27
|
shape[dims('t')] = Pixels.SizeT;
|
|
28
28
|
shape[dims('c')] = Pixels.SizeC;
|
|
29
29
|
shape[dims('z')] = Pixels.SizeZ;
|
|
@@ -31,8 +31,8 @@ function getOmePixelSourceMeta(_ref) {
|
|
|
31
31
|
labels.push('_c');
|
|
32
32
|
shape.push(3);
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const getShape = level => {
|
|
35
|
+
const s = [...shape];
|
|
36
36
|
s[dims('x')] = Pixels.SizeX >> level;
|
|
37
37
|
s[dims('y')] = Pixels.SizeY >> level;
|
|
38
38
|
return s;
|
|
@@ -40,9 +40,9 @@ function getOmePixelSourceMeta(_ref) {
|
|
|
40
40
|
if (!(Pixels.Type in DTYPE_LOOKUP)) {
|
|
41
41
|
throw Error("Pixel type ".concat(Pixels.Type, " not supported."));
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
const dtype = DTYPE_LOOKUP[Pixels.Type];
|
|
44
44
|
if (Pixels.PhysicalSizeX && Pixels.PhysicalSizeY) {
|
|
45
|
-
|
|
45
|
+
const physicalSizes = {
|
|
46
46
|
x: {
|
|
47
47
|
size: Pixels.PhysicalSizeX,
|
|
48
48
|
unit: Pixels.PhysicalSizeXUnit
|
|
@@ -59,16 +59,16 @@ function getOmePixelSourceMeta(_ref) {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
return {
|
|
62
|
-
labels
|
|
63
|
-
getShape
|
|
64
|
-
physicalSizes
|
|
65
|
-
dtype
|
|
62
|
+
labels,
|
|
63
|
+
getShape,
|
|
64
|
+
physicalSizes,
|
|
65
|
+
dtype
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
return {
|
|
69
|
-
labels
|
|
70
|
-
getShape
|
|
71
|
-
dtype
|
|
69
|
+
labels,
|
|
70
|
+
getShape,
|
|
71
|
+
dtype
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
//# sourceMappingURL=ome-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ome-utils.js","names":["_utils","require","DTYPE_LOOKUP","uint8","uint16","uint32","float","double","int8","int16","int32","exports","getOmePixelSourceMeta","_ref","Pixels","labels","getLabels","DimensionOrder","dims","getDims","shape","Array","length","fill","SizeT","SizeC","SizeZ","Interleaved","push","getShape","level","s","
|
|
1
|
+
{"version":3,"file":"ome-utils.js","names":["_utils","require","DTYPE_LOOKUP","uint8","uint16","uint32","float","double","int8","int16","int32","exports","getOmePixelSourceMeta","_ref","Pixels","labels","getLabels","DimensionOrder","dims","getDims","shape","Array","length","fill","SizeT","SizeC","SizeZ","Interleaved","push","getShape","level","s","SizeX","SizeY","Type","Error","concat","dtype","PhysicalSizeX","PhysicalSizeY","physicalSizes","x","size","unit","PhysicalSizeXUnit","y","PhysicalSizeYUnit","PhysicalSizeZ","z","PhysicalSizeZUnit"],"sources":["../../../../src/lib/ome/ome-utils.ts"],"sourcesContent":["import {getDims, getLabels} from './utils';\nimport type {OMEXML, UnitsLength} from './omexml';\n\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} as const;\n\nexport function getOmePixelSourceMeta({Pixels}: OMEXML[0]) {\n // e.g. 'XYZCT' -> ['t', 'c', 'z', 'y', 'x']\n const labels = getLabels(Pixels.DimensionOrder);\n\n // Compute \"shape\" of image\n const dims = getDims(labels);\n const shape: number[] = Array(labels.length).fill(0);\n shape[dims('t')] = Pixels.SizeT;\n shape[dims('c')] = Pixels.SizeC;\n shape[dims('z')] = Pixels.SizeZ;\n\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\n // Creates a new shape for different level of pyramid.\n // Assumes factor-of-two downsampling.\n const getShape = (level: number) => {\n const s = [...shape];\n s[dims('x')] = Pixels.SizeX >> level;\n s[dims('y')] = Pixels.SizeY >> level;\n return s;\n };\n\n if (!(Pixels.Type in DTYPE_LOOKUP)) {\n throw Error(`Pixel type ${Pixels.Type} not supported.`);\n }\n\n const dtype = DTYPE_LOOKUP[Pixels.Type as keyof typeof DTYPE_LOOKUP];\n if (Pixels.PhysicalSizeX && Pixels.PhysicalSizeY) {\n const physicalSizes: {\n [k: string]: {size: number; unit: UnitsLength};\n } = {\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\n return {labels, getShape, dtype};\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGO,MAAMC,YAAY,GAAG;EAC1BC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE,QAAQ;EAChBC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,SAAS;EAChBC,MA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I,oBAAiB,CAAC;EACzD;EAEA,MAAMG,KAAK,GAAGnC,YAAY,CAACY,MAAM,CAACoB,IAAI,CAA8B;EACpE,IAAIpB,MAAM,CAACwB,aAAa,IAAIxB,MAAM,CAACyB,aAAa,EAAE;IAChD,MAAMC,aAEL,GAAG;MACFC,CAAC,EAAE;QACDC,IAAI,EAAE5B,MAAM,CAACwB,aAAa;QAC1BK,IAAI,EAAE7B,MAAM,CAAC8B;MACf,CAAC;MACDC,CAAC,EAAE;QACDH,IAAI,EAAE5B,MAAM,CAACyB,aAAa;QAC1BI,IAAI,EAAE7B,MAAM,CAACgC;MACf;IACF,CAAC;IACD,IAAIhC,MAAM,CAACiC,aAAa,EAAE;MACxBP,aAAa,CAACQ,CAAC,GAAG;QAChBN,IAAI,EAAE5B,MAAM,CAACiC,aAAa;QAC1BJ,IAAI,EAAE7B,MAAM,CAACmC;MACf,CAAC;IACH;IACA,OAAO;MAAClC,MAAM;MAAEc,QAAQ;MAAEW,aAAa;MAAEH;IAAK,CAAC;EACjD;EAEA,OAAO;IAACtB,MAAM;IAAEc,QAAQ;IAAEQ;EAAK,CAAC;AAClC"}
|
|
@@ -1,56 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.fromString = fromString;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _fastXmlParser = require("fast-xml-parser");
|
|
10
8
|
var _tiffUtils = require("../utils/tiff-utils");
|
|
11
|
-
|
|
12
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
-
var xmlParser = new _fastXmlParser.XMLParser({
|
|
9
|
+
const xmlParser = new _fastXmlParser.XMLParser({
|
|
14
10
|
attributeNamePrefix: '',
|
|
15
11
|
attributesGroupName: 'attr',
|
|
16
12
|
parseTagValue: true,
|
|
17
13
|
parseAttributeValue: true,
|
|
18
14
|
ignoreAttributes: false
|
|
19
15
|
});
|
|
20
|
-
|
|
21
|
-
return xmlParser.parse(str);
|
|
22
|
-
};
|
|
16
|
+
const parse = str => xmlParser.parse(str);
|
|
23
17
|
function fromString(str) {
|
|
24
|
-
|
|
18
|
+
const res = parse(str);
|
|
25
19
|
if (!res.OME) {
|
|
26
20
|
throw Error('Failed to parse OME-XML metadata.');
|
|
27
21
|
}
|
|
28
|
-
return (0, _tiffUtils.ensureArray)(res.OME.Image).map(
|
|
29
|
-
|
|
22
|
+
return (0, _tiffUtils.ensureArray)(res.OME.Image).map(img => {
|
|
23
|
+
const Channels = (0, _tiffUtils.ensureArray)(img.Pixels.Channel).map(c => {
|
|
30
24
|
if ('Color' in c.attr) {
|
|
31
|
-
return
|
|
25
|
+
return {
|
|
26
|
+
...c.attr,
|
|
32
27
|
Color: (0, _tiffUtils.intToRgba)(c.attr.Color)
|
|
33
|
-
}
|
|
28
|
+
};
|
|
34
29
|
}
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
AquisitionDate = _img$AquisitionDate === void 0 ? '' : _img$AquisitionDate,
|
|
39
|
-
_img$Description = img.Description,
|
|
40
|
-
Description = _img$Description === void 0 ? '' : _img$Description;
|
|
41
|
-
var image = _objectSpread(_objectSpread({}, img.attr), {}, {
|
|
42
|
-
AquisitionDate: AquisitionDate,
|
|
43
|
-
Description: Description,
|
|
44
|
-
Pixels: _objectSpread(_objectSpread({}, img.Pixels.attr), {}, {
|
|
45
|
-
Channels: Channels
|
|
46
|
-
})
|
|
30
|
+
return {
|
|
31
|
+
...c.attr
|
|
32
|
+
};
|
|
47
33
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
34
|
+
const {
|
|
35
|
+
AquisitionDate = '',
|
|
36
|
+
Description = ''
|
|
37
|
+
} = img;
|
|
38
|
+
const image = {
|
|
39
|
+
...img.attr,
|
|
40
|
+
AquisitionDate,
|
|
41
|
+
Description,
|
|
42
|
+
Pixels: {
|
|
43
|
+
...img.Pixels.attr,
|
|
44
|
+
Channels
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
...image,
|
|
49
|
+
format() {
|
|
50
|
+
const {
|
|
51
|
+
Pixels
|
|
52
|
+
} = image;
|
|
53
|
+
const sizes = ['X', 'Y', 'Z'].map(name => {
|
|
54
|
+
const size = Pixels["PhysicalSize".concat(name)];
|
|
55
|
+
const unit = Pixels["PhysicalSize".concat(name, "Unit")];
|
|
54
56
|
return size && unit ? "".concat(size, " ").concat(unit) : '-';
|
|
55
57
|
}).join(' x ');
|
|
56
58
|
return {
|
|
@@ -62,7 +64,7 @@ function fromString(str) {
|
|
|
62
64
|
Channels: Pixels.SizeC
|
|
63
65
|
};
|
|
64
66
|
}
|
|
65
|
-
}
|
|
67
|
+
};
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
70
|
//# sourceMappingURL=omexml.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omexml.js","names":["_fastXmlParser","require","_tiffUtils","
|
|
1
|
+
{"version":3,"file":"omexml.js","names":["_fastXmlParser","require","_tiffUtils","xmlParser","XMLParser","attributeNamePrefix","attributesGroupName","parseTagValue","parseAttributeValue","ignoreAttributes","parse","str","fromString","res","OME","Error","ensureArray","Image","map","img","Channels","Pixels","Channel","c","attr","Color","intToRgba","AquisitionDate","Description","image","format","sizes","name","size","concat","unit","join","SizeX","SizeY","Type","SizeZ","SizeT","SizeC"],"sources":["../../../../src/lib/ome/omexml.ts"],"sourcesContent":["import {XMLParser} from 'fast-xml-parser';\nimport {ensureArray, intToRgba} from '../utils/tiff-utils';\n\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\n // Parses numbers for both attributes and nodes\n parseTagValue: true,\n parseAttributeValue: true,\n\n // Forces attributes to be parsed\n ignoreAttributes: false\n});\n\nconst parse = (str: string): Root => xmlParser.parse(str);\n\nexport function fromString(str: string) {\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\n const sizes = (['X', 'Y', 'Z'] as const)\n .map((name) => {\n const size = Pixels[`PhysicalSize${name}` as const];\n const unit = Pixels[`PhysicalSize${name}Unit` as const];\n return size && unit ? `${size} ${unit}` : '-';\n })\n .join(' x ');\n\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\nexport type OMEXML = ReturnType<typeof fromString>;\nexport type DimensionOrder = 'XYZCT' | 'XYZTC' | 'XYCTZ' | 'XYCZT' | 'XYTCZ' | 'XYTZC';\n\n// Structure of node is determined by the PARSER_OPTIONS.\ntype Node<T, A> = T & {attr: A};\ntype Attrs<Fields extends string, T = string> = {[K in Fields]: T};\n\ntype OMEAttrs = Attrs<'xmlns' | 'xmlns:xsi' | 'xsi:schemaLocation'>;\ntype OME = Node<{Insturment: Insturment; Image: Image | Image[]}, OMEAttrs>;\n\ntype Insturment = Node<\n {Objective: Node<{}, Attrs<'ID' | 'Model' | 'NominalMagnification'>>},\n Attrs<'ID'>\n>;\n\ninterface ImageNodes {\n AquisitionDate?: string;\n Description?: string;\n Pixels: Pixels;\n InstrumentRef: Node<{}, {ID: string}>;\n ObjectiveSettings: Node<{}, {ID: string}>;\n}\ntype Image = Node<ImageNodes, Attrs<'ID' | 'Name'>>;\n\ntype PixelType =\n | 'int8'\n | 'int16'\n | 'int32'\n | 'uint8'\n | 'uint16'\n | 'uint32'\n | 'float'\n | 'bit'\n | 'double'\n | 'complex'\n | 'double-complex';\n\nexport type UnitsLength =\n | 'Ym'\n | 'Zm'\n | 'Em'\n | 'Pm'\n | 'Tm'\n | 'Gm'\n | 'Mm'\n | 'km'\n | 'hm'\n | 'dam'\n | 'm'\n | 'dm'\n | 'cm'\n | 'mm'\n | 'µm'\n | 'nm'\n | 'pm'\n | 'fm'\n | 'am'\n | 'zm'\n | 'ym'\n | 'Å'\n | 'thou'\n | 'li'\n | 'in'\n | 'ft'\n | 'yd'\n | 'mi'\n | 'ua'\n | 'ly'\n | 'pc'\n | 'pt'\n | 'pixel'\n | 'reference frame';\n\ntype PhysicalSize<Name extends string> = `PhysicalSize${Name}`;\ntype PhysicalSizeUnit<Name extends string> = `PhysicalSize${Name}Unit`;\ntype Size<Names extends string> = `Size${Names}`;\n\ntype PixelAttrs = Attrs<\n PhysicalSize<'X' | 'Y' | 'Z'> | 'SignificantBits' | Size<'T' | 'C' | 'Z' | 'Y' | 'X'>,\n number\n> &\n Attrs<PhysicalSizeUnit<'X' | 'Y' | 'Z'>, UnitsLength> &\n Attrs<'BigEndian' | 'Interleaved', boolean> & {\n ID: string;\n DimensionOrder: DimensionOrder;\n Type: PixelType;\n };\n\ntype Pixels = Node<\n {\n Channel: Channel | Channel[];\n TiffData: Node<{}, Attrs<'IFD' | 'PlaneCount'>>;\n },\n PixelAttrs\n>;\n\ntype ChannelAttrs =\n | {\n ID: string;\n SamplesPerPixel: number;\n Name?: string;\n }\n | {\n ID: string;\n SamplesPerPixel: number;\n Name?: string;\n Color: number;\n };\n\ntype Channel = Node<{}, ChannelAttrs>;\n\ntype Root = {OME: OME};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAGA,MAAME,SAAS,GAAG,IAAIC,wBAAS,CAAC;EAE9BC,mBAAmB,EAAE,EAAE;EACvBC,mBAAmB,EAAE,MAAM;EAG3BC,aAAa,EAAE,IAAI;EACnBC,mBAAmB,EAAE,IAAI;EAGzBC,gBAAgB,EAAE;AACpB,CAAC,CAAC;AAEF,MAAMC,KAAK,GAAIC,GAAW,IAAWR,SAAS,CAACO,KAAK,CAACC,GAAG,CAAC;AAElD,SAASC,UAAUA,CAACD,GAAW,EAAE;EACtC,MAAME,GAAG,GAAGH,KAAK,CAACC,GAAG,CAAC;EACtB,IAAI,CAACE,GAAG,CAACC,GAAG,EAAE;IACZ,MAAMC,KAAK,CAAC,mCAAmC,CAAC;EAClD;EACA,OAAO,IAAAC,sBAAW,EAACH,GAAG,CAACC,GAAG,CAACG,KAAK,CAAC,CAACC,GAAG,CAAEC,GAAG,IAAK;IAC7C,MAAMC,QAAQ,GAAG,IAAAJ,sBAAW,EAACG,GAAG,CAACE,MAAM,CAACC,OAAO,CAAC,CAACJ,GAAG,CAAEK,CAAC,IAAK;MAC1D,IAAI,OAAO,IAAIA,CAAC,CAACC,IAAI,EAAE;QACrB,OAAO;UAAC,GAAGD,CAAC,CAACC,IAAI;UAAEC,KAAK,EAAE,IAAAC,oBAAS,EAACH,CAAC,CAACC,IAAI,CAACC,KAAK;QAA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9,12 @@ function getLabels(dimOrder) {
|
|
|
9
9
|
return dimOrder.toLowerCase().split('').reverse();
|
|
10
10
|
}
|
|
11
11
|
function getDims(labels) {
|
|
12
|
-
|
|
13
|
-
return [name, i];
|
|
14
|
-
}));
|
|
12
|
+
const lookup = new Map(labels.map((name, i) => [name, i]));
|
|
15
13
|
if (lookup.size !== labels.length) {
|
|
16
14
|
throw Error('Labels must be unique, found duplicated label.');
|
|
17
15
|
}
|
|
18
|
-
return
|
|
19
|
-
|
|
16
|
+
return name => {
|
|
17
|
+
const index = lookup.get(name);
|
|
20
18
|
if (index === undefined) {
|
|
21
19
|
throw Error('Invalid dimension.');
|
|
22
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["getLabels","dimOrder","toLowerCase","split","reverse","getDims","labels","lookup","Map","map","name","i","size","length","Error","index","get","undefined"],"sources":["../../../../src/lib/ome/utils.ts"],"sourcesContent":["import type {OMEXML} from '../ome/omexml';\nimport type {Labels} from '../../types';\n\n/*\n * Creates typed labels from DimensionOrder.\n * > imgMeta.Pixels.DimensionOrder === 'XYCZT'\n * > getLabels(imgMeta.Pixels) === ['t', 'z', 'c', 'y', 'x']\n */\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype Sel<Dim extends string> = Dim extends `${infer Z}${infer X}${infer A}${infer B}${infer C}`\n ? [C, B, A]\n : 'error';\nexport function getLabels(dimOrder: OMEXML[0]['Pixels']['DimensionOrder']) {\n return dimOrder.toLowerCase().split('').reverse() as Labels<Sel<Lowercase<typeof dimOrder>>>;\n}\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<S extends string>(labels: S[]) {\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: S) => {\n const index = lookup.get(name);\n if (index === undefined) {\n throw Error('Invalid dimension.');\n }\n return index;\n };\n}\n"],"mappings":";;;;;;;AAaO,SAASA,SAASA,CAACC,QAA+C,EAAE;EACzE,OAAOA,QAAQ,CAACC,WAAW,CAAC,CAAC,CAACC,KAAK,CAAC,EAAE,CAAC,CAACC,OAAO,CAAC,CAAC;AACnD;AAWO,SAASC,OAAOA,CAAmBC,MAAW,EAAE;EACrD,
|
|
1
|
+
{"version":3,"file":"utils.js","names":["getLabels","dimOrder","toLowerCase","split","reverse","getDims","labels","lookup","Map","map","name","i","size","length","Error","index","get","undefined"],"sources":["../../../../src/lib/ome/utils.ts"],"sourcesContent":["import type {OMEXML} from '../ome/omexml';\nimport type {Labels} from '../../types';\n\n/*\n * Creates typed labels from DimensionOrder.\n * > imgMeta.Pixels.DimensionOrder === 'XYCZT'\n * > getLabels(imgMeta.Pixels) === ['t', 'z', 'c', 'y', 'x']\n */\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype Sel<Dim extends string> = Dim extends `${infer Z}${infer X}${infer A}${infer B}${infer C}`\n ? [C, B, A]\n : 'error';\nexport function getLabels(dimOrder: OMEXML[0]['Pixels']['DimensionOrder']) {\n return dimOrder.toLowerCase().split('').reverse() as Labels<Sel<Lowercase<typeof dimOrder>>>;\n}\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<S extends string>(labels: S[]) {\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: S) => {\n const index = lookup.get(name);\n if (index === undefined) {\n throw Error('Invalid dimension.');\n }\n return index;\n };\n}\n"],"mappings":";;;;;;;AAaO,SAASA,SAASA,CAACC,QAA+C,EAAE;EACzE,OAAOA,QAAQ,CAACC,WAAW,CAAC,CAAC,CAACC,KAAK,CAAC,EAAE,CAAC,CAACC,OAAO,CAAC,CAAC;AACnD;AAWO,SAASC,OAAOA,CAAmBC,MAAW,EAAE;EACrD,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAACF,MAAM,CAACG,GAAG,CAAC,CAACC,IAAI,EAAEC,CAAC,KAAK,CAACD,IAAI,EAAEC,CAAC,CAAC,CAAC,CAAC;EAC1D,IAAIJ,MAAM,CAACK,IAAI,KAAKN,MAAM,CAACO,MAAM,EAAE;IACjC,MAAMC,KAAK,CAAC,gDAAgD,CAAC;EAC/D;EACA,OAAQJ,IAAO,IAAK;IAClB,MAAMK,KAAK,GAAGR,MAAM,CAACS,GAAG,CAACN,IAAI,CAAC;IAC9B,IAAIK,KAAK,KAAKE,SAAS,EAAE;MACvB,MAAMH,KAAK,CAAC,oBAAoB,CAAC;IACnC;IACA,OAAOC,KAAK;EACd,CAAC;AACH"}
|
|
@@ -5,17 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
9
|
var _tiffUtils = require("./utils/tiff-utils");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var TiffPixelSource = function () {
|
|
17
|
-
function TiffPixelSource(indexer, dtype, tileSize, shape, labels, meta) {
|
|
18
|
-
(0, _classCallCheck2.default)(this, TiffPixelSource);
|
|
10
|
+
class TiffPixelSource {
|
|
11
|
+
constructor(indexer, dtype, tileSize, shape, labels, meta) {
|
|
19
12
|
(0, _defineProperty2.default)(this, "dtype", void 0);
|
|
20
13
|
(0, _defineProperty2.default)(this, "tileSize", void 0);
|
|
21
14
|
(0, _defineProperty2.default)(this, "shape", void 0);
|
|
@@ -29,135 +22,79 @@ var TiffPixelSource = function () {
|
|
|
29
22
|
this.labels = labels;
|
|
30
23
|
this.meta = meta;
|
|
31
24
|
}
|
|
32
|
-
(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}()
|
|
93
|
-
}, {
|
|
94
|
-
key: "_readRasters",
|
|
95
|
-
value: function () {
|
|
96
|
-
var _readRasters2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(image, props) {
|
|
97
|
-
var _props$signal;
|
|
98
|
-
var interleave, raster, data;
|
|
99
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
100
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
101
|
-
case 0:
|
|
102
|
-
interleave = (0, _tiffUtils.isInterleaved)(this.shape);
|
|
103
|
-
_context3.next = 3;
|
|
104
|
-
return image.readRasters(_objectSpread({
|
|
105
|
-
interleave: interleave
|
|
106
|
-
}, props));
|
|
107
|
-
case 3:
|
|
108
|
-
raster = _context3.sent;
|
|
109
|
-
if (!(props !== null && props !== void 0 && (_props$signal = props.signal) !== null && _props$signal !== void 0 && _props$signal.aborted)) {
|
|
110
|
-
_context3.next = 6;
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
throw _tiffUtils.SIGNAL_ABORTED;
|
|
114
|
-
case 6:
|
|
115
|
-
data = interleave ? raster : raster[0];
|
|
116
|
-
return _context3.abrupt("return", {
|
|
117
|
-
data: data,
|
|
118
|
-
width: raster.width,
|
|
119
|
-
height: raster.height
|
|
120
|
-
});
|
|
121
|
-
case 8:
|
|
122
|
-
case "end":
|
|
123
|
-
return _context3.stop();
|
|
124
|
-
}
|
|
125
|
-
}, _callee3, this);
|
|
126
|
-
}));
|
|
127
|
-
function _readRasters(_x3, _x4) {
|
|
128
|
-
return _readRasters2.apply(this, arguments);
|
|
129
|
-
}
|
|
130
|
-
return _readRasters;
|
|
131
|
-
}()
|
|
132
|
-
}, {
|
|
133
|
-
key: "_getTileExtent",
|
|
134
|
-
value: function _getTileExtent(x, y) {
|
|
135
|
-
var _getImageSize = (0, _tiffUtils.getImageSize)(this),
|
|
136
|
-
zoomLevelHeight = _getImageSize.height,
|
|
137
|
-
zoomLevelWidth = _getImageSize.width;
|
|
138
|
-
var height = this.tileSize;
|
|
139
|
-
var width = this.tileSize;
|
|
140
|
-
var maxXTileCoord = Math.floor(zoomLevelWidth / this.tileSize);
|
|
141
|
-
var maxYTileCoord = Math.floor(zoomLevelHeight / this.tileSize);
|
|
142
|
-
if (x === maxXTileCoord) {
|
|
143
|
-
width = zoomLevelWidth % this.tileSize;
|
|
144
|
-
}
|
|
145
|
-
if (y === maxYTileCoord) {
|
|
146
|
-
height = zoomLevelHeight % this.tileSize;
|
|
147
|
-
}
|
|
148
|
-
return {
|
|
149
|
-
height: height,
|
|
150
|
-
width: width
|
|
151
|
-
};
|
|
25
|
+
async getRaster(_ref) {
|
|
26
|
+
let {
|
|
27
|
+
selection,
|
|
28
|
+
signal
|
|
29
|
+
} = _ref;
|
|
30
|
+
const image = await this._indexer(selection);
|
|
31
|
+
return this._readRasters(image, {
|
|
32
|
+
signal
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async getTile(_ref2) {
|
|
36
|
+
let {
|
|
37
|
+
x,
|
|
38
|
+
y,
|
|
39
|
+
selection,
|
|
40
|
+
signal
|
|
41
|
+
} = _ref2;
|
|
42
|
+
const {
|
|
43
|
+
height,
|
|
44
|
+
width
|
|
45
|
+
} = this._getTileExtent(x, y);
|
|
46
|
+
const x0 = x * this.tileSize;
|
|
47
|
+
const y0 = y * this.tileSize;
|
|
48
|
+
const window = [x0, y0, x0 + width, y0 + height];
|
|
49
|
+
const image = await this._indexer(selection);
|
|
50
|
+
return this._readRasters(image, {
|
|
51
|
+
window,
|
|
52
|
+
width,
|
|
53
|
+
height,
|
|
54
|
+
signal
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async _readRasters(image, props) {
|
|
58
|
+
var _props$signal;
|
|
59
|
+
const interleave = (0, _tiffUtils.isInterleaved)(this.shape);
|
|
60
|
+
const raster = await image.readRasters({
|
|
61
|
+
interleave,
|
|
62
|
+
...props
|
|
63
|
+
});
|
|
64
|
+
if (props !== null && props !== void 0 && (_props$signal = props.signal) !== null && _props$signal !== void 0 && _props$signal.aborted) {
|
|
65
|
+
throw _tiffUtils.SIGNAL_ABORTED;
|
|
66
|
+
}
|
|
67
|
+
const data = interleave ? raster : raster[0];
|
|
68
|
+
return {
|
|
69
|
+
data,
|
|
70
|
+
width: raster.width,
|
|
71
|
+
height: raster.height
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
_getTileExtent(x, y) {
|
|
75
|
+
const {
|
|
76
|
+
height: zoomLevelHeight,
|
|
77
|
+
width: zoomLevelWidth
|
|
78
|
+
} = (0, _tiffUtils.getImageSize)(this);
|
|
79
|
+
let height = this.tileSize;
|
|
80
|
+
let width = this.tileSize;
|
|
81
|
+
const maxXTileCoord = Math.floor(zoomLevelWidth / this.tileSize);
|
|
82
|
+
const maxYTileCoord = Math.floor(zoomLevelHeight / this.tileSize);
|
|
83
|
+
if (x === maxXTileCoord) {
|
|
84
|
+
width = zoomLevelWidth % this.tileSize;
|
|
152
85
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
value: function onTileError(err) {
|
|
156
|
-
console.error(err);
|
|
86
|
+
if (y === maxYTileCoord) {
|
|
87
|
+
height = zoomLevelHeight % this.tileSize;
|
|
157
88
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
89
|
+
return {
|
|
90
|
+
height,
|
|
91
|
+
width
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
onTileError(err) {
|
|
95
|
+
console.error(err);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
161
98
|
var _default = TiffPixelSource;
|
|
162
99
|
exports.default = _default;
|
|
163
100
|
//# sourceMappingURL=tiff-pixel-source.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiff-pixel-source.js","names":["_tiffUtils","require","
|
|
1
|
+
{"version":3,"file":"tiff-pixel-source.js","names":["_tiffUtils","require","TiffPixelSource","constructor","indexer","dtype","tileSize","shape","labels","meta","_defineProperty2","default","_indexer","getRaster","_ref","selection","signal","image","_readRasters","getTile","_ref2","x","y","height","width","_getTileExtent","x0","y0","window","props","_props$signal","interleave","isInterleaved","raster","readRasters","aborted","SIGNAL_ABORTED","data","zoomLevelHeight","zoomLevelWidth","getImageSize","maxXTileCoord","Math","floor","maxYTileCoord","onTileError","err","console","error","_default","exports"],"sources":["../../../src/lib/tiff-pixel-source.ts"],"sourcesContent":["import type {GeoTIFFImage, RasterOptions} from 'geotiff';\nimport {getImageSize, isInterleaved, SIGNAL_ABORTED} from './utils/tiff-utils';\n\nimport type {\n PixelSource,\n PixelSourceSelection,\n PixelSourceMeta,\n Dtype,\n Labels,\n RasterSelection,\n TileSelection,\n PixelData,\n TypedArray\n} from '../types';\n\nclass TiffPixelSource<S extends string[]> implements PixelSource<S> {\n public dtype: Dtype;\n public tileSize: number;\n public shape: number[];\n public labels: Labels<S>;\n public meta: PixelSourceMeta | undefined;\n private _indexer: (sel: PixelSourceSelection<S>) => Promise<GeoTIFFImage>;\n\n // eslint-disable-next-line max-params\n constructor(\n indexer: (sel: PixelSourceSelection<S>) => Promise<GeoTIFFImage>,\n dtype: Dtype,\n tileSize: number,\n shape: number[],\n labels: Labels<S>,\n meta?: PixelSourceMeta\n ) {\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\n async getRaster({selection, signal}: RasterSelection<S>) {\n const image = await this._indexer(selection);\n return this._readRasters(image, {signal});\n }\n\n async getTile({x, y, selection, signal}: TileSelection<S>) {\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\n const image = await this._indexer(selection);\n return this._readRasters(image, {window, width, height, signal});\n }\n\n private async _readRasters(image: GeoTIFFImage, props?: RasterOptions) {\n const interleave = isInterleaved(this.shape);\n const raster = await image.readRasters({interleave, ...props});\n\n if (props?.signal?.aborted) {\n throw SIGNAL_ABORTED;\n }\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]) as TypedArray;\n return {\n data,\n width: raster.width,\n height: raster.height\n } as PixelData;\n }\n\n /*\n * Computes tile size given x, y coord.\n */\n private _getTileExtent(x: number, y: number) {\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\n onTileError(err: Error) {\n console.error(err); // eslint-disable-line no-console\n }\n}\n\nexport default TiffPixelSource;\n"],"mappings":";;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAcA,MAAMC,eAAe,CAA+C;EASlEC,WAAWA,CACTC,OAAgE,EAChEC,KAAY,EACZC,QAAgB,EAChBC,KAAe,EACfC,MAAiB,EACjBC,IAAsB,EACtB;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IACA,IAAI,CAACC,QAAQ,GAAGR,OAAO;IACvB,IAAI,CAACC,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,IAAI,GAAGA,IAAI;EAClB;EAEA,MAAMI,SAASA,CAAAC,IAAA,EAA0C;IAAA,IAAzC;MAACC,SAAS;MAAEC;IAA0B,CAAC,GAAAF,IAAA;IACrD,MAAMG,KAAK,GAAG,MAAM,IAAI,CAACL,QAAQ,CAACG,SAAS,CAAC;IAC5C,OAAO,IAAI,CAACG,YAAY,CAACD,KAAK,EAAE;MAACD;IAAM,CAAC,CAAC;EAC3C;EAEA,MAAMG,OAAOA,CAAAC,KAAA,EAA8C;IAAA,IAA7C;MAACC,CAAC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