@vitessce/ome-tiff 3.7.0 → 3.7.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-DRn85KHd.js";
2
+ import { B as BaseDecoder } from "./index-232sb5OI.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -104765,22 +104765,22 @@ async function getDecoder(fileDirectory) {
104765
104765
  const Decoder = await importFn();
104766
104766
  return new Decoder(fileDirectory);
104767
104767
  }
104768
- addDecoder([void 0, 1], () => import("./raw-DP_5N1Jo.js").then((m) => m.default));
104769
- addDecoder(5, () => import("./lzw-BeXf3EsN.js").then((m) => m.default));
104768
+ addDecoder([void 0, 1], () => import("./raw-DrIPO2u3.js").then((m) => m.default));
104769
+ addDecoder(5, () => import("./lzw-BoCtt2-m.js").then((m) => m.default));
104770
104770
  addDecoder(6, () => {
104771
104771
  throw new Error("old style JPEG compression is not supported.");
104772
104772
  });
104773
- addDecoder(7, () => import("./jpeg-BObK4ini.js").then((m) => m.default));
104774
- addDecoder([8, 32946], () => import("./deflate-DmNqlBs9.js").then((m) => m.default));
104775
- addDecoder(32773, () => import("./packbits-BuXgVzsG.js").then((m) => m.default));
104773
+ addDecoder(7, () => import("./jpeg-BlicShCt.js").then((m) => m.default));
104774
+ addDecoder([8, 32946], () => import("./deflate-_lVGjEGe.js").then((m) => m.default));
104775
+ addDecoder(32773, () => import("./packbits-DX44B-XP.js").then((m) => m.default));
104776
104776
  addDecoder(
104777
104777
  34887,
104778
- () => import("./lerc-C8MlNyxy.js").then(async (m) => {
104778
+ () => import("./lerc-CAv7lilE.js").then(async (m) => {
104779
104779
  await m.zstd.init();
104780
104780
  return m;
104781
104781
  }).then((m) => m.default)
104782
104782
  );
104783
- addDecoder(50001, () => import("./webimage-D63RI41j.js").then((m) => m.default));
104783
+ addDecoder(50001, () => import("./webimage-DPm5zEbA.js").then((m) => m.default));
104784
104784
  function copyNewSize(array, width, height, samplesPerPixel = 1) {
104785
104785
  return new (Object.getPrototypeOf(array)).constructor(width * height * samplesPerPixel);
104786
104786
  }
@@ -141397,7 +141397,7 @@ const canLoadResolution = (loader, resolution) => {
141397
141397
  const { totalBytes, height, width, depthDownsampled } = getStatsForResolution(loader, resolution);
141398
141398
  const maxHeapSize = window.performance?.memory && window.performance?.memory?.jsHeapSizeLimit / 2;
141399
141399
  const maxSize = maxHeapSize || 2 ** 31 - 1;
141400
- return totalBytes < maxSize && height <= 2048 && depthDownsampled <= 2048 && width <= 2048 && depthDownsampled > 1;
141400
+ return totalBytes < maxSize && height <= 2048 && width <= 2048 && depthDownsampled <= 2048;
141401
141401
  };
141402
141402
  function isRgb(loader, channels2) {
141403
141403
  const source = getSourceFromLoader(loader);
@@ -142174,6 +142174,8 @@ class CoordinationLevel {
142174
142174
  function CL(value) {
142175
142175
  return new CoordinationLevel(value);
142176
142176
  }
142177
+ const OFFSETS_DOCS_URL = "https://vitessce.io/docs/data-troubleshooting/#ome-tiff-offsets";
142178
+ const PYRAMID_DOCS_URL = "https://vitessce.io/docs/data-troubleshooting/#multi-resolution-pyramidal-representation";
142177
142179
  class OmeTiffLoader extends AbstractTwoStepLoader {
142178
142180
  async loadOffsets() {
142179
142181
  const { offsetsUrl } = this.options || {};
@@ -142193,6 +142195,16 @@ class OmeTiffLoader extends AbstractTwoStepLoader {
142193
142195
  const offsets = await this.loadOffsets();
142194
142196
  const loader = await loadOmeTiff(url, { offsets, headers: requestInit?.headers });
142195
142197
  const imageWrapper = new ImageWrapper(loader, this.options);
142198
+ const multiResolutionStats = imageWrapper.getMultiResolutionStats();
142199
+ const lowestResolutionStats = multiResolutionStats.at(-1);
142200
+ if (!lowestResolutionStats.canLoad) {
142201
+ throw new Error(`The lowest resolution of this image exceeds texture size limits or the browser max heap size. Please use an image pyramid with lower resolution levels. See documentation at ${PYRAMID_DOCS_URL}`);
142202
+ }
142203
+ if (!offsets) {
142204
+ {
142205
+ log$1.error(`OME-TIFF offsets JSON file is missing, which can increase loading times and degrade performance. See documentation at ${OFFSETS_DOCS_URL}`);
142206
+ }
142207
+ }
142196
142208
  const {
142197
142209
  Name: imageName,
142198
142210
  Pixels: {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c, b, O } from "./index-DRn85KHd.js";
1
+ import { c, b, O } from "./index-232sb5OI.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-DRn85KHd.js";
1
+ import { B as BaseDecoder } from "./index-232sb5OI.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-DRn85KHd.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-232sb5OI.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-DRn85KHd.js";
1
+ import { B as BaseDecoder } from "./index-232sb5OI.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-DRn85KHd.js";
1
+ import { B as BaseDecoder } from "./index-232sb5OI.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-DRn85KHd.js";
1
+ import { B as BaseDecoder } from "./index-232sb5OI.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-DRn85KHd.js";
1
+ import { B as BaseDecoder } from "./index-232sb5OI.js";
2
2
  class WebImageDecoder extends BaseDecoder {
3
3
  constructor() {
4
4
  super();
@@ -1 +1 @@
1
- {"version":3,"file":"OmeTiffLoader.d.ts","sourceRoot":"","sources":["../src/OmeTiffLoader.js"],"names":[],"mappings":"AAUA;;IACE,4BAWC;IAED,qBAqHC;IA1CG,oBAIC;CAuCN;sCAvImD,oBAAoB"}
1
+ {"version":3,"file":"OmeTiffLoader.d.ts","sourceRoot":"","sources":["../src/OmeTiffLoader.js"],"names":[],"mappings":"AAcA;;IACE,4BAWC;IAED,qBAsIC;IA1CG,oBAIC;CAuCN;sCA5JmD,oBAAoB"}
@@ -3,6 +3,9 @@ import { initializeRasterLayersAndChannels, coordinateTransformationsToMatrix, g
3
3
  import { ImageWrapper } from '@vitessce/image-utils';
4
4
  import { AbstractTwoStepLoader, LoaderResult } from '@vitessce/abstract';
5
5
  import { CoordinationLevel as CL } from '@vitessce/config';
6
+ import { getDebugMode, log } from '@vitessce/globals';
7
+ const OFFSETS_DOCS_URL = 'https://vitessce.io/docs/data-troubleshooting/#ome-tiff-offsets';
8
+ const PYRAMID_DOCS_URL = 'https://vitessce.io/docs/data-troubleshooting/#multi-resolution-pyramidal-representation';
6
9
  export default class OmeTiffLoader extends AbstractTwoStepLoader {
7
10
  async loadOffsets() {
8
11
  const { offsetsUrl } = this.options || {};
@@ -22,6 +25,23 @@ export default class OmeTiffLoader extends AbstractTwoStepLoader {
22
25
  const offsets = await this.loadOffsets();
23
26
  const loader = await viv.loadOmeTiff(url, { offsets, headers: requestInit?.headers });
24
27
  const imageWrapper = new ImageWrapper(loader, this.options);
28
+ // Check size of lowest resolution.
29
+ // TODO: does this multiResolutionStats logic still work when image is not pyramidal?
30
+ const multiResolutionStats = imageWrapper.getMultiResolutionStats();
31
+ const lowestResolutionStats = multiResolutionStats.at(-1);
32
+ if (!lowestResolutionStats.canLoad) {
33
+ throw new Error(`The lowest resolution of this image exceeds texture size limits or the browser max heap size. Please use an image pyramid with lower resolution levels. See documentation at ${PYRAMID_DOCS_URL}`);
34
+ }
35
+ // Check that offsets are provided.
36
+ if (!offsets) {
37
+ // Offsets are missing.
38
+ if (getDebugMode()) {
39
+ throw new Error(`In debug mode, OME-TIFF offsets JSON file is required. See documentation at ${OFFSETS_DOCS_URL}`);
40
+ }
41
+ else {
42
+ log.error(`OME-TIFF offsets JSON file is missing, which can increase loading times and degrade performance. See documentation at ${OFFSETS_DOCS_URL}`);
43
+ }
44
+ }
25
45
  const { Name: imageName, Pixels: { Channels, DimensionOrder, PhysicalSizeX, PhysicalSizeXUnit, PhysicalSizeY, PhysicalSizeYUnit, }, } = loader.metadata;
26
46
  const channels = Array.isArray(Channels)
27
47
  ? Channels.map((channel, i) => channel.Name || `Channel ${i}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/ome-tiff",
3
- "version": "3.7.0",
3
+ "version": "3.7.1",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -18,15 +18,16 @@
18
18
  "dependencies": {
19
19
  "d3-array": "^2.4.0",
20
20
  "lodash-es": "^4.17.21",
21
- "@vitessce/abstract": "3.7.0",
22
- "@vitessce/error": "3.7.0",
23
- "@vitessce/constants-internal": "3.7.0",
24
- "@vitessce/config": "3.7.0",
25
- "@vitessce/gl": "3.7.0",
26
- "@vitessce/sets-utils": "3.7.0",
27
- "@vitessce/spatial-utils": "3.7.0",
28
- "@vitessce/image-utils": "3.7.0",
29
- "@vitessce/utils": "3.7.0"
21
+ "@vitessce/globals": "3.7.1",
22
+ "@vitessce/abstract": "3.7.1",
23
+ "@vitessce/error": "3.7.1",
24
+ "@vitessce/constants-internal": "3.7.1",
25
+ "@vitessce/config": "3.7.1",
26
+ "@vitessce/gl": "3.7.1",
27
+ "@vitessce/sets-utils": "3.7.1",
28
+ "@vitessce/spatial-utils": "3.7.1",
29
+ "@vitessce/image-utils": "3.7.1",
30
+ "@vitessce/utils": "3.7.1"
30
31
  },
31
32
  "scripts": {
32
33
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.mjs",
@@ -7,6 +7,10 @@ import {
7
7
  import { ImageWrapper } from '@vitessce/image-utils';
8
8
  import { AbstractTwoStepLoader, LoaderResult } from '@vitessce/abstract';
9
9
  import { CoordinationLevel as CL } from '@vitessce/config';
10
+ import { getDebugMode, log } from '@vitessce/globals';
11
+
12
+ const OFFSETS_DOCS_URL = 'https://vitessce.io/docs/data-troubleshooting/#ome-tiff-offsets';
13
+ const PYRAMID_DOCS_URL = 'https://vitessce.io/docs/data-troubleshooting/#multi-resolution-pyramidal-representation';
10
14
 
11
15
  export default class OmeTiffLoader extends AbstractTwoStepLoader {
12
16
  async loadOffsets() {
@@ -28,9 +32,26 @@ export default class OmeTiffLoader extends AbstractTwoStepLoader {
28
32
 
29
33
  const offsets = await this.loadOffsets();
30
34
  const loader = await viv.loadOmeTiff(url, { offsets, headers: requestInit?.headers });
31
-
32
35
  const imageWrapper = new ImageWrapper(loader, this.options);
33
36
 
37
+ // Check size of lowest resolution.
38
+ // TODO: does this multiResolutionStats logic still work when image is not pyramidal?
39
+ const multiResolutionStats = imageWrapper.getMultiResolutionStats();
40
+ const lowestResolutionStats = multiResolutionStats.at(-1);
41
+ if (!lowestResolutionStats.canLoad) {
42
+ throw new Error(`The lowest resolution of this image exceeds texture size limits or the browser max heap size. Please use an image pyramid with lower resolution levels. See documentation at ${PYRAMID_DOCS_URL}`);
43
+ }
44
+
45
+ // Check that offsets are provided.
46
+ if (!offsets) {
47
+ // Offsets are missing.
48
+ if (getDebugMode()) {
49
+ throw new Error(`In debug mode, OME-TIFF offsets JSON file is required. See documentation at ${OFFSETS_DOCS_URL}`);
50
+ } else {
51
+ log.error(`OME-TIFF offsets JSON file is missing, which can increase loading times and degrade performance. See documentation at ${OFFSETS_DOCS_URL}`);
52
+ }
53
+ }
54
+
34
55
  const {
35
56
  Name: imageName,
36
57
  Pixels: {