@vitessce/json 3.0.0 → 3.1.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-a2d6b257.js → deflate-4ca42b76.js} +1 -1
- package/dist/{index-8cb529a4.js → index-4747e079.js} +1551 -1429
- package/dist/index.js +1 -1
- package/dist/{jpeg-e323e6ed.js → jpeg-abb345c7.js} +1 -1
- package/dist/{lerc-0dc6a58a.js → lerc-9046df68.js} +1 -1
- package/dist/{lzw-e9c82d83.js → lzw-10a09468.js} +1 -1
- package/dist/{packbits-0a0f672b.js → packbits-d8a8e4a5.js} +1 -1
- package/dist/{raw-3f989896.js → raw-fc3a808c.js} +1 -1
- package/dist/{webimage-f799ed95.js → webimage-1a311fc4.js} +1 -1
- package/dist-tsc/json-loaders/JsonLoader.test.js +1 -0
- package/dist-tsc/json-loaders/ObsSetsJson.test-old.js +1 -1
- package/dist-tsc/legacy-loaders/CellsJsonLoaders.test.js +4 -3
- package/dist-tsc/legacy-loaders/ClustersJsonLoaders.test.js +2 -1
- package/dist-tsc/legacy-loaders/GenesJsonLoaders.test.js +2 -1
- package/dist-tsc/legacy-loaders/MoleculesJsonLoaders.test.js +3 -2
- package/dist-tsc/raster-json-loaders/RasterJsonLoader.d.ts.map +1 -1
- package/dist-tsc/raster-json-loaders/RasterJsonLoader.js +33 -2
- package/package.json +9 -9
- package/src/json-loaders/JsonLoader.test.js +1 -0
- package/src/json-loaders/ObsSetsJson.test-old.js +1 -1
- package/src/legacy-loaders/CellsJsonLoaders.test.js +4 -3
- package/src/legacy-loaders/ClustersJsonLoaders.test.js +2 -1
- package/src/legacy-loaders/GenesJsonLoaders.test.js +2 -1
- package/src/legacy-loaders/MoleculesJsonLoaders.test.js +3 -2
- package/src/raster-json-loaders/RasterJsonLoader.js +49 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as inflate_1 } from "./pako.esm-68f84e2a.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-4747e079.js";
|
|
3
3
|
import "@vitessce/vit-s";
|
|
4
4
|
import "react";
|
|
5
5
|
var LercDecode = { exports: {} };
|
|
@@ -19,7 +19,7 @@ describe('loaders/json-loaders/ObsSetsJson', () => {
|
|
|
19
19
|
it('can load obsSets', async () => {
|
|
20
20
|
const loader = createLoader(ObsSetsJsonLoader, {
|
|
21
21
|
fileType: 'obsSets.cells.json',
|
|
22
|
-
}, 'http://localhost:
|
|
22
|
+
}, 'http://localhost:4204/@fixtures/vit-s/obsSets.good.json');
|
|
23
23
|
const result = await loader.load();
|
|
24
24
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
25
25
|
const payload = result.data;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
1
2
|
import { LoaderResult } from '@vitessce/vit-s';
|
|
2
3
|
import CellsJsonAsObsEmbeddingLoader from './CellsJsonAsObsEmbedding.js';
|
|
3
4
|
import CellsJsonAsObsLabelsLoader from './CellsJsonAsObsLabels.js';
|
|
@@ -19,7 +20,7 @@ describe('loaders/cells-json-loaders', () => {
|
|
|
19
20
|
coordinationValues: {
|
|
20
21
|
embeddingType: 'PCA',
|
|
21
22
|
},
|
|
22
|
-
}, 'http://localhost:
|
|
23
|
+
}, 'http://localhost:4204/@fixtures/json-legacy/cells.good.json');
|
|
23
24
|
const result = await loader.load();
|
|
24
25
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
25
26
|
const payload = result.data;
|
|
@@ -36,7 +37,7 @@ describe('loaders/cells-json-loaders', () => {
|
|
|
36
37
|
coordinationValues: {
|
|
37
38
|
obsLabelsType: 'cluster',
|
|
38
39
|
},
|
|
39
|
-
}, 'http://localhost:
|
|
40
|
+
}, 'http://localhost:4204/@fixtures/json-legacy/cells.good.json');
|
|
40
41
|
const result = await loader.load();
|
|
41
42
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
42
43
|
const payload = result.data;
|
|
@@ -49,7 +50,7 @@ describe('loaders/cells-json-loaders', () => {
|
|
|
49
50
|
it('can load obsSegmentations', async () => {
|
|
50
51
|
const loader = createLoader(CellsJsonAsObsSegmentationsLoader, {
|
|
51
52
|
fileType: 'obsSegmentations.cells.json',
|
|
52
|
-
}, 'http://localhost:
|
|
53
|
+
}, 'http://localhost:4204/@fixtures/json-legacy/cells.good.json');
|
|
53
54
|
const result = await loader.load();
|
|
54
55
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
55
56
|
const payload = result.data;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
1
2
|
import { LoaderResult } from '@vitessce/vit-s';
|
|
2
3
|
import ClustersJsonAsObsFeatureMatrixLoader from './ClustersJsonAsObsFeatureMatrix.js';
|
|
3
4
|
import JsonSource from '../JsonSource.js';
|
|
@@ -14,7 +15,7 @@ describe('loaders/clusters-json-loaders', () => {
|
|
|
14
15
|
it('can load obsFeatureMatrix', async () => {
|
|
15
16
|
const loader = createLoader(ClustersJsonAsObsFeatureMatrixLoader, {
|
|
16
17
|
fileType: 'obsFeatureMatrix.clusters.json',
|
|
17
|
-
}, 'http://localhost:
|
|
18
|
+
}, 'http://localhost:4204/@fixtures/json-legacy/clusters.good.json');
|
|
18
19
|
const result = await loader.load();
|
|
19
20
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
20
21
|
const payload = result.data;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
1
2
|
import { LoaderResult } from '@vitessce/vit-s';
|
|
2
3
|
import GenesJsonAsObsFeatureMatrixLoader from './GenesJsonAsObsFeatureMatrix.js';
|
|
3
4
|
import JsonSource from '../JsonSource.js';
|
|
@@ -14,7 +15,7 @@ describe('loaders/genes-json-loaders', () => {
|
|
|
14
15
|
it('can load obsFeatureMatrix', async () => {
|
|
15
16
|
const loader = createLoader(GenesJsonAsObsFeatureMatrixLoader, {
|
|
16
17
|
fileType: 'obsFeatureMatrix.genes.json',
|
|
17
|
-
}, 'http://localhost:
|
|
18
|
+
}, 'http://localhost:4204/@fixtures/json-legacy/genes.good.json');
|
|
18
19
|
const result = await loader.load();
|
|
19
20
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
20
21
|
const payload = result.data;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
1
2
|
import { LoaderResult } from '@vitessce/vit-s';
|
|
2
3
|
import MoleculesJsonAsObsLocationsLoader from './MoleculesJsonAsObsLocations.js';
|
|
3
4
|
import MoleculesJsonAsObsLabelsLoader from './MoleculesJsonAsObsLabels.js';
|
|
@@ -15,7 +16,7 @@ describe('loaders/molecules-json-loaders', () => {
|
|
|
15
16
|
it('can load obsLocations', async () => {
|
|
16
17
|
const loader = createLoader(MoleculesJsonAsObsLocationsLoader, {
|
|
17
18
|
fileType: 'obsLocations.molecules.json',
|
|
18
|
-
}, 'http://localhost:
|
|
19
|
+
}, 'http://localhost:4204/@fixtures/json-legacy/molecules.good.json');
|
|
19
20
|
const result = await loader.load();
|
|
20
21
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
21
22
|
const payload = result.data;
|
|
@@ -32,7 +33,7 @@ describe('loaders/molecules-json-loaders', () => {
|
|
|
32
33
|
coordinationValues: {
|
|
33
34
|
obsLabelsType: 'gene',
|
|
34
35
|
},
|
|
35
|
-
}, 'http://localhost:
|
|
36
|
+
}, 'http://localhost:4204/@fixtures/json-legacy/molecules.good.json');
|
|
36
37
|
const result = await loader.load();
|
|
37
38
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
38
39
|
const payload = result.data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RasterJsonLoader.d.ts","sourceRoot":"","sources":["../../src/raster-json-loaders/RasterJsonLoader.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RasterJsonLoader.d.ts","sourceRoot":"","sources":["../../src/raster-json-loaders/RasterJsonLoader.js"],"names":[],"mappings":"AAyHA;IAWE,qBAyCC;IAnBG,oBAIC;CAgBN"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { viv } from '@vitessce/gl';
|
|
2
|
-
import { initializeRasterLayersAndChannels } from '@vitessce/spatial-utils';
|
|
2
|
+
import { initializeRasterLayersAndChannels, coordinateTransformationsToMatrix, getNgffAxes, } from '@vitessce/spatial-utils';
|
|
3
3
|
import { openArray } from 'zarr';
|
|
4
4
|
import { AbstractLoaderError, LoaderResult } from '@vitessce/vit-s';
|
|
5
5
|
import { rasterJsonSchema as rasterSchema } from '@vitessce/schemas';
|
|
@@ -57,6 +57,37 @@ async function initLoader(imageData) {
|
|
|
57
57
|
: [Channels.Name || `Channel ${0}`];
|
|
58
58
|
return { ...loader, channels };
|
|
59
59
|
}
|
|
60
|
+
case ('ome-zarr'): {
|
|
61
|
+
// Reference: https://github.com/vitessce/vitessce-python/issues/242#issuecomment-1517930964
|
|
62
|
+
// Most of the following has been copied from OmeZarrLoader.js.
|
|
63
|
+
// Reference: https://github.com/vitessce/vitessce/blob/fb0e7f/packages/file-types/zarr/src/ome-loaders/OmeZarrLoader.js#L29
|
|
64
|
+
const { coordinateTransformations: coordinateTransformationsFromOptions } = metadata || {};
|
|
65
|
+
const loader = await viv.loadOmeZarr(url, { fetchOptions: requestInit, type: 'multiscales' });
|
|
66
|
+
const { metadata: loaderMetadata } = loader;
|
|
67
|
+
const { omero, multiscales } = loaderMetadata;
|
|
68
|
+
if (!Array.isArray(multiscales) || multiscales.length === 0) {
|
|
69
|
+
console.error('Multiscales array must exist and have at least one element');
|
|
70
|
+
}
|
|
71
|
+
const { coordinateTransformations } = multiscales[0];
|
|
72
|
+
// Axes in v0.4 format.
|
|
73
|
+
const axes = getNgffAxes(multiscales[0].axes);
|
|
74
|
+
const transformMatrixFromOptions = coordinateTransformationsToMatrix(coordinateTransformationsFromOptions, axes);
|
|
75
|
+
const transformMatrixFromFile = coordinateTransformationsToMatrix(coordinateTransformations, axes);
|
|
76
|
+
const transformMatrix = transformMatrixFromFile.multiplyLeft(transformMatrixFromOptions);
|
|
77
|
+
const { channels, name: omeroName } = omero;
|
|
78
|
+
return {
|
|
79
|
+
name: omeroName || 'Image',
|
|
80
|
+
channels: channels.map((c, i) => c.label || `Channel ${i}`),
|
|
81
|
+
...(transformMatrix ? {
|
|
82
|
+
metadata: {
|
|
83
|
+
transform: {
|
|
84
|
+
matrix: transformMatrix,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
} : {}),
|
|
88
|
+
...loader,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
60
91
|
default: {
|
|
61
92
|
throw Error(`Image type (${type}) is not supported`);
|
|
62
93
|
}
|
|
@@ -82,7 +113,7 @@ export default class RasterLoader extends JsonLoader {
|
|
|
82
113
|
// Get image name and URL tuples.
|
|
83
114
|
const urls = images
|
|
84
115
|
.filter(image => !image.url.includes('zarr'))
|
|
85
|
-
.map(image => (
|
|
116
|
+
.map(image => ({ url: image.url, name: image.name }));
|
|
86
117
|
// Add a loaderCreator function for each image layer.
|
|
87
118
|
const imagesWithLoaderCreators = images.map(image => ({
|
|
88
119
|
...image,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/json",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"lodash-es": "^4.17.21",
|
|
21
21
|
"zarr": "0.5.1",
|
|
22
22
|
"zod": "^3.21.4",
|
|
23
|
-
"@vitessce/constants-internal": "3.
|
|
24
|
-
"@vitessce/gl": "3.
|
|
25
|
-
"@vitessce/schemas": "3.
|
|
26
|
-
"@vitessce/sets-utils": "3.
|
|
27
|
-
"@vitessce/spatial-utils": "3.
|
|
28
|
-
"@vitessce/utils": "3.
|
|
29
|
-
"@vitessce/vit-s": "3.
|
|
23
|
+
"@vitessce/constants-internal": "3.1.0",
|
|
24
|
+
"@vitessce/gl": "3.1.0",
|
|
25
|
+
"@vitessce/schemas": "3.1.0",
|
|
26
|
+
"@vitessce/sets-utils": "3.1.0",
|
|
27
|
+
"@vitessce/spatial-utils": "3.1.0",
|
|
28
|
+
"@vitessce/utils": "3.1.0",
|
|
29
|
+
"@vitessce/vit-s": "3.1.0"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
|
|
33
|
-
"test": "pnpm exec vitest --run
|
|
33
|
+
"test": "pnpm exec vitest --run"
|
|
34
34
|
},
|
|
35
35
|
"module": "dist/index.js",
|
|
36
36
|
"exports": {
|
|
@@ -18,7 +18,7 @@ describe('loaders/json-loaders/ObsSetsJson', () => {
|
|
|
18
18
|
it('can load obsSets', async () => {
|
|
19
19
|
const loader = createLoader(ObsSetsJsonLoader, {
|
|
20
20
|
fileType: 'obsSets.cells.json',
|
|
21
|
-
}, 'http://localhost:
|
|
21
|
+
}, 'http://localhost:4204/@fixtures/vit-s/obsSets.good.json');
|
|
22
22
|
const result = await loader.load();
|
|
23
23
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
24
24
|
const payload = result.data;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
1
2
|
import { LoaderResult } from '@vitessce/vit-s';
|
|
2
3
|
import CellsJsonAsObsEmbeddingLoader from './CellsJsonAsObsEmbedding.js';
|
|
3
4
|
import CellsJsonAsObsLabelsLoader from './CellsJsonAsObsLabels.js';
|
|
@@ -21,7 +22,7 @@ describe('loaders/cells-json-loaders', () => {
|
|
|
21
22
|
coordinationValues: {
|
|
22
23
|
embeddingType: 'PCA',
|
|
23
24
|
},
|
|
24
|
-
}, 'http://localhost:
|
|
25
|
+
}, 'http://localhost:4204/@fixtures/json-legacy/cells.good.json');
|
|
25
26
|
const result = await loader.load();
|
|
26
27
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
27
28
|
const payload = result.data;
|
|
@@ -38,7 +39,7 @@ describe('loaders/cells-json-loaders', () => {
|
|
|
38
39
|
coordinationValues: {
|
|
39
40
|
obsLabelsType: 'cluster',
|
|
40
41
|
},
|
|
41
|
-
}, 'http://localhost:
|
|
42
|
+
}, 'http://localhost:4204/@fixtures/json-legacy/cells.good.json');
|
|
42
43
|
const result = await loader.load();
|
|
43
44
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
44
45
|
const payload = result.data;
|
|
@@ -51,7 +52,7 @@ describe('loaders/cells-json-loaders', () => {
|
|
|
51
52
|
it('can load obsSegmentations', async () => {
|
|
52
53
|
const loader = createLoader(CellsJsonAsObsSegmentationsLoader, {
|
|
53
54
|
fileType: 'obsSegmentations.cells.json',
|
|
54
|
-
}, 'http://localhost:
|
|
55
|
+
}, 'http://localhost:4204/@fixtures/json-legacy/cells.good.json');
|
|
55
56
|
const result = await loader.load();
|
|
56
57
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
57
58
|
const payload = result.data;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
1
2
|
import { LoaderResult } from '@vitessce/vit-s';
|
|
2
3
|
import ClustersJsonAsObsFeatureMatrixLoader from './ClustersJsonAsObsFeatureMatrix.js';
|
|
3
4
|
import JsonSource from '../JsonSource.js';
|
|
@@ -16,7 +17,7 @@ describe('loaders/clusters-json-loaders', () => {
|
|
|
16
17
|
it('can load obsFeatureMatrix', async () => {
|
|
17
18
|
const loader = createLoader(ClustersJsonAsObsFeatureMatrixLoader, {
|
|
18
19
|
fileType: 'obsFeatureMatrix.clusters.json',
|
|
19
|
-
}, 'http://localhost:
|
|
20
|
+
}, 'http://localhost:4204/@fixtures/json-legacy/clusters.good.json');
|
|
20
21
|
const result = await loader.load();
|
|
21
22
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
22
23
|
const payload = result.data;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
1
2
|
import { LoaderResult } from '@vitessce/vit-s';
|
|
2
3
|
import GenesJsonAsObsFeatureMatrixLoader from './GenesJsonAsObsFeatureMatrix.js';
|
|
3
4
|
import JsonSource from '../JsonSource.js';
|
|
@@ -16,7 +17,7 @@ describe('loaders/genes-json-loaders', () => {
|
|
|
16
17
|
it('can load obsFeatureMatrix', async () => {
|
|
17
18
|
const loader = createLoader(GenesJsonAsObsFeatureMatrixLoader, {
|
|
18
19
|
fileType: 'obsFeatureMatrix.genes.json',
|
|
19
|
-
}, 'http://localhost:
|
|
20
|
+
}, 'http://localhost:4204/@fixtures/json-legacy/genes.good.json');
|
|
20
21
|
const result = await loader.load();
|
|
21
22
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
22
23
|
const payload = result.data;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
1
2
|
import { LoaderResult } from '@vitessce/vit-s';
|
|
2
3
|
import MoleculesJsonAsObsLocationsLoader from './MoleculesJsonAsObsLocations.js';
|
|
3
4
|
import MoleculesJsonAsObsLabelsLoader from './MoleculesJsonAsObsLabels.js';
|
|
@@ -17,7 +18,7 @@ describe('loaders/molecules-json-loaders', () => {
|
|
|
17
18
|
it('can load obsLocations', async () => {
|
|
18
19
|
const loader = createLoader(MoleculesJsonAsObsLocationsLoader, {
|
|
19
20
|
fileType: 'obsLocations.molecules.json',
|
|
20
|
-
}, 'http://localhost:
|
|
21
|
+
}, 'http://localhost:4204/@fixtures/json-legacy/molecules.good.json');
|
|
21
22
|
const result = await loader.load();
|
|
22
23
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
23
24
|
const payload = result.data;
|
|
@@ -34,7 +35,7 @@ describe('loaders/molecules-json-loaders', () => {
|
|
|
34
35
|
coordinationValues: {
|
|
35
36
|
obsLabelsType: 'gene',
|
|
36
37
|
},
|
|
37
|
-
}, 'http://localhost:
|
|
38
|
+
}, 'http://localhost:4204/@fixtures/json-legacy/molecules.good.json');
|
|
38
39
|
const result = await loader.load();
|
|
39
40
|
expect(result).toBeInstanceOf(LoaderResult);
|
|
40
41
|
const payload = result.data;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { viv } from '@vitessce/gl';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
initializeRasterLayersAndChannels,
|
|
4
|
+
coordinateTransformationsToMatrix,
|
|
5
|
+
getNgffAxes,
|
|
6
|
+
} from '@vitessce/spatial-utils';
|
|
3
7
|
import { openArray } from 'zarr';
|
|
4
8
|
import { AbstractLoaderError, LoaderResult } from '@vitessce/vit-s';
|
|
5
9
|
import { rasterJsonSchema as rasterSchema } from '@vitessce/schemas';
|
|
@@ -66,6 +70,49 @@ async function initLoader(imageData) {
|
|
|
66
70
|
: [Channels.Name || `Channel ${0}`];
|
|
67
71
|
return { ...loader, channels };
|
|
68
72
|
}
|
|
73
|
+
case ('ome-zarr'): {
|
|
74
|
+
// Reference: https://github.com/vitessce/vitessce-python/issues/242#issuecomment-1517930964
|
|
75
|
+
// Most of the following has been copied from OmeZarrLoader.js.
|
|
76
|
+
// Reference: https://github.com/vitessce/vitessce/blob/fb0e7f/packages/file-types/zarr/src/ome-loaders/OmeZarrLoader.js#L29
|
|
77
|
+
const { coordinateTransformations: coordinateTransformationsFromOptions } = metadata || {};
|
|
78
|
+
|
|
79
|
+
const loader = await viv.loadOmeZarr(url, { fetchOptions: requestInit, type: 'multiscales' });
|
|
80
|
+
const { metadata: loaderMetadata } = loader;
|
|
81
|
+
|
|
82
|
+
const { omero, multiscales } = loaderMetadata;
|
|
83
|
+
|
|
84
|
+
if (!Array.isArray(multiscales) || multiscales.length === 0) {
|
|
85
|
+
console.error('Multiscales array must exist and have at least one element');
|
|
86
|
+
}
|
|
87
|
+
const { coordinateTransformations } = multiscales[0];
|
|
88
|
+
|
|
89
|
+
// Axes in v0.4 format.
|
|
90
|
+
const axes = getNgffAxes(multiscales[0].axes);
|
|
91
|
+
|
|
92
|
+
const transformMatrixFromOptions = coordinateTransformationsToMatrix(
|
|
93
|
+
coordinateTransformationsFromOptions, axes,
|
|
94
|
+
);
|
|
95
|
+
const transformMatrixFromFile = coordinateTransformationsToMatrix(
|
|
96
|
+
coordinateTransformations, axes,
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const transformMatrix = transformMatrixFromFile.multiplyLeft(transformMatrixFromOptions);
|
|
100
|
+
|
|
101
|
+
const { channels, name: omeroName } = omero;
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
name: omeroName || 'Image',
|
|
105
|
+
channels: channels.map((c, i) => c.label || `Channel ${i}`),
|
|
106
|
+
...(transformMatrix ? {
|
|
107
|
+
metadata: {
|
|
108
|
+
transform: {
|
|
109
|
+
matrix: transformMatrix,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
} : {}),
|
|
113
|
+
...loader,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
69
116
|
default: {
|
|
70
117
|
throw Error(`Image type (${type}) is not supported`);
|
|
71
118
|
}
|
|
@@ -94,7 +141,7 @@ export default class RasterLoader extends JsonLoader {
|
|
|
94
141
|
// Get image name and URL tuples.
|
|
95
142
|
const urls = images
|
|
96
143
|
.filter(image => !image.url.includes('zarr'))
|
|
97
|
-
.map(image => (
|
|
144
|
+
.map(image => ({ url: image.url, name: image.name }));
|
|
98
145
|
|
|
99
146
|
// Add a loaderCreator function for each image layer.
|
|
100
147
|
const imagesWithLoaderCreators = images.map(image => ({
|