@vitessce/ome-tiff 3.6.7 → 3.6.8

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-DayW9LOs.js";
2
+ import { B as BaseDecoder } from "./index-DVU_YY8y.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -104771,22 +104771,22 @@ async function getDecoder(fileDirectory) {
104771
104771
  const Decoder = await importFn();
104772
104772
  return new Decoder(fileDirectory);
104773
104773
  }
104774
- addDecoder([void 0, 1], () => import("./raw-8RpAiEWv.js").then((m) => m.default));
104775
- addDecoder(5, () => import("./lzw-C3j8n_C_.js").then((m) => m.default));
104774
+ addDecoder([void 0, 1], () => import("./raw-C3hLu5jb.js").then((m) => m.default));
104775
+ addDecoder(5, () => import("./lzw-Ce2kmxIQ.js").then((m) => m.default));
104776
104776
  addDecoder(6, () => {
104777
104777
  throw new Error("old style JPEG compression is not supported.");
104778
104778
  });
104779
- addDecoder(7, () => import("./jpeg-BHVrU3cB.js").then((m) => m.default));
104780
- addDecoder([8, 32946], () => import("./deflate-Cf0xAa_y.js").then((m) => m.default));
104781
- addDecoder(32773, () => import("./packbits-aUchmhLK.js").then((m) => m.default));
104779
+ addDecoder(7, () => import("./jpeg-CCpTe65J.js").then((m) => m.default));
104780
+ addDecoder([8, 32946], () => import("./deflate-BmN326NK.js").then((m) => m.default));
104781
+ addDecoder(32773, () => import("./packbits-DmSd6DAT.js").then((m) => m.default));
104782
104782
  addDecoder(
104783
104783
  34887,
104784
- () => import("./lerc-DcvJGmf8.js").then(async (m) => {
104784
+ () => import("./lerc-CS9H9Ndh.js").then(async (m) => {
104785
104785
  await m.zstd.init();
104786
104786
  return m;
104787
104787
  }).then((m) => m.default)
104788
104788
  );
104789
- addDecoder(50001, () => import("./webimage-DAZ0DnAA.js").then((m) => m.default));
104789
+ addDecoder(50001, () => import("./webimage-DItILlGR.js").then((m) => m.default));
104790
104790
  function copyNewSize(array, width, height, samplesPerPixel = 1) {
104791
104791
  return new (Object.getPrototypeOf(array)).constructor(width * height * samplesPerPixel);
104792
104792
  }
@@ -141521,11 +141521,80 @@ function getNgffAxesForTiff(dimOrder) {
141521
141521
  type: getDefaultAxisType(name2)
141522
141522
  }));
141523
141523
  }
