@vitessce/spatial-utils 3.9.7 → 3.9.9

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-Dp7z3eFU.js";
2
+ import { B as BaseDecoder } from "./index-C5cy3J5q.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -120380,22 +120380,22 @@ function addDecoder(cases, importFn) {
120380
120380
  }
120381
120381
  cases.forEach((c) => registry$2.set(c, importFn));
120382
120382
  }
120383
- addDecoder([void 0, 1], () => import("./raw-Dz5RhSxu.js").then((m) => m.default));
120384
- addDecoder(5, () => import("./lzw-4pgnm1Eb.js").then((m) => m.default));
120383
+ addDecoder([void 0, 1], () => import("./raw-BW4rcScv.js").then((m) => m.default));
120384
+ addDecoder(5, () => import("./lzw-DLXXUpEz.js").then((m) => m.default));
120385
120385
  addDecoder(6, () => {
120386
120386
  throw new Error("old style JPEG compression is not supported.");
120387
120387
  });
120388
- addDecoder(7, () => import("./jpeg-D0pcgCKy.js").then((m) => m.default));
120389
- addDecoder([8, 32946], () => import("./deflate-BCS26n3C.js").then((m) => m.default));
120390
- addDecoder(32773, () => import("./packbits-Qp-2JQzP.js").then((m) => m.default));
120388
+ addDecoder(7, () => import("./jpeg-AJv2kZca.js").then((m) => m.default));
120389
+ addDecoder([8, 32946], () => import("./deflate-CVce_-La.js").then((m) => m.default));
120390
+ addDecoder(32773, () => import("./packbits-CN5Wf7cN.js").then((m) => m.default));
120391
120391
  addDecoder(
120392
120392
  34887,
120393
- () => import("./lerc-BHh6dW9L.js").then(async (m) => {
120393
+ () => import("./lerc-8rr5kVc2.js").then(async (m) => {
120394
120394
  await m.zstd.init();
120395
120395
  return m;
120396
120396
  }).then((m) => m.default)
120397
120397
  );
120398
- addDecoder(50001, () => import("./webimage-C7H_-PrH.js").then((m) => m.default));
120398
+ addDecoder(50001, () => import("./webimage-BJe_5cpU.js").then((m) => m.default));
120399
120399
  function decodeRowAcc(row, stride) {
120400
120400
  let length2 = row.length - stride;
120401
120401
  let offset = 0;
@@ -139716,6 +139716,12 @@ function createZarrArrayAdapter(arr) {
139716
139716
  }
139717
139717
  });
139718
139718
  }
