@vitessce/json 3.3.1 → 3.3.3

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-68f84e2a.js";
2
- import { B as BaseDecoder } from "./index-c9e50f8e.js";
2
+ import { B as BaseDecoder } from "./index-b20eb2e8.js";
3
3
  import "@vitessce/vit-s";
4
4
  import "react";
5
5
  class DeflateDecoder extends BaseDecoder {
@@ -111,7 +111,9 @@ const FileType$1 = {
111
111
  OBS_SEGMENTATIONS_JSON: "obsSegmentations.json",
112
112
  OBS_SETS_CSV: "obsSets.csv",
113
113
  OBS_SETS_JSON: "obsSets.json",
114
+ // OME-Zarr
114
115
  IMAGE_OME_ZARR: "image.ome-zarr",
116
+ OBS_SEGMENTATIONS_OME_ZARR: "obsSegmentations.ome-zarr",
115
117
  // AnnData
116
118
  OBS_FEATURE_MATRIX_ANNDATA_ZARR: "obsFeatureMatrix.anndata.zarr",
117
119
  OBS_SETS_ANNDATA_ZARR: "obsSets.anndata.zarr",
@@ -16972,30 +16974,39 @@ const omeCoordinateTransformations = z.array(z.union([
16972
16974
  scale: z.array(z.number())
16973
16975
  })
16974
16976
  ]));
