@vitessce/json 3.1.3 → 3.2.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-f77ff47e.js → deflate-a6cb9579.js} +1 -1
- package/dist/{index-5eaf12d6.js → index-8012d2e4.js} +758 -109
- package/dist/index.js +1 -1
- package/dist/{jpeg-9552e89a.js → jpeg-4c99f279.js} +1 -1
- package/dist/{lerc-dd5ffcb9.js → lerc-4666ac1a.js} +1 -1
- package/dist/{lzw-fa7b8ffe.js → lzw-e36a19d9.js} +1 -1
- package/dist/{packbits-9fa1f51b.js → packbits-07586fed.js} +1 -1
- package/dist/{raw-e999bbbe.js → raw-52aeaa84.js} +1 -1
- package/dist/{webimage-6f7695f8.js → webimage-eac23f35.js} +1 -1
- package/package.json +8 -8
|
@@ -41,8 +41,10 @@ const ViewType$1 = {
|
|
|
41
41
|
STATUS: "status",
|
|
42
42
|
SCATTERPLOT: "scatterplot",
|
|
43
43
|
SPATIAL: "spatial",
|
|
44
|
+
SPATIAL_BETA: "spatialBeta",
|
|
44
45
|
HEATMAP: "heatmap",
|
|
45
46
|
LAYER_CONTROLLER: "layerController",
|
|
47
|
+
LAYER_CONTROLLER_BETA: "layerControllerBeta",
|
|
46
48
|
GENOMIC_PROFILES: "genomicProfiles",
|
|
47
49
|
GATING: "gating",
|
|
48
50
|
FEATURE_LIST: "featureList",
|
|
@@ -54,20 +56,24 @@ const ViewType$1 = {
|
|
|
54
56
|
const DataType$2 = {
|
|
55
57
|
OBS_LABELS: "obsLabels",
|
|
56
58
|
OBS_EMBEDDING: "obsEmbedding",
|
|
57
|
-
OBS_LOCATIONS: "obsLocations",
|
|
58
59
|
OBS_FEATURE_MATRIX: "obsFeatureMatrix",
|
|
59
60
|
OBS_SETS: "obsSets",
|
|
60
61
|
FEATURE_LABELS: "featureLabels",
|
|
61
62
|
IMAGE: "image",
|
|
62
63
|
OBS_SEGMENTATIONS: "obsSegmentations",
|
|
63
64
|
NEIGHBORHOODS: "neighborhoods",
|
|
64
|
-
GENOMIC_PROFILES: "genomic-profiles"
|
|
65
|
+
GENOMIC_PROFILES: "genomic-profiles",
|
|
66
|
+
OBS_SPOTS: "obsSpots",
|
|
67
|
+
OBS_POINTS: "obsPoints",
|
|
68
|
+
OBS_LOCATIONS: "obsLocations"
|
|
65
69
|
};
|
|
66
70
|
const FileType$1 = {
|
|
67
71
|
// Joint file types
|
|
68
72
|
ANNDATA_ZARR: "anndata.zarr",
|
|
69
73
|
// Atomic file types
|
|
70
74
|
OBS_EMBEDDING_CSV: "obsEmbedding.csv",
|
|
75
|
+
OBS_SPOTS_CSV: "obsSpots.csv",
|
|
76
|
+
OBS_POINTS_CSV: "obsPoints.csv",
|
|
71
77
|
OBS_LOCATIONS_CSV: "obsLocations.csv",
|
|
72
78
|
OBS_LABELS_CSV: "obsLabels.csv",
|
|
73
79
|
FEATURE_LABELS_CSV: "featureLabels.csv",
|
|
@@ -80,6 +86,8 @@ const FileType$1 = {
|
|
|
80
86
|
OBS_FEATURE_MATRIX_ANNDATA_ZARR: "obsFeatureMatrix.anndata.zarr",
|
|
81
87
|
OBS_SETS_ANNDATA_ZARR: "obsSets.anndata.zarr",
|
|
82
88
|
OBS_EMBEDDING_ANNDATA_ZARR: "obsEmbedding.anndata.zarr",
|
|
89
|
+
OBS_SPOTS_ANNDATA_ZARR: "obsSpots.anndata.zarr",
|
|
90
|
+
OBS_POINTS_ANNDATA_ZARR: "obsPoints.anndata.zarr",
|
|
83
91
|
OBS_LOCATIONS_ANNDATA_ZARR: "obsLocations.anndata.zarr",
|
|
84
92
|
OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
|
|
85
93
|
OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
|
|
@@ -88,6 +96,8 @@ const FileType$1 = {
|
|
|
88
96
|
OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
|
|
89
97
|
OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
|
|
90
98
|
OBS_EMBEDDING_MUDATA_ZARR: "obsEmbedding.mudata.zarr",
|
|
99
|
+
OBS_SPOTS_MUDATA_ZARR: "obsSpots.mudata.zarr",
|
|
100
|
+
OBS_POINTS_MUDATA_ZARR: "obsPoints.mudata.zarr",
|
|
91
101
|
OBS_LOCATIONS_MUDATA_ZARR: "obsLocations.mudata.zarr",
|
|
92
102
|
OBS_SEGMENTATIONS_MUDATA_ZARR: "obsSegmentations.mudata.zarr",
|
|
93
103
|
OBS_LABELS_MUDATA_ZARR: "obsLabels.mudata.zarr",
|
|
@@ -131,10 +141,8 @@ const FileType$1 = {
|
|
|
131
141
|
ANNDATA_EXPRESSION_MATRIX_ZARR: "anndata-expression-matrix.zarr"
|
|
132
142
|
};
|
|
133
143
|
const CoordinationType$1 = {
|
|
134
|
-
// Meta coordination scopes
|
|
135
144
|
META_COORDINATION_SCOPES: "metaCoordinationScopes",
|
|
136
145
|
META_COORDINATION_SCOPES_BY: "metaCoordinationScopesBy",
|
|
137
|
-
// Other coordination scopes
|
|
138
146
|
DATASET: "dataset",
|
|
139
147
|
// Entity types
|
|
140
148
|
OBS_TYPE: "obsType",
|
|
@@ -160,6 +168,7 @@ const CoordinationType$1 = {
|
|
|
160
168
|
SPATIAL_TARGET_X: "spatialTargetX",
|
|
161
169
|
SPATIAL_TARGET_Y: "spatialTargetY",
|
|
162
170
|
SPATIAL_TARGET_Z: "spatialTargetZ",
|
|
171
|
+
SPATIAL_TARGET_T: "spatialTargetT",
|
|
163
172
|
SPATIAL_ROTATION_X: "spatialRotationX",
|
|
164
173
|
SPATIAL_ROTATION_Y: "spatialRotationY",
|
|
165
174
|
SPATIAL_ROTATION_Z: "spatialRotationZ",
|
|
@@ -197,7 +206,46 @@ const CoordinationType$1 = {
|
|
|
197
206
|
GATING_FEATURE_SELECTION_X: "gatingFeatureSelectionX",
|
|
198
207
|
GATING_FEATURE_SELECTION_Y: "gatingFeatureSelectionY",
|
|
199
208
|
FEATURE_VALUE_TRANSFORM_COEFFICIENT: "featureValueTransformCoefficient",
|
|
200
|
-
TOOLTIPS_VISIBLE: "tooltipsVisible"
|
|
209
|
+
TOOLTIPS_VISIBLE: "tooltipsVisible",
|
|
210
|
+
FILE_UID: "fileUid",
|
|
211
|
+
IMAGE_LAYER: "imageLayer",
|
|
212
|
+
IMAGE_CHANNEL: "imageChannel",
|
|
213
|
+
SEGMENTATION_LAYER: "segmentationLayer",
|
|
214
|
+
SEGMENTATION_CHANNEL: "segmentationChannel",
|
|
215
|
+
SPATIAL_TARGET_C: "spatialTargetC",
|
|
216
|
+
SPATIAL_LAYER_VISIBLE: "spatialLayerVisible",
|
|
217
|
+
SPATIAL_LAYER_OPACITY: "spatialLayerOpacity",
|
|
218
|
+
SPATIAL_LAYER_COLORMAP: "spatialLayerColormap",
|
|
219
|
+
SPATIAL_LAYER_TRANSPARENT_COLOR: "spatialLayerTransparentColor",
|
|
220
|
+
SPATIAL_LAYER_MODEL_MATRIX: "spatialLayerModelMatrix",
|
|
221
|
+
SPATIAL_SEGMENTATION_FILLED: "spatialSegmentationFilled",
|
|
222
|
+
SPATIAL_SEGMENTATION_STROKE_WIDTH: "spatialSegmentationStrokeWidth",
|
|
223
|
+
SPATIAL_CHANNEL_COLOR: "spatialChannelColor",
|
|
224
|
+
SPATIAL_CHANNEL_VISIBLE: "spatialChannelVisible",
|
|
225
|
+
SPATIAL_CHANNEL_OPACITY: "spatialChannelOpacity",
|
|
226
|
+
SPATIAL_CHANNEL_WINDOW: "spatialChannelWindow",
|
|
227
|
+
PHOTOMETRIC_INTERPRETATION: "photometricInterpretation",
|
|
228
|
+
// For 3D volume rendering
|
|
229
|
+
SPATIAL_RENDERING_MODE: "spatialRenderingMode",
|
|
230
|
+
VOLUMETRIC_RENDERING_ALGORITHM: "volumetricRenderingAlgorithm",
|
|
231
|
+
SPATIAL_TARGET_RESOLUTION: "spatialTargetResolution",
|
|
232
|
+
// For clipping plane sliders
|
|
233
|
+
SPATIAL_SLICE_X: "spatialSliceX",
|
|
234
|
+
SPATIAL_SLICE_Y: "spatialSliceY",
|
|
235
|
+
SPATIAL_SLICE_Z: "spatialSliceZ",
|
|
236
|
+
// For spatial spot and point layers
|
|
237
|
+
SPOT_LAYER: "spotLayer",
|
|
238
|
+
POINT_LAYER: "pointLayer",
|
|
239
|
+
SPATIAL_SPOT_RADIUS: "spatialSpotRadius",
|
|
240
|
+
SPATIAL_SPOT_FILLED: "spatialSpotFilled",
|
|
241
|
+
SPATIAL_SPOT_STROKE_WIDTH: "spatialSpotStrokeWidth",
|
|
242
|
+
SPATIAL_LAYER_COLOR: "spatialLayerColor",
|
|
243
|
+
PIXEL_HIGHLIGHT: "pixelHighlight",
|
|
244
|
+
TOOLTIP_CROSSHAIRS_VISIBLE: "tooltipCrosshairsVisible",
|
|
245
|
+
LEGEND_VISIBLE: "legendVisible",
|
|
246
|
+
SPATIAL_CHANNEL_LABELS_VISIBLE: "spatialChannelLabelsVisible",
|
|
247
|
+
SPATIAL_CHANNEL_LABELS_ORIENTATION: "spatialChannelLabelsOrientation",
|
|
248
|
+
SPATIAL_CHANNEL_LABEL_SIZE: "spatialChannelLabelSize"
|
|
201
249
|
};
|
|
202
250
|
var util$4;
|
|
203
251
|
(function(util2) {
|
|
@@ -16866,6 +16914,8 @@ const annDataObsSets = z.array(z.object({
|
|
|
16866
16914
|
]),
|
|
16867
16915
|
scorePath: z.string().optional().describe("The location in the AnnData store for the set confidence scores, like 'obs/celltype_prediction_score.'")
|
|
16868
16916
|
}));
|
|
16917
|
+
const annDataObsSpots = annDataObsm;
|
|
16918
|
+
const annDataObsPoints = annDataObsm;
|
|
16869
16919
|
const annDataObsLocations = annDataObsm;
|
|
16870
16920
|
const annDataObsEmbedding = annDataObsm;
|
|
16871
16921
|
const annDataObsSegmentations = annDataObs;
|
|
@@ -16892,10 +16942,21 @@ z.object({
|
|
|
16892
16942
|
z.object({
|
|
16893
16943
|
obsIndex: z.string(),
|
|
16894
16944
|
obsEmbedding: z.array(z.string()).length(2)
|
|
16945
|
+
// TODO: support 3D?
|
|
16946
|
+
});
|
|
16947
|
+
z.object({
|
|
16948
|
+
obsIndex: z.string(),
|
|
16949
|
+
obsSpots: z.array(z.string()).length(2)
|
|
16950
|
+
// TODO: support 3D?
|
|
16951
|
+
});
|
|
16952
|
+
z.object({
|
|
16953
|
+
obsIndex: z.string(),
|
|
16954
|
+
obsPoints: z.array(z.string()).length(3)
|
|
16895
16955
|
});
|
|
16896
16956
|
z.object({
|
|
16897
16957
|
obsIndex: z.string(),
|
|
16898
16958
|
obsLocations: z.array(z.string()).length(2)
|
|
16959
|
+
// TODO: support 3D?
|
|
16899
16960
|
});
|
|
16900
16961
|
z.object({
|
|
16901
16962
|
obsIndex: z.string(),
|
|
@@ -16927,6 +16988,8 @@ z.object({
|
|
|
16927
16988
|
]),
|
|
16928
16989
|
obsFeatureMatrix: annDataObsFeatureMatrix,
|
|
16929
16990
|
obsSets: annDataObsSets,
|
|
16991
|
+
obsSpots: annDataObsSpots,
|
|
16992
|
+
obsPoints: annDataObsPoints,
|
|
16930
16993
|
obsLocations: annDataObsLocations,
|
|
16931
16994
|
obsSegmentations: annDataObsSegmentations,
|
|
16932
16995
|
obsEmbedding: z.union([
|
|
@@ -17991,7 +18054,7 @@ function negate(out, a2) {
|
|
|
17991
18054
|
out[2] = -a2[2];
|
|
17992
18055
|
return out;
|
|
17993
18056
|
}
|
|
17994
|
-
function normalize$
|
|
18057
|
+
function normalize$4(out, a2) {
|
|
17995
18058
|
var x2 = a2[0];
|
|
17996
18059
|
var y2 = a2[1];
|
|
17997
18060
|
var z2 = a2[2];
|
|
@@ -19300,7 +19363,7 @@ function squaredLength$1(a2) {
|
|
|
19300
19363
|
var w2 = a2[3];
|
|
19301
19364
|
return x2 * x2 + y2 * y2 + z2 * z2 + w2 * w2;
|
|
19302
19365
|
}
|
|
19303
|
-
function normalize$
|
|
19366
|
+
function normalize$3(out, a2) {
|
|
19304
19367
|
var x2 = a2[0];
|
|
19305
19368
|
var y2 = a2[1];
|
|
19306
19369
|
var z2 = a2[2];
|
|
@@ -19937,7 +20000,7 @@ var dot$2 = dot$3;
|
|
|
19937
20000
|
var lerp$2 = lerp$3;
|
|
19938
20001
|
var length$2 = length$3;
|
|
19939
20002
|
var squaredLength = squaredLength$1;
|
|
19940
|
-
var normalize$
|
|
20003
|
+
var normalize$2 = normalize$3;
|
|
19941
20004
|
var rotationTo = function() {
|
|
19942
20005
|
var tmpvec3 = create$4();
|
|
19943
20006
|
var xUnitVec3 = fromValues(1, 0, 0);
|
|
@@ -19948,7 +20011,7 @@ var rotationTo = function() {
|
|
|
19948
20011
|
cross(tmpvec3, xUnitVec3, a2);
|
|
19949
20012
|
if (len(tmpvec3) < 1e-6)
|
|
19950
20013
|
cross(tmpvec3, yUnitVec3, a2);
|
|
19951
|
-
normalize$
|
|
20014
|
+
normalize$4(tmpvec3, tmpvec3);
|
|
19952
20015
|
setAxisAngle(out, tmpvec3, Math.PI);
|
|
19953
20016
|
return out;
|
|
19954
20017
|
} else if (dot2 > 0.999999) {
|
|
@@ -19963,7 +20026,7 @@ var rotationTo = function() {
|
|
|
19963
20026
|
out[1] = tmpvec3[1];
|
|
19964
20027
|
out[2] = tmpvec3[2];
|
|
19965
20028
|
out[3] = 1 + dot2;
|
|
19966
|
-
return normalize$
|
|
20029
|
+
return normalize$2(out, out);
|
|
19967
20030
|
}
|
|
19968
20031
|
};
|
|
19969
20032
|
}();
|
|
@@ -19989,7 +20052,7 @@ var rotationTo = function() {
|
|
|
19989
20052
|
matr[2] = -view[0];
|
|
19990
20053
|
matr[5] = -view[1];
|
|
19991
20054
|
matr[8] = -view[2];
|
|
19992
|
-
return normalize$
|
|
20055
|
+
return normalize$2(out, fromMat3(out, matr));
|
|
19993
20056
|
};
|
|
19994
20057
|
})();
|
|
19995
20058
|
const IDENTITY_QUATERNION = [0, 0, 0, 1];
|
|
@@ -37318,17 +37381,17 @@ let COLOR;
|
|
|
37318
37381
|
COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
|
|
37319
37382
|
COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
|
|
37320
37383
|
})(COLOR || (COLOR = {}));
|
|
37321
|
-
function getColor(color) {
|
|
37384
|
+
function getColor$1(color) {
|
|
37322
37385
|
return typeof color === "string" ? COLOR[color.toUpperCase()] || COLOR.WHITE : color;
|
|
37323
37386
|
}
|
|
37324
37387
|
function addColor(string, color, background) {
|
|
37325
37388
|
if (!isBrowser$1 && typeof string === "string") {
|
|
37326
37389
|
if (color) {
|
|
37327
|
-
color = getColor(color);
|
|
37390
|
+
color = getColor$1(color);
|
|
37328
37391
|
string = "\x1B[".concat(color, "m").concat(string, "\x1B[39m");
|
|
37329
37392
|
}
|
|
37330
37393
|
if (background) {
|
|
37331
|
-
color = getColor(background);
|
|
37394
|
+
color = getColor$1(background);
|
|
37332
37395
|
string = "\x1B[".concat(background + 10, "m").concat(string, "\x1B[49m");
|
|
37333
37396
|
}
|
|
37334
37397
|
}
|
|
@@ -67438,7 +67501,7 @@ function copyFlatRing(target, targetStartIndex, positions, size2, srcStartIndex
|
|
|
67438
67501
|
modifyPolygonWindingDirection(target, windingDirection, windingOptions);
|
|
67439
67502
|
return targetIndex;
|
|
67440
67503
|
}
|
|
67441
|
-
function normalize(polygon2, positionSize) {
|
|
67504
|
+
function normalize$1(polygon2, positionSize) {
|
|
67442
67505
|
validate(polygon2);
|
|
67443
67506
|
const positions = [];
|
|
67444
67507
|
const holeIndices = [];
|
|
@@ -67544,7 +67607,7 @@ class PolygonTesselator extends Tesselator {
|
|
|
67544
67607
|
}
|
|
67545
67608
|
normalizeGeometry(polygon2) {
|
|
67546
67609
|
if (this.normalize) {
|
|
67547
|
-
const normalizedPolygon = normalize(polygon2, this.positionSize);
|
|
67610
|
+
const normalizedPolygon = normalize$1(polygon2, this.positionSize);
|
|
67548
67611
|
if (this.opts.resolution) {
|
|
67549
67612
|
return cutPolygonByGrid(getPositions(normalizedPolygon), getHoleIndices(normalizedPolygon), {
|
|
67550
67613
|
size: this.positionSize,
|
|
@@ -68166,7 +68229,7 @@ class PolygonLayer extends CompositeLayer {
|
|
|
68166
68229
|
objectInfo.index++;
|
|
68167
68230
|
let polygon2 = getPolygon(object2, objectInfo);
|
|
68168
68231
|
if (_normalize) {
|
|
68169
|
-
polygon2 = normalize(polygon2, positionSize);
|
|
68232
|
+
polygon2 = normalize$1(polygon2, positionSize);
|
|
68170
68233
|
}
|
|
68171
68234
|
const {
|
|
68172
68235
|
holeIndices
|
|
@@ -132603,28 +132666,38 @@ const PASS_THROUGH_PROPS = [
|
|
|
132603
132666
|
];
|
|
132604
132667
|
class SelectionLayer extends CompositeLayer {
|
|
132605
132668
|
_selectPolygonObjects(coordinates2) {
|
|
132606
|
-
const {
|
|
132669
|
+
const { flipY, obsLayers } = this.props;
|
|
132607
132670
|
const flippedCoordinates = flipY ? coordinates2.map((poly) => poly.map((p) => [p[0], -p[1]])) : coordinates2;
|
|
132608
132671
|
const selectedPolygon = polygon(flippedCoordinates);
|
|
132609
|
-
|
|
132610
|
-
|
|
132611
|
-
const
|
|
132612
|
-
|
|
132613
|
-
|
|
132614
|
-
|
|
132615
|
-
|
|
132616
|
-
|
|
132617
|
-
|
|
132618
|
-
|
|
132619
|
-
|
|
132620
|
-
|
|
132621
|
-
|
|
132622
|
-
|
|
132672
|
+
obsLayers.forEach((obsLayer) => {
|
|
132673
|
+
const { getObsCoords, obsQuadTree, obsIndex, onSelect: layerOnSelect } = obsLayer;
|
|
132674
|
+
const pickingInfos = [];
|
|
132675
|
+
obsQuadTree == null ? void 0 : obsQuadTree.visit((node2, x02, y02, x12, y12) => {
|
|
132676
|
+
const nodePoints = [[[x02, y02], [x12, y02], [x12, y12], [x02, y12], [x02, y02]]];
|
|
132677
|
+
const nodePolygon = polygon(nodePoints);
|
|
132678
|
+
const nodePolygonContainsSelectedPolygon = booleanContains(nodePolygon, selectedPolygon);
|
|
132679
|
+
const nodePolygonWithinSelectedPolygon = booleanWithin(nodePolygon, selectedPolygon);
|
|
132680
|
+
const nodePolygonOverlapsSelectedPolgyon = booleanOverlap(nodePolygon, selectedPolygon);
|
|
132681
|
+
if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
|
|
132682
|
+
return true;
|
|
132683
|
+
}
|
|
132684
|
+
if (node2.data && booleanPointInPolygon$1(point([].slice.call(getObsCoords(node2.data))), selectedPolygon)) {
|
|
132685
|
+
pickingInfos.push(node2.data);
|
|
132686
|
+
}
|
|
132687
|
+
return false;
|
|
132688
|
+
});
|
|
132689
|
+
const pickingIds = pickingInfos.map((obsI) => obsIndex[obsI]);
|
|
132690
|
+
layerOnSelect(pickingIds);
|
|
132691
|
+
});
|
|
132692
|
+
}
|
|
132693
|
+
_selectEmpty() {
|
|
132694
|
+
const { obsLayers } = this.props;
|
|
132695
|
+
obsLayers.forEach((obsLayer) => {
|
|
132696
|
+
const { onSelect: layerOnSelect } = obsLayer;
|
|
132697
|
+
layerOnSelect([]);
|
|
132623
132698
|
});
|
|
132624
|
-
onSelect({ pickingInfos });
|
|
132625
132699
|
}
|
|
132626
132700
|
renderLayers() {
|
|
132627
|
-
const { onSelect } = this.props;
|
|
132628
132701
|
const mode = MODE_MAP[this.props.selectionType] || distEs6.ViewMode;
|
|
132629
132702
|
const inheritedProps = {};
|
|
132630
132703
|
PASS_THROUGH_PROPS.forEach((p) => {
|
|
@@ -132646,7 +132719,7 @@ class SelectionLayer extends CompositeLayer {
|
|
|
132646
132719
|
const { coordinates: coordinates2 } = updatedData.features[0].geometry;
|
|
132647
132720
|
this._selectPolygonObjects(coordinates2);
|
|
132648
132721
|
} else if (editType === EDIT_TYPE_CLEAR) {
|
|
132649
|
-
|
|
132722
|
+
this._selectEmpty();
|
|
132650
132723
|
}
|
|
132651
132724
|
},
|
|
132652
132725
|
_subLayerProps: {
|
|
@@ -134465,16 +134538,16 @@ async function getDecoder(fileDirectory) {
|
|
|
134465
134538
|
const Decoder = await importFn();
|
|
134466
134539
|
return new Decoder(fileDirectory);
|
|
134467
134540
|
}
|
|
134468
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
134469
|
-
addDecoder(5, () => import("./lzw-
|
|
134541
|
+
addDecoder([void 0, 1], () => import("./raw-52aeaa84.js").then((m) => m.default));
|
|
134542
|
+
addDecoder(5, () => import("./lzw-e36a19d9.js").then((m) => m.default));
|
|
134470
134543
|
addDecoder(6, () => {
|
|
134471
134544
|
throw new Error("old style JPEG compression is not supported.");
|
|
134472
134545
|
});
|
|
134473
|
-
addDecoder(7, () => import("./jpeg-
|
|
134474
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
134475
|
-
addDecoder(32773, () => import("./packbits-
|
|
134476
|
-
addDecoder(34887, () => import("./lerc-
|
|
134477
|
-
addDecoder(50001, () => import("./webimage-
|
|
134546
|
+
addDecoder(7, () => import("./jpeg-4c99f279.js").then((m) => m.default));
|
|
134547
|
+
addDecoder([8, 32946], () => import("./deflate-a6cb9579.js").then((m) => m.default));
|
|
134548
|
+
addDecoder(32773, () => import("./packbits-07586fed.js").then((m) => m.default));
|
|
134549
|
+
addDecoder(34887, () => import("./lerc-4666ac1a.js").then((m) => m.default));
|
|
134550
|
+
addDecoder(50001, () => import("./webimage-eac23f35.js").then((m) => m.default));
|
|
134478
134551
|
function copyNewSize(array2, width, height, samplesPerPixel = 1) {
|
|
134479
134552
|
return new (Object.getPrototypeOf(array2)).constructor(width * height * samplesPerPixel);
|
|
134480
134553
|
}
|
|
@@ -146893,7 +146966,7 @@ async function loadOmeZarr(source, options = {}) {
|
|
|
146893
146966
|
}
|
|
146894
146967
|
const MAX_COLOR_INTENSITY = 255;
|
|
146895
146968
|
const DEFAULT_COLOR_OFF = [0, 0, 0];
|
|
146896
|
-
const MAX_CHANNELS = 6;
|
|
146969
|
+
const MAX_CHANNELS$1 = 6;
|
|
146897
146970
|
const DEFAULT_FONT_FAMILY = "-apple-system, 'Helvetica Neue', Arial, sans-serif";
|
|
146898
146971
|
const DTYPE_VALUES = {
|
|
146899
146972
|
Uint8: {
|
|
@@ -148415,7 +148488,7 @@ const AdditiveColormapExtension = class extends LayerExtension {
|
|
|
148415
148488
|
};
|
|
148416
148489
|
AdditiveColormapExtension.extensionName = "AdditiveColormapExtension";
|
|
148417
148490
|
AdditiveColormapExtension.defaultProps = defaultProps$4$1;
|
|
148418
|
-
const fs$1$
|
|
148491
|
+
const fs$1$2 = `uniform vec3 transparentColor;
|
|
148419
148492
|
uniform bool useTransparentColor;
|
|
148420
148493
|
uniform float opacity;
|
|
148421
148494
|
|
|
@@ -148442,12 +148515,12 @@ rgba = apply_opacity(rgb);
|
|
|
148442
148515
|
`;
|
|
148443
148516
|
const colorPalette = {
|
|
148444
148517
|
name: "color-palette-module",
|
|
148445
|
-
fs: fs$1$
|
|
148518
|
+
fs: fs$1$2,
|
|
148446
148519
|
inject: {
|
|
148447
148520
|
"fs:DECKGL_MUTATE_COLOR": DECKGL_MUTATE_COLOR
|
|
148448
148521
|
}
|
|
148449
148522
|
};
|
|
148450
|
-
function padWithDefault$
|
|
148523
|
+
function padWithDefault$3(arr, defaultValue2, padWidth) {
|
|
148451
148524
|
for (let i2 = 0; i2 < padWidth; i2 += 1) {
|
|
148452
148525
|
arr.push(defaultValue2);
|
|
148453
148526
|
}
|
|
@@ -148473,8 +148546,8 @@ function padColors({ colors, channelsVisible }) {
|
|
|
148473
148546
|
const newColors = colors.map(
|
|
148474
148547
|
(color, i2) => channelsVisible[i2] ? color.map((c) => c / MAX_COLOR_INTENSITY) : DEFAULT_COLOR_OFF
|
|
148475
148548
|
);
|
|
148476
|
-
const padSize = MAX_CHANNELS - newColors.length;
|
|
148477
|
-
const paddedColors = padWithDefault$
|
|
148549
|
+
const padSize = MAX_CHANNELS$1 - newColors.length;
|
|
148550
|
+
const paddedColors = padWithDefault$3(
|
|
148478
148551
|
newColors,
|
|
148479
148552
|
DEFAULT_COLOR_OFF,
|
|
148480
148553
|
padSize
|
|
@@ -148718,7 +148791,7 @@ vec4 colormap(float intensity, float opacity) {
|
|
|
148718
148791
|
fs: fs2
|
|
148719
148792
|
};
|
|
148720
148793
|
}
|
|
148721
|
-
const defaultProps$1$
|
|
148794
|
+
const defaultProps$1$2 = {
|
|
148722
148795
|
colormap: { type: "string", value: "viridis", compare: true }
|
|
148723
148796
|
};
|
|
148724
148797
|
const BaseExtension$1 = class extends LayerExtension {
|
|
@@ -148728,7 +148801,7 @@ const BaseExtension$1 = class extends LayerExtension {
|
|
|
148728
148801
|
}
|
|
148729
148802
|
getShaders() {
|
|
148730
148803
|
var _a2;
|
|
148731
|
-
const name2 = ((_a2 = this == null ? void 0 : this.props) == null ? void 0 : _a2.colormap) || defaultProps$1$
|
|
148804
|
+
const name2 = ((_a2 = this == null ? void 0 : this.props) == null ? void 0 : _a2.colormap) || defaultProps$1$2.colormap.value;
|
|
148732
148805
|
const apply_cmap = cmaps[name2];
|
|
148733
148806
|
return {
|
|
148734
148807
|
...super.getShaders(),
|
|
@@ -148747,7 +148820,7 @@ const BaseExtension$1 = class extends LayerExtension {
|
|
|
148747
148820
|
}
|
|
148748
148821
|
};
|
|
148749
148822
|
BaseExtension$1.extensionName = "BaseExtension";
|
|
148750
|
-
BaseExtension$1.defaultProps = defaultProps$1$
|
|
148823
|
+
BaseExtension$1.defaultProps = defaultProps$1$2;
|
|
148751
148824
|
const _BEFORE_RENDER$5 = "";
|
|
148752
148825
|
const _RENDER$5 = ` float intensityArray[6] = float[6](intensityValue0, intensityValue1, intensityValue2, intensityValue3, intensityValue4, intensityValue5);
|
|
148753
148826
|
float total = 0.0;
|
|
@@ -148946,7 +149019,7 @@ const channels = {
|
|
|
148946
149019
|
function range(len2) {
|
|
148947
149020
|
return [...Array(len2).keys()];
|
|
148948
149021
|
}
|
|
148949
|
-
function padWithDefault$
|
|
149022
|
+
function padWithDefault$2(arr, defaultValue2, padWidth) {
|
|
148950
149023
|
for (let i2 = 0; i2 < padWidth; i2 += 1) {
|
|
148951
149024
|
arr.push(defaultValue2);
|
|
148952
149025
|
}
|
|
@@ -148970,13 +149043,13 @@ function padContrastLimits({
|
|
|
148970
149043
|
const newContrastLimits = contrastLimits.map(
|
|
148971
149044
|
(slider, i2) => channelsVisible[i2] ? slider : [maxSliderValue, maxSliderValue]
|
|
148972
149045
|
);
|
|
148973
|
-
const padSize = MAX_CHANNELS - newContrastLimits.length;
|
|
149046
|
+
const padSize = MAX_CHANNELS$1 - newContrastLimits.length;
|
|
148974
149047
|
if (padSize < 0) {
|
|
148975
149048
|
throw Error(
|
|
148976
149049
|
`${newContrastLimits.lengths} channels passed in, but only 6 are allowed.`
|
|
148977
149050
|
);
|
|
148978
149051
|
}
|
|
148979
|
-
const paddedContrastLimits = padWithDefault$
|
|
149052
|
+
const paddedContrastLimits = padWithDefault$2(
|
|
148980
149053
|
newContrastLimits,
|
|
148981
149054
|
[maxSliderValue, maxSliderValue],
|
|
148982
149055
|
padSize
|
|
@@ -149006,7 +149079,7 @@ function makeBoundingBox(viewState) {
|
|
|
149006
149079
|
viewport.unproject([0, viewport.height])
|
|
149007
149080
|
];
|
|
149008
149081
|
}
|
|
149009
|
-
const fs$1 = `#define SHADER_NAME xr-layer-fragment-shader
|
|
149082
|
+
const fs$1$1 = `#define SHADER_NAME xr-layer-fragment-shader
|
|
149010
149083
|
|
|
149011
149084
|
precision highp float;
|
|
149012
149085
|
precision highp int;
|
|
@@ -149047,7 +149120,7 @@ void main() {
|
|
|
149047
149120
|
DECKGL_FILTER_COLOR(gl_FragColor, geometry);
|
|
149048
149121
|
}
|
|
149049
149122
|
`;
|
|
149050
|
-
const vs$1 = `#define SHADER_NAME xr-layer-vertex-shader
|
|
149123
|
+
const vs$1$1 = `#define SHADER_NAME xr-layer-vertex-shader
|
|
149051
149124
|
|
|
149052
149125
|
attribute vec2 texCoords;
|
|
149053
149126
|
attribute vec3 positions;
|
|
@@ -149066,7 +149139,7 @@ void main(void) {
|
|
|
149066
149139
|
DECKGL_FILTER_COLOR(color, geometry);
|
|
149067
149140
|
}
|
|
149068
149141
|
`;
|
|
149069
|
-
const coreShaderModule = { fs: fs$1, vs: vs$1 };
|
|
149142
|
+
const coreShaderModule = { fs: fs$1$1, vs: vs$1$1 };
|
|
149070
149143
|
function validateWebGL2Filter(gl, interpolation) {
|
|
149071
149144
|
const canShowFloat = hasFeature(gl, FEATURES$1.TEXTURE_FLOAT);
|
|
149072
149145
|
const canShowLinear = hasFeature(gl, FEATURES$1.TEXTURE_FILTER_LINEAR_FLOAT);
|
|
@@ -150157,7 +150230,7 @@ const CUBE_STRIP = [
|
|
|
150157
150230
|
0
|
|
150158
150231
|
];
|
|
150159
150232
|
const NUM_PLANES_DEFAULT = 1;
|
|
150160
|
-
const defaultProps$1 = {
|
|
150233
|
+
const defaultProps$1$1 = {
|
|
150161
150234
|
pickable: false,
|
|
150162
150235
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
150163
150236
|
channelData: { type: "object", value: {}, compare: true },
|
|
@@ -150299,7 +150372,7 @@ const XR3DLayer = class extends Layer {
|
|
|
150299
150372
|
});
|
|
150300
150373
|
const invertedScaleMatrix = scaleMatrix.clone().invert();
|
|
150301
150374
|
const invertedResolutionMatrix = resolutionMatrix.clone().invert();
|
|
150302
|
-
const paddedClippingPlanes = padWithDefault$
|
|
150375
|
+
const paddedClippingPlanes = padWithDefault$2(
|
|
150303
150376
|
clippingPlanes.map(
|
|
150304
150377
|
(p) => p.clone().transform(invertedScaleMatrix).transform(invertedResolutionMatrix)
|
|
150305
150378
|
),
|
|
@@ -150389,7 +150462,7 @@ const XR3DLayer = class extends Layer {
|
|
|
150389
150462
|
}
|
|
150390
150463
|
};
|
|
150391
150464
|
XR3DLayer.layerName = "XR3DLayer";
|
|
150392
|
-
XR3DLayer.defaultProps = defaultProps$1;
|
|
150465
|
+
XR3DLayer.defaultProps = defaultProps$1$1;
|
|
150393
150466
|
async function getVolume({
|
|
150394
150467
|
source,
|
|
150395
150468
|
selection,
|
|
@@ -150611,7 +150684,7 @@ const VolumeLayer = class extends CompositeLayer {
|
|
|
150611
150684
|
};
|
|
150612
150685
|
VolumeLayer.layerName = "VolumeLayer";
|
|
150613
150686
|
VolumeLayer.defaultProps = defaultProps$9;
|
|
150614
|
-
const vs = `
|
|
150687
|
+
const vs$1 = `
|
|
150615
150688
|
#define SHADER_NAME bitmask-layer-vertex-shader
|
|
150616
150689
|
|
|
150617
150690
|
attribute vec2 texCoords;
|
|
@@ -150632,7 +150705,7 @@ void main(void) {
|
|
|
150632
150705
|
DECKGL_FILTER_COLOR(color, geometry);
|
|
150633
150706
|
}
|
|
150634
150707
|
`;
|
|
150635
|
-
const fs = `
|
|
150708
|
+
const fs$1 = `
|
|
150636
150709
|
#define SHADER_NAME bitmask-layer-fragment-shader
|
|
150637
150710
|
precision highp float;
|
|
150638
150711
|
|
|
@@ -150700,14 +150773,14 @@ void main() {
|
|
|
150700
150773
|
DECKGL_FILTER_COLOR(gl_FragColor, geometry);
|
|
150701
150774
|
}
|
|
150702
150775
|
`;
|
|
150703
|
-
function padWithDefault(arr, defaultValue2, padWidth) {
|
|
150776
|
+
function padWithDefault$1(arr, defaultValue2, padWidth) {
|
|
150704
150777
|
const newArr = [...arr];
|
|
150705
150778
|
for (let i2 = 0; i2 < padWidth; i2 += 1) {
|
|
150706
150779
|
newArr.push(defaultValue2);
|
|
150707
150780
|
}
|
|
150708
150781
|
return newArr;
|
|
150709
150782
|
}
|
|
150710
|
-
const defaultProps = {
|
|
150783
|
+
const defaultProps$1 = {
|
|
150711
150784
|
hoveredCell: { type: "number", value: null, compare: true },
|
|
150712
150785
|
// We do not want to deep-compare cellColorData,
|
|
150713
150786
|
// as it is potentially a TypedArray with millions of elements.
|
|
@@ -150719,13 +150792,13 @@ const defaultProps = {
|
|
|
150719
150792
|
// Same as with cellColorData, we do not want to deep-compare expressionData.
|
|
150720
150793
|
expressionData: { type: "object", value: null, compare: 0 }
|
|
150721
150794
|
};
|
|
150722
|
-
class BitmaskLayer extends XRLayer {
|
|
150795
|
+
let BitmaskLayer$1 = class BitmaskLayer extends XRLayer {
|
|
150723
150796
|
// eslint-disable-next-line class-methods-use-this
|
|
150724
150797
|
getShaders() {
|
|
150725
150798
|
const { colormap } = this.props;
|
|
150726
150799
|
return {
|
|
150727
|
-
fs,
|
|
150728
|
-
vs,
|
|
150800
|
+
fs: fs$1,
|
|
150801
|
+
vs: vs$1,
|
|
150729
150802
|
modules: [project32, picking],
|
|
150730
150803
|
defines: {
|
|
150731
150804
|
[COLORMAP_SHADER_PLACEHOLDER]: GLSL_COLORMAPS.includes(colormap) ? colormap : GLSL_COLORMAP_DEFAULT
|
|
@@ -150785,7 +150858,7 @@ class BitmaskLayer extends XRLayer {
|
|
|
150785
150858
|
expressionTex,
|
|
150786
150859
|
colorTexHeight: colorTex.height,
|
|
150787
150860
|
colorTexWidth: colorTex.width,
|
|
150788
|
-
channelsVisible: padWithDefault(
|
|
150861
|
+
channelsVisible: padWithDefault$1(
|
|
150789
150862
|
channelsVisible,
|
|
150790
150863
|
false,
|
|
150791
150864
|
// There are six texture entries on the shaders
|
|
@@ -150822,28 +150895,628 @@ class BitmaskLayer extends XRLayer {
|
|
|
150822
150895
|
type: GL$1.FLOAT
|
|
150823
150896
|
});
|
|
150824
150897
|
}
|
|
150898
|
+
};
|
|
150899
|
+
BitmaskLayer$1.layerName = "BitmaskLayer";
|
|
150900
|
+
BitmaskLayer$1.defaultProps = defaultProps$1;
|
|
150901
|
+
const vs = `
|
|
150902
|
+
#define SHADER_NAME bitmask-layer-vertex-shader
|
|
150903
|
+
|
|
150904
|
+
attribute vec2 texCoords;
|
|
150905
|
+
attribute vec3 positions;
|
|
150906
|
+
attribute vec3 positions64Low;
|
|
150907
|
+
attribute vec3 instancePickingColors;
|
|
150908
|
+
|
|
150909
|
+
varying vec2 vTexCoord;
|
|
150910
|
+
|
|
150911
|
+
void main(void) {
|
|
150912
|
+
geometry.worldPosition = positions;
|
|
150913
|
+
geometry.uv = texCoords;
|
|
150914
|
+
geometry.pickingColor = instancePickingColors;
|
|
150915
|
+
gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position);
|
|
150916
|
+
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
150917
|
+
vTexCoord = texCoords;
|
|
150918
|
+
vec4 color = vec4(0.0);
|
|
150919
|
+
DECKGL_FILTER_COLOR(color, geometry);
|
|
150920
|
+
}
|
|
150921
|
+
`;
|
|
150922
|
+
const fs = `
|
|
150923
|
+
#define SHADER_NAME bitmask-layer-fragment-shader
|
|
150924
|
+
precision highp float;
|
|
150925
|
+
|
|
150926
|
+
${colormaps}
|
|
150927
|
+
|
|
150928
|
+
// Note: can have a maximum of 16 textures in most browsers
|
|
150929
|
+
// Reference: https://webglreport.com/
|
|
150930
|
+
|
|
150931
|
+
// Data (mask) texture
|
|
150932
|
+
uniform sampler2D channel0;
|
|
150933
|
+
uniform sampler2D channel1;
|
|
150934
|
+
uniform sampler2D channel2;
|
|
150935
|
+
uniform sampler2D channel3;
|
|
150936
|
+
uniform sampler2D channel4;
|
|
150937
|
+
uniform sampler2D channel5;
|
|
150938
|
+
uniform sampler2D channel6;
|
|
150939
|
+
|
|
150940
|
+
// Color texture
|
|
150941
|
+
uniform float hovered;
|
|
150942
|
+
|
|
150943
|
+
// Channel-specific properties
|
|
150944
|
+
uniform bool channelsVisible[7];
|
|
150945
|
+
uniform float channelOpacities[7];
|
|
150946
|
+
uniform bool channelIsStaticColorMode[7]; // TODO: should this be a single float?
|
|
150947
|
+
uniform bool channelIsSetColorMode[7]; // TODO: should this be a single float?
|
|
150948
|
+
|
|
150949
|
+
// TODO: can array of tuples/vec2 be used?
|
|
150950
|
+
uniform float channelColormapRangeStarts[7];
|
|
150951
|
+
uniform float channelColormapRangeEnds[7];
|
|
150952
|
+
|
|
150953
|
+
uniform float multiFeatureTexSize;
|
|
150954
|
+
|
|
150955
|
+
// Use one expressionTex for all channels, using an offset mechanism.
|
|
150956
|
+
uniform sampler2D valueTex;
|
|
150957
|
+
uniform float valueTexOffsets[7];
|
|
150958
|
+
uniform float valueTexHeight;
|
|
150959
|
+
|
|
150960
|
+
// Textures for set colors, using the same offset mechanism.
|
|
150961
|
+
uniform sampler2D colorTex;
|
|
150962
|
+
uniform float colorTexOffsets[7];
|
|
150963
|
+
uniform float colorTexHeight;
|
|
150964
|
+
|
|
150965
|
+
|
|
150966
|
+
// Static colors
|
|
150967
|
+
// TODO: For some reason I cannot use uniform vec3 colors[7]; and i cannot figure out why.
|
|
150968
|
+
uniform vec3 color0;
|
|
150969
|
+
uniform vec3 color1;
|
|
150970
|
+
uniform vec3 color2;
|
|
150971
|
+
uniform vec3 color3;
|
|
150972
|
+
uniform vec3 color4;
|
|
150973
|
+
uniform vec3 color5;
|
|
150974
|
+
uniform vec3 color6;
|
|
150975
|
+
|
|
150976
|
+
// Info for edge-only mode
|
|
150977
|
+
uniform float scaleFactor;
|
|
150978
|
+
uniform bool channelsFilled[7];
|
|
150979
|
+
uniform float channelStrokeWidths[7];
|
|
150980
|
+
|
|
150981
|
+
// opacity
|
|
150982
|
+
uniform float opacity;
|
|
150983
|
+
|
|
150984
|
+
varying vec2 vTexCoord;
|
|
150985
|
+
|
|
150986
|
+
vec3 sampleAndGetData(sampler2D dataTex, vec2 coord, bool isFilled, float strokeWidth, bool isOn) {
|
|
150987
|
+
float sampledData = texture(dataTex, coord).r;
|
|
150988
|
+
float clampedSampledData = max(0., min(sampledData, 1.));
|
|
150989
|
+
|
|
150990
|
+
bool isEdge = true;
|
|
150991
|
+
|
|
150992
|
+
if(!isFilled) {
|
|
150993
|
+
vec2 uTextureSize = vec2(2048.0, 2048.0);
|
|
150994
|
+
vec2 onePixel = vec2(1.0, 1.0) / uTextureSize;
|
|
150995
|
+
|
|
150996
|
+
// Vary the edgeSize based on user-defined stroke width.
|
|
150997
|
+
float edgeSize = 150.0 * strokeWidth * scaleFactor;
|
|
150998
|
+
|
|
150999
|
+
float pixN = texture(dataTex, coord + vec2(0.0, onePixel.y * edgeSize)).r;
|
|
151000
|
+
float pixS = texture(dataTex, coord - vec2(0.0, onePixel.y * edgeSize)).r;
|
|
151001
|
+
float pixW = texture(dataTex, coord + vec2(onePixel.x * edgeSize, 0.0)).r;
|
|
151002
|
+
float pixE = texture(dataTex, coord - vec2(onePixel.x * edgeSize, 0.0)).r;
|
|
151003
|
+
|
|
151004
|
+
float pixNW = texture(dataTex, coord + vec2(onePixel.y * edgeSize, onePixel.y * edgeSize)).r;
|
|
151005
|
+
float pixNE = texture(dataTex, coord + vec2(-1.0 * onePixel.x * edgeSize, onePixel.y * edgeSize)).r;
|
|
151006
|
+
float pixSW = texture(dataTex, coord - vec2(onePixel.x * edgeSize, onePixel.y * edgeSize)).r;
|
|
151007
|
+
float pixSE = texture(dataTex, coord - vec2(-1.0 * onePixel.x * edgeSize, onePixel.y * edgeSize)).r;
|
|
151008
|
+
|
|
151009
|
+
isEdge = (pixN != sampledData || pixS != sampledData || pixW != sampledData || pixE != sampledData || pixNW != sampledData || pixNE != sampledData || pixSW != sampledData || pixSE != sampledData);
|
|
151010
|
+
}
|
|
151011
|
+
// Return a tuple of (sampledData, isEdge)
|
|
151012
|
+
return vec3(clampedSampledData * float(isOn), sampledData, float(isEdge));
|
|
151013
|
+
}
|
|
151014
|
+
|
|
151015
|
+
vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
|
|
151016
|
+
float clampedSampledDataAndIsOn = sampledDataAndIsEdge.x;
|
|
151017
|
+
float sampledData = sampledDataAndIsEdge.y;
|
|
151018
|
+
float isEdge = sampledDataAndIsEdge.z;
|
|
151019
|
+
|
|
151020
|
+
|
|
151021
|
+
vec4 hoveredColor = float(sampledData == hovered && sampledData > 0. && hovered > 0.) * vec4(0., 0., 1., 1.);
|
|
151022
|
+
|
|
151023
|
+
// Colors are laid out corresponding to ids in row-major order in the texture. So if width of the texture is 10, and you want ID 25,
|
|
151024
|
+
// you need coordinate (1, 4) (i.e 2 rows down, and 5 columns over indexed from 0 for a total of 25 units covered in row major order).
|
|
151025
|
+
float offsetSampledData = sampledData + valueOffset - 1.0;
|
|
151026
|
+
vec2 colorTexCoord = vec2(mod(offsetSampledData, multiFeatureTexSize) / multiFeatureTexSize, floor(offsetSampledData / multiFeatureTexSize) / (valueTexHeight - 1.));
|
|
151027
|
+
|
|
151028
|
+
// Get expression value
|
|
151029
|
+
float expressionValue = texture(valueTex, colorTexCoord).r / 255.;
|
|
151030
|
+
float scaledExpressionValue = (expressionValue - rangeStart) / max(0.005, (rangeEnd - rangeStart));
|
|
151031
|
+
|
|
151032
|
+
|
|
151033
|
+
// Get set color index value
|
|
151034
|
+
vec2 setIndicesTexCoord = vec2(mod(offsetSampledData, multiFeatureTexSize) / multiFeatureTexSize, floor(offsetSampledData / multiFeatureTexSize) / (valueTexHeight - 1.));
|
|
151035
|
+
float setColorIndex = texture(valueTex, setIndicesTexCoord).r;
|
|
151036
|
+
|
|
151037
|
+
// Initialize to the default "null" color.
|
|
151038
|
+
vec3 setColor = vec3(200. / 255., 200. / 255., 200. / 255.);
|
|
151039
|
+
if(setColorIndex != 0.) {
|
|
151040
|
+
// Subtract one from setColorIndex because we have already checked for the "null" value.
|
|
151041
|
+
setColorIndex = setColorIndex - 1.;
|
|
151042
|
+
|
|
151043
|
+
float setColorOffsetR = (setColorIndex + setColorOffset) * 3.0 + 0.0;
|
|
151044
|
+
vec2 setColorTexCoordR = vec2(mod(setColorOffsetR, multiFeatureTexSize) / multiFeatureTexSize, floor(setColorOffsetR / multiFeatureTexSize) / (colorTexHeight - 1.));
|
|
151045
|
+
float setColorR = texture(colorTex, setColorTexCoordR).r / 255.;
|
|
151046
|
+
|
|
151047
|
+
float setColorOffsetG = (setColorIndex + setColorOffset) * 3.0 + 1.0;
|
|
151048
|
+
vec2 setColorTexCoordG = vec2(mod(setColorOffsetG, multiFeatureTexSize) / multiFeatureTexSize, floor(setColorOffsetG / multiFeatureTexSize) / (colorTexHeight - 1.));
|
|
151049
|
+
float setColorG = texture(colorTex, setColorTexCoordG).r / 255.;
|
|
151050
|
+
|
|
151051
|
+
float setColorOffsetB = (setColorIndex + setColorOffset) * 3.0 + 2.0;
|
|
151052
|
+
vec2 setColorTexCoordB = vec2(mod(setColorOffsetB, multiFeatureTexSize) / multiFeatureTexSize, floor(setColorOffsetB / multiFeatureTexSize) / (colorTexHeight - 1.));
|
|
151053
|
+
float setColorB = texture(colorTex, setColorTexCoordB).r / 255.;
|
|
151054
|
+
|
|
151055
|
+
setColor = vec3(setColorR, setColorG, setColorB);
|
|
151056
|
+
}
|
|
151057
|
+
|
|
151058
|
+
|
|
151059
|
+
vec4 sampledColor = (1. - (float(isStaticColorMode) + float(isSetColorMode))) * vec4(COLORMAP_FUNC(clamp(scaledExpressionValue, 0.0, 1.0)).rgb, channelOpacity) + float(isStaticColorMode) * vec4(channelColor.rgb, channelOpacity) + float(isSetColorMode) * vec4(setColor, channelOpacity);
|
|
151060
|
+
// Only return a color if the data is non-zero.
|
|
151061
|
+
|
|
151062
|
+
return clampedSampledDataAndIsOn * isEdge * sampledColor;
|
|
151063
|
+
}
|
|
151064
|
+
|
|
151065
|
+
void main() {
|
|
151066
|
+
|
|
151067
|
+
// Get the color and alpha value for each channel.
|
|
151068
|
+
vec3 dat0 = sampleAndGetData(channel0, vTexCoord, channelsFilled[0], channelStrokeWidths[0], channelsVisible[0]);
|
|
151069
|
+
vec3 dat1 = sampleAndGetData(channel1, vTexCoord, channelsFilled[1], channelStrokeWidths[1], channelsVisible[1]);
|
|
151070
|
+
vec3 dat2 = sampleAndGetData(channel2, vTexCoord, channelsFilled[2], channelStrokeWidths[2], channelsVisible[2]);
|
|
151071
|
+
vec3 dat3 = sampleAndGetData(channel3, vTexCoord, channelsFilled[3], channelStrokeWidths[3], channelsVisible[3]);
|
|
151072
|
+
vec3 dat4 = sampleAndGetData(channel4, vTexCoord, channelsFilled[4], channelStrokeWidths[4], channelsVisible[4]);
|
|
151073
|
+
vec3 dat5 = sampleAndGetData(channel5, vTexCoord, channelsFilled[5], channelStrokeWidths[5], channelsVisible[5]);
|
|
151074
|
+
vec3 dat6 = sampleAndGetData(channel6, vTexCoord, channelsFilled[6], channelStrokeWidths[6], channelsVisible[6]);
|
|
151075
|
+
|
|
151076
|
+
vec4 val0 = dataToColor(dat0, channelIsStaticColorMode[0], color0, channelOpacities[0], valueTexOffsets[0], channelColormapRangeStarts[0], channelColormapRangeEnds[0], channelIsSetColorMode[0], colorTexOffsets[0]);
|
|
151077
|
+
vec4 val1 = dataToColor(dat1, channelIsStaticColorMode[1], color1, channelOpacities[1], valueTexOffsets[1], channelColormapRangeStarts[1], channelColormapRangeEnds[1], channelIsSetColorMode[1], colorTexOffsets[1]);
|
|
151078
|
+
vec4 val2 = dataToColor(dat2, channelIsStaticColorMode[2], color2, channelOpacities[2], valueTexOffsets[2], channelColormapRangeStarts[2], channelColormapRangeEnds[2], channelIsSetColorMode[2], colorTexOffsets[2]);
|
|
151079
|
+
vec4 val3 = dataToColor(dat3, channelIsStaticColorMode[3], color3, channelOpacities[3], valueTexOffsets[3], channelColormapRangeStarts[3], channelColormapRangeEnds[3], channelIsSetColorMode[3], colorTexOffsets[3]);
|
|
151080
|
+
vec4 val4 = dataToColor(dat4, channelIsStaticColorMode[4], color4, channelOpacities[4], valueTexOffsets[4], channelColormapRangeStarts[4], channelColormapRangeEnds[4], channelIsSetColorMode[4], colorTexOffsets[4]);
|
|
151081
|
+
vec4 val5 = dataToColor(dat5, channelIsStaticColorMode[5], color5, channelOpacities[5], valueTexOffsets[5], channelColormapRangeStarts[5], channelColormapRangeEnds[5], channelIsSetColorMode[5], colorTexOffsets[5]);
|
|
151082
|
+
vec4 val6 = dataToColor(dat6, channelIsStaticColorMode[6], color6, channelOpacities[6], valueTexOffsets[6], channelColormapRangeStarts[6], channelColormapRangeEnds[6], channelIsSetColorMode[6], colorTexOffsets[6]);
|
|
151083
|
+
|
|
151084
|
+
// If all of the channels are "empty", then discard this pixel so that it is not considered during picking.
|
|
151085
|
+
float emptyDat = 0.;
|
|
151086
|
+
if(dat0.x == emptyDat && dat1.x == emptyDat && dat2.x == emptyDat && dat3.x == emptyDat && dat4.x == emptyDat && dat5.x == emptyDat && dat6.x == emptyDat) {
|
|
151087
|
+
discard;
|
|
151088
|
+
}
|
|
151089
|
+
|
|
151090
|
+
// If the next channel color and the currently stored color (gl_FragColor) are identical,
|
|
151091
|
+
// or the next channel color is transparent black,
|
|
151092
|
+
// just use the currently stored color. Repeat this for all channels.
|
|
151093
|
+
|
|
151094
|
+
// Mix colors where necessary, using the alpha value of the next channel as the weight.
|
|
151095
|
+
// Use the maximum alpha value as the resulting alpha value.
|
|
151096
|
+
gl_FragColor = val0;
|
|
151097
|
+
gl_FragColor = (val1 == gl_FragColor || val1 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val1, val1.a).rgb, max(gl_FragColor.a, val1.a));
|
|
151098
|
+
gl_FragColor = (val2 == gl_FragColor || val2 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val2, val2.a).rgb, max(gl_FragColor.a, val2.a));
|
|
151099
|
+
gl_FragColor = (val3 == gl_FragColor || val3 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val3, val3.a).rgb, max(gl_FragColor.a, val3.a));
|
|
151100
|
+
gl_FragColor = (val4 == gl_FragColor || val4 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val4, val4.a).rgb, max(gl_FragColor.a, val4.a));
|
|
151101
|
+
gl_FragColor = (val5 == gl_FragColor || val5 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val5, val5.a).rgb, max(gl_FragColor.a, val5.a));
|
|
151102
|
+
gl_FragColor = (val6 == gl_FragColor || val6 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val6, val6.a).rgb, max(gl_FragColor.a, val6.a));
|
|
151103
|
+
|
|
151104
|
+
|
|
151105
|
+
|
|
151106
|
+
// TODO: multiply the resulting channel-level opacity value by the layer-level opacity value.
|
|
151107
|
+
|
|
151108
|
+
geometry.uv = vTexCoord;
|
|
151109
|
+
DECKGL_FILTER_COLOR(gl_FragColor, geometry);
|
|
151110
|
+
}
|
|
151111
|
+
`;
|
|
151112
|
+
function extent(values2, valueof) {
|
|
151113
|
+
let min2;
|
|
151114
|
+
let max2;
|
|
151115
|
+
if (valueof === void 0) {
|
|
151116
|
+
for (const value of values2) {
|
|
151117
|
+
if (value != null) {
|
|
151118
|
+
if (min2 === void 0) {
|
|
151119
|
+
if (value >= value)
|
|
151120
|
+
min2 = max2 = value;
|
|
151121
|
+
} else {
|
|
151122
|
+
if (min2 > value)
|
|
151123
|
+
min2 = value;
|
|
151124
|
+
if (max2 < value)
|
|
151125
|
+
max2 = value;
|
|
151126
|
+
}
|
|
151127
|
+
}
|
|
151128
|
+
}
|
|
151129
|
+
} else {
|
|
151130
|
+
let index2 = -1;
|
|
151131
|
+
for (let value of values2) {
|
|
151132
|
+
if ((value = valueof(value, ++index2, values2)) != null) {
|
|
151133
|
+
if (min2 === void 0) {
|
|
151134
|
+
if (value >= value)
|
|
151135
|
+
min2 = max2 = value;
|
|
151136
|
+
} else {
|
|
151137
|
+
if (min2 > value)
|
|
151138
|
+
min2 = value;
|
|
151139
|
+
if (max2 < value)
|
|
151140
|
+
max2 = value;
|
|
151141
|
+
}
|
|
151142
|
+
}
|
|
151143
|
+
}
|
|
151144
|
+
}
|
|
151145
|
+
return [min2, max2];
|
|
151146
|
+
}
|
|
151147
|
+
function normalize(arr) {
|
|
151148
|
+
const [min2, max2] = extent(arr);
|
|
151149
|
+
const ratio = 255 / (max2 - min2);
|
|
151150
|
+
const data = new Uint8Array(arr.map((i2) => Math.floor((i2 - min2) * ratio)));
|
|
151151
|
+
return data;
|
|
151152
|
+
}
|
|
151153
|
+
function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSetColorMode, texSize) {
|
|
151154
|
+
let totalValuesLength = 0;
|
|
151155
|
+
let totalColorsLength = 0;
|
|
151156
|
+
channelIsSetColorMode.forEach((isSetColorMode, channelIndex) => {
|
|
151157
|
+
var _a2, _b, _c, _d, _e;
|
|
151158
|
+
if (isSetColorMode) {
|
|
151159
|
+
totalValuesLength += ((_b = (_a2 = setColorValues[channelIndex]) == null ? void 0 : _a2.obsIndex) == null ? void 0 : _b.length) || 0;
|
|
151160
|
+
totalColorsLength += (((_d = (_c = setColorValues[channelIndex]) == null ? void 0 : _c.setColors) == null ? void 0 : _d.length) || 0) * 3;
|
|
151161
|
+
} else {
|
|
151162
|
+
totalValuesLength += ((_e = multiFeatureValues[channelIndex]) == null ? void 0 : _e.length) || 0;
|
|
151163
|
+
}
|
|
151164
|
+
});
|
|
151165
|
+
const valueTexHeight = Math.max(2, Math.ceil(totalValuesLength / texSize));
|
|
151166
|
+
const colorTexHeight = Math.max(2, Math.ceil(totalColorsLength / texSize));
|
|
151167
|
+
if (valueTexHeight > texSize) {
|
|
151168
|
+
console.error("Error: length of concatenated quantitative feature values larger than maximum texture size");
|
|
151169
|
+
}
|
|
151170
|
+
if (colorTexHeight > texSize) {
|
|
151171
|
+
console.error("Error: length of concatenated quantitative feature values larger than maximum texture size");
|
|
151172
|
+
}
|
|
151173
|
+
const totalData = new Uint8Array(texSize * valueTexHeight);
|
|
151174
|
+
const totalColors = new Uint8Array(texSize * colorTexHeight);
|
|
151175
|
+
const indicesOffsets = [];
|
|
151176
|
+
const colorsOffsets = [];
|
|
151177
|
+
let indexOffset = 0;
|
|
151178
|
+
let colorOffset = 0;
|
|
151179
|
+
channelIsSetColorMode.forEach((isSetColorMode, channelIndex) => {
|
|
151180
|
+
if (isSetColorMode) {
|
|
151181
|
+
const { setColorIndices, setColors, obsIndex } = setColorValues[channelIndex] || {};
|
|
151182
|
+
if (setColorIndices && setColors && obsIndex) {
|
|
151183
|
+
for (let i2 = 0; i2 < obsIndex.length; i2++) {
|
|
151184
|
+
const colorIndex = setColorIndices.get(String(i2 + 1));
|
|
151185
|
+
totalData[indexOffset + i2] = colorIndex === void 0 ? 0 : colorIndex + 1;
|
|
151186
|
+
}
|
|
151187
|
+
for (let i2 = 0; i2 < setColors.length; i2++) {
|
|
151188
|
+
const { color: [r2, g2, b] } = setColors[i2];
|
|
151189
|
+
totalColors[(colorOffset + i2) * 3 + 0] = r2;
|
|
151190
|
+
totalColors[(colorOffset + i2) * 3 + 1] = g2;
|
|
151191
|
+
totalColors[(colorOffset + i2) * 3 + 2] = b;
|
|
151192
|
+
}
|
|
151193
|
+
}
|
|
151194
|
+
indicesOffsets.push(indexOffset);
|
|
151195
|
+
colorsOffsets.push(colorOffset);
|
|
151196
|
+
indexOffset += (obsIndex == null ? void 0 : obsIndex.length) || 0;
|
|
151197
|
+
colorOffset += (setColors == null ? void 0 : setColors.length) || 0;
|
|
151198
|
+
} else {
|
|
151199
|
+
const featureArr = multiFeatureValues[channelIndex];
|
|
151200
|
+
totalData.set(normalize(featureArr), indexOffset);
|
|
151201
|
+
indicesOffsets.push(indexOffset);
|
|
151202
|
+
indexOffset += featureArr.length;
|
|
151203
|
+
colorsOffsets.push(colorOffset);
|
|
151204
|
+
}
|
|
151205
|
+
});
|
|
151206
|
+
return [
|
|
151207
|
+
totalData,
|
|
151208
|
+
valueTexHeight,
|
|
151209
|
+
indicesOffsets,
|
|
151210
|
+
totalColors,
|
|
151211
|
+
colorTexHeight,
|
|
151212
|
+
colorsOffsets
|
|
151213
|
+
];
|
|
151214
|
+
}
|
|
151215
|
+
const MAX_CHANNELS = 7;
|
|
151216
|
+
const MULTI_FEATURE_TEX_SIZE = 2048;
|
|
151217
|
+
function padWithDefault(arr, defaultValue2, padWidth) {
|
|
151218
|
+
const newArr = [...arr];
|
|
151219
|
+
for (let i2 = 0; i2 < padWidth; i2 += 1) {
|
|
151220
|
+
newArr.push(defaultValue2);
|
|
151221
|
+
}
|
|
151222
|
+
return newArr;
|
|
151223
|
+
}
|
|
151224
|
+
function getColor(arr) {
|
|
151225
|
+
return arr ? arr.map((v) => v / 255) : [0, 0, 0];
|
|
151226
|
+
}
|
|
151227
|
+
const defaultProps = {
|
|
151228
|
+
channelStrokeWidths: { type: "array", value: null, compare: true },
|
|
151229
|
+
channelsFilled: { type: "array", value: null, compare: true },
|
|
151230
|
+
channelOpacities: { type: "array", value: null, compare: true },
|
|
151231
|
+
channelColors: { type: "array", value: null, compare: true },
|
|
151232
|
+
hoveredCell: { type: "number", value: null, compare: true },
|
|
151233
|
+
colormap: { type: "string", value: GLSL_COLORMAP_DEFAULT, compare: true },
|
|
151234
|
+
expressionData: { type: "object", value: null, compare: true },
|
|
151235
|
+
multiFeatureValues: { type: "array", value: null, compare: true },
|
|
151236
|
+
setColorValues: { type: "array", value: null, compare: true },
|
|
151237
|
+
channelFeatureValueColormaps: { type: "array", value: null, compare: true },
|
|
151238
|
+
channelFeatureValueColormapRanges: { type: "array", value: null, compare: true },
|
|
151239
|
+
channelIsStaticColorMode: { type: "array", value: null, compare: true },
|
|
151240
|
+
channelIsSetColorMode: { type: "array", value: null, compare: true }
|
|
151241
|
+
};
|
|
151242
|
+
class BitmaskLayer2 extends XRLayer {
|
|
151243
|
+
// eslint-disable-next-line class-methods-use-this
|
|
151244
|
+
getShaders() {
|
|
151245
|
+
const { colormap } = this.props;
|
|
151246
|
+
return {
|
|
151247
|
+
fs,
|
|
151248
|
+
vs,
|
|
151249
|
+
modules: [project32, picking],
|
|
151250
|
+
defines: {
|
|
151251
|
+
[COLORMAP_SHADER_PLACEHOLDER]: GLSL_COLORMAPS.includes(colormap) ? colormap : GLSL_COLORMAP_DEFAULT
|
|
151252
|
+
}
|
|
151253
|
+
};
|
|
151254
|
+
}
|
|
151255
|
+
/**
|
|
151256
|
+
* Override the parent loadChannelTextures to enable
|
|
151257
|
+
* up to eight channels (rather than six).
|
|
151258
|
+
* Reference: https://github.com/hms-dbmi/viv/blob/v0.13.3/packages/layers/src/xr-layer/xr-layer.js#L316
|
|
151259
|
+
*/
|
|
151260
|
+
loadChannelTextures(channelData) {
|
|
151261
|
+
const textures = {
|
|
151262
|
+
channel0: null,
|
|
151263
|
+
channel1: null,
|
|
151264
|
+
channel2: null,
|
|
151265
|
+
channel3: null,
|
|
151266
|
+
channel4: null,
|
|
151267
|
+
channel5: null,
|
|
151268
|
+
channel6: null
|
|
151269
|
+
};
|
|
151270
|
+
if (this.state.textures) {
|
|
151271
|
+
Object.values(this.state.textures).forEach((tex) => tex && tex.delete());
|
|
151272
|
+
}
|
|
151273
|
+
if (channelData && Object.keys(channelData).length > 0 && channelData.data) {
|
|
151274
|
+
channelData.data.forEach((d, i2) => {
|
|
151275
|
+
textures[`channel${i2}`] = this.dataToTexture(d, channelData.width, channelData.height);
|
|
151276
|
+
}, this);
|
|
151277
|
+
this.setState({ textures });
|
|
151278
|
+
}
|
|
151279
|
+
}
|
|
151280
|
+
updateState({ props: props2, oldProps, changeFlags }) {
|
|
151281
|
+
super.updateState({ props: props2, oldProps, changeFlags });
|
|
151282
|
+
if (props2.multiFeatureValues !== oldProps.multiFeatureValues || props2.setColorValues !== oldProps.setColorValues || props2.channelIsSetColorMode !== oldProps.channelIsSetColorMode) {
|
|
151283
|
+
const { multiFeatureValues, setColorValues, channelIsSetColorMode } = this.props;
|
|
151284
|
+
const [valueTex, colorTex, valueTexOffsets, colorTexOffsets, valueTexHeight, colorTexHeight] = this.multiSetsToTexture(multiFeatureValues, setColorValues, channelIsSetColorMode);
|
|
151285
|
+
this.setState({
|
|
151286
|
+
valueTex,
|
|
151287
|
+
colorTex,
|
|
151288
|
+
valueTexOffsets,
|
|
151289
|
+
colorTexOffsets,
|
|
151290
|
+
valueTexHeight,
|
|
151291
|
+
colorTexHeight
|
|
151292
|
+
});
|
|
151293
|
+
}
|
|
151294
|
+
if (props2.colormap !== oldProps.colormap) {
|
|
151295
|
+
const { gl } = this.context;
|
|
151296
|
+
if (this.state.model) {
|
|
151297
|
+
this.state.model.delete();
|
|
151298
|
+
}
|
|
151299
|
+
this.setState({ model: this._getModel(gl) });
|
|
151300
|
+
this.getAttributeManager().invalidateAll();
|
|
151301
|
+
}
|
|
151302
|
+
}
|
|
151303
|
+
draw(opts2) {
|
|
151304
|
+
const { uniforms } = opts2;
|
|
151305
|
+
const {
|
|
151306
|
+
channelStrokeWidths,
|
|
151307
|
+
channelsFilled,
|
|
151308
|
+
channelOpacities,
|
|
151309
|
+
channelColors,
|
|
151310
|
+
channelsVisible,
|
|
151311
|
+
// TODO: use `channelFeatureValueColormaps` in shader,
|
|
151312
|
+
// figure out how to call multiple GLSL colormap functions
|
|
151313
|
+
channelFeatureValueColormaps,
|
|
151314
|
+
channelFeatureValueColormapRanges,
|
|
151315
|
+
channelIsStaticColorMode,
|
|
151316
|
+
channelIsSetColorMode,
|
|
151317
|
+
hoveredCell,
|
|
151318
|
+
colorScaleLo,
|
|
151319
|
+
colorScaleHi,
|
|
151320
|
+
isExpressionMode,
|
|
151321
|
+
zoom,
|
|
151322
|
+
minZoom,
|
|
151323
|
+
maxZoom,
|
|
151324
|
+
zoomOffset
|
|
151325
|
+
// TODO: figure out if this needs to be used or not
|
|
151326
|
+
} = this.props;
|
|
151327
|
+
const {
|
|
151328
|
+
textures,
|
|
151329
|
+
model,
|
|
151330
|
+
// Expression and set index (and colors) textures with offsets
|
|
151331
|
+
valueTex,
|
|
151332
|
+
colorTex,
|
|
151333
|
+
valueTexOffsets,
|
|
151334
|
+
colorTexOffsets,
|
|
151335
|
+
valueTexHeight,
|
|
151336
|
+
colorTexHeight
|
|
151337
|
+
} = this.state;
|
|
151338
|
+
if (textures && model) {
|
|
151339
|
+
const scaleFactor = 1 / 2 ** (maxZoom - zoom);
|
|
151340
|
+
const colors = fromEntries(range$5(MAX_CHANNELS).map((i2) => [`color${i2}`, getColor(channelColors[i2])]));
|
|
151341
|
+
model.setUniforms(Object.assign({}, uniforms, {
|
|
151342
|
+
...colors,
|
|
151343
|
+
// Bitmask image channel data textures
|
|
151344
|
+
...textures,
|
|
151345
|
+
multiFeatureTexSize: MULTI_FEATURE_TEX_SIZE,
|
|
151346
|
+
// Expression textures with offsets
|
|
151347
|
+
valueTex,
|
|
151348
|
+
valueTexOffsets: padWithDefault(valueTexOffsets, 0, MAX_CHANNELS - valueTexOffsets.length),
|
|
151349
|
+
valueTexHeight,
|
|
151350
|
+
// Set indices and colors textures with offsets
|
|
151351
|
+
colorTex,
|
|
151352
|
+
colorTexOffsets: padWithDefault(colorTexOffsets, 0, MAX_CHANNELS - colorTexOffsets.length),
|
|
151353
|
+
colorTexHeight,
|
|
151354
|
+
// Visualization properties
|
|
151355
|
+
channelsFilled: padWithDefault(
|
|
151356
|
+
channelsFilled,
|
|
151357
|
+
true,
|
|
151358
|
+
// There are six texture entries on the shaders
|
|
151359
|
+
MAX_CHANNELS - channelsFilled.length
|
|
151360
|
+
),
|
|
151361
|
+
channelOpacities: padWithDefault(
|
|
151362
|
+
channelOpacities,
|
|
151363
|
+
0,
|
|
151364
|
+
// There are six texture entries on the shaders
|
|
151365
|
+
MAX_CHANNELS - channelOpacities.length
|
|
151366
|
+
),
|
|
151367
|
+
channelStrokeWidths: padWithDefault(
|
|
151368
|
+
channelStrokeWidths,
|
|
151369
|
+
1,
|
|
151370
|
+
// There are six texture entries on the shaders
|
|
151371
|
+
MAX_CHANNELS - channelStrokeWidths.length
|
|
151372
|
+
),
|
|
151373
|
+
channelColormapRangeStarts: padWithDefault(
|
|
151374
|
+
channelFeatureValueColormapRanges.map((r2) => (r2 == null ? void 0 : r2[0]) || 0),
|
|
151375
|
+
0,
|
|
151376
|
+
// There are six texture entries on the shaders
|
|
151377
|
+
MAX_CHANNELS - channelFeatureValueColormapRanges.length
|
|
151378
|
+
),
|
|
151379
|
+
channelColormapRangeEnds: padWithDefault(
|
|
151380
|
+
channelFeatureValueColormapRanges.map((r2) => (r2 == null ? void 0 : r2[1]) || 1),
|
|
151381
|
+
1,
|
|
151382
|
+
// There are six texture entries on the shaders
|
|
151383
|
+
MAX_CHANNELS - channelFeatureValueColormapRanges.length
|
|
151384
|
+
),
|
|
151385
|
+
channelIsStaticColorMode: padWithDefault(
|
|
151386
|
+
channelIsStaticColorMode,
|
|
151387
|
+
true,
|
|
151388
|
+
// There are six texture entries on the shaders
|
|
151389
|
+
MAX_CHANNELS - channelIsStaticColorMode.length
|
|
151390
|
+
),
|
|
151391
|
+
channelIsSetColorMode: padWithDefault(
|
|
151392
|
+
channelIsSetColorMode,
|
|
151393
|
+
false,
|
|
151394
|
+
// There are six texture entries on the shaders
|
|
151395
|
+
MAX_CHANNELS - channelIsSetColorMode.length
|
|
151396
|
+
),
|
|
151397
|
+
hovered: hoveredCell || 0,
|
|
151398
|
+
channelsVisible: padWithDefault(
|
|
151399
|
+
channelsVisible,
|
|
151400
|
+
false,
|
|
151401
|
+
// There are six texture entries on the shaders
|
|
151402
|
+
MAX_CHANNELS - channelsVisible.length
|
|
151403
|
+
),
|
|
151404
|
+
// uColorScaleRange: [colorScaleLo, colorScaleHi],
|
|
151405
|
+
// uIsExpressionMode: isExpressionMode,
|
|
151406
|
+
// uIsOutlined: false,
|
|
151407
|
+
scaleFactor
|
|
151408
|
+
})).draw();
|
|
151409
|
+
}
|
|
151410
|
+
}
|
|
151411
|
+
/**
|
|
151412
|
+
* This function creates textures from the data
|
|
151413
|
+
*/
|
|
151414
|
+
dataToTexture(data, width, height) {
|
|
151415
|
+
const isWebGL2On = isWebGL2$1(this.context.gl);
|
|
151416
|
+
return new Texture2D(this.context.gl, {
|
|
151417
|
+
width,
|
|
151418
|
+
height,
|
|
151419
|
+
// Only use Float32 so we don't have to write two shaders
|
|
151420
|
+
data: new Float32Array(data),
|
|
151421
|
+
// we don't want or need mimaps
|
|
151422
|
+
mipmaps: false,
|
|
151423
|
+
parameters: {
|
|
151424
|
+
// NEAREST for integer data
|
|
151425
|
+
[GL$1.TEXTURE_MIN_FILTER]: GL$1.NEAREST,
|
|
151426
|
+
[GL$1.TEXTURE_MAG_FILTER]: GL$1.NEAREST,
|
|
151427
|
+
// CLAMP_TO_EDGE to remove tile artifacts
|
|
151428
|
+
[GL$1.TEXTURE_WRAP_S]: GL$1.CLAMP_TO_EDGE,
|
|
151429
|
+
[GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
|
|
151430
|
+
},
|
|
151431
|
+
format: isWebGL2On ? GL$1.R32F : GL$1.LUMINANCE,
|
|
151432
|
+
dataFormat: isWebGL2On ? GL$1.RED : GL$1.LUMINANCE,
|
|
151433
|
+
type: GL$1.FLOAT
|
|
151434
|
+
});
|
|
151435
|
+
}
|
|
151436
|
+
multiSetsToTexture(multiFeatureValues, setColorValues, channelIsSetColorMode) {
|
|
151437
|
+
const isWebGL2On = isWebGL2$1(this.context.gl);
|
|
151438
|
+
const [totalData, valueTexHeight, indicesOffsets, totalColors, colorTexHeight, colorsOffsets] = multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSetColorMode, MULTI_FEATURE_TEX_SIZE);
|
|
151439
|
+
return [
|
|
151440
|
+
// Color indices texture
|
|
151441
|
+
new Texture2D(this.context.gl, {
|
|
151442
|
+
width: MULTI_FEATURE_TEX_SIZE,
|
|
151443
|
+
height: valueTexHeight,
|
|
151444
|
+
// Only use Float32 so we don't have to write two shaders
|
|
151445
|
+
data: new Float32Array(totalData),
|
|
151446
|
+
// we don't want or need mimaps
|
|
151447
|
+
mipmaps: false,
|
|
151448
|
+
parameters: {
|
|
151449
|
+
// NEAREST for integer data
|
|
151450
|
+
[GL$1.TEXTURE_MIN_FILTER]: GL$1.NEAREST,
|
|
151451
|
+
[GL$1.TEXTURE_MAG_FILTER]: GL$1.NEAREST,
|
|
151452
|
+
// CLAMP_TO_EDGE to remove tile artifacts
|
|
151453
|
+
[GL$1.TEXTURE_WRAP_S]: GL$1.CLAMP_TO_EDGE,
|
|
151454
|
+
[GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
|
|
151455
|
+
},
|
|
151456
|
+
format: isWebGL2On ? GL$1.R32F : GL$1.LUMINANCE,
|
|
151457
|
+
dataFormat: isWebGL2On ? GL$1.RED : GL$1.LUMINANCE,
|
|
151458
|
+
type: GL$1.FLOAT
|
|
151459
|
+
}),
|
|
151460
|
+
// Colors texture
|
|
151461
|
+
new Texture2D(this.context.gl, {
|
|
151462
|
+
width: MULTI_FEATURE_TEX_SIZE,
|
|
151463
|
+
height: colorTexHeight,
|
|
151464
|
+
// Only use Float32 so we don't have to write two shaders
|
|
151465
|
+
data: new Float32Array(totalColors),
|
|
151466
|
+
// we don't want or need mimaps
|
|
151467
|
+
mipmaps: false,
|
|
151468
|
+
parameters: {
|
|
151469
|
+
// NEAREST for integer data
|
|
151470
|
+
[GL$1.TEXTURE_MIN_FILTER]: GL$1.NEAREST,
|
|
151471
|
+
[GL$1.TEXTURE_MAG_FILTER]: GL$1.NEAREST,
|
|
151472
|
+
// CLAMP_TO_EDGE to remove tile artifacts
|
|
151473
|
+
[GL$1.TEXTURE_WRAP_S]: GL$1.CLAMP_TO_EDGE,
|
|
151474
|
+
[GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
|
|
151475
|
+
},
|
|
151476
|
+
format: isWebGL2On ? GL$1.R32F : GL$1.LUMINANCE,
|
|
151477
|
+
dataFormat: isWebGL2On ? GL$1.RED : GL$1.LUMINANCE,
|
|
151478
|
+
type: GL$1.FLOAT
|
|
151479
|
+
}),
|
|
151480
|
+
// Offsets
|
|
151481
|
+
indicesOffsets,
|
|
151482
|
+
colorsOffsets,
|
|
151483
|
+
// Texture heights
|
|
151484
|
+
valueTexHeight,
|
|
151485
|
+
colorTexHeight
|
|
151486
|
+
];
|
|
151487
|
+
}
|
|
151488
|
+
}
|
|
151489
|
+
BitmaskLayer2.layerName = "BitmaskLayer";
|
|
151490
|
+
BitmaskLayer2.defaultProps = defaultProps;
|
|
151491
|
+
function filterSelection(loader, selection) {
|
|
151492
|
+
if (!selection) {
|
|
151493
|
+
return selection;
|
|
151494
|
+
}
|
|
151495
|
+
const data = Array.isArray(loader) ? loader[loader.length - 1] : loader;
|
|
151496
|
+
const { labels } = data;
|
|
151497
|
+
return fromEntries(Object.entries(selection).filter(([key]) => labels.includes(key)));
|
|
150825
151498
|
}
|
|
150826
|
-
BitmaskLayer.layerName = "BitmaskLayer";
|
|
150827
|
-
BitmaskLayer.defaultProps = defaultProps;
|
|
150828
151499
|
async function getSingleSelectionStats2D({ loader, selection }) {
|
|
150829
151500
|
const data = Array.isArray(loader) ? loader[loader.length - 1] : loader;
|
|
150830
|
-
const
|
|
151501
|
+
const filteredSelection = filterSelection(loader, selection);
|
|
151502
|
+
const raster = await data.getRaster({ selection: filteredSelection });
|
|
150831
151503
|
const selectionStats = getChannelStats(raster.data);
|
|
150832
151504
|
const { domain, contrastLimits: slider } = selectionStats;
|
|
150833
151505
|
return { domain, slider };
|
|
150834
151506
|
}
|
|
150835
151507
|
async function getSingleSelectionStats3D({ loader, selection }) {
|
|
150836
151508
|
const lowResSource = loader[loader.length - 1];
|
|
151509
|
+
const filteredSelection = filterSelection(lowResSource, selection);
|
|
150837
151510
|
const { shape, labels } = lowResSource;
|
|
150838
151511
|
const sizeZ = shape[labels.indexOf("z")] >> loader.length - 1;
|
|
150839
151512
|
const raster0 = await lowResSource.getRaster({
|
|
150840
|
-
selection: { ...
|
|
151513
|
+
selection: { ...filteredSelection, z: 0 }
|
|
150841
151514
|
});
|
|
150842
151515
|
const rasterMid = await lowResSource.getRaster({
|
|
150843
|
-
selection: { ...
|
|
151516
|
+
selection: { ...filteredSelection, z: Math.floor(sizeZ / 2) }
|
|
150844
151517
|
});
|
|
150845
151518
|
const rasterTop = await lowResSource.getRaster({
|
|
150846
|
-
selection: { ...
|
|
151519
|
+
selection: { ...filteredSelection, z: Math.max(0, sizeZ - 1) }
|
|
150847
151520
|
});
|
|
150848
151521
|
const stats0 = getChannelStats(raster0.data);
|
|
150849
151522
|
const statsMid = getChannelStats(rasterMid.data);
|
|
@@ -151134,6 +151807,17 @@ function coordinateTransformationsToMatrix(coordinateTransformations, axes) {
|
|
|
151134
151807
|
}
|
|
151135
151808
|
return mat;
|
|
151136
151809
|
}
|
|
151810
|
+
function getDomains() {
|
|
151811
|
+
const domains = {};
|
|
151812
|
+
const needMin = ["Int8", "Int16", "Int32"];
|
|
151813
|
+
Object.keys(DTYPE_VALUES).forEach((dtype) => {
|
|
151814
|
+
const { max: max2 } = DTYPE_VALUES[dtype];
|
|
151815
|
+
const min2 = needMin.includes(dtype) ? -(max2 + 1) : 0;
|
|
151816
|
+
domains[dtype] = [min2, max2];
|
|
151817
|
+
});
|
|
151818
|
+
return domains;
|
|
151819
|
+
}
|
|
151820
|
+
getDomains();
|
|
151137
151821
|
class CellsJsonAsObsSegmentationsLoader extends JsonLoader {
|
|
151138
151822
|
constructor(dataSource, params) {
|
|
151139
151823
|
super(dataSource, params);
|
|
@@ -151180,41 +151864,6 @@ class CellsJsonAsObsSegmentationsLoader extends JsonLoader {
|
|
|
151180
151864
|
}, url, coordinationValues));
|
|
151181
151865
|
}
|
|
151182
151866
|
}
|
|
151183
|
-
function extent(values2, valueof) {
|
|
151184
|
-
let min2;
|
|
151185
|
-
let max2;
|
|
151186
|
-
if (valueof === void 0) {
|
|
151187
|
-
for (const value of values2) {
|
|
151188
|
-
if (value != null) {
|
|
151189
|
-
if (min2 === void 0) {
|
|
151190
|
-
if (value >= value)
|
|
151191
|
-
min2 = max2 = value;
|
|
151192
|
-
} else {
|
|
151193
|
-
if (min2 > value)
|
|
151194
|
-
min2 = value;
|
|
151195
|
-
if (max2 < value)
|
|
151196
|
-
max2 = value;
|
|
151197
|
-
}
|
|
151198
|
-
}
|
|
151199
|
-
}
|
|
151200
|
-
} else {
|
|
151201
|
-
let index2 = -1;
|
|
151202
|
-
for (let value of values2) {
|
|
151203
|
-
if ((value = valueof(value, ++index2, values2)) != null) {
|
|
151204
|
-
if (min2 === void 0) {
|
|
151205
|
-
if (value >= value)
|
|
151206
|
-
min2 = max2 = value;
|
|
151207
|
-
} else {
|
|
151208
|
-
if (min2 > value)
|
|
151209
|
-
min2 = value;
|
|
151210
|
-
if (max2 < value)
|
|
151211
|
-
max2 = value;
|
|
151212
|
-
}
|
|
151213
|
-
}
|
|
151214
|
-
}
|
|
151215
|
-
}
|
|
151216
|
-
return [min2, max2];
|
|
151217
|
-
}
|
|
151218
151867
|
const clustersSchema = z.object({
|
|
151219
151868
|
rows: z.array(z.string()),
|
|
151220
151869
|
cols: z.array(z.string()),
|
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, L as LercParameters, a as LercAddCompression } from "./index-
|
|
2
|
+
import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-8012d2e4.js";
|
|
3
3
|
import "@vitessce/vit-s";
|
|
4
4
|
import "react";
|
|
5
5
|
var LercDecode = { exports: {} };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/json",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"lodash-es": "^4.17.21",
|
|
21
21
|
"zarr": "0.5.1",
|
|
22
22
|
"zod": "^3.21.4",
|
|
23
|
-
"@vitessce/constants-internal": "3.
|
|
24
|
-
"@vitessce/gl": "3.
|
|
25
|
-
"@vitessce/schemas": "3.
|
|
26
|
-
"@vitessce/sets-utils": "3.
|
|
27
|
-
"@vitessce/spatial-utils": "3.
|
|
28
|
-
"@vitessce/utils": "3.
|
|
29
|
-
"@vitessce/vit-s": "3.
|
|
23
|
+
"@vitessce/constants-internal": "3.2.0",
|
|
24
|
+
"@vitessce/gl": "3.2.0",
|
|
25
|
+
"@vitessce/schemas": "3.2.0",
|
|
26
|
+
"@vitessce/sets-utils": "3.2.0",
|
|
27
|
+
"@vitessce/spatial-utils": "3.2.0",
|
|
28
|
+
"@vitessce/utils": "3.2.0",
|
|
29
|
+
"@vitessce/vit-s": "3.2.0"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
|