@vitessce/ome-tiff 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.
- package/dist/{deflate-DmNqlBs9.js → deflate-ChCTSJeP.js} +1 -1
- package/dist/{index-DRn85KHd.js → index-CbC3R3Yt.js} +38 -11
- package/dist/index.js +1 -1
- package/dist/{jpeg-BObK4ini.js → jpeg-f6Tz1iJ-.js} +1 -1
- package/dist/{lerc-C8MlNyxy.js → lerc-DJq-_kdR.js} +1 -1
- package/dist/{lzw-BeXf3EsN.js → lzw-iAN9_BAn.js} +1 -1
- package/dist/{packbits-BuXgVzsG.js → packbits-pGQCZ9pu.js} +1 -1
- package/dist/{raw-DP_5N1Jo.js → raw-DfYEbbM8.js} +1 -1
- package/dist/{webimage-D63RI41j.js → webimage-Dwoxj7RN.js} +1 -1
- package/dist-tsc/OmeTiffLoader.d.ts.map +1 -1
- package/dist-tsc/OmeTiffLoader.js +20 -0
- package/package.json +11 -10
- package/src/OmeTiffLoader.js +22 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as inflate_1 } from "./pako.esm-SxljTded.js";
|
|
2
|
-
import { B as BaseDecoder } from "./index-
|
|
2
|
+
import { B as BaseDecoder } from "./index-CbC3R3Yt.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-
|
|
104769
|
-
addDecoder(5, () => import("./lzw-
|
|
104768
|
+
addDecoder([void 0, 1], () => import("./raw-DfYEbbM8.js").then((m) => m.default));
|
|
104769
|
+
addDecoder(5, () => import("./lzw-iAN9_BAn.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-
|
|
104774
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
104775
|
-
addDecoder(32773, () => import("./packbits-
|
|
104773
|
+
addDecoder(7, () => import("./jpeg-f6Tz1iJ-.js").then((m) => m.default));
|
|
104774
|
+
addDecoder([8, 32946], () => import("./deflate-ChCTSJeP.js").then((m) => m.default));
|
|
104775
|
+
addDecoder(32773, () => import("./packbits-pGQCZ9pu.js").then((m) => m.default));
|
|
104776
104776
|
addDecoder(
|
|
104777
104777
|
34887,
|
|
104778
|
-
() => import("./lerc-
|
|
104778
|
+
() => import("./lerc-DJq-_kdR.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-
|
|
104783
|
+
addDecoder(50001, () => import("./webimage-Dwoxj7RN.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
|
}
|
|
@@ -141384,20 +141384,23 @@ const getStatsForResolution = (loader, resolution) => {
|
|
|
141384
141384
|
const height = shape[labels.indexOf("y")];
|
|
141385
141385
|
const width = shape[labels.indexOf("x")];
|
|
141386
141386
|
const depth = shape[labels.indexOf("z")];
|
|
141387
|
+
const dims = Object.fromEntries(labels.map((label, i2) => [label, shape[i2]]));
|
|
141387
141388
|
const depthDownsampled = Math.max(1, depth >> resolution);
|
|
141388
141389
|
const totalBytes = 4 * height * width * depthDownsampled;
|
|
141389
141390
|
return {
|
|
141390
141391
|
height,
|
|
141391
141392
|
width,
|
|
141393
|
+
depth,
|
|
141392
141394
|
depthDownsampled,
|
|
141393
|
-
totalBytes
|
|
141395
|
+
totalBytes,
|
|
141396
|
+
dims
|
|
141394
141397
|
};
|
|
141395
141398
|
};
|
|
141396
141399
|
const canLoadResolution = (loader, resolution) => {
|
|
141397
141400
|
const { totalBytes, height, width, depthDownsampled } = getStatsForResolution(loader, resolution);
|
|
141398
141401
|
const maxHeapSize = window.performance?.memory && window.performance?.memory?.jsHeapSizeLimit / 2;
|
|
141399
141402
|
const maxSize = maxHeapSize || 2 ** 31 - 1;
|
|
141400
|
-
return totalBytes < maxSize && height <= 2048 &&
|
|
141403
|
+
return totalBytes < maxSize && height <= 2048 && width <= 2048 && depthDownsampled <= 2048;
|
|
141401
141404
|
};
|
|
141402
141405
|
function isRgb(loader, channels2) {
|
|
141403
141406
|
const source = getSourceFromLoader(loader);
|
|
@@ -142030,6 +142033,10 @@ class ImageWrapper {
|
|
|
142030
142033
|
const { labels, shape } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
|
|
142031
142034
|
return shape[labels.indexOf("c")];
|
|
142032
142035
|
}
|
|
142036
|
+
getNumResolutions() {
|
|
142037
|
+
const loader = this.vivLoader;
|
|
142038
|
+
return Array.isArray(loader.data) ? loader.data.length : 1;
|
|
142039
|
+
}
|
|
142033
142040
|
isMultiResolution() {
|
|
142034
142041
|
const loader = this.vivLoader;
|
|
142035
142042
|
const hasViewableResolutions = Boolean(Array.from({
|
|
@@ -142040,13 +142047,21 @@ class ImageWrapper {
|
|
|
142040
142047
|
getMultiResolutionStats() {
|
|
142041
142048
|
const loader = this.vivLoader;
|
|
142042
142049
|
return Array.from({ length: loader.data.length }).fill(0).map((_, resolution) => {
|
|
142043
|
-
const { height, width, depthDownsampled, totalBytes } = getStatsForResolution(loader.data, resolution);
|
|
142050
|
+
const { height, width, depth, depthDownsampled, totalBytes, dims } = getStatsForResolution(loader.data, resolution);
|
|
142044
142051
|
return {
|
|
142045
142052
|
canLoad: canLoadResolution(loader.data, resolution),
|
|
142046
142053
|
height,
|
|
142047
142054
|
width,
|
|
142055
|
+
depth,
|
|
142048
142056
|
depthDownsampled,
|
|
142049
|
-
totalBytes
|
|
142057
|
+
totalBytes,
|
|
142058
|
+
dims
|
|
142059
|
+
// chunkHeight
|
|
142060
|
+
// chunkWidth
|
|
142061
|
+
// chunkDepth
|
|
142062
|
+
// physicalSizeVoxel
|
|
142063
|
+
// eslint-disable-next-line max-len
|
|
142064
|
+
// physicalSizeTotal (physicalSizeVoxel * highest-resolution numPixels, for each dimension)
|
|
142050
142065
|
};
|
|
142051
142066
|
});
|
|
142052
142067
|
}
|
|
@@ -142174,6 +142189,8 @@ class CoordinationLevel {
|
|
|
142174
142189
|
function CL(value) {
|
|
142175
142190
|
return new CoordinationLevel(value);
|
|
142176
142191
|
}
|
|
142192
|
+
const OFFSETS_DOCS_URL = "https://vitessce.io/docs/data-troubleshooting/#ome-tiff-offsets";
|
|
142193
|
+
const PYRAMID_DOCS_URL = "https://vitessce.io/docs/data-troubleshooting/#multi-resolution-pyramidal-representation";
|
|
142177
142194
|
class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
142178
142195
|
async loadOffsets() {
|
|
142179
142196
|
const { offsetsUrl } = this.options || {};
|
|
@@ -142193,6 +142210,16 @@ class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
|
142193
142210
|
const offsets = await this.loadOffsets();
|
|
142194
142211
|
const loader = await loadOmeTiff(url, { offsets, headers: requestInit?.headers });
|
|
142195
142212
|
const imageWrapper = new ImageWrapper(loader, this.options);
|
|
142213
|
+
const multiResolutionStats = imageWrapper.getMultiResolutionStats();
|
|
142214
|
+
const lowestResolutionStats = multiResolutionStats.at(-1);
|
|
142215
|
+
if (!lowestResolutionStats.canLoad) {
|
|
142216
|
+
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}`);
|
|
142217
|
+
}
|
|
142218
|
+
if (!offsets) {
|
|
142219
|
+
{
|
|
142220
|
+
log$1.error(`OME-TIFF offsets JSON file is missing, which can increase loading times and degrade performance. See documentation at ${OFFSETS_DOCS_URL}`);
|
|
142221
|
+
}
|
|
142222
|
+
}
|
|
142196
142223
|
const {
|
|
142197
142224
|
Name: imageName,
|
|
142198
142225
|
Pixels: {
|
package/dist/index.js
CHANGED
|
@@ -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-
|
|
2
|
+
import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-CbC3R3Yt.js";
|
|
3
3
|
var LercDecode = { exports: {} };
|
|
4
4
|
var hasRequiredLercDecode;
|
|
5
5
|
function requireLercDecode() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OmeTiffLoader.d.ts","sourceRoot":"","sources":["../src/OmeTiffLoader.js"],"names":[],"mappings":"
|
|
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.
|
|
3
|
+
"version": "3.8.0",
|
|
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/
|
|
22
|
-
"@vitessce/
|
|
23
|
-
"@vitessce/
|
|
24
|
-
"@vitessce/
|
|
25
|
-
"@vitessce/
|
|
26
|
-
"@vitessce/
|
|
27
|
-
"@vitessce/
|
|
28
|
-
"@vitessce/
|
|
29
|
-
"@vitessce/utils": "3.
|
|
21
|
+
"@vitessce/globals": "3.8.0",
|
|
22
|
+
"@vitessce/abstract": "3.8.0",
|
|
23
|
+
"@vitessce/error": "3.8.0",
|
|
24
|
+
"@vitessce/constants-internal": "3.8.0",
|
|
25
|
+
"@vitessce/config": "3.8.0",
|
|
26
|
+
"@vitessce/gl": "3.8.0",
|
|
27
|
+
"@vitessce/sets-utils": "3.8.0",
|
|
28
|
+
"@vitessce/spatial-utils": "3.8.0",
|
|
29
|
+
"@vitessce/image-utils": "3.8.0",
|
|
30
|
+
"@vitessce/utils": "3.8.0"
|
|
30
31
|
},
|
|
31
32
|
"scripts": {
|
|
32
33
|
"bundle": "pnpm exec vite build -c ../../../scripts/vite.config.mjs",
|
package/src/OmeTiffLoader.js
CHANGED
|
@@ -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: {
|