16975
- z.object({
16977
+ const imageOmeTiffSchema = z.object({
16976
16978
  offsetsUrl: z.string().optional(),
16977
16979
  coordinateTransformations: omeCoordinateTransformations.optional()
16978
16980
  });
16981
+ imageOmeTiffSchema.extend({
16982
+ obsTypesFromChannelNames: z.boolean().optional()
16983
+ });
16979
16984
  const imageOmeZarrSchema = z.object({
16980
16985
  coordinateTransformations: omeCoordinateTransformations.optional()
16981
16986
  });
16982
16987
  imageOmeZarrSchema.extend({
16988
+ obsTypesFromChannelNames: z.boolean().optional()
16989
+ });
16990
+ const imageSpatialdataSchema = imageOmeZarrSchema.extend({
16983
16991
  path: z.string()
16984
16992
  });
16985
- z.object({
16993
+ const obsSegmentationsSpatialdataSchema = z.object({
16994
+ // TODO: should this also extend the imageOmeZarrSchema?
16995
+ // TODO: should this be renamed labelsSpatialdataSchema?
16996
+ // TODO: support obsTypesFromChannelNames?
16986
16997
  path: z.string()
16987
16998
  });
16988
16999
  z.object({
16989
17000
  path: z.string()
16990
17001
  });
16991
- z.object({
17002
+ const obsSpotsSpatialdataSchema = z.object({
16992
17003
  path: z.string(),
16993
17004
  tablePath: z.string().optional().describe("The path to a table which annotates the spots. If available but not specified, the spot identifiers may not be aligned with associated tabular data as expected.")
16994
17005
  });
16995
- annDataObsFeatureMatrix.extend({
17006
+ const obsFeatureMatrixSpatialdataSchema = annDataObsFeatureMatrix.extend({
16996
17007
  region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional()
16997
17008
  });
16998
- z.object({
17009
+ const obsSetsSpatialdataSchema = z.object({
16999
17010
  region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional(),
17000
17011
  tablePath: z.string().optional().describe("The path to a table which contains the index for the set values."),
17001
17012
  obsSets: annDataObsSets
@@ -17058,6 +17069,19 @@ z.object({
17058
17069
  z.array(annDataConvenienceObsEmbeddingItem)
17059
17070
  ])
17060
17071
  }).partial();
17072
+ z.object({
17073
+ // TODO: should `image` be a special schema
17074
+ // to allow specifying fileUid (like for embeddingType)?
17075
+ image: imageSpatialdataSchema,
17076
+ // TODO: should this be a special schema
17077
+ // to allow specifying fileUid (like for embeddingType)?
17078
+ labels: obsSegmentationsSpatialdataSchema,
17079
+ obsFeatureMatrix: obsFeatureMatrixSpatialdataSchema,
17080
+ obsSpots: obsSpotsSpatialdataSchema,
17081
+ // TODO: obsPoints
17082
+ // TODO: obsLocations
17083
+ obsSets: obsSetsSpatialdataSchema
17084
+ }).partial();
17061
17085
  z.object({
17062
17086
  obsLabelsTypes: z.array(z.string()).optional(),
17063
17087
  embeddingTypes: z.array(z.string()).optional()
@@ -17193,6 +17217,24 @@ class JsonLoader extends AbstractTwoStepLoader {
17193
17217
  return [valid2, failureReason];
17194
17218
  }
17195
17219
  }
17220
+ class CoordinationLevel {
17221
+ constructor(value) {
17222
+ this.value = value;
17223
+ this.cachedValue = null;
17224
+ }
17225
+ setCached(processedLevel) {
17226
+ this.cachedValue = processedLevel;
17227
+ }
17228
+ getCached() {
17229
+ return this.cachedValue;
17230
+ }
17231
+ isCached() {
17232
+ return this.cachedValue !== null;
17233
+ }
17234
+ }
17235
+ function CL(value) {
17236
+ return new CoordinationLevel(value);
17237
+ }
17196
17238
  class ObsSegmentationsJsonLoader extends JsonLoader {
17197
17239
  loadFromCache(data) {
17198
17240
  if (this.cachedResult) {
@@ -17208,15 +17250,42 @@ class ObsSegmentationsJsonLoader extends JsonLoader {
17208
17250
  return this.cachedResult;
17209
17251
  }
17210
17252
  async load() {
17253
+ var _a3;
17211
17254
  const payload = await super.load().catch((reason) => Promise.resolve(reason));
17212
17255
  if (payload instanceof AbstractLoaderError) {
17213
17256
  return Promise.reject(payload);
17214
17257
  }
17258
+ const channelCoordination = [{
17259
+ // obsType: null,
17260
+ spatialChannelColor: [255, 255, 255],
17261
+ spatialChannelVisible: true,
17262
+ spatialChannelOpacity: 1,
17263
+ spatialChannelWindow: null,
17264
+ // featureType: 'feature',
17265
+ // featureValueType: 'value',
17266
+ obsColorEncoding: "spatialChannelColor",
17267
+ spatialSegmentationFilled: true,
17268
+ spatialSegmentationStrokeWidth: 1,
17269
+ obsHighlight: null
17270
+ }];
17271
+ const coordinationValues = {
17272
+ // spatialTargetZ: imageWrapper.getDefaultTargetZ(),
17273
+ // spatialTargetT: imageWrapper.getDefaultTargetT(),
17274
+ segmentationLayer: CL([
17275
+ {
17276
+ fileUid: ((_a3 = this.coordinationValues) == null ? void 0 : _a3.fileUid) || null,
17277
+ spatialLayerOpacity: 1,
17278
+ spatialLayerVisible: true,
17279
+ segmentationChannel: CL(channelCoordination)
17280
+ }
17281
+ ])
17282
+ };
17215
17283
  const { data, url } = payload;
17216
17284
  const result = this.loadFromCache(data);
17217
17285
  return Promise.resolve(new LoaderResult(
17218
17286
  result,
17219
- url
17287
+ url,
17288
+ coordinationValues
17220
17289
  ));
17221
17290
  }
17222
17291
  }
@@ -25420,7 +25489,7 @@ function clone$6(obj) {
25420
25489
  Decimal2.log = log$5;
25421
25490
  Decimal2.log10 = log10;
25422
25491
  Decimal2.log2 = log2$1;
25423
- Decimal2.max = max;
25492
+ Decimal2.max = max$1;
25424
25493
  Decimal2.min = min;
25425
25494
  Decimal2.mod = mod$2;
25426
25495
  Decimal2.mul = mul;
@@ -25491,7 +25560,7 @@ function log2$1(x2) {
25491
25560
  function log10(x2) {
25492
25561
  return new this(x2).log(10);
25493
25562
  }
25494
- function max() {
25563
+ function max$1() {
25495
25564
  return maxOrMin(this, arguments, "lt");
25496
25565
  }
25497
25566
  function min() {
@@ -134648,16 +134717,16 @@ async function getDecoder(fileDirectory) {
134648
134717
  const Decoder = await importFn();
134649
134718
  return new Decoder(fileDirectory);
134650
134719
  }
134651
- addDecoder([void 0, 1], () => import("./raw-489994e7.js").then((m) => m.default));
134652
- addDecoder(5, () => import("./lzw-95c88af0.js").then((m) => m.default));
134720
+ addDecoder([void 0, 1], () => import("./raw-f74c147a.js").then((m) => m.default));
134721
+ addDecoder(5, () => import("./lzw-121e745b.js").then((m) => m.default));
134653
134722
  addDecoder(6, () => {
134654
134723
  throw new Error("old style JPEG compression is not supported.");
134655
134724
  });
134656
- addDecoder(7, () => import("./jpeg-4352029f.js").then((m) => m.default));
134657
- addDecoder([8, 32946], () => import("./deflate-44be7eee.js").then((m) => m.default));
134658
- addDecoder(32773, () => import("./packbits-dbe03832.js").then((m) => m.default));
134659
- addDecoder(34887, () => import("./lerc-9666eaeb.js").then((m) => m.default));
134660
- addDecoder(50001, () => import("./webimage-bf903bbd.js").then((m) => m.default));
134725
+ addDecoder(7, () => import("./jpeg-3f41f3cf.js").then((m) => m.default));
134726
+ addDecoder([8, 32946], () => import("./deflate-ee9ae6b1.js").then((m) => m.default));
134727
+ addDecoder(32773, () => import("./packbits-b1e4f281.js").then((m) => m.default));
134728
+ addDecoder(34887, () => import("./lerc-8d5192ce.js").then((m) => m.default));
134729
+ addDecoder(50001, () => import("./webimage-aa89e581.js").then((m) => m.default));
134661
134730
  function copyNewSize(array, width, height, samplesPerPixel = 1) {
134662
134731
  return new (Object.getPrototypeOf(array)).constructor(width * height * samplesPerPixel);
134663
134732
  }
@@ -148910,22 +148979,40 @@ function extent(values2, valueof) {
148910
148979
  }
148911
148980
  return [min2, max2];
148912
148981
  }
148982
+ function max(values2, valueof) {
148983
+ let max2;
148984
+ if (valueof === void 0) {
148985
+ for (const value of values2) {
148986
+ if (value != null && (max2 < value || max2 === void 0 && value >= value)) {
148987
+ max2 = value;
148988
+ }
148989
+ }
148990
+ } else {
148991
+ let index2 = -1;
148992
+ for (let value of values2) {
148993
+ if ((value = valueof(value, ++index2, values2)) != null && (max2 < value || max2 === void 0 && value >= value)) {
148994
+ max2 = value;
148995
+ }
148996
+ }
148997
+ }
148998
+ return max2;
148999
+ }
148913
149000
  function normalize(arr) {
148914
149001
  const [min2, max2] = extent(arr);
148915
149002
  const ratio = 255 / (max2 - min2);
148916
149003
  const data = new Uint8Array(arr.map((i2) => Math.floor((i2 - min2) * ratio)));
148917
149004
  return data;
148918
149005
  }
148919
- function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSetColorMode, texSize) {
149006
+ function multiSetsToTextureData(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode, texSize) {
148920
149007
  let totalValuesLength = 0;
148921
149008
  let totalColorsLength = 0;
148922
149009
  channelIsSetColorMode.forEach((isSetColorMode, channelIndex) => {
148923
- var _a3, _b2, _c, _d, _e;
149010
+ var _a3, _b2, _c, _d;
148924
149011
  if (isSetColorMode) {
148925
- totalValuesLength += ((_b2 = (_a3 = setColorValues[channelIndex]) == null ? void 0 : _a3.obsIndex) == null ? void 0 : _b2.length) || 0;
148926
- totalColorsLength += (((_d = (_c = setColorValues[channelIndex]) == null ? void 0 : _c.setColors) == null ? void 0 : _d.length) || 0) * 3;
149012
+ totalColorsLength += (((_b2 = (_a3 = setColorValues[channelIndex]) == null ? void 0 : _a3.setColors) == null ? void 0 : _b2.length) || 0) * 3;
149013
+ totalValuesLength += ((_c = setColorValues[channelIndex]) == null ? void 0 : _c.obsIndex) ? max(setColorValues[channelIndex].obsIndex.map((d) => parseInt(d))) : 0;
148927
149014
  } else {
148928
- totalValuesLength += ((_e = multiFeatureValues[channelIndex]) == null ? void 0 : _e.length) || 0;
149015
+ totalValuesLength += multiMatrixObsIndex[channelIndex] ? max(multiMatrixObsIndex[channelIndex].map((d) => parseInt(d))) : ((_d = multiFeatureValues[channelIndex]) == null ? void 0 : _d.length) || 0;
148929
149016
  }
148930
149017
  });
148931
149018
  const valueTexHeight = Math.max(2, Math.ceil(totalValuesLength / texSize));
@@ -148943,12 +149030,20 @@ function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSet
148943
149030
  let indexOffset = 0;
148944
149031
  let colorOffset = 0;
148945
149032
  channelIsSetColorMode.forEach((isSetColorMode, channelIndex) => {
149033
+ const matrixObsIndex = multiMatrixObsIndex[channelIndex];
149034
+ const bitmaskValueIsIndex = matrixObsIndex === null;
148946
149035
  if (isSetColorMode) {
148947
149036
  const { setColorIndices, setColors, obsIndex } = setColorValues[channelIndex] || {};
148948
149037
  if (setColorIndices && setColors && obsIndex) {
148949
149038
  for (let i2 = 0; i2 < obsIndex.length; i2++) {
148950
- const colorIndex = setColorIndices.get(String(i2 + 1));
148951
- totalData[indexOffset + i2] = colorIndex === void 0 ? 0 : colorIndex + 1;
149039
+ let obsId = String(i2 + 1);
149040
+ let obsI = i2;
149041
+ if (!bitmaskValueIsIndex) {
149042
+ obsId = obsIndex[i2];
149043
+ obsI = parseInt(obsId) - 1;
149044
+ }
149045
+ const colorIndex = setColorIndices.get(obsId);
149046
+ totalData[indexOffset + obsI] = colorIndex === void 0 ? 0 : colorIndex + 1;
148952
149047
  }
148953
149048
  for (let i2 = 0; i2 < setColors.length; i2++) {
148954
149049
  const { color: [r2, g2, b] } = setColors[i2];
@@ -148963,7 +149058,16 @@ function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSet
148963
149058
  colorOffset += (setColors == null ? void 0 : setColors.length) || 0;
148964
149059
  } else {
148965
149060
  const featureArr = multiFeatureValues[channelIndex];
148966
- totalData.set(normalize(featureArr), indexOffset);
149061
+ const normalizedFeatureArr = normalize(featureArr);
149062
+ if (!bitmaskValueIsIndex && matrixObsIndex) {
149063
+ for (let i2 = 0; i2 < matrixObsIndex.length; i2++) {
149064
+ const obsId = matrixObsIndex[i2];
149065
+ const obsI = parseInt(obsId) - 1;
149066
+ totalData[indexOffset + obsI] = normalizedFeatureArr[i2];
149067
+ }
149068
+ } else {
149069
+ totalData.set(normalizedFeatureArr, indexOffset);
149070
+ }
148967
149071
  indicesOffsets.push(indexOffset);
148968
149072
  indexOffset += featureArr.length;
148969
149073
  colorsOffsets.push(colorOffset);
@@ -148990,6 +149094,17 @@ function padWithDefault(arr, defaultValue2, padWidth) {
148990
149094
  function getColor(arr) {
148991
149095
  return arr ? arr.map((v) => v / 255) : [0, 0, 0];
148992
149096
  }
149097
+ function isEqualShallow(prevArr, nextArr) {
149098
+ if (prevArr === nextArr) {
149099
+ return true;
149100
+ }
149101
+ if (Array.isArray(prevArr) && Array.isArray(nextArr)) {
149102
+ if (prevArr.length === nextArr.length) {
149103
+ return !prevArr.some((v, i2) => v !== nextArr[i2] && (!Array.isArray(v) && !Array.isArray(nextArr[i2]) || (v.length > 0 || nextArr[i2].length > 0)));
149104
+ }
149105
+ }
149106
+ return prevArr === nextArr;
149107
+ }
148993
149108
  const defaultProps = {
148994
149109
  channelStrokeWidths: { type: "array", value: null, compare: true },
148995
149110
  channelsFilled: { type: "array", value: null, compare: true },
@@ -148999,6 +149114,7 @@ const defaultProps = {
148999
149114
  colormap: { type: "string", value: GLSL_COLORMAP_DEFAULT, compare: true },
149000
149115
  expressionData: { type: "object", value: null, compare: true },
149001
149116
  multiFeatureValues: { type: "array", value: null, compare: true },
149117
+ multiMatrixObsIndex: { type: "array", value: null, compare: true },
149002
149118
  setColorValues: { type: "array", value: null, compare: true },
149003
149119
  channelFeatureValueColormaps: { type: "array", value: null, compare: true },
149004
149120
  channelFeatureValueColormapRanges: { type: "array", value: null, compare: true },
@@ -149045,9 +149161,9 @@ class BitmaskLayer2 extends XRLayer {
149045
149161
  }
149046
149162
  updateState({ props: props2, oldProps, changeFlags }) {
149047
149163
  super.updateState({ props: props2, oldProps, changeFlags });
149048
- if (props2.multiFeatureValues !== oldProps.multiFeatureValues || props2.setColorValues !== oldProps.setColorValues || props2.channelIsSetColorMode !== oldProps.channelIsSetColorMode) {
149049
- const { multiFeatureValues, setColorValues, channelIsSetColorMode } = this.props;
149050
- const [valueTex, colorTex, valueTexOffsets, colorTexOffsets, valueTexHeight, colorTexHeight] = this.multiSetsToTexture(multiFeatureValues, setColorValues, channelIsSetColorMode);
149164
+ if (!isEqualShallow(props2.multiFeatureValues, oldProps.multiFeatureValues) || !isEqualShallow(props2.multiMatrixObsIndex, oldProps.multiMatrixObsIndex) || !isEqualShallow(props2.setColorValues, oldProps.setColorValues) || !isEqualShallow(props2.channelIsSetColorMode, oldProps.channelIsSetColorMode)) {
149165
+ const { multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode } = this.props;
149166
+ const [valueTex, colorTex, valueTexOffsets, colorTexOffsets, valueTexHeight, colorTexHeight] = this.multiSetsToTexture(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode);
149051
149167
  this.setState({
149052
149168
  valueTex,
149053
149169
  colorTex,
@@ -149199,9 +149315,9 @@ class BitmaskLayer2 extends XRLayer {
149199
149315
  type: GL$1.FLOAT
149200
149316
  });
149201
149317
  }
149202
- multiSetsToTexture(multiFeatureValues, setColorValues, channelIsSetColorMode) {
149318
+ multiSetsToTexture(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode) {
149203
149319
  const isWebGL2On = isWebGL2$1(this.context.gl);
149204
- const [totalData, valueTexHeight, indicesOffsets, totalColors, colorTexHeight, colorsOffsets] = multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSetColorMode, MULTI_FEATURE_TEX_SIZE);
149320
+ const [totalData, valueTexHeight, indicesOffsets, totalColors, colorTexHeight, colorsOffsets] = multiSetsToTextureData(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode, MULTI_FEATURE_TEX_SIZE);
149205
149321
  return [
149206
149322
  // Color indices texture
149207
149323
  new Texture2D(this.context.gl, {
@@ -151043,8 +151159,7 @@ class ZarritaPixelSource extends ZarrPixelSource {
151043
151159
  this._readChunks = false;
151044
151160
  }
151045
151161
  }
151046
- async function loadOmeZarr(url, requestInit2) {
151047
- const root2 = await zarrOpenRoot(url, requestInit2);
151162
+ async function loadOmeZarr(root2) {
151048
151163
  const { data, rootAttrs, labels } = await loadMultiscales(root2);
151049
151164
  const tileSize = guessTileSize(data[0]);
151050
151165
  const pyramid = data.map((arr) => new ZarritaPixelSource(createZarrArrayAdapter(arr), labels, tileSize));
@@ -151320,7 +151435,8 @@ async function initLoader(imageData) {
151320
151435
  }
151321
151436
  case "ome-zarr": {
151322
151437
  const { coordinateTransformations: coordinateTransformationsFromOptions } = metadata || {};
151323
- const loader = await loadOmeZarr(url, requestInit2);
151438
+ const root2 = await zarrOpenRoot(url, requestInit2);
151439
+ const loader = await loadOmeZarr(root2);
151324
151440
  const { metadata: loaderMetadata } = loader;
151325
151441
  const { omero, multiscales } = loaderMetadata;
151326
151442
  if (!Array.isArray(multiscales) || multiscales.length === 0) {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C, d, e, f, h, G, b, J, M, i, O, c, R, j } from "./index-c9e50f8e.js";
1
+ import { C, d, e, f, h, G, b, J, M, i, O, c, R, j } from "./index-b20eb2e8.js";
2
2
  import "@vitessce/vit-s";
3
3
  import "react";
4
4
  export {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-c9e50f8e.js";
1
+ import { B as BaseDecoder } from "./index-b20eb2e8.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, L as LercParameters, a as LercAddCompression } from "./index-c9e50f8e.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-b20eb2e8.js";
3
3
  import "@vitessce/vit-s";
4
4
  import "react";
5
5
  var LercDecode = { exports: {} };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-c9e50f8e.js";
1
+ import { B as BaseDecoder } from "./index-b20eb2e8.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-c9e50f8e.js";
1
+ import { B as BaseDecoder } from "./index-b20eb2e8.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-c9e50f8e.js";
1
+ import { B as BaseDecoder } from "./index-b20eb2e8.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-c9e50f8e.js";
1
+ import { B as BaseDecoder } from "./index-b20eb2e8.js";
2
2
  import "@vitessce/vit-s";
3
3
  import "react";
4
4
  class WebImageDecoder extends BaseDecoder {
@@ -1 +1 @@
1
- {"version":3,"file":"ObsSegmentationsJson.d.ts","sourceRoot":"","sources":["../../src/json-loaders/ObsSegmentationsJson.js"],"names":[],"mappings":"AAGA;IACE;;;;;;;MAYC;IAFC;;;;;;;kBAAmF;IAIrF,qBAWC;CACF"}
1
+ {"version":3,"file":"ObsSegmentationsJson.d.ts","sourceRoot":"","sources":["../../src/json-loaders/ObsSegmentationsJson.js"],"names":[],"mappings":"AAIA;IACE;;;;;;;MAYC;IAFC;;;;;;;kBAAmF;IAIrF,qBAwCC;CACF"}
@@ -1,4 +1,5 @@
1
1
  import { AbstractLoaderError, LoaderResult } from '@vitessce/vit-s';
2
+ import { CoordinationLevel as CL } from '@vitessce/config';
2
3
  import JsonLoader from './JsonLoader.js';
3
4
  export default class ObsSegmentationsJsonLoader extends JsonLoader {
4
5
  loadFromCache(data) {
@@ -19,8 +20,33 @@ export default class ObsSegmentationsJsonLoader extends JsonLoader {
19
20
  if (payload instanceof AbstractLoaderError) {
20
21
  return Promise.reject(payload);
21
22
  }
23
+ const channelCoordination = [{
24
+ // obsType: null,
25
+ spatialChannelColor: [255, 255, 255],
26
+ spatialChannelVisible: true,
27
+ spatialChannelOpacity: 1.0,
28
+ spatialChannelWindow: null,
29
+ // featureType: 'feature',
30
+ // featureValueType: 'value',
31
+ obsColorEncoding: 'spatialChannelColor',
32
+ spatialSegmentationFilled: true,
33
+ spatialSegmentationStrokeWidth: 1.0,
34
+ obsHighlight: null,
35
+ }];
36
+ const coordinationValues = {
37
+ // spatialTargetZ: imageWrapper.getDefaultTargetZ(),
38
+ // spatialTargetT: imageWrapper.getDefaultTargetT(),
39
+ segmentationLayer: CL([
40
+ {
41
+ fileUid: this.coordinationValues?.fileUid || null,
42
+ spatialLayerOpacity: 1.0,
43
+ spatialLayerVisible: true,
44
+ segmentationChannel: CL(channelCoordination),
45
+ },
46
+ ]),
47
+ };
22
48
  const { data, url } = payload;
23
49
  const result = this.loadFromCache(data);
24
- return Promise.resolve(new LoaderResult(result, url));
50
+ return Promise.resolve(new LoaderResult(result, url, coordinationValues));
25
51
  }
26
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RasterJsonLoader.d.ts","sourceRoot":"","sources":["../../src/raster-json-loaders/RasterJsonLoader.js"],"names":[],"mappings":"AA6HA;IAWE,qBAyCC;IAnBG,oBAIC;CAgBN"}
1
+ {"version":3,"file":"RasterJsonLoader.d.ts","sourceRoot":"","sources":["../../src/raster-json-loaders/RasterJsonLoader.js"],"names":[],"mappings":"AA8HA;IAWE,qBAyCC;IAnBG,oBAIC;CAgBN"}
@@ -63,7 +63,8 @@ async function initLoader(imageData) {
63
63
  // Most of the following has been copied from OmeZarrLoader.js.
64
64
  // Reference: https://github.com/vitessce/vitessce/blob/fb0e7f/packages/file-types/zarr/src/ome-loaders/OmeZarrLoader.js#L29
65
65
  const { coordinateTransformations: coordinateTransformationsFromOptions } = metadata || {};
66
- const loader = await loadOmeZarr(url, requestInit);
66
+ const root = await zarrOpenRoot(url, requestInit);
67
+ const loader = await loadOmeZarr(root);
67
68
  const { metadata: loaderMetadata } = loader;
68
69
  const { omero, multiscales } = loaderMetadata;
69
70
  if (!Array.isArray(multiscales) || multiscales.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/json",
3
- "version": "3.3.1",
3
+ "version": "3.3.3",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -20,14 +20,15 @@
20
20
  "lodash-es": "^4.17.21",
21
21
  "zarrita": "0.4.0-next.4",
22
22
  "zod": "^3.21.4",
23
- "@vitessce/gl": "3.3.1",
24
- "@vitessce/constants-internal": "3.3.1",
25
- "@vitessce/schemas": "3.3.1",
26
- "@vitessce/sets-utils": "3.3.1",
27
- "@vitessce/utils": "3.3.1",
28
- "@vitessce/spatial-utils": "3.3.1",
29
- "@vitessce/vit-s": "3.3.1",
30
- "@vitessce/zarr-utils": "3.3.1"
23
+ "@vitessce/constants-internal": "3.3.3",
24
+ "@vitessce/gl": "3.3.3",
25
+ "@vitessce/sets-utils": "3.3.3",
26
+ "@vitessce/spatial-utils": "3.3.3",
27
+ "@vitessce/utils": "3.3.3",
28
+ "@vitessce/schemas": "3.3.3",
29
+ "@vitessce/vit-s": "3.3.3",
30
+ "@vitessce/zarr-utils": "3.3.3",
31
+ "@vitessce/config": "3.3.3"
31
32
  },
32
33
  "scripts": {
33
34
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
@@ -1,4 +1,5 @@
1
1
  import { AbstractLoaderError, LoaderResult } from '@vitessce/vit-s';
2
+ import { CoordinationLevel as CL } from '@vitessce/config';
2
3
  import JsonLoader from './JsonLoader.js';
3
4
 
4
5
  export default class ObsSegmentationsJsonLoader extends JsonLoader {
@@ -21,11 +22,40 @@ export default class ObsSegmentationsJsonLoader extends JsonLoader {
21
22
  if (payload instanceof AbstractLoaderError) {
22
23
  return Promise.reject(payload);
23
24
  }
25
+
26
+ const channelCoordination = [{
27
+ // obsType: null,
28
+ spatialChannelColor: [255, 255, 255],
29
+ spatialChannelVisible: true,
30
+ spatialChannelOpacity: 1.0,
31
+ spatialChannelWindow: null,
32
+ // featureType: 'feature',
33
+ // featureValueType: 'value',
34
+ obsColorEncoding: 'spatialChannelColor',
35
+ spatialSegmentationFilled: true,
36
+ spatialSegmentationStrokeWidth: 1.0,
37
+ obsHighlight: null,
38
+ }];
39
+
40
+ const coordinationValues = {
41
+ // spatialTargetZ: imageWrapper.getDefaultTargetZ(),
42
+ // spatialTargetT: imageWrapper.getDefaultTargetT(),
43
+ segmentationLayer: CL([
44
+ {
45
+ fileUid: this.coordinationValues?.fileUid || null,
46
+ spatialLayerOpacity: 1.0,
47
+ spatialLayerVisible: true,
48
+ segmentationChannel: CL(channelCoordination),
49
+ },
50
+ ]),
51
+ };
52
+
24
53
  const { data, url } = payload;
25
54
  const result = this.loadFromCache(data);
26
55
  return Promise.resolve(new LoaderResult(
27
56
  result,
28
57
  url,
58
+ coordinationValues,
29
59
  ));
30
60
  }
31
61
  }
@@ -80,7 +80,8 @@ async function initLoader(imageData) {
80
80
  // Reference: https://github.com/vitessce/vitessce/blob/fb0e7f/packages/file-types/zarr/src/ome-loaders/OmeZarrLoader.js#L29
81
81
  const { coordinateTransformations: coordinateTransformationsFromOptions } = metadata || {};
82
82
 
83
- const loader = await loadOmeZarr(url, requestInit);
83
+ const root = await zarrOpenRoot(url, requestInit);
84
+ const loader = await loadOmeZarr(root);
84
85
  const { metadata: loaderMetadata } = loader;
85
86
 
86
87
  const { omero, multiscales } = loaderMetadata;