@vitessce/zarr 3.1.3 → 3.2.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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A, F, G, a, M, b, O, f, c, d, e, h, Z } from "./index-58807fea.js";
1
+ import { A, F, G, a, M, b, O, i, e, d, f, h, c, j, Z } from "./index-9ae02eab.js";
2
2
  import "@vitessce/vit-s";
3
3
  import "react";
4
4
  export {
@@ -9,10 +9,12 @@ export {
9
9
  M as MuDataSource,
10
10
  b as ObsEmbeddingAnndataLoader,
11
11
  O as ObsFeatureMatrixAnndataLoader,
12
- f as ObsLabelsAnndataLoader,
13
- c as ObsLocationsAnndataLoader,
14
- d as ObsSegmentationsAnndataLoader,
15
- e as ObsSetsAnndataLoader,
16
- h as OmeZarrLoader,
12
+ i as ObsLabelsAnndataLoader,
13
+ e as ObsLocationsAnndataLoader,
14
+ d as ObsPointsAnndataLoader,
15
+ f as ObsSegmentationsAnndataLoader,
16
+ h as ObsSetsAnndataLoader,
17
+ c as ObsSpotsAnndataLoader,
18
+ j as OmeZarrLoader,
17
19
  Z as ZarrDataSource
18
20
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-58807fea.js";
1
+ import { B as BaseDecoder } from "./index-9ae02eab.js";
2
2
  import "@vitessce/vit-s";
3
3
  import "react";
4
4
  const dctZigZag = new Int32Array([
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
2
- import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-58807fea.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-9ae02eab.js";
3
3
  import "@vitessce/vit-s";
4
4
  import "react";
5
5
  const LercParameters = {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-58807fea.js";
1
+ import { B as BaseDecoder } from "./index-9ae02eab.js";
2
2
  import "@vitessce/vit-s";
3
3
  import "react";
4
4
  const MIN_BITS = 9;
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-58807fea.js";
1
+ import { B as BaseDecoder } from "./index-9ae02eab.js";
2
2
  import "@vitessce/vit-s";
3
3
  import "react";
4
4
  class PackbitsDecoder extends BaseDecoder {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-58807fea.js";
1
+ import { B as BaseDecoder } from "./index-9ae02eab.js";
2
2
  import "@vitessce/vit-s";
3
3
  import "react";
4
4
  class RawDecoder extends BaseDecoder {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-58807fea.js";
1
+ import { B as BaseDecoder } from "./index-9ae02eab.js";
2
2
  import "@vitessce/vit-s";
3
3
  import "react";
4
4
  class WebImageDecoder extends BaseDecoder {
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Loader for embedding arrays located in anndata.zarr stores.
3
+ */
4
+ export default class ObsPointsAnndataLoader {
5
+ /**
6
+ * Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
7
+ * @returns {Promise} A promise for an array of columns.
8
+ */
9
+ loadPoints(): Promise<any>;
10
+ locations: any;
11
+ load(): Promise<any>;
12
+ }
13
+ //# sourceMappingURL=ObsPointsAnndataLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObsPointsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsPointsAnndataLoader.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IACE;;;OAGG;IACH,2BAWC;IALG,eAA+D;IAOnE,qBAaC;CACF"}
@@ -0,0 +1,33 @@
1
+ import { LoaderResult, AbstractTwoStepLoader, AbstractLoaderError, } from '@vitessce/vit-s';
2
+ /**
3
+ * Loader for embedding arrays located in anndata.zarr stores.
4
+ */
5
+ export default class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
6
+ /**
7
+ * Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
8
+ * @returns {Promise} A promise for an array of columns.
9
+ */
10
+ loadPoints() {
11
+ const { path, dims = [0, 1] } = this.options;
12
+ if (this.locations) {
13
+ return this.locations;
14
+ }
15
+ if (!this.locations) {
16
+ this.locations = this.dataSource.loadNumericForDims(path, dims);
17
+ return this.locations;
18
+ }
19
+ this.locations = Promise.resolve(null);
20
+ return this.locations;
21
+ }
22
+ async load() {
23
+ const { path } = this.options;
24
+ const superResult = await super.load().catch(reason => Promise.resolve(reason));
25
+ if (superResult instanceof AbstractLoaderError) {
26
+ return Promise.reject(superResult);
27
+ }
28
+ return Promise.all([
29
+ this.dataSource.loadObsIndex(path),
30
+ this.loadPoints(),
31
+ ]).then(([obsIndex, obsPoints]) => Promise.resolve(new LoaderResult({ obsIndex, obsPoints }, null)));
32
+ }
33
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Loader for embedding arrays located in anndata.zarr stores.
3
+ */
4
+ export default class ObsSpotsAnndataLoader {
5
+ /**
6
+ * Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
7
+ * @returns {Promise} A promise for an array of columns.
8
+ */
9
+ loadSpots(): Promise<any>;
10
+ locations: any;
11
+ load(): Promise<any>;
12
+ }
13
+ //# sourceMappingURL=ObsSpotsAnndataLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObsSpotsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsSpotsAnndataLoader.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IACE;;;OAGG;IACH,0BAWC;IALG,eAA+D;IAOnE,qBAaC;CACF"}
@@ -0,0 +1,33 @@
1
+ import { LoaderResult, AbstractTwoStepLoader, AbstractLoaderError, } from '@vitessce/vit-s';
2
+ /**
3
+ * Loader for embedding arrays located in anndata.zarr stores.
4
+ */
5
+ export default class ObsSpotsAnndataLoader extends AbstractTwoStepLoader {
6
+ /**
7
+ * Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
8
+ * @returns {Promise} A promise for an array of columns.
9
+ */
10
+ loadSpots() {
11
+ const { path, dims = [0, 1] } = this.options;
12
+ if (this.locations) {
13
+ return this.locations;
14
+ }
15
+ if (!this.locations) {
16
+ this.locations = this.dataSource.loadNumericForDims(path, dims);
17
+ return this.locations;
18
+ }
19
+ this.locations = Promise.resolve(null);
20
+ return this.locations;
21
+ }
22
+ async load() {
23
+ const { path } = this.options;
24
+ const superResult = await super.load().catch(reason => Promise.resolve(reason));
25
+ if (superResult instanceof AbstractLoaderError) {
26
+ return Promise.reject(superResult);
27
+ }
28
+ return Promise.all([
29
+ this.dataSource.loadObsIndex(path),
30
+ this.loadSpots(),
31
+ ]).then(([obsIndex, obsSpots]) => Promise.resolve(new LoaderResult({ obsIndex, obsSpots }, null)));
32
+ }
33
+ }
@@ -1,5 +1,7 @@
1
1
  export { default as ObsFeatureMatrixAnndataLoader } from "./ObsFeatureMatrixAnndataLoader.js";
2
2
  export { default as ObsEmbeddingAnndataLoader } from "./ObsEmbeddingAnndataLoader.js";
3
+ export { default as ObsSpotsAnndataLoader } from "./ObsSpotsAnndataLoader.js";
4
+ export { default as ObsPointsAnndataLoader } from "./ObsPointsAnndataLoader.js";
3
5
  export { default as ObsLocationsAnndataLoader } from "./ObsLocationsAnndataLoader.js";
4
6
  export { default as ObsSegmentationsAnndataLoader } from "./ObsSegmentationsAnndataLoader.js";
5
7
  export { default as ObsSetsAnndataLoader } from "./ObsSetsAnndataLoader.js";
@@ -1,5 +1,7 @@
1
1
  export { default as ObsFeatureMatrixAnndataLoader } from './ObsFeatureMatrixAnndataLoader.js';
2
2
  export { default as ObsEmbeddingAnndataLoader } from './ObsEmbeddingAnndataLoader.js';
3
+ export { default as ObsSpotsAnndataLoader } from './ObsSpotsAnndataLoader.js';
4
+ export { default as ObsPointsAnndataLoader } from './ObsPointsAnndataLoader.js';
3
5
  export { default as ObsLocationsAnndataLoader } from './ObsLocationsAnndataLoader.js';
4
6
  export { default as ObsSegmentationsAnndataLoader } from './ObsSegmentationsAnndataLoader.js';
5
7
  export { default as ObsSetsAnndataLoader } from './ObsSetsAnndataLoader.js';
@@ -1 +1 @@
1
- {"version":3,"file":"OmeZarrLoader.d.ts","sourceRoot":"","sources":["../../src/ome-loaders/OmeZarrLoader.js"],"names":[],"mappings":"AAsBA;IACE,qBAsIC;CACF"}
1
+ {"version":3,"file":"OmeZarrLoader.d.ts","sourceRoot":"","sources":["../../src/ome-loaders/OmeZarrLoader.js"],"names":[],"mappings":"AAkBA;IACE,qBAgJC;CACF"}
@@ -1,14 +1,7 @@
1
1
  import { viv } from '@vitessce/gl';
2
- import { initializeRasterLayersAndChannels, coordinateTransformationsToMatrix, getNgffAxes, normalizeCoordinateTransformations, } from '@vitessce/spatial-utils';
2
+ import { initializeRasterLayersAndChannels, coordinateTransformationsToMatrix, getNgffAxes, hexToRgb, normalizeCoordinateTransformations, } from '@vitessce/spatial-utils';
3
+ import { ImageWrapper, } from '@vitessce/image-utils';
3
4
  import { AbstractLoaderError, LoaderResult, AbstractTwoStepLoader, } from '@vitessce/vit-s';
4
- function hexToRgb(hex) {
5
- const result = /^#?([A-F\d]{2})([A-F\d]{2})([A-F\d]{2})$/i.exec(hex);
6
- return [
7
- parseInt(result[1].toLowerCase(), 16),
8
- parseInt(result[2].toLowerCase(), 16),
9
- parseInt(result[3].toLowerCase(), 16),
10
- ];
11
- }
12
5
  export default class OmeZarrLoader extends AbstractTwoStepLoader {
13
6
  async load() {
14
7
  const payload = await this.dataSource.getJson('.zattrs').catch(reason => Promise.resolve(reason));
@@ -17,6 +10,7 @@ export default class OmeZarrLoader extends AbstractTwoStepLoader {
17
10
  }
18
11
  const { coordinateTransformations: coordinateTransformationsFromOptions } = this.options || {};
19
12
  const loader = await viv.loadOmeZarr(this.url, { fetchOptions: this.requestInit, type: 'multiscales' });
13
+ const imageWrapper = new ImageWrapper(loader, this.options);
20
14
  const { metadata, data } = loader;
21
15
  const { omero, multiscales, channels_metadata: spatialDataChannels } = metadata;
22
16
  // Crude way to check if this is a SpatialData OME-NGFF.
@@ -108,6 +102,13 @@ export default class OmeZarrLoader extends AbstractTwoStepLoader {
108
102
  const coordinationValues = {
109
103
  spatialImageLayer: autoImageLayers,
110
104
  };
111
- return Promise.resolve(new LoaderResult({ image: { loaders: imageLayerLoaders, meta: imageLayerMeta } }, [], coordinationValues));
105
+ return Promise.resolve(new LoaderResult({
106
+ image: {
107
+ loaders: imageLayerLoaders,
108
+ meta: imageLayerMeta,
109
+ instance: imageWrapper, // TODO: make this the root value of LoaderResult.image.
110
+ },
111
+ featureIndex: imageWrapper.getChannelNames(),
112
+ }, [], coordinationValues));
112
113
  }
113
114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/zarr",
3
- "version": "3.1.3",
3
+ "version": "3.2.1",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -19,12 +19,13 @@
19
19
  "d3-array": "^2.4.0",
20
20
  "lodash-es": "^4.17.21",
21
21
  "zarr": "0.5.1",
22
- "@vitessce/constants-internal": "3.1.3",
23
- "@vitessce/gl": "3.1.3",
24
- "@vitessce/sets-utils": "3.1.3",
25
- "@vitessce/spatial-utils": "3.1.3",
26
- "@vitessce/utils": "3.1.3",
27
- "@vitessce/vit-s": "3.1.3"
22
+ "@vitessce/constants-internal": "3.2.1",
23
+ "@vitessce/gl": "3.2.1",
24
+ "@vitessce/sets-utils": "3.2.1",
25
+ "@vitessce/spatial-utils": "3.2.1",
26
+ "@vitessce/image-utils": "3.2.1",
27
+ "@vitessce/utils": "3.2.1",
28
+ "@vitessce/vit-s": "3.2.1"
28
29
  },
29
30
  "scripts": {
30
31
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
@@ -0,0 +1,40 @@
1
+ import {
2
+ LoaderResult, AbstractTwoStepLoader, AbstractLoaderError,
3
+ } from '@vitessce/vit-s';
4
+
5
+ /**
6
+ * Loader for embedding arrays located in anndata.zarr stores.
7
+ */
8
+ export default class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
9
+ /**
10
+ * Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
11
+ * @returns {Promise} A promise for an array of columns.
12
+ */
13
+ loadPoints() {
14
+ const { path, dims = [0, 1] } = this.options;
15
+ if (this.locations) {
16
+ return this.locations;
17
+ }
18
+ if (!this.locations) {
19
+ this.locations = this.dataSource.loadNumericForDims(path, dims);
20
+ return this.locations;
21
+ }
22
+ this.locations = Promise.resolve(null);
23
+ return this.locations;
24
+ }
25
+
26
+ async load() {
27
+ const { path } = this.options;
28
+ const superResult = await super.load().catch(reason => Promise.resolve(reason));
29
+ if (superResult instanceof AbstractLoaderError) {
30
+ return Promise.reject(superResult);
31
+ }
32
+ return Promise.all([
33
+ this.dataSource.loadObsIndex(path),
34
+ this.loadPoints(),
35
+ ]).then(([obsIndex, obsPoints]) => Promise.resolve(new LoaderResult(
36
+ { obsIndex, obsPoints },
37
+ null,
38
+ )));
39
+ }
40
+ }
@@ -0,0 +1,40 @@
1
+ import {
2
+ LoaderResult, AbstractTwoStepLoader, AbstractLoaderError,
3
+ } from '@vitessce/vit-s';
4
+
5
+ /**
6
+ * Loader for embedding arrays located in anndata.zarr stores.
7
+ */
8
+ export default class ObsSpotsAnndataLoader extends AbstractTwoStepLoader {
9
+ /**
10
+ * Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
11
+ * @returns {Promise} A promise for an array of columns.
12
+ */
13
+ loadSpots() {
14
+ const { path, dims = [0, 1] } = this.options;
15
+ if (this.locations) {
16
+ return this.locations;
17
+ }
18
+ if (!this.locations) {
19
+ this.locations = this.dataSource.loadNumericForDims(path, dims);
20
+ return this.locations;
21
+ }
22
+ this.locations = Promise.resolve(null);
23
+ return this.locations;
24
+ }
25
+
26
+ async load() {
27
+ const { path } = this.options;
28
+ const superResult = await super.load().catch(reason => Promise.resolve(reason));
29
+ if (superResult instanceof AbstractLoaderError) {
30
+ return Promise.reject(superResult);
31
+ }
32
+ return Promise.all([
33
+ this.dataSource.loadObsIndex(path),
34
+ this.loadSpots(),
35
+ ]).then(([obsIndex, obsSpots]) => Promise.resolve(new LoaderResult(
36
+ { obsIndex, obsSpots },
37
+ null,
38
+ )));
39
+ }
40
+ }
@@ -1,5 +1,7 @@
1
1
  export { default as ObsFeatureMatrixAnndataLoader } from './ObsFeatureMatrixAnndataLoader.js';
2
2
  export { default as ObsEmbeddingAnndataLoader } from './ObsEmbeddingAnndataLoader.js';
3
+ export { default as ObsSpotsAnndataLoader } from './ObsSpotsAnndataLoader.js';
4
+ export { default as ObsPointsAnndataLoader } from './ObsPointsAnndataLoader.js';
3
5
  export { default as ObsLocationsAnndataLoader } from './ObsLocationsAnndataLoader.js';
4
6
  export { default as ObsSegmentationsAnndataLoader } from './ObsSegmentationsAnndataLoader.js';
5
7
  export { default as ObsSetsAnndataLoader } from './ObsSetsAnndataLoader.js';
@@ -3,22 +3,18 @@ import {
3
3
  initializeRasterLayersAndChannels,
4
4
  coordinateTransformationsToMatrix,
5
5
  getNgffAxes,
6
+ hexToRgb,
6
7
  normalizeCoordinateTransformations,
7
8
  } from '@vitessce/spatial-utils';
9
+ import {
10
+ ImageWrapper,
11
+ } from '@vitessce/image-utils';
8
12
  import {
9
13
  AbstractLoaderError,
10
14
  LoaderResult,
11
15
  AbstractTwoStepLoader,
12
16
  } from '@vitessce/vit-s';
13
17
 
14
- function hexToRgb(hex) {
15
- const result = /^#?([A-F\d]{2})([A-F\d]{2})([A-F\d]{2})$/i.exec(hex);
16
- return [
17
- parseInt(result[1].toLowerCase(), 16),
18
- parseInt(result[2].toLowerCase(), 16),
19
- parseInt(result[3].toLowerCase(), 16),
20
- ];
21
- }
22
18
 
23
19
  export default class OmeZarrLoader extends AbstractTwoStepLoader {
24
20
  async load() {
@@ -30,6 +26,9 @@ export default class OmeZarrLoader extends AbstractTwoStepLoader {
30
26
  const { coordinateTransformations: coordinateTransformationsFromOptions } = this.options || {};
31
27
 
32
28
  const loader = await viv.loadOmeZarr(this.url, { fetchOptions: this.requestInit, type: 'multiscales' });
29
+
30
+ const imageWrapper = new ImageWrapper(loader, this.options);
31
+
33
32
  const { metadata, data } = loader;
34
33
 
35
34
  const { omero, multiscales, channels_metadata: spatialDataChannels } = metadata;
@@ -151,7 +150,14 @@ export default class OmeZarrLoader extends AbstractTwoStepLoader {
151
150
  spatialImageLayer: autoImageLayers,
152
151
  };
153
152
  return Promise.resolve(new LoaderResult(
154
- { image: { loaders: imageLayerLoaders, meta: imageLayerMeta } },
153
+ {
154
+ image: {
155
+ loaders: imageLayerLoaders, // TODO: replace with imageWrapper
156
+ meta: imageLayerMeta, // TODO: replace with imageWrapper
157
+ instance: imageWrapper, // TODO: make this the root value of LoaderResult.image.
158
+ },
159
+ featureIndex: imageWrapper.getChannelNames(),
160
+ },
155
161
  [],
156
162
  coordinationValues,
157
163
  ));