@vitessce/ome-tiff 4.2.0 → 4.2.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.
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-SxljTded.js";
2
- import { B as BaseDecoder } from "./index-Cf41eRvn.js";
2
+ import { B as BaseDecoder } from "./index-CQ0ULzhP.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -901,16 +901,16 @@ class Stats {
901
901
  }
902
902
  }
903
903
  getTable() {
904
- const table = {};
904
+ const table2 = {};
905
905
  this.forEach((stat) => {
906
- table[stat.name] = {
906
+ table2[stat.name] = {
907
907
  time: stat.time || 0,
908
908
  count: stat.count || 0,
909
909
  average: stat.getAverageTime() || 0,
910
910
  hz: stat.getHz() || 0
911
911
  };
912
912
  });
913
- return table;
913
+ return table2;
914
914
  }
915
915
  _initializeStats() {
916
916
  let stats = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
@@ -1568,10 +1568,10 @@ class Log {
1568
1568
  }
1569
1569
  return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
1570
1570
  }
1571
- table(logLevel, table, columns) {
1572
- if (table) {
1573
- return this._getLogFunction(logLevel, table, console.table || noop$4, columns && [columns], {
1574
- tag: getTableHeader(table)
1571
+ table(logLevel, table2, columns) {
1572
+ if (table2) {
1573
+ return this._getLogFunction(logLevel, table2, console.table || noop$4, columns && [columns], {
1574
+ tag: getTableHeader(table2)
1575
1575
  });
1576
1576
  }
1577
1577
  return noop$4;
@@ -1771,9 +1771,9 @@ function logImageInBrowser(_ref3) {
1771
1771
  }
1772
1772
  return noop$4;
1773
1773
  }
1774
- function getTableHeader(table) {
1775
- for (const key in table) {
1776
- for (const title in table[key]) {
1774
+ function getTableHeader(table2) {
1775
+ for (const key in table2) {
1776
+ for (const title in table2[key]) {
1777
1777
  return title || "untitled";
1778
1778
  }
1779
1779
  }
@@ -9217,13 +9217,13 @@ function getDebugTableForUniforms(_ref) {
9217
9217
  const SHADER_MODULE_UNIFORM_REGEXP = ".*_.*";
9218
9218
  const PROJECT_MODULE_UNIFORM_REGEXP = ".*Matrix";
9219
9219
  const uniformLocations = program._uniformSetters;
9220
- const table = {};
9220
+ const table2 = {};
9221
9221
  const uniformNames = Object.keys(uniformLocations).sort();
9222
9222
  let count2 = 0;
9223
9223
  for (const uniformName of uniformNames) {
9224
9224
  if (!uniformName.match(SHADER_MODULE_UNIFORM_REGEXP) && !uniformName.match(PROJECT_MODULE_UNIFORM_REGEXP)) {
9225
9225
  if (addUniformToTable({
9226
- table,
9226
+ table: table2,
9227
9227
  header,
9228
9228
  uniforms,
9229
9229
  uniformName,
@@ -9236,7 +9236,7 @@ function getDebugTableForUniforms(_ref) {
9236
9236
  for (const uniformName of uniformNames) {
9237
9237
  if (uniformName.match(PROJECT_MODULE_UNIFORM_REGEXP)) {
9238
9238
  if (addUniformToTable({
9239
- table,
9239
+ table: table2,
9240
9240
  header,
9241
9241
  uniforms,
9242
9242
  uniformName,
@@ -9247,9 +9247,9 @@ function getDebugTableForUniforms(_ref) {
9247
9247
  }
9248
9248
  }
9249
9249
  for (const uniformName of uniformNames) {
9250
- if (!table[uniformName]) {
9250
+ if (!table2[uniformName]) {
9251
9251
  if (addUniformToTable({
9252
- table,
9252
+ table: table2,
9253
9253
  header,
9254
9254
  uniforms,
9255
9255
  uniformName,
@@ -9264,7 +9264,7 @@ function getDebugTableForUniforms(_ref) {
9264
9264
  if (!undefinedOnly) {
9265
9265
  for (const uniformName in uniforms) {
9266
9266
  const uniform = uniforms[uniformName];
9267
- if (!table[uniformName]) {
9267
+ if (!table2[uniformName]) {
9268
9268
  unusedCount++;
9269
9269
  unusedTable[uniformName] = {
9270
9270
  Type: "NOT USED: ".concat(uniform),
@@ -9274,7 +9274,7 @@ function getDebugTableForUniforms(_ref) {
9274
9274
  }
9275
9275
  }
9276
9276
  return {
9277
- table,
9277
+ table: table2,
9278
9278
  count: count2,
9279
9279
  unusedTable,
9280
9280
  unusedCount
@@ -9282,7 +9282,7 @@ function getDebugTableForUniforms(_ref) {
9282
9282
  }
9283
9283
  function addUniformToTable(_ref2) {
9284
9284
  let {
9285
- table,
9285
+ table: table2,
9286
9286
  header,
9287
9287
  uniforms,
9288
9288
  uniformName,
@@ -9291,7 +9291,7 @@ function addUniformToTable(_ref2) {
9291
9291
  const value = uniforms[uniformName];
9292
9292
  const isDefined = isUniformDefined(value);
9293
9293
  if (!undefinedOnly || !isDefined) {
9294
- table[uniformName] = {
9294
+ table2[uniformName] = {
9295
9295
  [header]: isDefined ? formatValue$1(value) : "N/A",
9296
9296
  "Uniform Type": isDefined ? value : "NOT PROVIDED"
9297
9297
  };
@@ -9310,9 +9310,9 @@ function getDebugTableForVertexArray(_ref) {
9310
9310
  if (!vertexArray.configuration) {
9311
9311
  return {};
9312
9312
  }
9313
- const table = {};
9313
+ const table2 = {};
9314
9314
  if (vertexArray.elements) {
9315
- table.ELEMENT_ARRAY_BUFFER = getDebugTableRow(vertexArray, vertexArray.elements, null, header);
9315
+ table2.ELEMENT_ARRAY_BUFFER = getDebugTableRow(vertexArray, vertexArray.elements, null, header);
9316
9316
  }
9317
9317
  const attributes = vertexArray.values;
9318
9318
  for (const attributeLocation in attributes) {
@@ -9323,10 +9323,10 @@ function getDebugTableForVertexArray(_ref) {
9323
9323
  if (accessor) {
9324
9324
  rowHeader = "".concat(attributeLocation, ": ").concat(getGLSLDeclaration$1(info.name, accessor));
9325
9325
  }
9326
- table[rowHeader] = getDebugTableRow(vertexArray, attributes[attributeLocation], accessor, header);
9326
+ table2[rowHeader] = getDebugTableRow(vertexArray, attributes[attributeLocation], accessor, header);
9327
9327
  }
9328
9328
  }
9329
- return table;
9329
+ return table2;
9330
9330
  }
9331
9331
  function getDebugTableRow(vertexArray, attribute, accessor, header) {
9332
9332
  const {
@@ -9398,12 +9398,12 @@ function getGLSLDeclaration$1(name2, accessor) {
9398
9398
  return typeAndName ? "".concat(name2, " (").concat(typeAndName.name, ")") : name2;
9399
9399
  }
9400
9400
  function getDebugTableForProgramConfiguration(config3) {
9401
- const table = {};
9401
+ const table2 = {};
9402
9402
  const header = "Accessors for ".concat(config3.id);
9403
9403
  for (const attributeInfo of config3.attributeInfos) {
9404
9404
  if (attributeInfo) {
9405
9405
  const glslDeclaration = getGLSLDeclaration(attributeInfo);
9406
- table["in ".concat(glslDeclaration)] = {
9406
+ table2["in ".concat(glslDeclaration)] = {
9407
9407
  [header]: JSON.stringify(attributeInfo.accessor)
9408
9408
  };
9409
9409
  }
@@ -9411,12 +9411,12 @@ function getDebugTableForProgramConfiguration(config3) {
9411
9411
  for (const varyingInfo of config3.varyingInfos) {
9412
9412
  if (varyingInfo) {
9413
9413
  const glslDeclaration = getGLSLDeclaration(varyingInfo);
9414
- table["out ".concat(glslDeclaration)] = {
9414
+ table2["out ".concat(glslDeclaration)] = {
9415
9415
  [header]: JSON.stringify(varyingInfo.accessor)
9416
9416
  };
9417
9417
  }
9418
9418
  }
9419
- return table;
9419
+ return table2;
9420
9420
  }
9421
9421
  function getGLSLDeclaration(attributeInfo) {
9422
9422
  const {
@@ -82125,7 +82125,7 @@ function requireBignumber() {
82125
82125
  suffix: ""
82126
82126
  }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
82127
82127
  function BigNumber3(v, b) {
82128
- var alphabet, c, caseChanged, e2, i2, isNum, len2, str, x = this;
82128
+ var alphabet2, c, caseChanged, e2, i2, isNum, len2, str, x = this;
82129
82129
  if (!(x instanceof BigNumber3)) return new BigNumber3(v, b);
82130
82130
  if (b == null) {
82131
82131
  if (v && v._isBigNumber === true) {
@@ -82181,10 +82181,10 @@ function requireBignumber() {
82181
82181
  } else {
82182
82182
  x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
82183
82183
  }
82184
- alphabet = ALPHABET.slice(0, b);
82184
+ alphabet2 = ALPHABET.slice(0, b);
82185
82185
  e2 = i2 = 0;
82186
82186
  for (len2 = str.length; i2 < len2; i2++) {
82187
- if (alphabet.indexOf(c = str.charAt(i2)) < 0) {
82187
+ if (alphabet2.indexOf(c = str.charAt(i2)) < 0) {
82188
82188
  if (c == ".") {
82189
82189
  if (i2 > e2) {
82190
82190
  e2 = len2;
@@ -82455,11 +82455,11 @@ function requireBignumber() {
82455
82455
  };
82456
82456
  convertBase2 = /* @__PURE__ */ function() {
82457
82457
  var decimal = "0123456789";
82458
- function toBaseOut(str, baseIn, baseOut, alphabet) {
82458
+ function toBaseOut(str, baseIn, baseOut, alphabet2) {
82459
82459
  var j, arr = [0], arrL, i2 = 0, len2 = str.length;
82460
82460
  for (; i2 < len2; ) {
82461
82461
  for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) ;
82462
- arr[0] += alphabet.indexOf(str.charAt(i2++));
82462
+ arr[0] += alphabet2.indexOf(str.charAt(i2++));
82463
82463
  for (j = 0; j < arr.length; j++) {
82464
82464
  if (arr[j] > baseOut - 1) {
82465
82465
  if (arr[j + 1] == null) arr[j + 1] = 0;
@@ -82471,7 +82471,7 @@ function requireBignumber() {
82471
82471
  return arr.reverse();
82472
82472
  }
82473
82473
  return function(str, baseIn, baseOut, sign2, callerIsToString) {
82474
- var alphabet, d, e2, k, r2, x, xc, y, i2 = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
82474
+ var alphabet2, d, e2, k, r2, x, xc, y, i2 = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
82475
82475
  if (i2 >= 0) {
82476
82476
  k = POW_PRECISION;
82477
82477
  POW_PRECISION = 0;
@@ -82487,10 +82487,10 @@ function requireBignumber() {
82487
82487
  );
82488
82488
  y.e = y.c.length;
82489
82489
  }
82490
- xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET));
82490
+ xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet2 = ALPHABET, decimal) : (alphabet2 = decimal, ALPHABET));
82491
82491
  e2 = k = xc.length;
82492
82492
  for (; xc[--k] == 0; xc.pop()) ;
82493
- if (!xc[0]) return alphabet.charAt(0);
82493
+ if (!xc[0]) return alphabet2.charAt(0);
82494
82494
  if (i2 < 0) {
82495
82495
  --e2;
82496
82496
  } else {
@@ -82508,7 +82508,7 @@ function requireBignumber() {
82508
82508
  r2 = r2 || d < 0 || xc[d + 1] != null;
82509
82509
  r2 = rm < 4 ? (i2 != null || r2) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i2 > k || i2 == k && (rm == 4 || r2 || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));
82510
82510
  if (d < 1 || !xc[0]) {
82511
- str = r2 ? toFixedPoint2(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
82511
+ str = r2 ? toFixedPoint2(alphabet2.charAt(1), -dp, alphabet2.charAt(0)) : alphabet2.charAt(0);
82512
82512
  } else {
82513
82513
  xc.length = d;
82514
82514
  if (r2) {
@@ -82521,8 +82521,8 @@ function requireBignumber() {
82521
82521
  }
82522
82522
  }
82523
82523
  for (k = xc.length; !xc[--k]; ) ;
82524
- for (i2 = 0, str = ""; i2 <= k; str += alphabet.charAt(xc[i2++])) ;
82525
- str = toFixedPoint2(str, e2, alphabet.charAt(0));
82524
+ for (i2 = 0, str = ""; i2 <= k; str += alphabet2.charAt(xc[i2++])) ;
82525
+ str = toFixedPoint2(str, e2, alphabet2.charAt(0));
82526
82526
  }
82527
82527
  return str;
82528
82528
  };
@@ -103251,22 +103251,22 @@ async function getDecoder(fileDirectory) {
103251
103251
  const Decoder = await importFn();
103252
103252
  return new Decoder(fileDirectory);
103253
103253
  }
103254
- addDecoder([void 0, 1], () => import("./raw-EqQpc0BS.js").then((m) => m.default));
103255
- addDecoder(5, () => import("./lzw-DLCrkMTy.js").then((m) => m.default));
103254
+ addDecoder([void 0, 1], () => import("./raw-8fYhxxrk.js").then((m) => m.default));
103255
+ addDecoder(5, () => import("./lzw-Ct-TYyMz.js").then((m) => m.default));
103256
103256
  addDecoder(6, () => {
103257
103257
  throw new Error("old style JPEG compression is not supported.");
103258
103258
  });
103259
- addDecoder(7, () => import("./jpeg-DMXjDxfw.js").then((m) => m.default));
103260
- addDecoder([8, 32946], () => import("./deflate-BueomBMX.js").then((m) => m.default));
103261
- addDecoder(32773, () => import("./packbits-6GKgmosY.js").then((m) => m.default));
103259
+ addDecoder(7, () => import("./jpeg-BYVxEYfP.js").then((m) => m.default));
103260
+ addDecoder([8, 32946], () => import("./deflate-CUv0cX0x.js").then((m) => m.default));
103261
+ addDecoder(32773, () => import("./packbits-IsjL89d4.js").then((m) => m.default));
103262
103262
  addDecoder(
103263
103263
  34887,
103264
- () => import("./lerc-ulxrRS5b.js").then(async (m) => {
103264
+ () => import("./lerc-CwhwXnAs.js").then(async (m) => {
103265
103265
  await m.zstd.init();
103266
103266
  return m;
103267
103267
  }).then((m) => m.default)
103268
103268
  );
103269
- addDecoder(50001, () => import("./webimage-CGPpgghp.js").then((m) => m.default));
103269
+ addDecoder(50001, () => import("./webimage-BZn38dU8.js").then((m) => m.default));
103270
103270
  function copyNewSize(array, width2, height2, samplesPerPixel = 1) {
103271
103271
  return new (Object.getPrototypeOf(array)).constructor(width2 * height2 * samplesPerPixel);
103272
103272
  }
@@ -104200,7 +104200,7 @@ class GeoTIFFImage {
104200
104200
  }
104201
104201
  }
104202
104202
  }
104203
- class DataView64 {
104203
+ let DataView64$1 = class DataView64 {
104204
104204
  constructor(arrayBuffer2) {
104205
104205
  this._dataView = new DataView(arrayBuffer2);
104206
104206
  }
@@ -104279,7 +104279,7 @@ class DataView64 {
104279
104279
  getFloat64(offset2, littleEndian) {
104280
104280
  return this._dataView.getFloat64(offset2, littleEndian);
104281
104281
  }
104282
- }
104282
+ };
104283
104283
  class DataSlice {
104284
104284
  constructor(arrayBuffer2, sliceOffset, littleEndian, bigTiff) {
104285
104285
  this._dataView = new DataView(arrayBuffer2);
@@ -105964,7 +105964,7 @@ class GeoTIFF extends GeoTIFFBase {
105964
105964
  */
105965
105965
  static async fromSource(source, options, signal) {
105966
105966
  const headerData = (await source.fetch([{ offset: 0, length: 1024 }], signal))[0];
105967
- const dataView = new DataView64(headerData);
105967
+ const dataView = new DataView64$1(headerData);
105968
105968
  const BOM = dataView.getUint16(0, 0);
105969
105969
  let littleEndian;
105970
105970
  if (BOM === 18761) {
@@ -110536,15 +110536,15 @@ const adler32 = (adler, buf, len2, pos) => {
110536
110536
  };
110537
110537
  var adler32_1 = adler32;
110538
110538
  const makeTable = () => {
110539
- let c, table = [];
110539
+ let c, table2 = [];
110540
110540
  for (var n3 = 0; n3 < 256; n3++) {
110541
110541
  c = n3;
110542
110542
  for (var k = 0; k < 8; k++) {
110543
110543
  c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
110544
110544
  }
110545
- table[n3] = c;
110545
+ table2[n3] = c;
110546
110546
  }
110547
- return table;
110547
+ return table2;
110548
110548
  };
110549
110549
  const crcTable = new Uint32Array(makeTable());
110550
110550
  const crc32 = (crc, buf, len2, pos) => {
@@ -112352,7 +112352,7 @@ const dext = new Uint8Array([
112352
112352
  64,
112353
112353
  64
112354
112354
  ]);
112355
- const inflate_table = (type, lens2, lens_index, codes, table, table_index, work, opts) => {
112355
+ const inflate_table = (type, lens2, lens_index, codes, table2, table_index, work, opts) => {
112356
112356
  const bits = opts.bits;
112357
112357
  let len2 = 0;
112358
112358
  let sym = 0;
@@ -112392,8 +112392,8 @@ const inflate_table = (type, lens2, lens_index, codes, table, table_index, work,
112392
112392
  root2 = max2;
112393
112393
  }
112394
112394
  if (max2 === 0) {
112395
- table[table_index++] = 1 << 24 | 64 << 16 | 0;
112396
- table[table_index++] = 1 << 24 | 64 << 16 | 0;
112395
+ table2[table_index++] = 1 << 24 | 64 << 16 | 0;
112396
+ table2[table_index++] = 1 << 24 | 64 << 16 | 0;
112397
112397
  opts.bits = 1;
112398
112398
  return 0;
112399
112399
  }
@@ -112468,7 +112468,7 @@ const inflate_table = (type, lens2, lens_index, codes, table, table_index, work,
112468
112468
  min2 = fill;
112469
112469
  do {
112470
112470
  fill -= incr;
112471
- table[next4 + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;
112471
+ table2[next4 + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;
112472
112472
  } while (fill !== 0);
112473
112473
  incr = 1 << len2 - 1;
112474
112474
  while (huff & incr) {
@@ -112507,11 +112507,11 @@ const inflate_table = (type, lens2, lens_index, codes, table, table_index, work,
112507
112507
  return 1;
112508
112508
  }
112509
112509
  low = huff & mask;
112510
- table[low] = root2 << 24 | curr << 16 | next4 - table_index | 0;
112510
+ table2[low] = root2 << 24 | curr << 16 | next4 - table_index | 0;
112511
112511
  }
112512
112512
  }
112513
112513
  if (huff !== 0) {
112514
- table[next4 + huff] = len2 - drop << 24 | 64 << 16 | 0;
112514
+ table2[next4 + huff] = len2 - drop << 24 | 64 << 16 | 0;
112515
112515
  }
112516
112516
  opts.bits = root2;
112517
112517
  return 0;
@@ -114898,13 +114898,13 @@ var blosc_codec = function() {
114898
114898
  }();
114899
114899
  var __isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
114900
114900
  var __toBinary = __isNode ? (base64) => new Uint8Array(Buffer.from(base64, "base64")) : /* @__PURE__ */ (() => {
114901
- var table = new Uint8Array(128);
114902
- for (var i2 = 0; i2 < 64; i2++) table[i2 < 26 ? i2 + 65 : i2 < 52 ? i2 + 71 : i2 < 62 ? i2 - 4 : i2 * 4 - 205] = i2;
114901
+ var table2 = new Uint8Array(128);
114902
+ for (var i2 = 0; i2 < 64; i2++) table2[i2 < 26 ? i2 + 65 : i2 < 52 ? i2 + 71 : i2 < 62 ? i2 - 4 : i2 * 4 - 205] = i2;
114903
114903
  return (base64) => {
114904
114904
  var n3 = base64.length, bytes = new Uint8Array((n3 - (base64[n3 - 1] == "=") - (base64[n3 - 2] == "=")) * 3 / 4 | 0);
114905
114905
  for (var i3 = 0, j = 0; i3 < n3; ) {
114906
- var c0 = table[base64.charCodeAt(i3++)], c1 = table[base64.charCodeAt(i3++)];
114907
- var c2 = table[base64.charCodeAt(i3++)], c3 = table[base64.charCodeAt(i3++)];
114906
+ var c0 = table2[base64.charCodeAt(i3++)], c1 = table2[base64.charCodeAt(i3++)];
114907
+ var c2 = table2[base64.charCodeAt(i3++)], c3 = table2[base64.charCodeAt(i3++)];
114908
114908
  bytes[j++] = c0 << 2 | c1 >> 4;
114909
114909
  bytes[j++] = c1 << 4 | c2 >> 2;
114910
114910
  bytes[j++] = c2 << 6 | c3;
@@ -121611,7 +121611,7 @@ function clone$3(configObject) {
121611
121611
  suffix: ""
121612
121612
  }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
121613
121613
  function BigNumber2(v, b) {
121614
- var alphabet, c, caseChanged, e2, i2, isNum, len2, str, x = this;
121614
+ var alphabet2, c, caseChanged, e2, i2, isNum, len2, str, x = this;
121615
121615
  if (!(x instanceof BigNumber2)) return new BigNumber2(v, b);
121616
121616
  if (b == null) {
121617
121617
  if (v && v._isBigNumber === true) {
@@ -121667,10 +121667,10 @@ function clone$3(configObject) {
121667
121667
  } else {
121668
121668
  x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
121669
121669
  }
121670
- alphabet = ALPHABET.slice(0, b);
121670
+ alphabet2 = ALPHABET.slice(0, b);
121671
121671
  e2 = i2 = 0;
121672
121672
  for (len2 = str.length; i2 < len2; i2++) {
121673
- if (alphabet.indexOf(c = str.charAt(i2)) < 0) {
121673
+ if (alphabet2.indexOf(c = str.charAt(i2)) < 0) {
121674
121674
  if (c == ".") {
121675
121675
  if (i2 > e2) {
121676
121676
  e2 = len2;
@@ -121941,11 +121941,11 @@ function clone$3(configObject) {
121941
121941
  };
121942
121942
  convertBase2 = /* @__PURE__ */ function() {
121943
121943
  var decimal = "0123456789";
121944
- function toBaseOut(str, baseIn, baseOut, alphabet) {
121944
+ function toBaseOut(str, baseIn, baseOut, alphabet2) {
121945
121945
  var j, arr = [0], arrL, i2 = 0, len2 = str.length;
121946
121946
  for (; i2 < len2; ) {
121947
121947
  for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) ;
121948
- arr[0] += alphabet.indexOf(str.charAt(i2++));
121948
+ arr[0] += alphabet2.indexOf(str.charAt(i2++));
121949
121949
  for (j = 0; j < arr.length; j++) {
121950
121950
  if (arr[j] > baseOut - 1) {
121951
121951
  if (arr[j + 1] == null) arr[j + 1] = 0;
@@ -121957,7 +121957,7 @@ function clone$3(configObject) {
121957
121957
  return arr.reverse();
121958
121958
  }
121959
121959
  return function(str, baseIn, baseOut, sign2, callerIsToString) {
121960
- var alphabet, d, e2, k, r2, x, xc, y, i2 = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
121960
+ var alphabet2, d, e2, k, r2, x, xc, y, i2 = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
121961
121961
  if (i2 >= 0) {
121962
121962
  k = POW_PRECISION;
121963
121963
  POW_PRECISION = 0;
@@ -121973,10 +121973,10 @@ function clone$3(configObject) {
121973
121973
  );
121974
121974
  y.e = y.c.length;
121975
121975
  }
121976
- xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET));
121976
+ xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet2 = ALPHABET, decimal) : (alphabet2 = decimal, ALPHABET));
121977
121977
  e2 = k = xc.length;
121978
121978
  for (; xc[--k] == 0; xc.pop()) ;
121979
- if (!xc[0]) return alphabet.charAt(0);
121979
+ if (!xc[0]) return alphabet2.charAt(0);
121980
121980
  if (i2 < 0) {
121981
121981
  --e2;
121982
121982
  } else {
@@ -121994,7 +121994,7 @@ function clone$3(configObject) {
121994
121994
  r2 = r2 || d < 0 || xc[d + 1] != null;
121995
121995
  r2 = rm < 4 ? (i2 != null || r2) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i2 > k || i2 == k && (rm == 4 || r2 || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));
121996
121996
  if (d < 1 || !xc[0]) {
121997
- str = r2 ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
121997
+ str = r2 ? toFixedPoint(alphabet2.charAt(1), -dp, alphabet2.charAt(0)) : alphabet2.charAt(0);
121998
121998
  } else {
121999
121999
  xc.length = d;
122000
122000
  if (r2) {
@@ -122007,8 +122007,8 @@ function clone$3(configObject) {
122007
122007
  }
122008
122008
  }
122009
122009
  for (k = xc.length; !xc[--k]; ) ;
122010
- for (i2 = 0, str = ""; i2 <= k; str += alphabet.charAt(xc[i2++])) ;
122011
- str = toFixedPoint(str, e2, alphabet.charAt(0));
122010
+ for (i2 = 0, str = ""; i2 <= k; str += alphabet2.charAt(xc[i2++])) ;
122011
+ str = toFixedPoint(str, e2, alphabet2.charAt(0));
122012
122012
  }
122013
122013
  return str;
122014
122014
  };
@@ -131842,13 +131842,13 @@ const parseAddition = (str) => {
131842
131842
  if (!Number.isNaN(+str)) {
131843
131843
  return +str;
131844
131844
  }
131845
- const numbers = str.match(/\d*\.?\d+/g);
131846
- if (!numbers) {
131845
+ const numbers2 = str.match(/\d*\.?\d+/g);
131846
+ if (!numbers2) {
131847
131847
  return 0;
131848
131848
  }
131849
131849
  let sum2 = 0;
131850
- for (let i2 = 0; i2 < numbers.length; i2 += 1) {
131851
- sum2 += +numbers[i2];
131850
+ for (let i2 = 0; i2 < numbers2.length; i2 += 1) {
131851
+ sum2 += +numbers2[i2];
131852
131852
  }
131853
131853
  return sum2;
131854
131854
  };
@@ -151102,6 +151102,13 @@ function normalizeCoordinateTransformations(coordinateTransformations, datasets)
151102
151102
  }
151103
151103
  return result;
151104
151104
  }
151105
+ function getDatasetScale(dataset) {
151106
+ const scales = normalizeCoordinateTransformations(dataset?.coordinateTransformations, null).filter((transform2) => transform2?.type === "scale" && Array.isArray(transform2.scale)).map((transform2) => transform2.scale);
151107
+ if (scales.length === 0) {
151108
+ return void 0;
151109
+ }
151110
+ return scales.reduce((product2, scale2) => product2.map((factor, axis) => factor * scale2[axis]));
151111
+ }
151105
151112
  function coordinateTransformationsToMatrixForSpatialData(ngffMetadata, targetCoordinateSystem) {
151106
151113
  const { datasets, coordinateTransformations, axes } = ngffMetadata;
151107
151114
  const normAxes = normalizeAxes(axes);
@@ -151123,6 +151130,354 @@ function coordinateTransformationsToMatrixForSpatialData(ngffMetadata, targetCoo
151123
151130
  const normalizedTransformations = normalizeCoordinateTransformations(filteredTransformations, datasets);
151124
151131
  return coordinateTransformationsToMatrix(normalizedTransformations, normAxes);
151125
151132
  }
151133
+ const alphabet = "abcdefghijklmnopqrstuvwxyz";
151134
+ const numbers = "01234569789";
151135
+ const expr = "()*/+-";
151136
+ const space = " ";
151137
+ new Set(
151138
+ alphabet + alphabet.toUpperCase() + numbers + expr + space
151139
+ );
151140
+ (() => {
151141
+ var table2 = new Uint8Array(128);
151142
+ for (var i2 = 0; i2 < 64; i2++) {
151143
+ table2[i2 < 26 ? i2 + 65 : i2 < 52 ? i2 + 71 : i2 < 62 ? i2 - 4 : i2 * 4 - 205] = i2;
151144
+ }
151145
+ return (base64) => {
151146
+ var n3 = base64.length;
151147
+ var bytes = new Uint8Array(
151148
+ // @ts-expect-error
151149
+ (n3 - (base64[n3 - 1] == "=") - (base64[n3 - 2] == "=")) * 3 / 4 | 0
151150
+ );
151151
+ for (var i22 = 0, j = 0; i22 < n3; ) {
151152
+ var c0 = table2[base64.charCodeAt(i22++)], c1 = table2[base64.charCodeAt(i22++)];
151153
+ var c2 = table2[base64.charCodeAt(i22++)], c3 = table2[base64.charCodeAt(i22++)];
151154
+ bytes[j++] = c0 << 2 | c1 >> 4;
151155
+ bytes[j++] = c1 << 4 | c2 >> 2;
151156
+ bytes[j++] = c2 << 6 | c3;
151157
+ }
151158
+ return bytes;
151159
+ };
151160
+ })();
151161
+ new TextEncoder();
151162
+ function _structure_size(structure) {
151163
+ const fmt = "<" + Array.from(structure.values()).join("");
151164
+ return struct.calcsize(fmt);
151165
+ }
151166
+ function isBigEndian() {
151167
+ const array = new Uint8Array(4);
151168
+ const view = new Uint32Array(array.buffer);
151169
+ return !((view[0] = 1) & array[0]);
151170
+ }
151171
+ function decodeFloat16(low, high) {
151172
+ const sign2 = (high & 128) >> 7;
151173
+ const exponent = (high & 124) >> 2;
151174
+ const fraction2 = ((high & 3) << 8) + low;
151175
+ let magnitude;
151176
+ if (exponent === 31) {
151177
+ magnitude = fraction2 === 0 ? Infinity : NaN;
151178
+ } else if (exponent === 0) {
151179
+ magnitude = 2 ** -14 * (fraction2 / 1024);
151180
+ } else {
151181
+ magnitude = 2 ** (exponent - 15) * (1 + fraction2 / 1024);
151182
+ }
151183
+ return sign2 ? -magnitude : magnitude;
151184
+ }
151185
+ class DataView642 extends DataView {
151186
+ getFloat16(byteOffset, littleEndian) {
151187
+ const bytes = [this.getUint8(byteOffset), this.getUint8(byteOffset + 1)];
151188
+ if (!littleEndian)
151189
+ bytes.reverse();
151190
+ return decodeFloat16(bytes[0], bytes[1]);
151191
+ }
151192
+ getUint64(byteOffset, littleEndian) {
151193
+ const left = BigInt(this.getUint32(byteOffset, littleEndian));
151194
+ const right = BigInt(this.getUint32(byteOffset + 4, littleEndian));
151195
+ const combined = littleEndian ? left + (right << 32n) : (left << 32n) + right;
151196
+ return Number(combined);
151197
+ }
151198
+ getInt64(byteOffset, littleEndian) {
151199
+ let low, high;
151200
+ if (littleEndian) {
151201
+ low = this.getUint32(byteOffset, true);
151202
+ high = this.getInt32(byteOffset + 4, true);
151203
+ } else {
151204
+ high = this.getInt32(byteOffset, false);
151205
+ low = this.getUint32(byteOffset + 4, false);
151206
+ }
151207
+ const combined = BigInt(low) + (BigInt(high) << 32n);
151208
+ return Number(combined);
151209
+ }
151210
+ getString(byteOffset, _littleEndian, length2) {
151211
+ const str_buffer = this.buffer.slice(byteOffset, byteOffset + length2);
151212
+ return new TextDecoder().decode(str_buffer);
151213
+ }
151214
+ getVLENStruct(byteOffset, littleEndian, _length) {
151215
+ const item_size = this.getUint32(byteOffset, littleEndian);
151216
+ const collection_address = this.getUint64(byteOffset + 4, littleEndian);
151217
+ const object_index = this.getUint32(byteOffset + 12, littleEndian);
151218
+ return [item_size, collection_address, object_index];
151219
+ }
151220
+ }
151221
+ class Struct {
151222
+ big_endian;
151223
+ getters;
151224
+ byte_lengths;
151225
+ fmt_size_regex;
151226
+ constructor() {
151227
+ this.big_endian = isBigEndian();
151228
+ this.getters = {
151229
+ s: "getUint8",
151230
+ b: "getInt8",
151231
+ B: "getUint8",
151232
+ h: "getInt16",
151233
+ H: "getUint16",
151234
+ i: "getInt32",
151235
+ I: "getUint32",
151236
+ l: "getInt32",
151237
+ L: "getUint32",
151238
+ q: "getInt64",
151239
+ Q: "getUint64",
151240
+ e: "getFloat16",
151241
+ f: "getFloat32",
151242
+ d: "getFloat64"
151243
+ };
151244
+ this.byte_lengths = {
151245
+ s: 1,
151246
+ b: 1,
151247
+ B: 1,
151248
+ h: 2,
151249
+ H: 2,
151250
+ i: 4,
151251
+ I: 4,
151252
+ l: 4,
151253
+ L: 4,
151254
+ q: 8,
151255
+ Q: 8,
151256
+ e: 2,
151257
+ f: 4,
151258
+ d: 8
151259
+ };
151260
+ const all_formats = Object.keys(this.byte_lengths).join("");
151261
+ this.fmt_size_regex = "(\\d*)([" + all_formats + "])";
151262
+ }
151263
+ calcsize(fmt) {
151264
+ let size2 = 0;
151265
+ const regex = new RegExp(this.fmt_size_regex, "g");
151266
+ let match2;
151267
+ while ((match2 = regex.exec(fmt)) !== null) {
151268
+ const n3 = parseInt(match2[1] || "1", 10);
151269
+ const f2 = match2[2];
151270
+ size2 += n3 * this.byte_lengths[f2];
151271
+ }
151272
+ return size2;
151273
+ }
151274
+ _is_big_endian(fmt) {
151275
+ if (/^</.test(fmt))
151276
+ return false;
151277
+ if (/^(!|>)/.test(fmt))
151278
+ return true;
151279
+ return this.big_endian;
151280
+ }
151281
+ unpack_from(fmt, buffer2, offset2) {
151282
+ offset2 = Number(offset2 || 0);
151283
+ const view = new DataView642(buffer2, 0);
151284
+ const output = [];
151285
+ const big_endian = this._is_big_endian(fmt);
151286
+ const regex = new RegExp(this.fmt_size_regex, "g");
151287
+ let match2;
151288
+ while ((match2 = regex.exec(fmt)) !== null) {
151289
+ const n3 = parseInt(match2[1] || "1", 10);
151290
+ const f2 = match2[2];
151291
+ const getter = this.getters[f2];
151292
+ const size2 = this.byte_lengths[f2];
151293
+ if (f2 === "s") {
151294
+ output.push(new TextDecoder().decode(buffer2.slice(offset2, offset2 + n3)));
151295
+ offset2 += n3;
151296
+ } else {
151297
+ for (let i2 = 0; i2 < n3; i2++) {
151298
+ output.push(view[getter](offset2, !big_endian));
151299
+ offset2 += size2;
151300
+ }
151301
+ }
151302
+ }
151303
+ return output;
151304
+ }
151305
+ }
151306
+ const struct = new Struct();
151307
+ const DATATYPE_MSG = /* @__PURE__ */ new Map([
151308
+ ["class_and_version", "B"],
151309
+ ["class_bit_field_0", "B"],
151310
+ ["class_bit_field_1", "B"],
151311
+ ["class_bit_field_2", "B"],
151312
+ ["size", "I"]
151313
+ ]);
151314
+ _structure_size(DATATYPE_MSG);
151315
+ const B_LINK_NODE_V1 = /* @__PURE__ */ new Map([
151316
+ ["signature", "4s"],
151317
+ ["node_type", "B"],
151318
+ ["node_level", "B"],
151319
+ ["entries_used", "H"],
151320
+ ["left_sibling", "Q"],
151321
+ ["right_sibling", "Q"]
151322
+ ]);
151323
+ _structure_size(B_LINK_NODE_V1);
151324
+ const B_LINK_NODE_V2 = /* @__PURE__ */ new Map([
151325
+ ["signature", "4s"],
151326
+ ["version", "B"],
151327
+ ["node_type", "B"]
151328
+ ]);
151329
+ _structure_size(B_LINK_NODE_V2);
151330
+ struct.unpack_from("8s", new Uint8Array([137, 72, 68, 70, 13, 10, 26, 10]).buffer)[0];
151331
+ struct.unpack_from("<Q", new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255]).buffer)[0];
151332
+ const SUPERBLOCK_V0 = /* @__PURE__ */ new Map([
151333
+ ["format_signature", "8s"],
151334
+ ["superblock_version", "B"],
151335
+ ["free_storage_version", "B"],
151336
+ ["root_group_version", "B"],
151337
+ ["reserved_0", "B"],
151338
+ ["shared_header_version", "B"],
151339
+ ["offset_size", "B"],
151340
+ ["length_size", "B"],
151341
+ ["reserved_1", "B"],
151342
+ ["group_leaf_node_k", "H"],
151343
+ ["group_internal_node_k", "H"],
151344
+ ["file_consistency_flags", "L"],
151345
+ ["base_address_lower", "Q"],
151346
+ ["free_space_address", "Q"],
151347
+ ["end_of_file_address", "Q"],
151348
+ ["driver_information_address", "Q"]
151349
+ ]);
151350
+ _structure_size(SUPERBLOCK_V0);
151351
+ const SUPERBLOCK_V2_V3 = /* @__PURE__ */ new Map([
151352
+ ["format_signature", "8s"],
151353
+ ["superblock_version", "B"],
151354
+ ["offset_size", "B"],
151355
+ ["length_size", "B"],
151356
+ ["file_consistency_flags", "B"],
151357
+ ["base_address", "Q"],
151358
+ ["superblock_extension_address", "Q"],
151359
+ ["end_of_file_address", "Q"],
151360
+ ["root_group_address", "Q"],
151361
+ ["superblock_checksum", "I"]
151362
+ ]);
151363
+ _structure_size(SUPERBLOCK_V2_V3);
151364
+ const SYMBOL_TABLE_ENTRY = /* @__PURE__ */ new Map([
151365
+ ["link_name_offset", "Q"],
151366
+ ["object_header_address", "Q"],
151367
+ ["cache_type", "I"],
151368
+ ["reserved", "I"],
151369
+ ["scratch", "16s"]
151370
+ ]);
151371
+ _structure_size(SYMBOL_TABLE_ENTRY);
151372
+ const SYMBOL_TABLE_NODE = /* @__PURE__ */ new Map([
151373
+ ["signature", "4s"],
151374
+ ["version", "B"],
151375
+ ["reserved_0", "B"],
151376
+ ["symbols", "H"]
151377
+ ]);
151378
+ _structure_size(SYMBOL_TABLE_NODE);
151379
+ const GLOBAL_HEAP_HEADER = /* @__PURE__ */ new Map([
151380
+ ["signature", "4s"],
151381
+ ["version", "B"],
151382
+ ["reserved", "3s"],
151383
+ ["collection_size", "Q"]
151384
+ ]);
151385
+ _structure_size(GLOBAL_HEAP_HEADER);
151386
+ const GLOBAL_HEAP_OBJECT = /* @__PURE__ */ new Map([
151387
+ ["object_index", "H"],
151388
+ ["reference_count", "H"],
151389
+ ["reserved", "I"],
151390
+ ["object_size", "Q"]
151391
+ ]);
151392
+ _structure_size(GLOBAL_HEAP_OBJECT);
151393
+ const OBJECT_HEADER_V1 = /* @__PURE__ */ new Map([
151394
+ ["version", "B"],
151395
+ ["reserved", "B"],
151396
+ ["total_header_messages", "H"],
151397
+ ["object_reference_count", "I"],
151398
+ ["object_header_size", "I"],
151399
+ ["padding", "I"]
151400
+ ]);
151401
+ _structure_size(OBJECT_HEADER_V1);
151402
+ const OBJECT_HEADER_V2 = /* @__PURE__ */ new Map([
151403
+ ["signature", "4s"],
151404
+ ["version", "B"],
151405
+ ["flags", "B"]
151406
+ ]);
151407
+ _structure_size(OBJECT_HEADER_V2);
151408
+ const HEADER_MSG_INFO_V1 = /* @__PURE__ */ new Map([
151409
+ ["type", "H"],
151410
+ ["size", "H"],
151411
+ ["flags", "B"],
151412
+ ["reserved", "3s"]
151413
+ ]);
151414
+ _structure_size(HEADER_MSG_INFO_V1);
151415
+ const HEADER_MSG_INFO_V2 = /* @__PURE__ */ new Map([
151416
+ ["type", "B"],
151417
+ ["size", "H"],
151418
+ ["flags", "B"]
151419
+ ]);
151420
+ _structure_size(HEADER_MSG_INFO_V2);
151421
+ const ATTR_MSG_HEADER_V1 = /* @__PURE__ */ new Map([
151422
+ ["version", "B"],
151423
+ ["reserved", "B"],
151424
+ ["name_size", "H"],
151425
+ ["datatype_size", "H"],
151426
+ ["dataspace_size", "H"]
151427
+ ]);
151428
+ _structure_size(ATTR_MSG_HEADER_V1);
151429
+ const ATTR_MSG_HEADER_V3 = /* @__PURE__ */ new Map([
151430
+ ["version", "B"],
151431
+ ["flags", "B"],
151432
+ ["name_size", "H"],
151433
+ ["datatype_size", "H"],
151434
+ ["dataspace_size", "H"],
151435
+ ["character_set_encoding", "B"]
151436
+ ]);
151437
+ _structure_size(ATTR_MSG_HEADER_V3);
151438
+ const DATASPACE_MSG_HEADER_V1 = /* @__PURE__ */ new Map([
151439
+ ["version", "B"],
151440
+ ["dimensionality", "B"],
151441
+ ["flags", "B"],
151442
+ ["reserved_0", "B"],
151443
+ ["reserved_1", "I"]
151444
+ ]);
151445
+ _structure_size(DATASPACE_MSG_HEADER_V1);
151446
+ const DATASPACE_MSG_HEADER_V2 = /* @__PURE__ */ new Map([
151447
+ ["version", "B"],
151448
+ ["dimensionality", "B"],
151449
+ ["flags", "B"],
151450
+ ["type", "B"]
151451
+ ]);
151452
+ _structure_size(DATASPACE_MSG_HEADER_V2);
151453
+ const FILLVAL_MSG_V1V2 = /* @__PURE__ */ new Map([
151454
+ ["version", "B"],
151455
+ ["space_allocation_time", "B"],
151456
+ ["fillvalue_write_time", "B"],
151457
+ ["fillvalue_defined", "B"]
151458
+ ]);
151459
+ _structure_size(FILLVAL_MSG_V1V2);
151460
+ const FILLVAL_MSG_V3 = /* @__PURE__ */ new Map([
151461
+ ["version", "B"],
151462
+ ["flags", "B"]
151463
+ ]);
151464
+ _structure_size(FILLVAL_MSG_V3);
151465
+ const FILTER_PIPELINE_DESCR_V1 = /* @__PURE__ */ new Map([
151466
+ ["filter_id", "H"],
151467
+ ["name_length", "H"],
151468
+ ["flags", "H"],
151469
+ ["client_data_values", "H"]
151470
+ ]);
151471
+ _structure_size(FILTER_PIPELINE_DESCR_V1);
151472
+ const GLOBAL_HEAP_ID = /* @__PURE__ */ new Map([
151473
+ ["collection_address", "Q"],
151474
+ ["object_index", "I"]
151475
+ ]);
151476
+ _structure_size(GLOBAL_HEAP_ID);
151477
+ let table = new Uint8Array(128);
151478
+ for (let i2 = 0; i2 < 64; i2++) {
151479
+ table[i2 < 26 ? i2 + 65 : i2 < 52 ? i2 + 71 : i2 < 62 ? i2 - 4 : i2 * 4 - 205] = i2;
151480
+ }
151126
151481
  function getDomains() {
151127
151482
  const domains = {};
151128
151483
  const needMin = ["Int8", "Int16", "Int32"];
@@ -151134,6 +151489,36 @@ function getDomains() {
151134
151489
  return domains;
151135
151490
  }
151136
151491
  getDomains();
151492
+ function getFirstPlaneSelection(labels) {
151493
+ return Object.fromEntries(labels.filter((axis) => axis !== "y" && axis !== "x").map((axis) => [axis, 0]));
151494
+ }
151495
+ async function readTiffTileShape(pixelSource) {
151496
+ const image = await pixelSource._indexer(getFirstPlaneSelection(pixelSource.labels));
151497
+ return [image.getTileHeight(), image.getTileWidth()];
151498
+ }
151499
+ async function readTiffSampleRange(pixelSource) {
151500
+ try {
151501
+ const image = await pixelSource._indexer(getFirstPlaneSelection(pixelSource.labels));
151502
+ const directory = image?.fileDirectory ?? {};
151503
+ const fromTag = (value, reduce) => value === void 0 || typeof value === "number" ? value : reduce(...Array.from(value));
151504
+ let min2 = fromTag(directory.SMinSampleValue, Math.min);
151505
+ let max2 = fromTag(directory.SMaxSampleValue, Math.max);
151506
+ const description = directory.ImageDescription;
151507
+ if (!(Number.isFinite(min2) && Number.isFinite(max2)) && typeof description === "string") {
151508
+ const fromXml = (key) => Number(description.match(new RegExp(`<Key>${key}</Key>\\s*<Value>([^<]*)</Value>`))?.[1]);
151509
+ min2 = fromXml("SMinSampleValue");
151510
+ max2 = fromXml("SMaxSampleValue");
151511
+ }
151512
+ return Number.isFinite(min2) && Number.isFinite(max2) && max2 > min2 ? [min2, max2] : null;
151513
+ } catch (error2) {
151514
+ return null;
151515
+ }
151516
+ }
151517
+ function getOmeroWindow(window2) {
151518
+ const start = window2?.start ?? window2?.min;
151519
+ const end = window2?.end ?? window2?.max;
151520
+ return Number.isFinite(start) && Number.isFinite(end) && end > start ? [start, end] : void 0;
151521
+ }
151137
151522
  class ImageWrapper {
151138
151523
  vivLoader;
151139
151524
  options;
@@ -151320,7 +151705,7 @@ class ImageWrapper {
151320
151705
  return channels2.map((channel, i2) => ({
151321
151706
  name: channel.label || `Channel ${i2}`,
151322
151707
  defaultColor: channel.color ? hexToRgb(channel.color) : void 0,
151323
- defaultWindow: channel.window ? [channel.window.start, channel.window.end] : void 0,
151708
+ defaultWindow: getOmeroWindow(channel.window),
151324
151709
  autoDefaultColor: VIEWER_PALETTE[i2 % VIEWER_PALETTE.length]
151325
151710
  }));
151326
151711
  }
@@ -151475,9 +151860,17 @@ class ImageWrapper {
151475
151860
  ];
151476
151861
  return [xSlice, ySlice, zSlice];
151477
151862
  }
151863
+ /**
151864
+ * Whether the last dimension holds interleaved RGB(A) samples.
151865
+ * viv labels it '_c' (OME-TIFF). When the last label is 'x',
151866
+ * the image is not interleaved, even if it is 3 or 4 pixels wide.
151867
+ */
151478
151868
  isInterleaved() {
151479
151869
  const loader = this.vivLoader;
151480
- const { shape: shape2 } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
151870
+ const { shape: shape2, labels } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
151871
+ if (labels?.length === shape2.length && labels.at(-1) === "x") {
151872
+ return false;
151873
+ }
151481
151874
  return isInterleaved(shape2);
151482
151875
  }
151483
151876
  getPhotometricInterpretation() {
@@ -151503,26 +151896,104 @@ class ImageWrapper {
151503
151896
  return "BlackIsZero";
151504
151897
  }
151505
151898
  /**
151506
- * Meters per 3D scene unit, i.e. the unit of getModelMatrix().
151507
- * OME-TIFF: physicalSizeToMatrix divides by 1 um, so the scene is in µm
151508
- * (only when physical sizes exist; otherwise pixels, unit unknown → null).
151509
- * OME-Zarr: the model matrix is in the units of the NGFF axes.
151899
+ * The unit of the 3D scene, i.e. of getModelMatrix() and getVoxelSpacing().
151900
+ * OME-TIFF: physicalSizeToMatrix divides by 1 µm, so the scene is in µm,
151901
+ * whatever PhysicalSizeXUnit is (only when physical sizes exist;
151902
+ * otherwise pixels, unit unknown → null).
151903
+ * OME-Zarr: the model matrix is in the units of the NGFF axes, as spelled
151904
+ * there (e.g. 'micrometer').
151510
151905
  */
151511
- getSceneMetersPerUnit() {
151906
+ getSpatialUnit() {
151512
151907
  const { metadata } = this.vivLoader;
151513
151908
  if (!metadata)
151514
151909
  return null;
151515
151910
  if ("Pixels" in metadata) {
151516
- return this.hasPhysicalSize() ? 1e-6 : null;
151911
+ return this.hasPhysicalSize() ? "µm" : null;
151517
151912
  }
151518
151913
  if ("multiscales" in metadata) {
151519
151914
  const axes = metadata.multiscales?.[0]?.axes ?? [];
151520
151915
  const xAxis = axes.find((a2) => (typeof a2 === "string" ? a2 : a2?.name) === "x");
151521
- const unit2 = typeof xAxis === "object" ? xAxis?.unit : null;
151522
- return unit2 ? UNIT_TO_METERS[unit2.normalize("NFKC")] ?? null : null;
151916
+ return (typeof xAxis === "object" ? xAxis?.unit : null) || null;
151523
151917
  }
151524
151918
  return null;
151525
151919
  }
151920
+ /**
151921
+ * Meters per 3D scene unit, i.e. the unit of getModelMatrix().
151922
+ * Null when the unit is unknown.
151923
+ */
151924
+ getSceneMetersPerUnit() {
151925
+ const unit2 = this.getSpatialUnit();
151926
+ return unit2 ? UNIT_TO_METERS[unit2.normalize("NFKC")] ?? null : null;
151927
+ }
151928
+ /**
151929
+ * Level-0 voxel size, ZYX, in units of getSpatialUnit(): the scale of each
151930
+ * axis of getModelMatrix() (including transforms from the file options),
151931
+ * times the scale of the non-standard root-level coordinateTransformations
151932
+ * that some converted OME-Zarr datasets (e.g. kingsnake, f8ii, melanoma) use
151933
+ * for their physical spacing. getModelMatrix() itself ignores the latter.
151934
+ */
151935
+ getVoxelSpacing() {
151936
+ const modelMatrix2 = this.getModelMatrix();
151937
+ const spacing = [8, 4, 0].map((i2) => Math.hypot(modelMatrix2[i2], modelMatrix2[i2 + 1], modelMatrix2[i2 + 2]) || 1);
151938
+ const { metadata } = this.vivLoader;
151939
+ const rootScale = metadata?.coordinateTransformations?.find((t) => t?.type === "scale")?.scale;
151940
+ if (Array.isArray(rootScale) && rootScale.length >= 3) {
151941
+ rootScale.slice(-3).forEach((value, axis) => {
151942
+ if (Number.isFinite(value) && value > 0)
151943
+ spacing[axis] *= value;
151944
+ });
151945
+ }
151946
+ return spacing;
151947
+ }
151948
+ /**
151949
+ * Every resolution level as stored, finest first, with its chunk shape
151950
+ * and, for OME-Zarr, the scale of its multiscales dataset.
151951
+ * For OME-TIFF, the chunk is each level's own TIFF tile, read from its TIFF
151952
+ * directory (viv's tileSize is level 0's for every level).
151953
+ */
151954
+ async getResolutionLevels() {
151955
+ const { data, metadata } = this.vivLoader;
151956
+ const pixelSources = Array.isArray(data) ? data : [data];
151957
+ if ("Pixels" in metadata) {
151958
+ return Promise.all(pixelSources.map(async (pixelSource) => {
151959
+ const { shape: shape2, labels, dtype } = pixelSource;
151960
+ const [tileHeight, tileWidth] = await readTiffTileShape(pixelSource);
151961
+ const tileShape = { y: tileHeight, x: tileWidth };
151962
+ return {
151963
+ shape: shape2,
151964
+ labels,
151965
+ dtype,
151966
+ chunks: labels.map((axis) => tileShape[axis] ?? 1),
151967
+ data: pixelSource
151968
+ };
151969
+ }));
151970
+ }
151971
+ const datasets = metadata.multiscales?.[0]?.datasets ?? [];
151972
+ return pixelSources.map((pixelSource, i2) => ({
151973
+ shape: pixelSource.shape,
151974
+ labels: pixelSource.labels,
151975
+ dtype: pixelSource.dtype,
151976
+ chunks: pixelSource._data.chunks,
151977
+ scale: getDatasetScale(datasets[i2]),
151978
+ data: pixelSource._data
151979
+ }));
151980
+ }
151981
+ /**
151982
+ * Value range of each channel from the image metadata, in the order of
151983
+ * getChannelObjects(): its defaultWindow, or for OME-TIFF the sample range
151984
+ * the writer recorded in the TIFF (see readTiffSampleRange), which needs a
151985
+ * read of the first TIFF directory. Undefined for channels without either.
151986
+ */
151987
+ async getChannelWindows() {
151988
+ const windows = this.getChannelObjects().map((channel) => channel.defaultWindow);
151989
+ const { data, metadata } = this.vivLoader;
151990
+ if (!("Pixels" in metadata)) {
151991
+ return windows;
151992
+ }
151993
+ const pixelSource = Array.isArray(data) ? data[0] : data;
151994
+ const sampleRange = await readTiffSampleRange(pixelSource);
151995
+ return sampleRange ? windows.map((window2) => window2 ?? sampleRange) : windows;
151996
+ }
151526
151997
  }
151527
151998
  class LoaderResult {
151528
151999
  /**
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c, b, O } from "./index-Cf41eRvn.js";
1
+ import { c, b, O } from "./index-CQ0ULzhP.js";
2
2
  export {
3
3
  c as OmeTiffAsObsSegmentationsLoader,
4
4
  b as OmeTiffLoader,
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Cf41eRvn.js";
1
+ import { B as BaseDecoder } from "./index-CQ0ULzhP.js";
2
2
  const dctZigZag = new Int32Array([
3
3
  0,
4
4
  1,
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-SxljTded.js";
2
- import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-Cf41eRvn.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-CQ0ULzhP.js";
3
3
  var LercDecode = { exports: {} };
4
4
  var hasRequiredLercDecode;
5
5
  function requireLercDecode() {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Cf41eRvn.js";
1
+ import { B as BaseDecoder } from "./index-CQ0ULzhP.js";
2
2
  const MIN_BITS = 9;
3
3
  const CLEAR_CODE = 256;
4
4
  const EOI_CODE = 257;
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Cf41eRvn.js";
1
+ import { B as BaseDecoder } from "./index-CQ0ULzhP.js";
2
2
  class PackbitsDecoder extends BaseDecoder {
3
3
  decodeBlock(buffer) {
4
4
  const dataView = new DataView(buffer);
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Cf41eRvn.js";
1
+ import { B as BaseDecoder } from "./index-CQ0ULzhP.js";
2
2
  class RawDecoder extends BaseDecoder {
3
3
  decodeBlock(buffer) {
4
4
  return buffer;
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Cf41eRvn.js";
1
+ import { B as BaseDecoder } from "./index-CQ0ULzhP.js";
2
2
  class WebImageDecoder extends BaseDecoder {
3
3
  constructor() {
4
4
  super();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/ome-tiff",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -18,16 +18,16 @@
18
18
  "dependencies": {
19
19
  "d3-array": "^2.4.0",
20
20
  "lodash-es": "^4.17.21",
21
- "@vitessce/abstract": "4.2.0",
22
- "@vitessce/globals": "4.2.0",
23
- "@vitessce/constants-internal": "4.2.0",
24
- "@vitessce/config": "4.2.0",
25
- "@vitessce/gl": "4.2.0",
26
- "@vitessce/sets-utils": "4.2.0",
27
- "@vitessce/image-utils": "4.2.0",
28
- "@vitessce/utils": "4.2.0",
29
- "@vitessce/spatial-utils": "4.2.0",
30
- "@vitessce/error": "4.2.0"
21
+ "@vitessce/globals": "4.2.1",
22
+ "@vitessce/abstract": "4.2.1",
23
+ "@vitessce/error": "4.2.1",
24
+ "@vitessce/config": "4.2.1",
25
+ "@vitessce/constants-internal": "4.2.1",
26
+ "@vitessce/gl": "4.2.1",
27
+ "@vitessce/sets-utils": "4.2.1",
28
+ "@vitessce/spatial-utils": "4.2.1",
29
+ "@vitessce/image-utils": "4.2.1",
30
+ "@vitessce/utils": "4.2.1"
31
31
  },
32
32
  "scripts": {
33
33
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.mjs",