@vitessce/utils 3.1.2 → 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/index.js +98 -36
- package/dist-tsc/components.d.ts +2 -7
- package/dist-tsc/components.d.ts.map +1 -1
- package/dist-tsc/components.js +28 -25
- package/package.json +2 -2
- package/src/components.js +30 -34
package/dist/index.js
CHANGED
|
@@ -461,6 +461,34 @@ const VIEWER_PALETTE = [
|
|
|
461
461
|
[255, 128, 0],
|
|
462
462
|
[255, 0, 0]
|
|
463
463
|
];
|
|
464
|
+
const PATHOLOGY_PALETTE = [
|
|
465
|
+
[0, 0, 0],
|
|
466
|
+
[228, 158, 37],
|
|
467
|
+
[91, 181, 231],
|
|
468
|
+
[22, 157, 116],
|
|
469
|
+
[239, 226, 82],
|
|
470
|
+
[16, 115, 176],
|
|
471
|
+
[211, 94, 26],
|
|
472
|
+
[202, 122, 166]
|
|
473
|
+
];
|
|
474
|
+
const LARGE_PATHOLOGY_PALETTE = [
|
|
475
|
+
[0, 0, 0],
|
|
476
|
+
[0, 73, 73],
|
|
477
|
+
[0, 146, 146],
|
|
478
|
+
[255, 109, 182],
|
|
479
|
+
[255, 182, 219],
|
|
480
|
+
[73, 0, 146],
|
|
481
|
+
[0, 109, 219],
|
|
482
|
+
[182, 109, 255],
|
|
483
|
+
[109, 182, 255],
|
|
484
|
+
[182, 219, 255],
|
|
485
|
+
[146, 0, 0],
|
|
486
|
+
[146, 72, 0],
|
|
487
|
+
[219, 109, 0],
|
|
488
|
+
[36, 255, 36],
|
|
489
|
+
[255, 255, 109],
|
|
490
|
+
[255, 255, 255]
|
|
491
|
+
];
|
|
464
492
|
const COLORMAP_OPTIONS = [
|
|
465
493
|
"viridis",
|
|
466
494
|
"greys",
|
|
@@ -517,35 +545,6 @@ function formatBytes(bytes, decimals = 2) {
|
|
|
517
545
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
518
546
|
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
519
547
|
}
|
|
520
|
-
const getStatsForResolution = (loader, resolution) => {
|
|
521
|
-
const { shape, labels } = loader[resolution];
|
|
522
|
-
const height = shape[labels.indexOf("y")];
|
|
523
|
-
const width = shape[labels.indexOf("x")];
|
|
524
|
-
const depth = shape[labels.indexOf("z")];
|
|
525
|
-
const depthDownsampled = Math.max(1, depth >> resolution);
|
|
526
|
-
const totalBytes = 4 * height * width * depthDownsampled;
|
|
527
|
-
return {
|
|
528
|
-
height,
|
|
529
|
-
width,
|
|
530
|
-
depthDownsampled,
|
|
531
|
-
totalBytes
|
|
532
|
-
};
|
|
533
|
-
};
|
|
534
|
-
const canLoadResolution = (loader, resolution) => {
|
|
535
|
-
var _a, _b, _c;
|
|
536
|
-
const {
|
|
537
|
-
totalBytes,
|
|
538
|
-
height,
|
|
539
|
-
width,
|
|
540
|
-
depthDownsampled
|
|
541
|
-
} = getStatsForResolution(
|
|
542
|
-
loader,
|
|
543
|
-
resolution
|
|
544
|
-
);
|
|
545
|
-
const maxHeapSize = ((_a = window.performance) == null ? void 0 : _a.memory) && ((_c = (_b = window.performance) == null ? void 0 : _b.memory) == null ? void 0 : _c.jsHeapSizeLimit) / 2;
|
|
546
|
-
const maxSize = maxHeapSize || 2 ** 31 - 1;
|
|
547
|
-
return totalBytes < maxSize && height <= 2048 && depthDownsampled <= 2048 && width <= 2048 && depthDownsampled > 1;
|
|
548
|
-
};
|
|
549
548
|
const VALUE_TRANSFORM_OPTIONS = [
|
|
550
549
|
{ name: "None", value: null },
|
|
551
550
|
{ name: "Log", value: "log1p" },
|
|
@@ -8957,8 +8956,10 @@ const ViewType$1 = {
|
|
|
8957
8956
|
STATUS: "status",
|
|
8958
8957
|
SCATTERPLOT: "scatterplot",
|
|
8959
8958
|
SPATIAL: "spatial",
|
|
8959
|
+
SPATIAL_BETA: "spatialBeta",
|
|
8960
8960
|
HEATMAP: "heatmap",
|
|
8961
8961
|
LAYER_CONTROLLER: "layerController",
|
|
8962
|
+
LAYER_CONTROLLER_BETA: "layerControllerBeta",
|
|
8962
8963
|
GENOMIC_PROFILES: "genomicProfiles",
|
|
8963
8964
|
GATING: "gating",
|
|
8964
8965
|
FEATURE_LIST: "featureList",
|
|
@@ -8970,20 +8971,24 @@ const ViewType$1 = {
|
|
|
8970
8971
|
const DataType$1 = {
|
|
8971
8972
|
OBS_LABELS: "obsLabels",
|
|
8972
8973
|
OBS_EMBEDDING: "obsEmbedding",
|
|
8973
|
-
OBS_LOCATIONS: "obsLocations",
|
|
8974
8974
|
OBS_FEATURE_MATRIX: "obsFeatureMatrix",
|
|
8975
8975
|
OBS_SETS: "obsSets",
|
|
8976
8976
|
FEATURE_LABELS: "featureLabels",
|
|
8977
8977
|
IMAGE: "image",
|
|
8978
8978
|
OBS_SEGMENTATIONS: "obsSegmentations",
|
|
8979
8979
|
NEIGHBORHOODS: "neighborhoods",
|
|
8980
|
-
GENOMIC_PROFILES: "genomic-profiles"
|
|
8980
|
+
GENOMIC_PROFILES: "genomic-profiles",
|
|
8981
|
+
OBS_SPOTS: "obsSpots",
|
|
8982
|
+
OBS_POINTS: "obsPoints",
|
|
8983
|
+
OBS_LOCATIONS: "obsLocations"
|
|
8981
8984
|
};
|
|
8982
8985
|
const FileType$1 = {
|
|
8983
8986
|
// Joint file types
|
|
8984
8987
|
ANNDATA_ZARR: "anndata.zarr",
|
|
8985
8988
|
// Atomic file types
|
|
8986
8989
|
OBS_EMBEDDING_CSV: "obsEmbedding.csv",
|
|
8990
|
+
OBS_SPOTS_CSV: "obsSpots.csv",
|
|
8991
|
+
OBS_POINTS_CSV: "obsPoints.csv",
|
|
8987
8992
|
OBS_LOCATIONS_CSV: "obsLocations.csv",
|
|
8988
8993
|
OBS_LABELS_CSV: "obsLabels.csv",
|
|
8989
8994
|
FEATURE_LABELS_CSV: "featureLabels.csv",
|
|
@@ -8996,6 +9001,8 @@ const FileType$1 = {
|
|
|
8996
9001
|
OBS_FEATURE_MATRIX_ANNDATA_ZARR: "obsFeatureMatrix.anndata.zarr",
|
|
8997
9002
|
OBS_SETS_ANNDATA_ZARR: "obsSets.anndata.zarr",
|
|
8998
9003
|
OBS_EMBEDDING_ANNDATA_ZARR: "obsEmbedding.anndata.zarr",
|
|
9004
|
+
OBS_SPOTS_ANNDATA_ZARR: "obsSpots.anndata.zarr",
|
|
9005
|
+
OBS_POINTS_ANNDATA_ZARR: "obsPoints.anndata.zarr",
|
|
8999
9006
|
OBS_LOCATIONS_ANNDATA_ZARR: "obsLocations.anndata.zarr",
|
|
9000
9007
|
OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
|
|
9001
9008
|
OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
|
|
@@ -9004,6 +9011,8 @@ const FileType$1 = {
|
|
|
9004
9011
|
OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
|
|
9005
9012
|
OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
|
|
9006
9013
|
OBS_EMBEDDING_MUDATA_ZARR: "obsEmbedding.mudata.zarr",
|
|
9014
|
+
OBS_SPOTS_MUDATA_ZARR: "obsSpots.mudata.zarr",
|
|
9015
|
+
OBS_POINTS_MUDATA_ZARR: "obsPoints.mudata.zarr",
|
|
9007
9016
|
OBS_LOCATIONS_MUDATA_ZARR: "obsLocations.mudata.zarr",
|
|
9008
9017
|
OBS_SEGMENTATIONS_MUDATA_ZARR: "obsSegmentations.mudata.zarr",
|
|
9009
9018
|
OBS_LABELS_MUDATA_ZARR: "obsLabels.mudata.zarr",
|
|
@@ -9047,10 +9056,8 @@ const FileType$1 = {
|
|
|
9047
9056
|
ANNDATA_EXPRESSION_MATRIX_ZARR: "anndata-expression-matrix.zarr"
|
|
9048
9057
|
};
|
|
9049
9058
|
const CoordinationType$1 = {
|
|
9050
|
-
// Meta coordination scopes
|
|
9051
9059
|
META_COORDINATION_SCOPES: "metaCoordinationScopes",
|
|
9052
9060
|
META_COORDINATION_SCOPES_BY: "metaCoordinationScopesBy",
|
|
9053
|
-
// Other coordination scopes
|
|
9054
9061
|
DATASET: "dataset",
|
|
9055
9062
|
// Entity types
|
|
9056
9063
|
OBS_TYPE: "obsType",
|
|
@@ -9076,6 +9083,7 @@ const CoordinationType$1 = {
|
|
|
9076
9083
|
SPATIAL_TARGET_X: "spatialTargetX",
|
|
9077
9084
|
SPATIAL_TARGET_Y: "spatialTargetY",
|
|
9078
9085
|
SPATIAL_TARGET_Z: "spatialTargetZ",
|
|
9086
|
+
SPATIAL_TARGET_T: "spatialTargetT",
|
|
9079
9087
|
SPATIAL_ROTATION_X: "spatialRotationX",
|
|
9080
9088
|
SPATIAL_ROTATION_Y: "spatialRotationY",
|
|
9081
9089
|
SPATIAL_ROTATION_Z: "spatialRotationZ",
|
|
@@ -9113,7 +9121,46 @@ const CoordinationType$1 = {
|
|
|
9113
9121
|
GATING_FEATURE_SELECTION_X: "gatingFeatureSelectionX",
|
|
9114
9122
|
GATING_FEATURE_SELECTION_Y: "gatingFeatureSelectionY",
|
|
9115
9123
|
FEATURE_VALUE_TRANSFORM_COEFFICIENT: "featureValueTransformCoefficient",
|
|
9116
|
-
TOOLTIPS_VISIBLE: "tooltipsVisible"
|
|
9124
|
+
TOOLTIPS_VISIBLE: "tooltipsVisible",
|
|
9125
|
+
FILE_UID: "fileUid",
|
|
9126
|
+
IMAGE_LAYER: "imageLayer",
|
|
9127
|
+
IMAGE_CHANNEL: "imageChannel",
|
|
9128
|
+
SEGMENTATION_LAYER: "segmentationLayer",
|
|
9129
|
+
SEGMENTATION_CHANNEL: "segmentationChannel",
|
|
9130
|
+
SPATIAL_TARGET_C: "spatialTargetC",
|
|
9131
|
+
SPATIAL_LAYER_VISIBLE: "spatialLayerVisible",
|
|
9132
|
+
SPATIAL_LAYER_OPACITY: "spatialLayerOpacity",
|
|
9133
|
+
SPATIAL_LAYER_COLORMAP: "spatialLayerColormap",
|
|
9134
|
+
SPATIAL_LAYER_TRANSPARENT_COLOR: "spatialLayerTransparentColor",
|
|
9135
|
+
SPATIAL_LAYER_MODEL_MATRIX: "spatialLayerModelMatrix",
|
|
9136
|
+
SPATIAL_SEGMENTATION_FILLED: "spatialSegmentationFilled",
|
|
9137
|
+
SPATIAL_SEGMENTATION_STROKE_WIDTH: "spatialSegmentationStrokeWidth",
|
|
9138
|
+
SPATIAL_CHANNEL_COLOR: "spatialChannelColor",
|
|
9139
|
+
SPATIAL_CHANNEL_VISIBLE: "spatialChannelVisible",
|
|
9140
|
+
SPATIAL_CHANNEL_OPACITY: "spatialChannelOpacity",
|
|
9141
|
+
SPATIAL_CHANNEL_WINDOW: "spatialChannelWindow",
|
|
9142
|
+
PHOTOMETRIC_INTERPRETATION: "photometricInterpretation",
|
|
9143
|
+
// For 3D volume rendering
|
|
9144
|
+
SPATIAL_RENDERING_MODE: "spatialRenderingMode",
|
|
9145
|
+
VOLUMETRIC_RENDERING_ALGORITHM: "volumetricRenderingAlgorithm",
|
|
9146
|
+
SPATIAL_TARGET_RESOLUTION: "spatialTargetResolution",
|
|
9147
|
+
// For clipping plane sliders
|
|
9148
|
+
SPATIAL_SLICE_X: "spatialSliceX",
|
|
9149
|
+
SPATIAL_SLICE_Y: "spatialSliceY",
|
|
9150
|
+
SPATIAL_SLICE_Z: "spatialSliceZ",
|
|
9151
|
+
// For spatial spot and point layers
|
|
9152
|
+
SPOT_LAYER: "spotLayer",
|
|
9153
|
+
POINT_LAYER: "pointLayer",
|
|
9154
|
+
SPATIAL_SPOT_RADIUS: "spatialSpotRadius",
|
|
9155
|
+
SPATIAL_SPOT_FILLED: "spatialSpotFilled",
|
|
9156
|
+
SPATIAL_SPOT_STROKE_WIDTH: "spatialSpotStrokeWidth",
|
|
9157
|
+
SPATIAL_LAYER_COLOR: "spatialLayerColor",
|
|
9158
|
+
PIXEL_HIGHLIGHT: "pixelHighlight",
|
|
9159
|
+
TOOLTIP_CROSSHAIRS_VISIBLE: "tooltipCrosshairsVisible",
|
|
9160
|
+
LEGEND_VISIBLE: "legendVisible",
|
|
9161
|
+
SPATIAL_CHANNEL_LABELS_VISIBLE: "spatialChannelLabelsVisible",
|
|
9162
|
+
SPATIAL_CHANNEL_LABELS_ORIENTATION: "spatialChannelLabelsOrientation",
|
|
9163
|
+
SPATIAL_CHANNEL_LABEL_SIZE: "spatialChannelLabelSize"
|
|
9117
9164
|
};
|
|
9118
9165
|
const ViewType = {
|
|
9119
9166
|
GENES: [
|
|
@@ -9374,6 +9421,8 @@ const annDataObsSets = z.array(z.object({
|
|
|
9374
9421
|
]),
|
|
9375
9422
|
scorePath: z.string().optional().describe("The location in the AnnData store for the set confidence scores, like 'obs/celltype_prediction_score.'")
|
|
9376
9423
|
}));
|
|
9424
|
+
const annDataObsSpots = annDataObsm;
|
|
9425
|
+
const annDataObsPoints = annDataObsm;
|
|
9377
9426
|
const annDataObsLocations = annDataObsm;
|
|
9378
9427
|
const annDataObsEmbedding = annDataObsm;
|
|
9379
9428
|
const annDataObsSegmentations = annDataObs;
|
|
@@ -9400,10 +9449,21 @@ z.object({
|
|
|
9400
9449
|
z.object({
|
|
9401
9450
|
obsIndex: z.string(),
|
|
9402
9451
|
obsEmbedding: z.array(z.string()).length(2)
|
|
9452
|
+
// TODO: support 3D?
|
|
9453
|
+
});
|
|
9454
|
+
z.object({
|
|
9455
|
+
obsIndex: z.string(),
|
|
9456
|
+
obsSpots: z.array(z.string()).length(2)
|
|
9457
|
+
// TODO: support 3D?
|
|
9458
|
+
});
|
|
9459
|
+
z.object({
|
|
9460
|
+
obsIndex: z.string(),
|
|
9461
|
+
obsPoints: z.array(z.string()).length(3)
|
|
9403
9462
|
});
|
|
9404
9463
|
z.object({
|
|
9405
9464
|
obsIndex: z.string(),
|
|
9406
9465
|
obsLocations: z.array(z.string()).length(2)
|
|
9466
|
+
// TODO: support 3D?
|
|
9407
9467
|
});
|
|
9408
9468
|
z.object({
|
|
9409
9469
|
obsIndex: z.string(),
|
|
@@ -9435,6 +9495,8 @@ z.object({
|
|
|
9435
9495
|
]),
|
|
9436
9496
|
obsFeatureMatrix: annDataObsFeatureMatrix,
|
|
9437
9497
|
obsSets: annDataObsSets,
|
|
9498
|
+
obsSpots: annDataObsSpots,
|
|
9499
|
+
obsPoints: annDataObsPoints,
|
|
9438
9500
|
obsLocations: annDataObsLocations,
|
|
9439
9501
|
obsSegmentations: annDataObsSegmentations,
|
|
9440
9502
|
obsEmbedding: z.union([
|
|
@@ -16106,12 +16168,13 @@ export {
|
|
|
16106
16168
|
DEFAULT_DARK_COLOR$1 as DEFAULT_DARK_COLOR,
|
|
16107
16169
|
DEFAULT_GL_OPTIONS,
|
|
16108
16170
|
DEFAULT_LIGHT_COLOR$1 as DEFAULT_LIGHT_COLOR,
|
|
16171
|
+
LARGE_PATHOLOGY_PALETTE,
|
|
16109
16172
|
PALETTE,
|
|
16173
|
+
PATHOLOGY_PALETTE,
|
|
16110
16174
|
Pool,
|
|
16111
16175
|
VALUE_TRANSFORM_OPTIONS,
|
|
16112
16176
|
VIEWER_PALETTE,
|
|
16113
16177
|
asEsModule,
|
|
16114
|
-
canLoadResolution,
|
|
16115
16178
|
capitalize$1 as capitalize,
|
|
16116
16179
|
commaNumber,
|
|
16117
16180
|
copyUint8Array,
|
|
@@ -16128,7 +16191,6 @@ export {
|
|
|
16128
16191
|
getDefaultColor$1 as getDefaultColor,
|
|
16129
16192
|
getLongestString,
|
|
16130
16193
|
getNextScope$1 as getNextScope,
|
|
16131
|
-
getStatsForResolution,
|
|
16132
16194
|
getValueTransformFunction,
|
|
16133
16195
|
pluralize
|
|
16134
16196
|
};
|
package/dist-tsc/components.d.ts
CHANGED
|
@@ -21,15 +21,10 @@ export const DEFAULT_DARK_COLOR: number[];
|
|
|
21
21
|
export const DEFAULT_LIGHT_COLOR: number[];
|
|
22
22
|
export const PALETTE: number[][];
|
|
23
23
|
export const VIEWER_PALETTE: number[][];
|
|
24
|
+
export const PATHOLOGY_PALETTE: number[][];
|
|
25
|
+
export const LARGE_PATHOLOGY_PALETTE: number[][];
|
|
24
26
|
export const COLORMAP_OPTIONS: string[];
|
|
25
27
|
export namespace DEFAULT_GL_OPTIONS {
|
|
26
28
|
const webgl2: boolean;
|
|
27
29
|
}
|
|
28
|
-
export function getStatsForResolution(loader: any, resolution: any): {
|
|
29
|
-
height: any;
|
|
30
|
-
width: any;
|
|
31
|
-
depthDownsampled: number;
|
|
32
|
-
totalBytes: number;
|
|
33
|
-
};
|
|
34
|
-
export function canLoadResolution(loader: any, resolution: any): boolean;
|
|
35
30
|
//# sourceMappingURL=components.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.js"],"names":[],"mappings":"AAIA,sDAEC;
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.js"],"names":[],"mappings":"AAIA,sDAEC;AAuED,sFAEC;AAED,qGAEC;AAED,4FAEC;AAED,4FAEC;AAED,6FAEC;AAED,yFAEC;AAED,2DAEC;AAGD;;;;GAIG;AACH,oCAHW,UAAU,GACR,UAAU,CAOtB;AAED;;;EAKC;AAGD,mEAWC;AAxID,0CAA+C;AAC/C,2CAAmD;AAOnD,iCAUE;AAEF,wCASE;AAEF,2CASE;AAEF,iDAiBE;AAEF,wCAWE"}
|
package/dist-tsc/components.js
CHANGED
|
@@ -26,6 +26,34 @@ export const VIEWER_PALETTE = [
|
|
|
26
26
|
[255, 128, 0],
|
|
27
27
|
[255, 0, 0],
|
|
28
28
|
];
|
|
29
|
+
export const PATHOLOGY_PALETTE = [
|
|
30
|
+
[0, 0, 0],
|
|
31
|
+
[228, 158, 37],
|
|
32
|
+
[91, 181, 231],
|
|
33
|
+
[22, 157, 116],
|
|
34
|
+
[239, 226, 82],
|
|
35
|
+
[16, 115, 176],
|
|
36
|
+
[211, 94, 26],
|
|
37
|
+
[202, 122, 166],
|
|
38
|
+
];
|
|
39
|
+
export const LARGE_PATHOLOGY_PALETTE = [
|
|
40
|
+
[0, 0, 0],
|
|
41
|
+
[0, 73, 73],
|
|
42
|
+
[0, 146, 146],
|
|
43
|
+
[255, 109, 182],
|
|
44
|
+
[255, 182, 219],
|
|
45
|
+
[73, 0, 146],
|
|
46
|
+
[0, 109, 219],
|
|
47
|
+
[182, 109, 255],
|
|
48
|
+
[109, 182, 255],
|
|
49
|
+
[182, 219, 255],
|
|
50
|
+
[146, 0, 0],
|
|
51
|
+
[146, 72, 0],
|
|
52
|
+
[219, 109, 0],
|
|
53
|
+
[36, 255, 36],
|
|
54
|
+
[255, 255, 109],
|
|
55
|
+
[255, 255, 255],
|
|
56
|
+
];
|
|
29
57
|
export const COLORMAP_OPTIONS = [
|
|
30
58
|
'viridis',
|
|
31
59
|
'greys',
|
|
@@ -87,28 +115,3 @@ export function formatBytes(bytes, decimals = 2) {
|
|
|
87
115
|
// eslint-disable-next-line no-restricted-properties
|
|
88
116
|
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
89
117
|
}
|
|
90
|
-
export const getStatsForResolution = (loader, resolution) => {
|
|
91
|
-
const { shape, labels } = loader[resolution];
|
|
92
|
-
const height = shape[labels.indexOf('y')];
|
|
93
|
-
const width = shape[labels.indexOf('x')];
|
|
94
|
-
const depth = shape[labels.indexOf('z')];
|
|
95
|
-
// eslint-disable-next-line no-bitwise
|
|
96
|
-
const depthDownsampled = Math.max(1, depth >> resolution);
|
|
97
|
-
// Check memory allocation limits for Float32Array (used in XR3DLayer for rendering)
|
|
98
|
-
const totalBytes = 4 * height * width * depthDownsampled;
|
|
99
|
-
return {
|
|
100
|
-
height, width, depthDownsampled, totalBytes,
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
export const canLoadResolution = (loader, resolution) => {
|
|
104
|
-
const { totalBytes, height, width, depthDownsampled, } = getStatsForResolution(loader, resolution);
|
|
105
|
-
const maxHeapSize = window.performance?.memory
|
|
106
|
-
&& window.performance?.memory?.jsHeapSizeLimit / 2;
|
|
107
|
-
const maxSize = maxHeapSize || (2 ** 31) - 1;
|
|
108
|
-
// 2048 is a normal texture size limit although some browsers go larger.
|
|
109
|
-
return (totalBytes < maxSize
|
|
110
|
-
&& height <= 2048
|
|
111
|
-
&& depthDownsampled <= 2048
|
|
112
|
-
&& width <= 2048
|
|
113
|
-
&& depthDownsampled > 1);
|
|
114
|
-
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/utils",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lodash-es": "^4.17.21",
|
|
21
21
|
"lz-string": "^1.4.4",
|
|
22
22
|
"pluralize": "^8.0.0",
|
|
23
|
-
"@vitessce/sets-utils": "3.
|
|
23
|
+
"@vitessce/sets-utils": "3.2.0"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
|
package/src/components.js
CHANGED
|
@@ -30,6 +30,36 @@ export const VIEWER_PALETTE = [
|
|
|
30
30
|
[255, 0, 0],
|
|
31
31
|
];
|
|
32
32
|
|
|
33
|
+
export const PATHOLOGY_PALETTE = [
|
|
34
|
+
[0, 0, 0],
|
|
35
|
+
[228, 158, 37],
|
|
36
|
+
[91, 181, 231],
|
|
37
|
+
[22, 157, 116],
|
|
38
|
+
[239, 226, 82],
|
|
39
|
+
[16, 115, 176],
|
|
40
|
+
[211, 94, 26],
|
|
41
|
+
[202, 122, 166],
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
export const LARGE_PATHOLOGY_PALETTE = [
|
|
45
|
+
[0, 0, 0],
|
|
46
|
+
[0, 73, 73],
|
|
47
|
+
[0, 146, 146],
|
|
48
|
+
[255, 109, 182],
|
|
49
|
+
[255, 182, 219],
|
|
50
|
+
[73, 0, 146],
|
|
51
|
+
[0, 109, 219],
|
|
52
|
+
[182, 109, 255],
|
|
53
|
+
[109, 182, 255],
|
|
54
|
+
[182, 219, 255],
|
|
55
|
+
[146, 0, 0],
|
|
56
|
+
[146, 72, 0],
|
|
57
|
+
[219, 109, 0],
|
|
58
|
+
[36, 255, 36],
|
|
59
|
+
[255, 255, 109],
|
|
60
|
+
[255, 255, 255],
|
|
61
|
+
];
|
|
62
|
+
|
|
33
63
|
export const COLORMAP_OPTIONS = [
|
|
34
64
|
'viridis',
|
|
35
65
|
'greys',
|
|
@@ -106,37 +136,3 @@ export function formatBytes(bytes, decimals = 2) {
|
|
|
106
136
|
// eslint-disable-next-line no-restricted-properties
|
|
107
137
|
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
108
138
|
}
|
|
109
|
-
|
|
110
|
-
export const getStatsForResolution = (loader, resolution) => {
|
|
111
|
-
const { shape, labels } = loader[resolution];
|
|
112
|
-
const height = shape[labels.indexOf('y')];
|
|
113
|
-
const width = shape[labels.indexOf('x')];
|
|
114
|
-
const depth = shape[labels.indexOf('z')];
|
|
115
|
-
// eslint-disable-next-line no-bitwise
|
|
116
|
-
const depthDownsampled = Math.max(1, depth >> resolution);
|
|
117
|
-
// Check memory allocation limits for Float32Array (used in XR3DLayer for rendering)
|
|
118
|
-
const totalBytes = 4 * height * width * depthDownsampled;
|
|
119
|
-
return {
|
|
120
|
-
height, width, depthDownsampled, totalBytes,
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export const canLoadResolution = (loader, resolution) => {
|
|
125
|
-
const {
|
|
126
|
-
totalBytes, height, width, depthDownsampled,
|
|
127
|
-
} = getStatsForResolution(
|
|
128
|
-
loader,
|
|
129
|
-
resolution,
|
|
130
|
-
);
|
|
131
|
-
const maxHeapSize = window.performance?.memory
|
|
132
|
-
&& window.performance?.memory?.jsHeapSizeLimit / 2;
|
|
133
|
-
const maxSize = maxHeapSize || (2 ** 31) - 1;
|
|
134
|
-
// 2048 is a normal texture size limit although some browsers go larger.
|
|
135
|
-
return (
|
|
136
|
-
totalBytes < maxSize
|
|
137
|
-
&& height <= 2048
|
|
138
|
-
&& depthDownsampled <= 2048
|
|
139
|
-
&& width <= 2048
|
|
140
|
-
&& depthDownsampled > 1
|
|
141
|
-
);
|
|
142
|
-
};
|