@vitessce/image-utils 3.6.6 → 3.6.7

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-DM2-ZM-A.js";
2
+ import { B as BaseDecoder } from "./index-DAesl-Fs.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -120224,22 +120224,22 @@ function addDecoder(cases, importFn) {
120224
120224
  }
120225
120225
  cases.forEach((c) => registry$1.set(c, importFn));
120226
120226
  }
120227
- addDecoder([void 0, 1], () => import("./raw-Bz42nnyn.js").then((m) => m.default));
120228
- addDecoder(5, () => import("./lzw-CleychH0.js").then((m) => m.default));
120227
+ addDecoder([void 0, 1], () => import("./raw-D2BhjYdV.js").then((m) => m.default));
120228
+ addDecoder(5, () => import("./lzw-DmH9LNuu.js").then((m) => m.default));
120229
120229
  addDecoder(6, () => {
120230
120230
  throw new Error("old style JPEG compression is not supported.");
120231
120231
  });
120232
- addDecoder(7, () => import("./jpeg-BqomB91U.js").then((m) => m.default));
120233
- addDecoder([8, 32946], () => import("./deflate-C_JiGtg2.js").then((m) => m.default));
120234
- addDecoder(32773, () => import("./packbits-vczGr1n0.js").then((m) => m.default));
120232
+ addDecoder(7, () => import("./jpeg-RS5nId0k.js").then((m) => m.default));
120233
+ addDecoder([8, 32946], () => import("./deflate-CYCHQGYv.js").then((m) => m.default));
120234
+ addDecoder(32773, () => import("./packbits-wJQ_J7RA.js").then((m) => m.default));
120235
120235
  addDecoder(
120236
120236
  34887,
120237
- () => import("./lerc-QsX1FZrM.js").then(async (m) => {
120237
+ () => import("./lerc-frA8I8i3.js").then(async (m) => {
120238
120238
  await m.zstd.init();
120239
120239
  return m;
120240
120240
  }).then((m) => m.default)
120241
120241
  );
120242
- addDecoder(50001, () => import("./webimage-CE6ZfP1L.js").then((m) => m.default));
120242
+ addDecoder(50001, () => import("./webimage-BAE-tDiz.js").then((m) => m.default));
120243
120243
  function decodeRowAcc(row, stride) {
120244
120244
  let length2 = row.length - stride;
120245
120245
  let offset = 0;
@@ -137418,6 +137418,44 @@ function hexToRgb(hex) {
137418
137418
  parseInt(result[3].toLowerCase(), 16)
137419
137419
  ];
137420
137420
  }
137421
+ function normalizeCoordinateTransformations(coordinateTransformations, datasets) {
137422
+ var _a3;
137423
+ let result = [];
137424
+ if (Array.isArray(coordinateTransformations)) {
137425
+ result = coordinateTransformations.flatMap((transform2) => {
137426
+ if (transform2.input && transform2.output) {
137427
+ const { type } = transform2;
137428
+ if (type === "translation") {
137429
+ return {
137430
+ type,
137431
+ translation: transform2.translation
137432
+ };
137433
+ }
137434
+ if (type === "scale") {
137435
+ return {
137436
+ type,
137437
+ scale: transform2.scale
137438
+ };
137439
+ }
137440
+ if (type === "identity") {
137441
+ return { type };
137442
+ }
137443
+ if (type === "sequence") {
137444
+ return normalizeCoordinateTransformations(transform2.transformations, datasets);
137445
+ }
137446
+ log$5.warn(`Coordinate transformation type "${type}" is not supported.`);
137447
+ }
137448
+ return transform2;
137449
+ });
137450
+ }
137451
+ if (Array.isArray((_a3 = datasets == null ? void 0 : datasets[0]) == null ? void 0 : _a3.coordinateTransformations)) {
137452
+ result = [
137453
+ ...datasets[0].coordinateTransformations,
137454
+ ...result
137455
+ ];
137456
+ }
137457
+ return result;
137458
+ }
137421
137459
  function getDomains() {
137422
137460
  const domains = {};
137423
137461
  const needMin = ["Int8", "Int16", "Int32"];
@@ -137470,7 +137508,8 @@ class ImageWrapper {
137470
137508
  const {
137471
137509
  multiscales: [
137472
137510
  {
137473
- coordinateTransformations,
137511
+ datasets,
137512
+ coordinateTransformations: coordinateTransformationsFromFile,
137474
137513
  axes
137475
137514
  }
137476
137515
  ]
@@ -137480,8 +137519,12 @@ class ImageWrapper {
137480
137519
  coordinateTransformationsFromOptions,
137481
137520
  ngffAxes
137482
137521
  );
137522
+ const normCoordinateTransformationsFromFile = normalizeCoordinateTransformations(
137523
+ coordinateTransformationsFromFile,
137524
+ datasets
137525
+ );
137483
137526
  const transformMatrixFromFile = coordinateTransformationsToMatrix(
137484
- coordinateTransformations,
137527
+ normCoordinateTransformationsFromFile,
137485
137528
  ngffAxes
137486
137529
  );
137487
137530
  const transformMatrix = transformMatrixFromFile.multiplyLeft(transformMatrixFromOptions);
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { I } from "./index-DM2-ZM-A.js";
1
+ import { I } from "./index-DAesl-Fs.js";
2
2
  export {
3
3
  I as ImageWrapper
4
4
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-DM2-ZM-A.js";
1
+ import { B as BaseDecoder } from "./index-DAesl-Fs.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 } from "./index-DM2-ZM-A.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-DAesl-Fs.js";
3
3
  const LercParameters = {
4
4
  AddCompression: 1
5
5
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-DM2-ZM-A.js";
1
+ import { B as BaseDecoder } from "./index-DAesl-Fs.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-DM2-ZM-A.js";
1
+ import { B as BaseDecoder } from "./index-DAesl-Fs.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-DM2-ZM-A.js";
1
+ import { B as BaseDecoder } from "./index-DAesl-Fs.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-DM2-ZM-A.js";
1
+ import { B as BaseDecoder } from "./index-DAesl-Fs.js";
2
2
  class WebImageDecoder extends BaseDecoder {
3
3
  constructor() {
4
4
  super();
@@ -1 +1 @@
1
- {"version":3,"file":"ImageWrapper.d.ts","sourceRoot":"","sources":["../src/ImageWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,YAAY,EACb,MAAM,iBAAiB,CAAC;AAczB;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,YAAW,oBAAoB;IAC/D,SAAS,EAAE,aAAa,CAAC;IAEzB,OAAO,EAAE,YAAY,CAAC;gBAEV,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY;IAK3D,OAAO,IAAI,UAAU,GAAG,UAAU;IAUlC,eAAe,IAAI,OAAO;IAuB1B,OAAO,IAAI,iBAAiB;IAI5B,cAAc,IAAI,MAAM,EAAE;IAyD1B,iBAAiB,IAAI,MAAM;IAe3B,iBAAiB,IAAI,MAAM;IAe3B,OAAO,IAAI,MAAM;IAyBjB,cAAc,IAAI,MAAM;IAmCxB,eAAe,IAAI,MAAM,EAAE;IAiC3B,eAAe,CAAC,gBAAgB,EAAE,MAAM,GAAC,MAAM,GAAG,MAAM;IAexD,iBAAiB,IAAI,aAAa,EAAE;IA6DpC,QAAQ,IAAI,MAAM,GAAG,SAAS;IAS9B,SAAS,IAAI,OAAO;IAOpB,SAAS,IAAI,OAAO;IAOpB,OAAO,IAAI,MAAM;IAMjB,OAAO,IAAI,MAAM;IAMjB,iBAAiB,IAAI,OAAO;IAU5B,uBAAuB,IAAI,gBAAgB,EAAE;IAsB7C;;;;;OAKG;IACH,uBAAuB,IAAI,MAAM,GAAC,IAAI;IAetC,eAAe,IAA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rix, getNgffAxes, getNgffAxesForTiff, physicalSizeToMatrix, hexToRgb, getSourceFromLoader, canLoadResolution, getStatsForResolution, isInterleaved as isInterleavedUtil, } from '@vitessce/spatial-utils';
1
+ import { normalizeCoordinateTransformations, coordinateTransformationsToMatrix, getNgffAxes, getNgffAxesForTiff, physicalSizeToMatrix, hexToRgb, getSourceFromLoader, canLoadResolution, getStatsForResolution, isInterleaved as isInterleavedUtil, } from '@vitessce/spatial-utils';
2
2
  import { VIEWER_PALETTE } from '@vitessce/utils';
3
3
  import { log } from '@vitessce/globals';
4
4
  /**
@@ -45,11 +45,13 @@ export default class ImageWrapper {
45
45
  // from the image file.
46
46
  if ('multiscales' in this.vivLoader.metadata) {
47
47
  // OME-Zarr case.
48
- const { multiscales: [{ coordinateTransformations, axes, },], } = this.vivLoader.metadata;
48
+ const { multiscales: [{ datasets, coordinateTransformations: coordinateTransformationsFromFile, axes, },], } = this.vivLoader.metadata;
49
49
  // Axes in v0.4 format.
50
50
  const ngffAxes = getNgffAxes(axes);
51
51
  const transformMatrixFromOptions = coordinateTransformationsToMatrix(coordinateTransformationsFromOptions, ngffAxes);
52
- const transformMatrixFromFile = coordinateTransformationsToMatrix(coordinateTransformations, ngffAxes);
52
+ // Normalize the coordinate transformations from the file.
53
+ const normCoordinateTransformationsFromFile = normalizeCoordinateTransformations(coordinateTransformationsFromFile, datasets);
54
+ const transformMatrixFromFile = coordinateTransformationsToMatrix(normCoordinateTransformationsFromFile, ngffAxes);
53
55
  const transformMatrix = transformMatrixFromFile.multiplyLeft(transformMatrixFromOptions);
54
56
  return transformMatrix;
55
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/image-utils",
3
- "version": "3.6.6",
3
+ "version": "3.6.7",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -17,10 +17,10 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "@hms-dbmi/viv": "~0.16.0",
20
- "@vitessce/types": "3.6.6",
21
- "@vitessce/spatial-utils": "3.6.6",
22
- "@vitessce/utils": "3.6.6",
23
- "@vitessce/globals": "3.6.6"
20
+ "@vitessce/types": "3.6.7",
21
+ "@vitessce/spatial-utils": "3.6.7",
22
+ "@vitessce/utils": "3.6.7",
23
+ "@vitessce/globals": "3.6.7"
24
24
  },
25
25
  "devDependencies": {
26
26
  "vite": "^6.3.5",
@@ -8,6 +8,7 @@ import type {
8
8
  BoundingCube,
9
9
  } from '@vitessce/types';
10
10
  import {
11
+ normalizeCoordinateTransformations,
11
12
  coordinateTransformationsToMatrix,
12
13
  getNgffAxes,
13
14
  getNgffAxesForTiff,
@@ -82,7 +83,8 @@ export default class ImageWrapper implements AbstractImageWrapper {
82
83
  const {
83
84
  multiscales: [
84
85
  {
85
- coordinateTransformations,
86
+ datasets,
87
+ coordinateTransformations: coordinateTransformationsFromFile,
86
88
  axes,
87
89
  },
88
90
  ],
@@ -92,8 +94,12 @@ export default class ImageWrapper implements AbstractImageWrapper {
92
94
  const transformMatrixFromOptions = coordinateTransformationsToMatrix(
93
95
  coordinateTransformationsFromOptions, ngffAxes,
94
96
  );
97
+ // Normalize the coordinate transformations from the file.
98
+ const normCoordinateTransformationsFromFile = normalizeCoordinateTransformations(
99
+ coordinateTransformationsFromFile, datasets,
100
+ );
95
101
  const transformMatrixFromFile = coordinateTransformationsToMatrix(
96
- coordinateTransformations, ngffAxes,
102
+ normCoordinateTransformationsFromFile, ngffAxes,
97
103
  );
98
104
  const transformMatrix = transformMatrixFromFile.multiplyLeft(transformMatrixFromOptions);
99
105
  return transformMatrix;