@vitessce/spatial-utils 3.5.1 → 3.5.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-cfd80560.js";
2
+ import { B as BaseDecoder } from "./index-ac1a35fe.js";
3
3
  import "react";
4
4
  class DeflateDecoder extends BaseDecoder {
5
5
  decodeBlock(buffer) {
@@ -43,6 +43,39 @@ function _mergeNamespaces(n3, m) {
43
43
  }
44
44
  return Object.freeze(Object.defineProperty(n3, Symbol.toStringTag, { value: "Module" }));
45
45
  }
46
+ const GLOBAL_LABELS = ["z", "t"];
47
+ const DEFAULT_RASTER_DOMAIN_TYPE = "Min/Max";
48
+ const DEFAULT_MOLECULES_LAYER = {
49
+ opacity: 1,
50
+ radius: 20,
51
+ visible: true
52
+ };
53
+ const DEFAULT_CELLS_LAYER = {
54
+ opacity: 1,
55
+ radius: 50,
56
+ visible: true,
57
+ stroked: false
58
+ };
59
+ const DEFAULT_NEIGHBORHOODS_LAYER = {
60
+ visible: false
61
+ };
62
+ const DEFAULT_LAYER_TYPE_ORDERING = [
63
+ "molecules",
64
+ "cells",
65
+ "neighborhoods",
66
+ "raster"
67
+ ];
68
+ const DEFAULT_RASTER_LAYER_PROPS = {
69
+ visible: true,
70
+ colormap: null,
71
+ opacity: 1,
72
+ domainType: DEFAULT_RASTER_DOMAIN_TYPE,
73
+ transparentColor: [0, 0, 0],
74
+ // Importing the full viv package here would add a lot of weight to the bundle
75
+ renderingMode: "Additive",
76
+ // viv.RENDERING_MODES.ADDITIVE,
77
+ use3d: false
78
+ };
46
79
  var freeGlobal$1 = typeof global == "object" && global && global.Object === Object && global;
47
80
  const freeGlobal$2 = freeGlobal$1;
48
81
  var freeSelf$1 = typeof self == "object" && self && self.Object === Object && self;
@@ -85486,24 +85519,16 @@ var getIntrinsic = function GetIntrinsic(name2, allowMissing) {
85486
85519
  return value;
85487
85520
  };
85488
85521
  var callBind$3 = { exports: {} };
85489
- var esDefineProperty;
85490
- var hasRequiredEsDefineProperty;
85491
- function requireEsDefineProperty() {
85492
- if (hasRequiredEsDefineProperty)
85493
- return esDefineProperty;
85494
- hasRequiredEsDefineProperty = 1;
85495
- var GetIntrinsic3 = getIntrinsic;
85496
- var $defineProperty2 = GetIntrinsic3("%Object.defineProperty%", true) || false;
85497
- if ($defineProperty2) {
85498
- try {
85499
- $defineProperty2({}, "a", { value: 1 });
85500
- } catch (e2) {
85501
- $defineProperty2 = false;
85502
- }
85522
+ var GetIntrinsic$4 = getIntrinsic;
85523
+ var $defineProperty$3 = GetIntrinsic$4("%Object.defineProperty%", true) || false;
85524
+ if ($defineProperty$3) {
85525
+ try {
85526
+ $defineProperty$3({}, "a", { value: 1 });
85527
+ } catch (e2) {
85528
+ $defineProperty$3 = false;
85503
85529
  }
85504
- esDefineProperty = $defineProperty2;
85505
- return esDefineProperty;
85506
85530
  }
85531
+ var esDefineProperty = $defineProperty$3;
85507
85532
  var GetIntrinsic$3 = getIntrinsic;
85508
85533
  var $gOPD$1 = GetIntrinsic$3("%Object.getOwnPropertyDescriptor%", true);
85509
85534
  if ($gOPD$1) {
@@ -85514,7 +85539,7 @@ if ($gOPD$1) {
85514
85539
  }
85515
85540
  }
85516
85541
  var gopd$1 = $gOPD$1;
85517
- var $defineProperty$2 = requireEsDefineProperty();
85542
+ var $defineProperty$2 = esDefineProperty;
85518
85543
  var $SyntaxError = syntax;
85519
85544
  var $TypeError$3 = type;
85520
85545
  var gopd = gopd$1;
@@ -85555,7 +85580,7 @@ var defineDataProperty$1 = function defineDataProperty(obj, property, value) {
85555
85580
  throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
85556
85581
  }
85557
85582
  };
85558
- var $defineProperty$1 = requireEsDefineProperty();
85583
+ var $defineProperty$1 = esDefineProperty;
85559
85584
  var hasPropertyDescriptors$1 = function hasPropertyDescriptors() {
85560
85585
  return !!$defineProperty$1;
85561
85586
  };
@@ -85624,7 +85649,7 @@ var setFunctionLength = function setFunctionLength2(fn, length2) {
85624
85649
  var $apply = GetIntrinsic3("%Function.prototype.apply%");
85625
85650
  var $call = GetIntrinsic3("%Function.prototype.call%");
85626
85651
  var $reflectApply = GetIntrinsic3("%Reflect.apply%", true) || bind4.call($call, $apply);
85627
- var $defineProperty2 = requireEsDefineProperty();
85652
+ var $defineProperty2 = esDefineProperty;
85628
85653
  var $max = GetIntrinsic3("%Math.max%");
85629
85654
  module2.exports = function callBind2(originalFunction) {
85630
85655
  if (typeof originalFunction !== "function") {
@@ -109104,10 +109129,10 @@ var DrawSquareFromCenterMode = /* @__PURE__ */ function(_TwoClickPolygonMode) {
109104
109129
  var corner = newPoint.geometry.coordinates;
109105
109130
  var longitude = coord1[0] > corner[0] ? coord1[0] + Math.abs(coord1[0] - corner[0]) : coord1[0] - Math.abs(coord1[0] - corner[0]);
109106
109131
  var latitude = coord1[1] > corner[1] ? coord1[1] + Math.abs(coord1[1] - corner[1]) : coord1[1] - Math.abs(coord1[1] - corner[1]);
109107
- var square2 = (0, _bboxPolygon$1["default"])([longitude, latitude, corner[0], corner[1]]);
109108
- square2.properties = square2.properties || {};
109109
- square2.properties.shape = "Square";
109110
- return square2;
109132
+ var square = (0, _bboxPolygon$1["default"])([longitude, latitude, corner[0], corner[1]]);
109133
+ square.properties = square.properties || {};
109134
+ square.properties.shape = "Square";
109135
+ return square;
109111
109136
  }
109112
109137
  }]);
109113
109138
  return DrawSquareFromCenterMode2;
@@ -119234,16 +119259,16 @@ function addDecoder(cases, importFn) {
119234
119259
  }
119235
119260
  cases.forEach((c) => registry$2.set(c, importFn));
119236
119261
  }
119237
- addDecoder([void 0, 1], () => import("./raw-3c5b9d00.js").then((m) => m.default));
119238
- addDecoder(5, () => import("./lzw-311071ed.js").then((m) => m.default));
119262
+ addDecoder([void 0, 1], () => import("./raw-50921dfc.js").then((m) => m.default));
119263
+ addDecoder(5, () => import("./lzw-04aab5f2.js").then((m) => m.default));
119239
119264
  addDecoder(6, () => {
119240
119265
  throw new Error("old style JPEG compression is not supported.");
119241
119266
  });
119242
- addDecoder(7, () => import("./jpeg-1d1532b2.js").then((m) => m.default));
119243
- addDecoder([8, 32946], () => import("./deflate-6119f695.js").then((m) => m.default));
119244
- addDecoder(32773, () => import("./packbits-a4515a7a.js").then((m) => m.default));
119245
- addDecoder(34887, () => import("./lerc-30e3a151.js").then((m) => m.default));
119246
- addDecoder(50001, () => import("./webimage-75eb6327.js").then((m) => m.default));
119267
+ addDecoder(7, () => import("./jpeg-defa9e7c.js").then((m) => m.default));
119268
+ addDecoder([8, 32946], () => import("./deflate-72995733.js").then((m) => m.default));
119269
+ addDecoder(32773, () => import("./packbits-3b8eecdb.js").then((m) => m.default));
119270
+ addDecoder(34887, () => import("./lerc-016c6bf9.js").then((m) => m.default));
119271
+ addDecoder(50001, () => import("./webimage-98d89993.js").then((m) => m.default));
119247
119272
  function decodeRowAcc(row, stride) {
119248
119273
  let length2 = row.length - stride;
119249
119274
  let offset = 0;
@@ -128815,12 +128840,6 @@ const DTYPE_VALUES = {
128815
128840
  cast: (data) => new Float32Array(data)
128816
128841
  }
128817
128842
  };
128818
- var RENDERING_MODES = /* @__PURE__ */ ((RENDERING_MODES2) => {
128819
- RENDERING_MODES2["MAX_INTENSITY_PROJECTION"] = "Maximum Intensity Projection";
128820
- RENDERING_MODES2["MIN_INTENSITY_PROJECTION"] = "Minimum Intensity Projection";
128821
- RENDERING_MODES2["ADDITIVE"] = "Additive";
128822
- return RENDERING_MODES2;
128823
- })(RENDERING_MODES || {});
128824
128843
  const apply_transparent_color = `vec4 apply_transparent_color(vec3 color, vec3 transparentColor, bool useTransparentColor, float opacity){
128825
128844
  return vec4(color, (color == transparentColor && useTransparentColor) ? 0. : opacity);
128826
128845
  }
@@ -133633,40 +133652,6 @@ function abbreviateNumber(value) {
133633
133652
  return naive;
133634
133653
  return value.toExponential(0);
133635
133654
  }
133636
- function square(x2, y2, r2) {
133637
- return [[x2, y2 + r2], [x2 + r2, y2], [x2, y2 - r2], [x2 - r2, y2]];
133638
- }
133639
- const GLOBAL_LABELS = ["z", "t"];
133640
- const DEFAULT_RASTER_DOMAIN_TYPE = "Min/Max";
133641
- const DEFAULT_RASTER_LAYER_PROPS = {
133642
- visible: true,
133643
- colormap: null,
133644
- opacity: 1,
133645
- domainType: DEFAULT_RASTER_DOMAIN_TYPE,
133646
- transparentColor: [0, 0, 0],
133647
- renderingMode: RENDERING_MODES.ADDITIVE,
133648
- use3d: false
133649
- };
133650
- const DEFAULT_MOLECULES_LAYER = {
133651
- opacity: 1,
133652
- radius: 20,
133653
- visible: true
133654
- };
133655
- const DEFAULT_CELLS_LAYER = {
133656
- opacity: 1,
133657
- radius: 50,
133658
- visible: true,
133659
- stroked: false
133660
- };
133661
- const DEFAULT_NEIGHBORHOODS_LAYER = {
133662
- visible: false
133663
- };
133664
- const DEFAULT_LAYER_TYPE_ORDERING = [
133665
- "molecules",
133666
- "cells",
133667
- "neighborhoods",
133668
- "raster"
133669
- ];
133670
133655
  function getSourceFromLoader(loader, level) {
133671
133656
  const { data } = loader;
133672
133657
  const source = Array.isArray(data) ? data[level || data.length - 1] : data;
@@ -135530,12 +135515,11 @@ function getDomains() {
135530
135515
  }
135531
135516
  const DOMAINS = getDomains();
135532
135517
  export {
135533
- getBoundingCube as A,
135518
+ abbreviateNumber as A,
135534
135519
  BaseDecoder as B,
135535
- abbreviateNumber as C,
135520
+ filterSelection as C,
135536
135521
  DEFAULT_CELLS_LAYER as D,
135537
- filterSelection as E,
135538
- DOMAINS as F,
135522
+ DOMAINS as E,
135539
135523
  GLOBAL_LABELS as G,
135540
135524
  ZarritaPixelSource as Z,
135541
135525
  DEFAULT_MOLECULES_LAYER as a,
@@ -135556,12 +135540,12 @@ export {
135556
135540
  physicalSizeToMatrix as p,
135557
135541
  getStatsForResolution as q,
135558
135542
  canLoadResolution as r,
135559
- square as s,
135560
- normalizeCoordinateTransformations as t,
135561
- loadOmeZarr as u,
135562
- guessTileSize as v,
135563
- toRgbUIString as w,
135564
- getSingleSelectionStats as x,
135565
- getMultiSelectionStats as y,
135566
- getPhysicalSizeScalingMatrix as z
135543
+ normalizeCoordinateTransformations as s,
135544
+ loadOmeZarr as t,
135545
+ guessTileSize as u,
135546
+ toRgbUIString as v,
135547
+ getSingleSelectionStats as w,
135548
+ getMultiSelectionStats as x,
135549
+ getPhysicalSizeScalingMatrix as y,
135550
+ getBoundingCube as z
135567
135551
  };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D, e, a, b, c, d, F, G, Z, C, r, n, E, A, y, l, m, z, x, h, q, v, o, i, f, j, k, u, t, p, s, w } from "./index-cfd80560.js";
1
+ import { D, e, a, b, c, d, E, G, Z, A, r, n, C, z, x, l, m, y, w, h, q, u, o, i, f, j, k, t, s, p, v } from "./index-ac1a35fe.js";
2
2
  import "react";
3
3
  export {
4
4
  D as DEFAULT_CELLS_LAYER,
@@ -7,30 +7,29 @@ export {
7
7
  b as DEFAULT_NEIGHBORHOODS_LAYER,
8
8
  c as DEFAULT_RASTER_DOMAIN_TYPE,
9
9
  d as DEFAULT_RASTER_LAYER_PROPS,
10
- F as DOMAINS,
10
+ E as DOMAINS,
11
11
  G as GLOBAL_LABELS,
12
12
  Z as ZarritaPixelSource,
13
- C as abbreviateNumber,
13
+ A as abbreviateNumber,
14
14
  r as canLoadResolution,
15
15
  n as coordinateTransformationsToMatrix,
16
- E as filterSelection,
17
- A as getBoundingCube,
18
- y as getMultiSelectionStats,
16
+ C as filterSelection,
17
+ z as getBoundingCube,
18
+ x as getMultiSelectionStats,
19
19
  l as getNgffAxes,
20
20
  m as getNgffAxesForTiff,
21
- z as getPhysicalSizeScalingMatrix,
22
- x as getSingleSelectionStats,
21
+ y as getPhysicalSizeScalingMatrix,
22
+ w as getSingleSelectionStats,
23
23
  h as getSourceFromLoader,
24
24
  q as getStatsForResolution,
25
- v as guessTileSize,
25
+ u as guessTileSize,
26
26
  o as hexToRgb,
27
27
  i as initializeLayerChannels,
28
28
  f as initializeRasterLayersAndChannels,
29
29
  j as isInterleaved,
30
30
  k as isRgb,
31
- u as loadOmeZarr,
32
- t as normalizeCoordinateTransformations,
31
+ t as loadOmeZarr,
32
+ s as normalizeCoordinateTransformations,
33
33
  p as physicalSizeToMatrix,
34
- s as square,
35
- w as toRgbUIString
34
+ v as toRgbUIString
36
35
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-cfd80560.js";
1
+ import { B as BaseDecoder } from "./index-ac1a35fe.js";
2
2
  import "react";
3
3
  const dctZigZag = new Int32Array([
4
4
  0,
@@ -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-cfd80560.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-ac1a35fe.js";
3
3
  import "react";
4
4
  const LercParameters = {
5
5
  Version: 0,
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-cfd80560.js";
1
+ import { B as BaseDecoder } from "./index-ac1a35fe.js";
2
2
  import "react";
3
3
  const MIN_BITS = 9;
4
4
  const CLEAR_CODE = 256;
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-cfd80560.js";
1
+ import { B as BaseDecoder } from "./index-ac1a35fe.js";
2
2
  import "react";
3
3
  class PackbitsDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-cfd80560.js";
1
+ import { B as BaseDecoder } from "./index-ac1a35fe.js";
2
2
  import "react";
3
3
  class RawDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-cfd80560.js";
1
+ import { B as BaseDecoder } from "./index-ac1a35fe.js";
2
2
  import "react";
3
3
  class WebImageDecoder extends BaseDecoder {
4
4
  constructor() {
@@ -1,5 +1,6 @@
1
1
  export { DOMAINS } from "./constants.js";
2
- export { GLOBAL_LABELS, DEFAULT_CELLS_LAYER, DEFAULT_MOLECULES_LAYER, DEFAULT_NEIGHBORHOODS_LAYER, DEFAULT_RASTER_DOMAIN_TYPE, DEFAULT_RASTER_LAYER_PROPS, DEFAULT_LAYER_TYPE_ORDERING, square, initializeLayerChannels, initializeRasterLayersAndChannels, getSourceFromLoader, isInterleaved, isRgb, getNgffAxes, getNgffAxesForTiff, coordinateTransformationsToMatrix, physicalSizeToMatrix, hexToRgb, getStatsForResolution, canLoadResolution, normalizeCoordinateTransformations } from "./spatial.js";
2
+ export { GLOBAL_LABELS, DEFAULT_CELLS_LAYER, DEFAULT_MOLECULES_LAYER, DEFAULT_NEIGHBORHOODS_LAYER, DEFAULT_RASTER_DOMAIN_TYPE, DEFAULT_RASTER_LAYER_PROPS, DEFAULT_LAYER_TYPE_ORDERING } from "@vitessce/constants-internal";
3
+ export { initializeLayerChannels, initializeRasterLayersAndChannels, getSourceFromLoader, isInterleaved, isRgb, getNgffAxes, getNgffAxesForTiff, coordinateTransformationsToMatrix, physicalSizeToMatrix, hexToRgb, getStatsForResolution, canLoadResolution, normalizeCoordinateTransformations } from "./spatial.js";
3
4
  export { loadOmeZarr, guessTileSize, ZarritaPixelSource } from "./load-ome-zarr.js";
4
5
  export { toRgbUIString, getSingleSelectionStats, getMultiSelectionStats, getPhysicalSizeScalingMatrix, getBoundingCube, abbreviateNumber, filterSelection } from "./layer-controller.js";
5
6
  //# sourceMappingURL=index.d.ts.map
package/dist-tsc/index.js CHANGED
@@ -1,4 +1,5 @@
1
- export { GLOBAL_LABELS, DEFAULT_CELLS_LAYER, DEFAULT_MOLECULES_LAYER, DEFAULT_NEIGHBORHOODS_LAYER, DEFAULT_RASTER_DOMAIN_TYPE, DEFAULT_RASTER_LAYER_PROPS, DEFAULT_LAYER_TYPE_ORDERING, square, initializeLayerChannels, initializeRasterLayersAndChannels, getSourceFromLoader, isInterleaved, isRgb, getNgffAxes, getNgffAxesForTiff, coordinateTransformationsToMatrix, physicalSizeToMatrix, hexToRgb, getStatsForResolution, canLoadResolution, normalizeCoordinateTransformations, } from './spatial.js';
1
+ export { GLOBAL_LABELS, DEFAULT_CELLS_LAYER, DEFAULT_MOLECULES_LAYER, DEFAULT_NEIGHBORHOODS_LAYER, DEFAULT_RASTER_DOMAIN_TYPE, DEFAULT_RASTER_LAYER_PROPS, DEFAULT_LAYER_TYPE_ORDERING, } from '@vitessce/constants-internal';
2
+ export { initializeLayerChannels, initializeRasterLayersAndChannels, getSourceFromLoader, isInterleaved, isRgb, getNgffAxes, getNgffAxesForTiff, coordinateTransformationsToMatrix, physicalSizeToMatrix, hexToRgb, getStatsForResolution, canLoadResolution, normalizeCoordinateTransformations, } from './spatial.js';
2
3
  export { loadOmeZarr, guessTileSize, ZarritaPixelSource, } from './load-ome-zarr.js';
3
4
  export { toRgbUIString, getSingleSelectionStats, getMultiSelectionStats, getPhysicalSizeScalingMatrix, getBoundingCube, abbreviateNumber, filterSelection, } from './layer-controller.js';
4
5
  export { DOMAINS, } from './constants.js';
@@ -1,12 +1,11 @@
1
- export function square(x: any, y: any, r: any): any[][];
2
1
  /**
3
2
  * Get a representative PixelSource from a loader object returned from
4
3
  * the Vitessce imaging loaders
5
4
  * @param {object} loader { data: (PixelSource[]|PixelSource), metadata, channels } object
6
- * @param {number=} level Level of the multiscale loader from which to get a PixelSource
5
+ * @param {number | undefined} level Level of the multiscale loader from which to get a PixelSource
7
6
  * @returns {object} PixelSource object
8
7
  */
9
- export function getSourceFromLoader(loader: object, level?: number | undefined): object;
8
+ export function getSourceFromLoader(loader: object, level: number | undefined): object;
10
9
  /**
11
10
  * Helper method to determine whether pixel data is interleaved and rgb or not.
12
11
  * @param {object} loader
@@ -64,38 +63,6 @@ export function hexToRgb(hex: any): number[];
64
63
  * @returns {object[]} Array of coordinateTransformations in OME-NGFF v0.4 format.
65
64
  */
66
65
  export function normalizeCoordinateTransformations(coordinateTransformations: object[] | undefined, datasets: object[]): object[];
67
- export const GLOBAL_LABELS: string[];
68
- export const DEFAULT_RASTER_DOMAIN_TYPE: "Min/Max";
69
- export namespace DEFAULT_RASTER_LAYER_PROPS {
70
- export let visible: boolean;
71
- export let colormap: null;
72
- export let opacity: number;
73
- export { DEFAULT_RASTER_DOMAIN_TYPE as domainType };
74
- export let transparentColor: number[];
75
- export let renderingMode: viv.RENDERING_MODES;
76
- export let use3d: boolean;
77
- }
78
- export namespace DEFAULT_MOLECULES_LAYER {
79
- let opacity_1: number;
80
- export { opacity_1 as opacity };
81
- export let radius: number;
82
- let visible_1: boolean;
83
- export { visible_1 as visible };
84
- }
85
- export namespace DEFAULT_CELLS_LAYER {
86
- let opacity_2: number;
87
- export { opacity_2 as opacity };
88
- let radius_1: number;
89
- export { radius_1 as radius };
90
- let visible_2: boolean;
91
- export { visible_2 as visible };
92
- export let stroked: boolean;
93
- }
94
- export namespace DEFAULT_NEIGHBORHOODS_LAYER {
95
- let visible_3: boolean;
96
- export { visible_3 as visible };
97
- }
98
- export const DEFAULT_LAYER_TYPE_ORDERING: string[];
99
66
  export function getStatsForResolution(loader: any, resolution: any): {
100
67
  height: any;
101
68
  width: any;
@@ -104,5 +71,4 @@ export function getStatsForResolution(loader: any, resolution: any): {
104
71
  };
105
72
  export function canLoadResolution(loader: any, resolution: any): boolean;
106
73
  import { Matrix4 } from 'math.gl';
107
- import { viv } from '@vitessce/gl';
108
74
  //# sourceMappingURL=spatial.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spatial.d.ts","sourceRoot":"","sources":["../src/spatial.js"],"names":[],"mappings":"AAOA,wDAEC;AAiCD;;;;;;GAMG;AACH,4CAJW,MAAM,UACN,MAAM,YAAC,GACL,MAAM,CAMlB;AAoCD;;;;GAIG;AACH,8BAHW,MAAM,YACN,KAAK,GAAC,IAAI,WAiBpB;AAID,sHAkCC;AAiHD;;GAEG;AACH,qCAFW,KAAK,CAAE,MAAM,CAAC,WAKxB;AAED;;;;;;GAMG;AACH,gDALW,MAAM,eAEJ,MAAM,EAAE,CAuCpB;AAED;;;;;;;;;GASG;AACH,gEAJW,MAAM,EAAE,sBAER,CAAC,MAAM,EAAE,GAAC,IAAI,CAAC,+CAuEzB;AASD;;;IAuBC;AAED,uDAQC;AAED;;;;;;;;GAQG;AACH,6EANW,MAAM,EAAE,GAAC,SAAS,QAElB,MAAM,EAAE,GAAC,SAAS,GAEhB,OAAO,CA4CnB;AAED,6CAOC;AAED;;;;;;;;;GASG;AACH,8EANW,MAAM,EAAE,GAAC,SAAS,YAGlB,MAAM,EAAE,GACN,MAAM,EAAE,CAoDpB;AAniBD,qCAAwC;AAExC,mDAAoD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBpD,mDAKE;AAeK;;;;;EAYN;AAEM,yEAkBN;wBAtFuB,SAAS;oBAGb,cAAc"}
1
+ {"version":3,"file":"spatial.d.ts","sourceRoot":"","sources":["../src/spatial.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,4CAJW,MAAM,SACN,MAAM,GAAG,SAAS,GAChB,MAAM,CAMlB;AAoCD;;;;GAIG;AACH,8BAHW,MAAM,YACN,KAAK,GAAC,IAAI,WAiBpB;AAID,sHAkCC;AAiHD;;GAEG;AACH,qCAFW,KAAK,CAAE,MAAM,CAAC,WAKxB;AAED;;;;;;GAMG;AACH,gDALW,MAAM,eAEJ,MAAM,EAAE,CAuCpB;AAED;;;;;;;;;GASG;AACH,gEAJW,MAAM,EAAE,sBAER,CAAC,MAAM,EAAE,GAAC,IAAI,CAAC,+CAuEzB;AASD;;;IAuBC;AAED,uDAQC;AAED;;;;;;;;GAQG;AACH,6EANW,MAAM,EAAE,GAAC,SAAS,QAElB,MAAM,EAAE,GAAC,SAAS,GAEhB,OAAO,CA4CnB;AAED,6CAOC;AAED;;;;;;;;;GASG;AACH,8EANW,MAAM,EAAE,GAAC,SAAS,YAGlB,MAAM,EAAE,GACN,MAAM,EAAE,CAoDpB;AAvfM;;;;;EAYN;AAEM,yEAkBN;wBAnDuB,SAAS"}
@@ -2,42 +2,13 @@ import { isEqual } from 'lodash-es';
2
2
  import { Matrix4 } from 'math.gl';
3
3
  import { divide, compare, unit } from 'mathjs';
4
4
  import { VIEWER_PALETTE } from '@vitessce/utils';
5
- import { viv } from '@vitessce/gl';
5
+ import { GLOBAL_LABELS, DEFAULT_RASTER_LAYER_PROPS } from '@vitessce/constants-internal';
6
6
  import { getMultiSelectionStats } from './layer-controller.js';
7
- export function square(x, y, r) {
8
- return [[x, y + r], [x + r, y], [x, y - r], [x - r, y]];
9
- }
10
- export const GLOBAL_LABELS = ['z', 't'];
11
- export const DEFAULT_RASTER_DOMAIN_TYPE = 'Min/Max';
12
- export const DEFAULT_RASTER_LAYER_PROPS = {
13
- visible: true,
14
- colormap: null,
15
- opacity: 1,
16
- domainType: DEFAULT_RASTER_DOMAIN_TYPE,
17
- transparentColor: [0, 0, 0],
18
- renderingMode: viv.RENDERING_MODES.ADDITIVE,
19
- use3d: false,
20
- };
21
- export const DEFAULT_MOLECULES_LAYER = {
22
- opacity: 1, radius: 20, visible: true,
23
- };
24
- export const DEFAULT_CELLS_LAYER = {
25
- opacity: 1, radius: 50, visible: true, stroked: false,
26
- };
27
- export const DEFAULT_NEIGHBORHOODS_LAYER = {
28
- visible: false,
29
- };
30
- export const DEFAULT_LAYER_TYPE_ORDERING = [
31
- 'molecules',
32
- 'cells',
33
- 'neighborhoods',
34
- 'raster',
35
- ];
36
7
  /**
37
8
  * Get a representative PixelSource from a loader object returned from
38
9
  * the Vitessce imaging loaders
39
10
  * @param {object} loader { data: (PixelSource[]|PixelSource), metadata, channels } object
40
- * @param {number=} level Level of the multiscale loader from which to get a PixelSource
11
+ * @param {number | undefined} level Level of the multiscale loader from which to get a PixelSource
41
12
  * @returns {object} PixelSource object
42
13
  */
43
14
  export function getSourceFromLoader(loader, level) {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { square, coordinateTransformationsToMatrix, normalizeCoordinateTransformations, } from './spatial.js';
2
+ import { coordinateTransformationsToMatrix, normalizeCoordinateTransformations, } from './spatial.js';
3
3
  const defaultAxes = [
4
4
  { type: 'time', name: 't' },
5
5
  { type: 'channel', name: 'c' },
@@ -8,11 +8,6 @@ const defaultAxes = [
8
8
  { type: 'space', name: 'x' },
9
9
  ];
10
10
  describe('Spatial.js', () => {
11
- describe('square()', () => {
12
- it('gives the right coordinates', () => {
13
- expect(square(0, 0, 50)).toEqual([[0, 50], [50, 0], [0, -50], [-50, 0]]);
14
- });
15
- });
16
11
  describe('coordinateTransformationsToMatrix', () => {
17
12
  it('returns an Array instance', () => {
18
13
  const transformations = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/spatial-utils",
3
- "version": "3.5.1",
3
+ "version": "3.5.3",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -20,9 +20,10 @@
20
20
  "zarrita": "0.4.0-next.16",
21
21
  "math.gl": "^3.5.6",
22
22
  "mathjs": "^9.2.0",
23
- "@vitessce/gl": "3.5.1",
24
- "@vitessce/utils": "3.5.1",
25
- "@vitessce/zarr-utils": "3.5.1"
23
+ "@vitessce/gl": "3.5.3",
24
+ "@vitessce/utils": "3.5.3",
25
+ "@vitessce/zarr-utils": "3.5.3",
26
+ "@vitessce/constants-internal": "3.5.3"
26
27
  },
27
28
  "scripts": {
28
29
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
package/src/index.js CHANGED
@@ -6,7 +6,8 @@ export {
6
6
  DEFAULT_RASTER_DOMAIN_TYPE,
7
7
  DEFAULT_RASTER_LAYER_PROPS,
8
8
  DEFAULT_LAYER_TYPE_ORDERING,
9
- square,
9
+ } from '@vitessce/constants-internal';
10
+ export {
10
11
  initializeLayerChannels,
11
12
  initializeRasterLayersAndChannels,
12
13
  getSourceFromLoader,
package/src/spatial.js CHANGED
@@ -2,49 +2,14 @@ import { isEqual } from 'lodash-es';
2
2
  import { Matrix4 } from 'math.gl';
3
3
  import { divide, compare, unit } from 'mathjs';
4
4
  import { VIEWER_PALETTE } from '@vitessce/utils';
5
- import { viv } from '@vitessce/gl';
5
+ import { GLOBAL_LABELS, DEFAULT_RASTER_LAYER_PROPS } from '@vitessce/constants-internal';
6
6
  import { getMultiSelectionStats } from './layer-controller.js';
7
7
 
8
- export function square(x, y, r) {
9
- return [[x, y + r], [x + r, y], [x, y - r], [x - r, y]];
10
- }
11
-
12
- export const GLOBAL_LABELS = ['z', 't'];
13
-
14
- export const DEFAULT_RASTER_DOMAIN_TYPE = 'Min/Max';
15
-
16
- export const DEFAULT_RASTER_LAYER_PROPS = {
17
- visible: true,
18
- colormap: null,
19
- opacity: 1,
20
- domainType: DEFAULT_RASTER_DOMAIN_TYPE,
21
- transparentColor: [0, 0, 0],
22
- renderingMode: viv.RENDERING_MODES.ADDITIVE,
23
- use3d: false,
24
- };
25
-
26
- export const DEFAULT_MOLECULES_LAYER = {
27
- opacity: 1, radius: 20, visible: true,
28
- };
29
- export const DEFAULT_CELLS_LAYER = {
30
- opacity: 1, radius: 50, visible: true, stroked: false,
31
- };
32
- export const DEFAULT_NEIGHBORHOODS_LAYER = {
33
- visible: false,
34
- };
35
-
36
- export const DEFAULT_LAYER_TYPE_ORDERING = [
37
- 'molecules',
38
- 'cells',
39
- 'neighborhoods',
40
- 'raster',
41
- ];
42
-
43
8
  /**
44
9
  * Get a representative PixelSource from a loader object returned from
45
10
  * the Vitessce imaging loaders
46
11
  * @param {object} loader { data: (PixelSource[]|PixelSource), metadata, channels } object
47
- * @param {number=} level Level of the multiscale loader from which to get a PixelSource
12
+ * @param {number | undefined} level Level of the multiscale loader from which to get a PixelSource
48
13
  * @returns {object} PixelSource object
49
14
  */
50
15
  export function getSourceFromLoader(loader, level) {
@@ -1,6 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
2
  import {
3
- square,
4
3
  coordinateTransformationsToMatrix,
5
4
  normalizeCoordinateTransformations,
6
5
  } from './spatial.js';
@@ -14,11 +13,6 @@ const defaultAxes = [
14
13
  ];
15
14
 
16
15
  describe('Spatial.js', () => {
17
- describe('square()', () => {
18
- it('gives the right coordinates', () => {
19
- expect(square(0, 0, 50)).toEqual([[0, 50], [50, 0], [0, -50], [-50, 0]]);
20
- });
21
- });
22
16
  describe('coordinateTransformationsToMatrix', () => {
23
17
  it('returns an Array instance', () => {
24
18
  const transformations = [