141524
+ function getSwapAxesMatrix(inputAxes, outputAxes) {
141525
+ const size2 = inputAxes.length;
141526
+ if (!(size2 === 2 || size2 === 3)) {
141527
+ throw new Error(`Expected input and output axes to have 2 or 3 elements, got ${size2}.`);
141528
+ }
141529
+ const matrix2 = [
141530
+ [0, 0, 0, 0],
141531
+ [0, 0, 0, 0],
141532
+ [0, 0, size2 === 2 ? 1 : 0, 0],
141533
+ // In 2D, leave Z unchanged.
141534
+ [0, 0, 0, 1]
141535
+ ];
141536
+ for (let outRow = 0; outRow < size2; outRow++) {
141537
+ const axis = outputAxes[outRow];
141538
+ const inCol = inputAxes.indexOf(axis);
141539
+ if (inCol === -1) {
141540
+ throw new Error(`Axis "${axis}" not found in inputAxes`);
141541
+ }
141542
+ matrix2[outRow][inCol] = 1;
141543
+ }
141544
+ return matrix2;
141545
+ }
141524
141546
  function coordinateTransformationsToMatrix(coordinateTransformations, axes) {
141525
141547
  let mat = new Matrix4().identity();
141526
141548
  if (coordinateTransformations && axes) {
141527
141549
  const xyzIndices = ["x", "y", "z"].map((name2) => axes.findIndex((axisObj) => axisObj.type === "space" && axisObj.name === name2));
141528
141550
  coordinateTransformations.forEach((transform2) => {
141551
+ if (transform2.type === "affine") {
141552
+ const { affine, input, output } = transform2;
141553
+ const excludeEntries = input.axes.map((axis, i2) => [axis, i2]).filter(([axis, i2]) => axis.type !== "space").map(([axis, i2]) => i2);
141554
+ const filteredAffine = affine.filter((_, i2) => !excludeEntries.includes(i2)).map((row) => row.filter((_, i2) => !excludeEntries.includes(i2)));
141555
+ const spatialInputAxes = input.axes.filter((axis) => axis.type === "space");
141556
+ const spatialOutputAxes = output.axes.filter((axis) => axis.type === "space");
141557
+ const inputAxisNames = spatialInputAxes.map((axis) => axis.name);
141558
+ const outputAxisNames = spatialOutputAxes.map((axis) => axis.name);
141559
+ if (spatialInputAxes.length === 3) {
141560
+ const nextMat = new Matrix4().fromArray([
141561
+ ...filteredAffine[0],
141562
+ ...filteredAffine[1],
141563
+ ...filteredAffine[2],
141564
+ 0,
141565
+ 0,
141566
+ 0,
141567
+ 1
141568
+ ]);
141569
+ mat = mat.multiplyLeft(nextMat);
141570
+ if (!isEqual(inputAxisNames, outputAxisNames)) {
141571
+ const swapMatNested = getSwapAxesMatrix(inputAxisNames, outputAxisNames);
141572
+ const swapMat = new Matrix4().fromArray(swapMatNested.flat());
141573
+ mat = mat.multiplyLeft(swapMat);
141574
+ }
141575
+ } else if (spatialOutputAxes.length === 2) {
141576
+ const nextMat = new Matrix4().fromArray([
141577
+ ...filteredAffine[0],
141578
+ ...filteredAffine[1],
141579
+ 0,
141580
+ 0,
141581
+ 1,
141582
+ 0,
141583
+ 0,
141584
+ 0,
141585
+ 0,
141586
+ 1
141587
+ ]);
141588
+ mat = mat.multiplyLeft(nextMat);
141589
+ if (!isEqual(inputAxisNames, outputAxisNames)) {
141590
+ const swapMatNested = getSwapAxesMatrix(inputAxisNames, outputAxisNames);
141591
+ const swapMat = new Matrix4().fromArray(swapMatNested.flat());
141592
+ mat = mat.multiplyLeft(swapMat);
141593
+ }
141594
+ } else {
141595
+ throw new Error("Affine transformation must have 2 or 3 rows.");
141596
+ }
141597
+ }
141529
141598
  if (transform2.type === "translation") {
141530
141599
  const { translation: axisOrderedTranslation } = transform2;
141531
141600
  if (axisOrderedTranslation.length !== axes.length) {
@@ -141577,6 +141646,16 @@ function normalizeCoordinateTransformations(coordinateTransformations, datasets)
141577
141646
  scale: transform2.scale
141578
141647
  };
141579
141648
  }
141649
+ if (type === "affine") {
141650
+ return {
141651
+ type,
141652
+ affine: transform2.affine,
141653
+ // Affine transformations can potentially swap axes,
141654
+ // so we need to include the input and output axes.
141655
+ input: transform2.input,
141656
+ output: transform2.output
141657
+ };
141658
+ }
141580
141659
  if (type === "identity") {
141581
141660
  return { type };
141582
141661
  }
@@ -141611,6 +141690,7 @@ class ImageWrapper {
141611
141690
  constructor(vivLoader, options) {
141612
141691
  __publicField(this, "vivLoader");
141613
141692
  __publicField(this, "options");
141693
+ __publicField(this, "modelMatrix", null);
141614
141694
  this.options = options || {};
141615
141695
  this.vivLoader = vivLoader;
141616
141696
  }
@@ -141634,6 +141714,12 @@ class ImageWrapper {
141634
141714
  return this.vivLoader.data;
141635
141715
  }
141636
141716
  getModelMatrix() {
141717
+ if (!this.modelMatrix) {
141718
+ this.modelMatrix = this._getModelMatrix();
141719
+ }
141720
+ return this.modelMatrix;
141721
+ }
141722
+ _getModelMatrix() {
141637
141723
  const { coordinateTransformations: coordinateTransformationsFromOptions } = this.options;
141638
141724
  if ("multiscales" in this.vivLoader.metadata) {
141639
141725
  const { multiscales: [{ datasets, coordinateTransformations: coordinateTransformationsFromFile, axes }] } = this.vivLoader.metadata;
@@ -141785,15 +141871,45 @@ class ImageWrapper {
141785
141871
  hasZStack() {
141786
141872
  const loader = this.vivLoader;
141787
141873
  const { labels, shape } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
141874
+ if (!labels.includes("z")) {
141875
+ return false;
141876
+ }
141788
141877
  const hasZStack = shape[labels.indexOf("z")] > 1;
141789
141878
  return hasZStack;
141790
141879
  }
141791
141880
  hasTStack() {
141792
141881
  const loader = this.vivLoader;
141793
141882
  const { labels, shape } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
141883
+ if (!labels.includes("t")) {
141884
+ return false;
141885
+ }
141794
141886
  const hasTStack = shape[labels.indexOf("t")] > 1;
141795
141887
  return hasTStack;
141796
141888
  }
141889
+ hasCStack() {
141890
+ const loader = this.vivLoader;
141891
+ const { labels, shape } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
141892
+ if (!labels.includes("c")) {
141893
+ return false;
141894
+ }
141895
+ const hasCStack = shape[labels.indexOf("c")] > 1;
141896
+ return hasCStack;
141897
+ }
141898
+ hasDimZ() {
141899
+ const loader = this.vivLoader;
141900
+ const { labels } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
141901
+ return labels.includes("z");
141902
+ }
141903
+ hasDimT() {
141904
+ const loader = this.vivLoader;
141905
+ const { labels } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
141906
+ return labels.includes("t");
141907
+ }
141908
+ hasDimC() {
141909
+ const loader = this.vivLoader;
141910
+ const { labels } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
141911
+ return labels.includes("c");
141912
+ }
141797
141913
  getNumZ() {
141798
141914
  const loader = this.vivLoader;
141799
141915
  const { labels, shape } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
@@ -141804,6 +141920,11 @@ class ImageWrapper {
141804
141920
  const { labels, shape } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
141805
141921
  return shape[labels.indexOf("t")];
141806
141922
  }
141923
+ getNumC() {
141924
+ const loader = this.vivLoader;
141925
+ const { labels, shape } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
141926
+ return shape[labels.indexOf("c")];
141927
+ }
141807
141928
  isMultiResolution() {
141808
141929
  const loader = this.vivLoader;
141809
141930
  const hasViewableResolutions = Boolean(Array.from({
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c, b, O } from "./index-DayW9LOs.js";
1
+ import { c, b, O } from "./index-DVU_YY8y.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-DayW9LOs.js";
1
+ import { B as BaseDecoder } from "./index-DVU_YY8y.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-DayW9LOs.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-DVU_YY8y.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-DayW9LOs.js";
1
+ import { B as BaseDecoder } from "./index-DVU_YY8y.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-DayW9LOs.js";
1
+ import { B as BaseDecoder } from "./index-DVU_YY8y.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-DayW9LOs.js";
1
+ import { B as BaseDecoder } from "./index-DVU_YY8y.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-DayW9LOs.js";
1
+ import { B as BaseDecoder } from "./index-DVU_YY8y.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": "3.6.7",
3
+ "version": "3.6.8",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -18,14 +18,15 @@
18
18
  "dependencies": {
19
19
  "d3-array": "^2.4.0",
20
20
  "lodash-es": "^4.17.21",
21
- "@vitessce/abstract": "3.6.7",
22
- "@vitessce/constants-internal": "3.6.7",
23
- "@vitessce/config": "3.6.7",
24
- "@vitessce/sets-utils": "3.6.7",
25
- "@vitessce/spatial-utils": "3.6.7",
26
- "@vitessce/image-utils": "3.6.7",
27
- "@vitessce/utils": "3.6.7",
28
- "@vitessce/gl": "3.6.7"
21
+ "@vitessce/abstract": "3.6.8",
22
+ "@vitessce/error": "3.6.8",
23
+ "@vitessce/constants-internal": "3.6.8",
24
+ "@vitessce/config": "3.6.8",
25
+ "@vitessce/gl": "3.6.8",
26
+ "@vitessce/sets-utils": "3.6.8",
27
+ "@vitessce/spatial-utils": "3.6.8",
28
+ "@vitessce/image-utils": "3.6.8",
29
+ "@vitessce/utils": "3.6.8"
29
30
  },
30
31
  "scripts": {
31
32
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",