@vitessce/spatial-utils 3.5.2 → 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-d1beeb70.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;
@@ -109096,10 +109129,10 @@ var DrawSquareFromCenterMode = /* @__PURE__ */ function(_TwoClickPolygonMode) {
109096
109129
  var corner = newPoint.geometry.coordinates;
109097
109130
  var longitude = coord1[0] > corner[0] ? coord1[0] + Math.abs(coord1[0] - corner[0]) : coord1[0] - Math.abs(coord1[0] - corner[0]);
109098
109131
  var latitude = coord1[1] > corner[1] ? coord1[1] + Math.abs(coord1[1] - corner[1]) : coord1[1] - Math.abs(coord1[1] - corner[1]);
109099
- var square2 = (0, _bboxPolygon$1["default"])([longitude, latitude, corner[0], corner[1]]);
109100
- square2.properties = square2.properties || {};
109101
- square2.properties.shape = "Square";
109102
- 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;
109103
109136
  }
109104
109137
  }]);
109105
109138
  return DrawSquareFromCenterMode2;
@@ -119226,16 +119259,16 @@ function addDecoder(cases, importFn) {
119226
119259
  }
119227
119260
  cases.forEach((c) => registry$2.set(c, importFn));
119228
119261
  }
119229
- addDecoder([void 0, 1], () => import("./raw-a9a348d2.js").then((m) => m.default));
119230
- addDecoder(5, () => import("./lzw-01e20243.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));
119231
119264
  addDecoder(6, () => {
119232
119265
  throw new Error("old style JPEG compression is not supported.");
119233
119266
  });
119234
- addDecoder(7, () => import("./jpeg-25ebd467.js").then((m) => m.default));
119235
- addDecoder([8, 32946], () => import("./deflate-b50ecf71.js").then((m) => m.default));
119236
- addDecoder(32773, () => import("./packbits-4cce52a2.js").then((m) => m.default));
119237
- addDecoder(34887, () => import("./lerc-7c40eebc.js").then((m) => m.default));
119238
- addDecoder(50001, () => import("./webimage-553303ea.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));
119239
119272
  function decodeRowAcc(row, stride) {
119240
119273
  let length2 = row.length - stride;
119241
119274
  let offset = 0;
@@ -128807,12 +128840,6 @@ const DTYPE_VALUES = {
128807
128840
  cast: (data) => new Float32Array(data)
128808
128841
  }
128809
128842
  };
128810
- var RENDERING_MODES = /* @__PURE__ */ ((RENDERING_MODES2) => {
128811
- RENDERING_MODES2["MAX_INTENSITY_PROJECTION"] = "Maximum Intensity Projection";
128812
- RENDERING_MODES2["MIN_INTENSITY_PROJECTION"] = "Minimum Intensity Projection";
128813
- RENDERING_MODES2["ADDITIVE"] = "Additive";
128814
- return RENDERING_MODES2;
128815
- })(RENDERING_MODES || {});
128816
128843
  const apply_transparent_color = `vec4 apply_transparent_color(vec3 color, vec3 transparentColor, bool useTransparentColor, float opacity){
128817
128844
  return vec4(color, (color == transparentColor && useTransparentColor) ? 0. : opacity);
128818
128845
  }
@@ -133625,40 +133652,6 @@ function abbreviateNumber(value) {
133625
133652
  return naive;
133626
133653
  return value.toExponential(0);
133627
133654
  }
133628
- function square(x2, y2, r2) {
133629
- return [[x2, y2 + r2], [x2 + r2, y2], [x2, y2 - r2], [x2 - r2, y2]];
133630
- }
133631
- const GLOBAL_LABELS = ["z", "t"];
133632
- const DEFAULT_RASTER_DOMAIN_TYPE = "Min/Max";
133633
- const DEFAULT_RASTER_LAYER_PROPS = {
133634
- visible: true,
133635
- colormap: null,
133636
- opacity: 1,
133637
- domainType: DEFAULT_RASTER_DOMAIN_TYPE,
133638
- transparentColor: [0, 0, 0],
133639
- renderingMode: RENDERING_MODES.ADDITIVE,
133640
- use3d: false
133641
- };
133642
- const DEFAULT_MOLECULES_LAYER = {
133643
- opacity: 1,
133644
- radius: 20,
133645
- visible: true
133646
- };
133647
- const DEFAULT_CELLS_LAYER = {
133648
- opacity: 1,
133649
- radius: 50,
133650
- visible: true,
133651
- stroked: false
133652
- };
133653
- const DEFAULT_NEIGHBORHOODS_LAYER = {
133654
- visible: false
133655
- };
133656
- const DEFAULT_LAYER_TYPE_ORDERING = [
133657
- "molecules",
133658
- "cells",
133659
- "neighborhoods",
133660
- "raster"
133661
- ];
133662
133655
  function getSourceFromLoader(loader, level) {
133663
133656
  const { data } = loader;
133664
133657
  const source = Array.isArray(data) ? data[level || data.length - 1] : data;
@@ -135522,12 +135515,11 @@ function getDomains() {
135522
135515
  }
135523
135516
  const DOMAINS = getDomains();
135524
135517
  export {
135525
- getBoundingCube as A,
135518
+ abbreviateNumber as A,
135526
135519
  BaseDecoder as B,
135527
- abbreviateNumber as C,
135520
+ filterSelection as C,
135528
135521
  DEFAULT_CELLS_LAYER as D,
135529
- filterSelection as E,
135530
- DOMAINS as F,
135522
+ DOMAINS as E,
135531
135523
  GLOBAL_LABELS as G,
135532
135524
  ZarritaPixelSource as Z,
135533
135525
  DEFAULT_MOLECULES_LAYER as a,
@@ -135548,12 +135540,12 @@ export {
135548
135540
  physicalSizeToMatrix as p,
135549
135541
  getStatsForResolution as q,
135550
135542
  canLoadResolution as r,
135551
- square as s,
135552
- normalizeCoordinateTransformations as t,
135553
- loadOmeZarr as u,
135554
- guessTileSize as v,
135555
- toRgbUIString as w,
135556
- getSingleSelectionStats as x,
135557
- getMultiSelectionStats as y,
135558
- 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
135559
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-d1beeb70.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-d1beeb70.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-d1beeb70.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-d1beeb70.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-d1beeb70.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-d1beeb70.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-d1beeb70.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.2",
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.2",
24
- "@vitessce/utils": "3.5.2",
25
- "@vitessce/zarr-utils": "3.5.2"
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 = [