139719
+ function flattenOmeAttrs(rootAttrs) {
139720
+ if (rootAttrs && typeof rootAttrs.ome === "object" && rootAttrs.ome !== null) {
139721
+ return { ...rootAttrs.ome, ...rootAttrs };
139722
+ }
139723
+ return rootAttrs;
139724
+ }
139719
139725
  class VitessceError extends Error {
139720
139726
  constructor(message) {
139721
139727
  super(message);
@@ -139760,10 +139766,12 @@ async function loadMultiscales(root2) {
139760
139766
  }
139761
139767
  throw e2;
139762
139768
  }
139769
+ rootAttrs = flattenOmeAttrs(rootAttrs);
139763
139770
  let paths = ["0"];
139764
139771
  let labels = ["t", "c", "z", "y", "x"];
139765
139772
  if ("multiscales" in rootAttrs) {
139766
- const { datasets, axes } = rootAttrs.multiscales[0];
139773
+ const { multiscales } = rootAttrs;
139774
+ const { datasets, axes } = multiscales[0];
139767
139775
  paths = datasets.map((d) => d.path);
139768
139776
  if (axes) {
139769
139777
  if (isAxis(axes)) {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D, e, a, b, c, d, H, G, Z, E, s, n, o, F, C, z, l, m, A, y, h, r, w, q, i, f, j, k, v, u, t, p, x } from "./index-Dp7z3eFU.js";
1
+ import { D, e, a, b, c, d, H, G, Z, E, s, n, o, F, C, z, l, m, A, y, h, r, w, q, i, f, j, k, v, u, t, p, x } from "./index-C5cy3J5q.js";
2
2
  export {
3
3
  D as DEFAULT_CELLS_LAYER,
4
4
  e as DEFAULT_LAYER_TYPE_ORDERING,
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Dp7z3eFU.js";
1
+ import { B as BaseDecoder } from "./index-C5cy3J5q.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-Dp7z3eFU.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-C5cy3J5q.js";
3
3
  const LercParameters = {
4
4
  AddCompression: 1
5
5
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Dp7z3eFU.js";
1
+ import { B as BaseDecoder } from "./index-C5cy3J5q.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-Dp7z3eFU.js";
1
+ import { B as BaseDecoder } from "./index-C5cy3J5q.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-Dp7z3eFU.js";
1
+ import { B as BaseDecoder } from "./index-C5cy3J5q.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-Dp7z3eFU.js";
1
+ import { B as BaseDecoder } from "./index-C5cy3J5q.js";
2
2
  class WebImageDecoder extends BaseDecoder {
3
3
  constructor() {
4
4
  super();
@@ -1,7 +1,7 @@
1
1
  export function guessTileSize(arr: any): number;
2
2
  export function loadOmeZarr(root: any): Promise<{
3
3
  data: ZarritaPixelSource[];
4
- metadata: import("zarrita").Attributes;
4
+ metadata: any;
5
5
  }>;
6
6
  export class ZarritaPixelSource extends viv.ZarrPixelSource<any> {
7
7
  constructor(arr: any, labels: any, tileSize: any);
@@ -1 +1 @@
1
- {"version":3,"file":"load-ome-zarr.d.ts","sourceRoot":"","sources":["../src/load-ome-zarr.js"],"names":[],"mappings":"AAmBA,gDAMC;AA6DD;;;GAaC;AA7BD;IACE,kDASC;IADC,qBAAwB;CAE3B;oBAjFmB,cAAc"}
1
+ {"version":3,"file":"load-ome-zarr.d.ts","sourceRoot":"","sources":["../src/load-ome-zarr.js"],"names":[],"mappings":"AAmBA,gDAMC;AAkED;;;GAaC;AA7BD;IACE,kDASC;IADC,qBAAwB;CAE3B;oBAtFmB,cAAc"}
@@ -1,6 +1,6 @@
1
1
  import { viv } from '@vitessce/gl';
2
2
  import { open as zarrOpen } from 'zarrita';
3
- import { createZarrArrayAdapter } from '@vitessce/zarr-utils';
3
+ import { createZarrArrayAdapter, flattenOmeAttrs } from '@vitessce/zarr-utils';
4
4
  import { ZarrNodeNotFoundError } from '@vitessce/error';
5
5
  function prevPowerOf2(x) {
6
6
  return 2 ** Math.floor(Math.log2(x));
@@ -36,11 +36,15 @@ async function loadMultiscales(root) {
36
36
  // Re-throw the error if it is not a NodeNotFoundError.
37
37
  throw e;
38
38
  }
39
+ // OME-NGFF v0.5 nests OME metadata under an `ome` key.
40
+ // Hoist it to the root so downstream consumers see the flat v0.4 shape.
41
+ rootAttrs = flattenOmeAttrs(rootAttrs);
39
42
  let paths = ['0'];
40
43
  // Default axes used for v0.1 and v0.2.
41
44
  let labels = ['t', 'c', 'z', 'y', 'x'];
42
45
  if ('multiscales' in rootAttrs) {
43
- const { datasets, axes } = rootAttrs.multiscales[0];
46
+ const { multiscales } = rootAttrs;
47
+ const { datasets, axes } = multiscales[0];
44
48
  paths = datasets.map(d => d.path);
45
49
  if (axes) {
46
50
  if (isAxis(axes)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/spatial-utils",
3
- "version": "3.9.7",
3
+ "version": "3.9.9",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -21,12 +21,12 @@
21
21
  "math.gl": "^3.5.6",
22
22
  "mathjs": "^9.2.0",
23
23
  "internmap": "^2.0.3",
24
- "@vitessce/zarr-utils": "3.9.7",
25
- "@vitessce/gl": "3.9.7",
26
- "@vitessce/utils": "3.9.7",
27
- "@vitessce/constants-internal": "3.9.7",
28
- "@vitessce/globals": "3.9.7",
29
- "@vitessce/error": "3.9.7"
24
+ "@vitessce/utils": "3.9.9",
25
+ "@vitessce/gl": "3.9.9",
26
+ "@vitessce/zarr-utils": "3.9.9",
27
+ "@vitessce/constants-internal": "3.9.9",
28
+ "@vitessce/error": "3.9.9",
29
+ "@vitessce/globals": "3.9.9"
30
30
  },
31
31
  "scripts": {
32
32
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.mjs",
@@ -1,6 +1,6 @@
1
1
  import { viv } from '@vitessce/gl';
2
2
  import { open as zarrOpen } from 'zarrita';
3
- import { createZarrArrayAdapter } from '@vitessce/zarr-utils';
3
+ import { createZarrArrayAdapter, flattenOmeAttrs } from '@vitessce/zarr-utils';
4
4
  import { ZarrNodeNotFoundError } from '@vitessce/error';
5
5
 
6
6
  function prevPowerOf2(x) {
@@ -41,11 +41,16 @@ async function loadMultiscales(root) {
41
41
  throw e;
42
42
  }
43
43
 
44
+ // OME-NGFF v0.5 nests OME metadata under an `ome` key.
45
+ // Hoist it to the root so downstream consumers see the flat v0.4 shape.
46
+ rootAttrs = flattenOmeAttrs(rootAttrs);
47
+
44
48
  let paths = ['0'];
45
49
  // Default axes used for v0.1 and v0.2.
46
50
  let labels = ['t', 'c', 'z', 'y', 'x'];
47
51
  if ('multiscales' in rootAttrs) {
48
- const { datasets, axes } = rootAttrs.multiscales[0];
52
+ const { multiscales } = rootAttrs;
53
+ const { datasets, axes } = multiscales[0];
49
54
  paths = datasets.map(d => d.path);
50
55
  if (axes) {
51
56
  if (isAxis(axes)) {