@vitessce/spatial-utils 3.7.0 → 3.8.0

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-CBSvaLO6.js";
2
+ import { B as BaseDecoder } from "./index-zLXH8-s_.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -120352,22 +120352,22 @@ function addDecoder(cases, importFn) {
120352
120352
  }
120353
120353
  cases.forEach((c) => registry$2.set(c, importFn));
120354
120354
  }
120355
- addDecoder([void 0, 1], () => import("./raw-DhyvnYlB.js").then((m) => m.default));
120356
- addDecoder(5, () => import("./lzw-DKnbTiWI.js").then((m) => m.default));
120355
+ addDecoder([void 0, 1], () => import("./raw-DZY6tqRx.js").then((m) => m.default));
120356
+ addDecoder(5, () => import("./lzw-DSzM2vzP.js").then((m) => m.default));
120357
120357
  addDecoder(6, () => {
120358
120358
  throw new Error("old style JPEG compression is not supported.");
120359
120359
  });
120360
- addDecoder(7, () => import("./jpeg-4MwzTqe4.js").then((m) => m.default));
120361
- addDecoder([8, 32946], () => import("./deflate-BfpHzB-E.js").then((m) => m.default));
120362
- addDecoder(32773, () => import("./packbits-sLzL54X2.js").then((m) => m.default));
120360
+ addDecoder(7, () => import("./jpeg-ByXD9maJ.js").then((m) => m.default));
120361
+ addDecoder([8, 32946], () => import("./deflate-D_2UO6fa.js").then((m) => m.default));
120362
+ addDecoder(32773, () => import("./packbits-CrqHVPsh.js").then((m) => m.default));
120363
120363
  addDecoder(
120364
120364
  34887,
120365
- () => import("./lerc-CewuM7hX.js").then(async (m) => {
120365
+ () => import("./lerc-BQbF85ET.js").then(async (m) => {
120366
120366
  await m.zstd.init();
120367
120367
  return m;
120368
120368
  }).then((m) => m.default)
120369
120369
  );
120370
- addDecoder(50001, () => import("./webimage-BV-EwN7e.js").then((m) => m.default));
120370
+ addDecoder(50001, () => import("./webimage-CFSHFGmn.js").then((m) => m.default));
120371
120371
  function decodeRowAcc(row, stride) {
120372
120372
  let length2 = row.length - stride;
120373
120373
  let offset = 0;
@@ -137813,13 +137813,18 @@ const getStatsForResolution = (loader, resolution) => {
137813
137813
  const height = shape[labels.indexOf("y")];
137814
137814
  const width = shape[labels.indexOf("x")];
137815
137815
  const depth = shape[labels.indexOf("z")];
137816
+ const dims = Object.fromEntries(
137817
+ labels.map((label, i2) => [label, shape[i2]])
137818
+ );
137816
137819
  const depthDownsampled = Math.max(1, depth >> resolution);
137817
137820
  const totalBytes = 4 * height * width * depthDownsampled;
137818
137821
  return {
137819
137822
  height,
137820
137823
  width,
137824
+ depth,
137821
137825
  depthDownsampled,
137822
- totalBytes
137826
+ totalBytes,
137827
+ dims
137823
137828
  };
137824
137829
  };
137825
137830
  const canLoadResolution = (loader, resolution) => {
@@ -137834,7 +137839,7 @@ const canLoadResolution = (loader, resolution) => {
137834
137839
  );
137835
137840
  const maxHeapSize = window.performance?.memory && window.performance?.memory?.jsHeapSizeLimit / 2;
137836
137841
  const maxSize = maxHeapSize || 2 ** 31 - 1;
137837
- return totalBytes < maxSize && height <= 2048 && depthDownsampled <= 2048 && width <= 2048 && depthDownsampled > 1;
137842
+ return totalBytes < maxSize && height <= 2048 && width <= 2048 && depthDownsampled <= 2048;
137838
137843
  };
137839
137844
  function isRgb(loader, channels2) {
137840
137845
  const source = getSourceFromLoader(loader);
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-CBSvaLO6.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-zLXH8-s_.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-CBSvaLO6.js";
1
+ import { B as BaseDecoder } from "./index-zLXH8-s_.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-CBSvaLO6.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-zLXH8-s_.js";
3
3
  const LercParameters = {
4
4
  AddCompression: 1
5
5
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-CBSvaLO6.js";
1
+ import { B as BaseDecoder } from "./index-zLXH8-s_.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-CBSvaLO6.js";
1
+ import { B as BaseDecoder } from "./index-zLXH8-s_.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-CBSvaLO6.js";
1
+ import { B as BaseDecoder } from "./index-zLXH8-s_.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-CBSvaLO6.js";
1
+ import { B as BaseDecoder } from "./index-zLXH8-s_.js";
2
2
  class WebImageDecoder extends BaseDecoder {
3
3
  constructor() {
4
4
  super();
@@ -100,8 +100,12 @@ export function coordinateTransformationsToMatrixForSpatialData(ngffMetadata: {
100
100
  export function getStatsForResolution(loader: any, resolution: any): {
101
101
  height: any;
102
102
  width: any;
103
+ depth: any;
103
104
  depthDownsampled: number;
104
105
  totalBytes: number;
106
+ dims: {
107
+ [k: string]: any;
108
+ };
105
109
  };
106
110
  export function canLoadResolution(loader: any, resolution: any): boolean;
107
111
  import { Matrix4 } from 'math.gl';
@@ -1 +1 @@
1
- {"version":3,"file":"spatial.d.ts","sourceRoot":"","sources":["../src/spatial.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,4CAJW,MAAM,SACN,MAAM,GAAG,SAAS,GAChB,MAAM,CAMlB;AAoCD;;;;GAIG;AACH,8BAHW,MAAM,YACN,KAAK,GAAC,IAAI,WAiBpB;AAID,sHAmCC;AAiHD;;GAEG;AACH,qCAFW,KAAK,CAAE,MAAM,CAAC,WAKxB;AAED;;;;;;GAMG;AACH,gDALW,MAAM,eAEJ,MAAM,EAAE,CAuCpB;AAED;;;;;;;;;GASG;AACH,gEAJW,MAAM,EAAE,sBAER,CAAC,MAAM,EAAE,GAAC,IAAI,CAAC,+CAuEzB;AASD;;;IAuBC;AAED,uDAQC;AAED;;;;;;GAMG;AACH,6CAJW,CAAC,GAAG,GAAC,GAAG,GAAC,GAAG,CAAC,EAAE,cACf,CAAC,GAAG,GAAC,GAAG,GAAC,GAAG,CAAC,EAAE,GACd,MAAM,EAAE,EAAE,CA6BrB;AAED;;;;;;;;GAQG;AACH,6EANW,MAAM,EAAE,GAAC,SAAS,QAElB,MAAM,EAAE,GAAC,SAAS,GAEhB,OAAO,CAiHnB;AAED,6CAOC;AAMD,8CASC;AAED,iEAKC;AAGD;;;;;;;;;GASG;AACH,8EANW,MAAM,EAAE,GAAC,SAAS,YAGlB,MAAM,EAAE,GACN,MAAM,EAAE,CA4CpB;AAED;;;;;;;;;;;;;;GAcG;AACH,8EAVW;IACV,GAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,CAAC;IACrE,yBAA4B,CAAC,EAAE,MAAM,EAAE,CAAC;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,EAAE,MAAM,EAAE,CAAC;IACxC,QAAW,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB,0BAEO,MAAM,GACJ,OAAO,CA2CnB;AA7qBM;;;;;;;;;EAiBN;AAEM,yEAiBN;wBAzDuB,SAAS"}
@@ -23,12 +23,13 @@ export const getStatsForResolution = (loader, resolution) => {
23
23
  const height = shape[labels.indexOf('y')];
24
24
  const width = shape[labels.indexOf('x')];
25
25
  const depth = shape[labels.indexOf('z')];
26
+ const dims = Object.fromEntries(labels.map((label, i) => ([label, shape[i]])));
26
27
  // eslint-disable-next-line no-bitwise
27
28
  const depthDownsampled = Math.max(1, depth >> resolution);
28
29
  // Check memory allocation limits for Float32Array (used in XR3DLayer for rendering)
29
30
  const totalBytes = 4 * height * width * depthDownsampled;
30
31
  return {
31
- height, width, depthDownsampled, totalBytes,
32
+ height, width, depth, depthDownsampled, totalBytes, dims,
32
33
  };
33
34
  };
34
35
  export const canLoadResolution = (loader, resolution) => {
@@ -39,9 +40,8 @@ export const canLoadResolution = (loader, resolution) => {
39
40
  // 2048 is a normal texture size limit although some browsers go larger.
40
41
  return (totalBytes < maxSize
41
42
  && height <= 2048
42
- && depthDownsampled <= 2048
43
43
  && width <= 2048
44
- && depthDownsampled > 1);
44
+ && depthDownsampled <= 2048);
45
45
  };
46
46
  /**
47
47
  * Helper method to determine whether pixel data is interleaved and rgb or not.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/spatial-utils",
3
- "version": "3.7.0",
3
+ "version": "3.8.0",
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/gl": "3.7.0",
25
- "@vitessce/utils": "3.7.0",
26
- "@vitessce/zarr-utils": "3.7.0",
27
- "@vitessce/constants-internal": "3.7.0",
28
- "@vitessce/globals": "3.7.0",
29
- "@vitessce/error": "3.7.0"
24
+ "@vitessce/gl": "3.8.0",
25
+ "@vitessce/utils": "3.8.0",
26
+ "@vitessce/zarr-utils": "3.8.0",
27
+ "@vitessce/constants-internal": "3.8.0",
28
+ "@vitessce/globals": "3.8.0",
29
+ "@vitessce/error": "3.8.0"
30
30
  },
31
31
  "scripts": {
32
32
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.mjs",
package/src/spatial.js CHANGED
@@ -25,12 +25,17 @@ export const getStatsForResolution = (loader, resolution) => {
25
25
  const height = shape[labels.indexOf('y')];
26
26
  const width = shape[labels.indexOf('x')];
27
27
  const depth = shape[labels.indexOf('z')];
28
+
29
+ const dims = Object.fromEntries(
30
+ labels.map((label, i) => ([label, shape[i]])),
31
+ );
32
+
28
33
  // eslint-disable-next-line no-bitwise
29
34
  const depthDownsampled = Math.max(1, depth >> resolution);
30
35
  // Check memory allocation limits for Float32Array (used in XR3DLayer for rendering)
31
36
  const totalBytes = 4 * height * width * depthDownsampled;
32
37
  return {
33
- height, width, depthDownsampled, totalBytes,
38
+ height, width, depth, depthDownsampled, totalBytes, dims,
34
39
  };
35
40
  };
36
41
 
@@ -48,9 +53,8 @@ export const canLoadResolution = (loader, resolution) => {
48
53
  return (
49
54
  totalBytes < maxSize
50
55
  && height <= 2048
51
- && depthDownsampled <= 2048
52
56
  && width <= 2048
53
- && depthDownsampled > 1
57
+ && depthDownsampled <= 2048
54
58
  );
55
59
  };
56
60