@vitessce/layer-controller 3.2.1 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{deflate-22ea8fc3.js → deflate-804156cd.js} +1 -1
- package/dist/{index-f8a9f462.js → index-b51c005e.js} +158 -36
- package/dist/index.js +1 -1
- package/dist/{jpeg-932c57f1.js → jpeg-32ca4e37.js} +1 -1
- package/dist/{lerc-0db1b156.js → lerc-be957c97.js} +1 -1
- package/dist/{lzw-3b2cc6cd.js → lzw-1b172fa4.js} +1 -1
- package/dist/{packbits-c8220e7f.js → packbits-84f5534a.js} +1 -1
- package/dist/{raw-dd52cf7d.js → raw-dbd5f758.js} +1 -1
- package/dist/{webimage-d7166a5a.js → webimage-d64061e3.js} +1 -1
- package/package.json +6 -6
|
@@ -16837,6 +16837,7 @@ const DataType$2 = {
|
|
|
16837
16837
|
const FileType$1 = {
|
|
16838
16838
|
// Joint file types
|
|
16839
16839
|
ANNDATA_ZARR: "anndata.zarr",
|
|
16840
|
+
SPATIALDATA_ZARR: "spatialdata.zarr",
|
|
16840
16841
|
// Atomic file types
|
|
16841
16842
|
OBS_EMBEDDING_CSV: "obsEmbedding.csv",
|
|
16842
16843
|
OBS_SPOTS_CSV: "obsSpots.csv",
|
|
@@ -16859,6 +16860,16 @@ const FileType$1 = {
|
|
|
16859
16860
|
OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
|
|
16860
16861
|
OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
|
|
16861
16862
|
FEATURE_LABELS_ANNDATA_ZARR: "featureLabels.anndata.zarr",
|
|
16863
|
+
// SpatialData
|
|
16864
|
+
IMAGE_SPATIALDATA_ZARR: "image.spatialdata.zarr",
|
|
16865
|
+
LABELS_SPATIALDATA_ZARR: "labels.spatialdata.zarr",
|
|
16866
|
+
SHAPES_SPATIALDATA_ZARR: "shapes.spatialdata.zarr",
|
|
16867
|
+
OBS_FEATURE_MATRIX_SPATIALDATA_ZARR: "obsFeatureMatrix.spatialdata.zarr",
|
|
16868
|
+
OBS_SETS_SPATIALDATA_ZARR: "obsSets.spatialdata.zarr",
|
|
16869
|
+
OBS_SPOTS_SPATIALDATA_ZARR: "obsSpots.spatialdata.zarr",
|
|
16870
|
+
// TODO:
|
|
16871
|
+
// OBS_POINTS_SPATIALDATA_ZARR: 'obsPoints.spatialdata.zarr',
|
|
16872
|
+
// OBS_LOCATIONS_SPATIALDATA_ZARR: 'obsLocations.spatialdata.zarr',
|
|
16862
16873
|
// MuData
|
|
16863
16874
|
OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
|
|
16864
16875
|
OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
|
|
@@ -27522,9 +27533,30 @@ z.object({
|
|
|
27522
27533
|
offsetsUrl: z.string().optional(),
|
|
27523
27534
|
coordinateTransformations: omeCoordinateTransformations.optional()
|
|
27524
27535
|
});
|
|
27525
|
-
z.object({
|
|
27536
|
+
const imageOmeZarrSchema = z.object({
|
|
27526
27537
|
coordinateTransformations: omeCoordinateTransformations.optional()
|
|
27527
27538
|
});
|
|
27539
|
+
imageOmeZarrSchema.extend({
|
|
27540
|
+
path: z.string()
|
|
27541
|
+
});
|
|
27542
|
+
z.object({
|
|
27543
|
+
path: z.string()
|
|
27544
|
+
});
|
|
27545
|
+
z.object({
|
|
27546
|
+
path: z.string()
|
|
27547
|
+
});
|
|
27548
|
+
z.object({
|
|
27549
|
+
path: z.string(),
|
|
27550
|
+
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.")
|
|
27551
|
+
});
|
|
27552
|
+
annDataObsFeatureMatrix.extend({
|
|
27553
|
+
region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional()
|
|
27554
|
+
});
|
|
27555
|
+
z.object({
|
|
27556
|
+
region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional(),
|
|
27557
|
+
tablePath: z.string().optional().describe("The path to a table which contains the index for the set values."),
|
|
27558
|
+
obsSets: annDataObsSets
|
|
27559
|
+
});
|
|
27528
27560
|
z.object({
|
|
27529
27561
|
obsIndex: z.string(),
|
|
27530
27562
|
obsEmbedding: z.array(z.string()).length(2)
|
|
@@ -34082,9 +34114,9 @@ const schemePlasma = [[13, 8, 135], [16, 7, 136], [19, 7, 137], [22, 7, 138], [2
|
|
|
34082
34114
|
function rgbSpline(spline) {
|
|
34083
34115
|
return (colors) => {
|
|
34084
34116
|
const n2 = colors.length;
|
|
34085
|
-
|
|
34086
|
-
|
|
34087
|
-
|
|
34117
|
+
const r2 = new Array(n2);
|
|
34118
|
+
const g2 = new Array(n2);
|
|
34119
|
+
const b = new Array(n2);
|
|
34088
34120
|
let i2;
|
|
34089
34121
|
let color;
|
|
34090
34122
|
for (i2 = 0; i2 < n2; ++i2) {
|
|
@@ -34093,10 +34125,10 @@ function rgbSpline(spline) {
|
|
|
34093
34125
|
g2[i2] = color[1] || 0;
|
|
34094
34126
|
b[i2] = color[2] || 0;
|
|
34095
34127
|
}
|
|
34096
|
-
|
|
34097
|
-
|
|
34098
|
-
|
|
34099
|
-
return (t2) => [
|
|
34128
|
+
const rFunc = spline(r2);
|
|
34129
|
+
const gFunc = spline(g2);
|
|
34130
|
+
const bFunc = spline(b);
|
|
34131
|
+
return (t2) => [rFunc(t2), gFunc(t2), bFunc(t2)];
|
|
34100
34132
|
};
|
|
34101
34133
|
}
|
|
34102
34134
|
function basis(values2) {
|
|
@@ -135596,16 +135628,16 @@ function addDecoder(cases, importFn) {
|
|
|
135596
135628
|
}
|
|
135597
135629
|
cases.forEach((c) => registry$1.set(c, importFn));
|
|
135598
135630
|
}
|
|
135599
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
135600
|
-
addDecoder(5, () => import("./lzw-
|
|
135631
|
+
addDecoder([void 0, 1], () => import("./raw-dbd5f758.js").then((m) => m.default));
|
|
135632
|
+
addDecoder(5, () => import("./lzw-1b172fa4.js").then((m) => m.default));
|
|
135601
135633
|
addDecoder(6, () => {
|
|
135602
135634
|
throw new Error("old style JPEG compression is not supported.");
|
|
135603
135635
|
});
|
|
135604
|
-
addDecoder(7, () => import("./jpeg-
|
|
135605
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
135606
|
-
addDecoder(32773, () => import("./packbits-
|
|
135607
|
-
addDecoder(34887, () => import("./lerc-
|
|
135608
|
-
addDecoder(50001, () => import("./webimage-
|
|
135636
|
+
addDecoder(7, () => import("./jpeg-32ca4e37.js").then((m) => m.default));
|
|
135637
|
+
addDecoder([8, 32946], () => import("./deflate-804156cd.js").then((m) => m.default));
|
|
135638
|
+
addDecoder(32773, () => import("./packbits-84f5534a.js").then((m) => m.default));
|
|
135639
|
+
addDecoder(34887, () => import("./lerc-be957c97.js").then((m) => m.default));
|
|
135640
|
+
addDecoder(50001, () => import("./webimage-d64061e3.js").then((m) => m.default));
|
|
135609
135641
|
function decodeRowAcc(row, stride) {
|
|
135610
135642
|
let length2 = row.length - stride;
|
|
135611
135643
|
let offset4 = 0;
|
|
@@ -144613,6 +144645,67 @@ function makeBoundingBox(viewState) {
|
|
|
144613
144645
|
viewport.unproject([0, viewport.height])
|
|
144614
144646
|
];
|
|
144615
144647
|
}
|
|
144648
|
+
const TARGETS = [1, 2, 3, 4, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1e3];
|
|
144649
|
+
const MIN_TARGET = TARGETS[0];
|
|
144650
|
+
const MAX_TARGET = TARGETS[TARGETS.length - 1];
|
|
144651
|
+
const SI_PREFIXES = [
|
|
144652
|
+
{ symbol: "Y", exponent: 24 },
|
|
144653
|
+
{ symbol: "Z", exponent: 21 },
|
|
144654
|
+
{ symbol: "E", exponent: 18 },
|
|
144655
|
+
{ symbol: "P", exponent: 15 },
|
|
144656
|
+
{ symbol: "T", exponent: 12 },
|
|
144657
|
+
{ symbol: "G", exponent: 9 },
|
|
144658
|
+
{ symbol: "M", exponent: 6 },
|
|
144659
|
+
{ symbol: "k", exponent: 3 },
|
|
144660
|
+
{ symbol: "h", exponent: 2 },
|
|
144661
|
+
{ symbol: "da", exponent: 1 },
|
|
144662
|
+
{ symbol: "", exponent: 0 },
|
|
144663
|
+
{ symbol: "d", exponent: -1 },
|
|
144664
|
+
{ symbol: "c", exponent: -2 },
|
|
144665
|
+
{ symbol: "m", exponent: -3 },
|
|
144666
|
+
{ symbol: "µ", exponent: -6 },
|
|
144667
|
+
{ symbol: "n", exponent: -9 },
|
|
144668
|
+
{ symbol: "p", exponent: -12 },
|
|
144669
|
+
{ symbol: "f", exponent: -15 },
|
|
144670
|
+
{ symbol: "a", exponent: -18 },
|
|
144671
|
+
{ symbol: "z", exponent: -21 },
|
|
144672
|
+
{ symbol: "y", exponent: -24 }
|
|
144673
|
+
];
|
|
144674
|
+
function sizeToMeters(size, unit) {
|
|
144675
|
+
if (!unit || unit === "m") {
|
|
144676
|
+
return size;
|
|
144677
|
+
}
|
|
144678
|
+
if (unit.length > 1) {
|
|
144679
|
+
let unitPrefix = unit.substring(0, unit.length - 1);
|
|
144680
|
+
if (unitPrefix === "u") {
|
|
144681
|
+
unitPrefix = "µ";
|
|
144682
|
+
}
|
|
144683
|
+
const unitObj = SI_PREFIXES.find((p) => p.symbol === unitPrefix);
|
|
144684
|
+
if (unitObj) {
|
|
144685
|
+
return size * 10 ** unitObj.exponent;
|
|
144686
|
+
}
|
|
144687
|
+
}
|
|
144688
|
+
throw new Error("Received unknown unit");
|
|
144689
|
+
}
|
|
144690
|
+
function snapValue(value) {
|
|
144691
|
+
let magnitude = 0;
|
|
144692
|
+
if (value < MIN_TARGET || value > MAX_TARGET) {
|
|
144693
|
+
magnitude = Math.floor(Math.log10(value));
|
|
144694
|
+
}
|
|
144695
|
+
let snappedUnit = SI_PREFIXES.find(
|
|
144696
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude
|
|
144697
|
+
);
|
|
144698
|
+
let adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
144699
|
+
if (adjustedValue > 500 && adjustedValue <= 1e3) {
|
|
144700
|
+
snappedUnit = SI_PREFIXES.find(
|
|
144701
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude + 3
|
|
144702
|
+
);
|
|
144703
|
+
adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
144704
|
+
}
|
|
144705
|
+
const targetNewUnits = TARGETS.find((t2) => t2 > adjustedValue);
|
|
144706
|
+
const targetOrigUnits = targetNewUnits * 10 ** snappedUnit.exponent;
|
|
144707
|
+
return [targetOrigUnits, targetNewUnits, snappedUnit.symbol];
|
|
144708
|
+
}
|
|
144616
144709
|
const fs$1$1 = `#define SHADER_NAME xr-layer-fragment-shader
|
|
144617
144710
|
|
|
144618
144711
|
precision highp float;
|
|
@@ -145380,26 +145473,27 @@ const OverviewLayer = class extends CompositeLayer {
|
|
|
145380
145473
|
OverviewLayer.layerName = "OverviewLayer";
|
|
145381
145474
|
OverviewLayer.defaultProps = defaultProps$3;
|
|
145382
145475
|
function getPosition(boundingBox, position, length2) {
|
|
145383
|
-
const
|
|
145476
|
+
const viewWidth = boundingBox[2][0] - boundingBox[0][0];
|
|
145477
|
+
const viewHeight = boundingBox[2][1] - boundingBox[0][1];
|
|
145384
145478
|
switch (position) {
|
|
145385
145479
|
case "bottom-right": {
|
|
145386
|
-
const yCoord = boundingBox[2][1] -
|
|
145387
|
-
const xLeftCoord = boundingBox[2][0] -
|
|
145480
|
+
const yCoord = boundingBox[2][1] - viewHeight * length2;
|
|
145481
|
+
const xLeftCoord = boundingBox[2][0] - viewWidth * length2;
|
|
145388
145482
|
return [yCoord, xLeftCoord];
|
|
145389
145483
|
}
|
|
145390
145484
|
case "top-right": {
|
|
145391
|
-
const yCoord =
|
|
145392
|
-
const xLeftCoord = boundingBox[2][0] -
|
|
145485
|
+
const yCoord = boundingBox[0][1] + viewHeight * length2;
|
|
145486
|
+
const xLeftCoord = boundingBox[2][0] - viewWidth * length2;
|
|
145393
145487
|
return [yCoord, xLeftCoord];
|
|
145394
145488
|
}
|
|
145395
145489
|
case "top-left": {
|
|
145396
|
-
const yCoord =
|
|
145397
|
-
const xLeftCoord =
|
|
145490
|
+
const yCoord = boundingBox[0][1] + viewHeight * length2;
|
|
145491
|
+
const xLeftCoord = boundingBox[0][0] + viewWidth * length2;
|
|
145398
145492
|
return [yCoord, xLeftCoord];
|
|
145399
145493
|
}
|
|
145400
145494
|
case "bottom-left": {
|
|
145401
|
-
const yCoord = boundingBox[2][1] -
|
|
145402
|
-
const xLeftCoord =
|
|
145495
|
+
const yCoord = boundingBox[2][1] - viewHeight * length2;
|
|
145496
|
+
const xLeftCoord = boundingBox[0][0] + viewWidth * length2;
|
|
145403
145497
|
return [yCoord, xLeftCoord];
|
|
145404
145498
|
}
|
|
145405
145499
|
default: {
|
|
@@ -145417,11 +145511,12 @@ const defaultProps$2 = {
|
|
|
145417
145511
|
unit: { type: "string", value: "", compare: true },
|
|
145418
145512
|
size: { type: "number", value: 1, compare: true },
|
|
145419
145513
|
position: { type: "string", value: "bottom-right", compare: true },
|
|
145420
|
-
length: { type: "number", value: 0.085, compare: true }
|
|
145514
|
+
length: { type: "number", value: 0.085, compare: true },
|
|
145515
|
+
snap: { type: "boolean", value: false, compare: true }
|
|
145421
145516
|
};
|
|
145422
145517
|
const ScaleBarLayer = class extends CompositeLayer {
|
|
145423
145518
|
renderLayers() {
|
|
145424
|
-
const { id, unit, size, position, viewState, length: length2 } = this.props;
|
|
145519
|
+
const { id, unit, size, position, viewState, length: length2, snap } = this.props;
|
|
145425
145520
|
const boundingBox = makeBoundingBox(viewState);
|
|
145426
145521
|
const { zoom } = viewState;
|
|
145427
145522
|
const viewLength = boundingBox[2][0] - boundingBox[0][0];
|
|
@@ -145430,15 +145525,27 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
145430
145525
|
2 ** (-zoom + 1.5),
|
|
145431
145526
|
(boundingBox[2][1] - boundingBox[0][1]) * 7e-3
|
|
145432
145527
|
);
|
|
145433
|
-
|
|
145528
|
+
let adjustedBarLength = barLength;
|
|
145529
|
+
let displayNumber = (barLength * size).toPrecision(5);
|
|
145530
|
+
let displayUnit = unit;
|
|
145531
|
+
if (snap) {
|
|
145532
|
+
const meterSize = sizeToMeters(size, unit);
|
|
145533
|
+
const numUnits = barLength * meterSize;
|
|
145534
|
+
const [snappedOrigUnits, snappedNewUnits, snappedUnitPrefix] = snapValue(numUnits);
|
|
145535
|
+
adjustedBarLength = snappedOrigUnits / meterSize;
|
|
145536
|
+
displayNumber = snappedNewUnits;
|
|
145537
|
+
displayUnit = `${snappedUnitPrefix}m`;
|
|
145538
|
+
}
|
|
145434
145539
|
const [yCoord, xLeftCoord] = getPosition(boundingBox, position, length2);
|
|
145540
|
+
const xRightCoord = xLeftCoord + barLength;
|
|
145541
|
+
const isLeft = position.endsWith("-left");
|
|
145435
145542
|
const lengthBar = new LineLayer({
|
|
145436
145543
|
id: `scale-bar-length-${id}`,
|
|
145437
145544
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
145438
145545
|
data: [
|
|
145439
145546
|
[
|
|
145440
|
-
[xLeftCoord, yCoord],
|
|
145441
|
-
[xLeftCoord +
|
|
145547
|
+
[isLeft ? xLeftCoord : xRightCoord - adjustedBarLength, yCoord],
|
|
145548
|
+
[isLeft ? xLeftCoord + adjustedBarLength : xRightCoord, yCoord]
|
|
145442
145549
|
]
|
|
145443
145550
|
],
|
|
145444
145551
|
getSourcePosition: (d) => d[0],
|
|
@@ -145451,8 +145558,14 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
145451
145558
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
145452
145559
|
data: [
|
|
145453
145560
|
[
|
|
145454
|
-
[
|
|
145455
|
-
|
|
145561
|
+
[
|
|
145562
|
+
isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
|
|
145563
|
+
yCoord - barHeight
|
|
145564
|
+
],
|
|
145565
|
+
[
|
|
145566
|
+
isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
|
|
145567
|
+
yCoord + barHeight
|
|
145568
|
+
]
|
|
145456
145569
|
]
|
|
145457
145570
|
],
|
|
145458
145571
|
getSourcePosition: (d) => d[0],
|
|
@@ -145465,8 +145578,14 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
145465
145578
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
145466
145579
|
data: [
|
|
145467
145580
|
[
|
|
145468
|
-
[
|
|
145469
|
-
|
|
145581
|
+
[
|
|
145582
|
+
isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
|
|
145583
|
+
yCoord - barHeight
|
|
145584
|
+
],
|
|
145585
|
+
[
|
|
145586
|
+
isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
|
|
145587
|
+
yCoord + barHeight
|
|
145588
|
+
]
|
|
145470
145589
|
]
|
|
145471
145590
|
],
|
|
145472
145591
|
getSourcePosition: (d) => d[0],
|
|
@@ -145479,8 +145598,11 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
145479
145598
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
145480
145599
|
data: [
|
|
145481
145600
|
{
|
|
145482
|
-
text:
|
|
145483
|
-
position: [
|
|
145601
|
+
text: `${displayNumber}${displayUnit}`,
|
|
145602
|
+
position: [
|
|
145603
|
+
isLeft ? xLeftCoord + barLength * 0.5 : xRightCoord - barLength * 0.5,
|
|
145604
|
+
yCoord + barHeight * 4
|
|
145605
|
+
]
|
|
145484
145606
|
}
|
|
145485
145607
|
],
|
|
145486
145608
|
getColor: [220, 220, 220, 255],
|
|
@@ -145489,7 +145611,7 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
145489
145611
|
sizeUnits: "meters",
|
|
145490
145612
|
sizeScale: 2 ** -zoom,
|
|
145491
145613
|
characterSet: [
|
|
145492
|
-
...
|
|
145614
|
+
...displayUnit.split(""),
|
|
145493
145615
|
...range(10).map((i2) => String(i2)),
|
|
145494
145616
|
".",
|
|
145495
145617
|
"e",
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
|
|
2
|
-
import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-
|
|
2
|
+
import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-b51c005e.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "@vitessce/vit-s";
|
|
5
5
|
import "react-dom";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/layer-controller",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"lodash-es": "^4.17.21",
|
|
22
22
|
"math.gl": "^3.5.6",
|
|
23
23
|
"react-aria": "^3.28.0",
|
|
24
|
-
"@vitessce/constants-internal": "3.
|
|
25
|
-
"@vitessce/gl": "3.
|
|
26
|
-
"@vitessce/spatial-utils": "3.
|
|
27
|
-
"@vitessce/utils": "3.
|
|
28
|
-
"@vitessce/vit-s": "3.
|
|
24
|
+
"@vitessce/constants-internal": "3.3.0",
|
|
25
|
+
"@vitessce/gl": "3.3.0",
|
|
26
|
+
"@vitessce/spatial-utils": "3.3.0",
|
|
27
|
+
"@vitessce/utils": "3.3.0",
|
|
28
|
+
"@vitessce/vit-s": "3.3.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"react": "^18.0.0",
|