@vitessce/neuroglancer 3.9.5 → 3.9.7
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/{ReactNeuroglancer-BCg93QGV.js → ReactNeuroglancer-pv4bM8Yp.js} +43 -26
- package/dist/index-BEPd2Tds.js +37856 -0
- package/dist/index.js +1 -1
- package/dist-tsc/Neuroglancer.d.ts +0 -2
- package/dist-tsc/Neuroglancer.d.ts.map +1 -1
- package/dist-tsc/Neuroglancer.js +26 -26
- package/dist-tsc/NeuroglancerSubscriber.d.ts.map +1 -1
- package/dist-tsc/NeuroglancerSubscriber.js +219 -53
- package/dist-tsc/ReactNeuroglancer.d.ts +2 -2
- package/dist-tsc/ReactNeuroglancer.d.ts.map +1 -1
- package/dist-tsc/ReactNeuroglancer.js +31 -28
- package/dist-tsc/data-hook-ng-utils.d.ts +18 -20
- package/dist-tsc/data-hook-ng-utils.d.ts.map +1 -1
- package/dist-tsc/data-hook-ng-utils.js +136 -68
- package/dist-tsc/shader-utils.d.ts +126 -0
- package/dist-tsc/shader-utils.d.ts.map +1 -0
- package/dist-tsc/shader-utils.js +547 -0
- package/dist-tsc/shader-utils.test.d.ts +2 -0
- package/dist-tsc/shader-utils.test.d.ts.map +1 -0
- package/dist-tsc/shader-utils.test.js +364 -0
- package/dist-tsc/use-memo-custom-comparison.d.ts +14 -0
- package/dist-tsc/use-memo-custom-comparison.d.ts.map +1 -0
- package/dist-tsc/use-memo-custom-comparison.js +150 -0
- package/package.json +9 -8
- package/src/Neuroglancer.js +31 -26
- package/src/NeuroglancerSubscriber.js +361 -81
- package/src/README.md +28 -0
- package/src/ReactNeuroglancer.js +34 -27
- package/src/data-hook-ng-utils.js +178 -78
- package/src/shader-utils.js +653 -0
- package/src/shader-utils.test.js +432 -0
- package/src/use-memo-custom-comparison.js +190 -0
- package/dist/index-Wdrc02VW.js +0 -32390
- package/dist-tsc/data-hook-ng-utils.test.d.ts +0 -2
- package/dist-tsc/data-hook-ng-utils.test.d.ts.map +0 -1
- package/dist-tsc/data-hook-ng-utils.test.js +0 -35
- package/src/data-hook-ng-utils.test.js +0 -52
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
z: [number, "nm"];
|
|
13
|
-
};
|
|
14
|
-
position: any[];
|
|
15
|
-
projectionOrientation: any[];
|
|
16
|
-
projectionScale: any;
|
|
17
|
-
crossSectionScale: any;
|
|
18
|
-
}[];
|
|
19
|
-
export function useExtractOptionsForNg(loaders: any, dataset: any, dataType: any): any[];
|
|
1
|
+
/**
|
|
2
|
+
* Normalize dimensionX/Y/Z to nanometers.
|
|
3
|
+
* @param {object} opts
|
|
4
|
+
* @returns {{ x:[number,'nm'], y:[number,'nm'], z:[number,'nm'] }}
|
|
5
|
+
*/
|
|
6
|
+
export function normalizeDimensionsToNanometers(opts: object): {
|
|
7
|
+
x: [number, "nm"];
|
|
8
|
+
y: [number, "nm"];
|
|
9
|
+
z: [number, "nm"];
|
|
10
|
+
};
|
|
11
|
+
export function toNgLayerName(dataType: any, layerScope: any, channelScope?: null): string;
|
|
20
12
|
/**
|
|
21
13
|
* Get the parameters for NG's viewerstate.
|
|
22
14
|
* @param {object} loaders The object mapping
|
|
@@ -29,12 +21,18 @@ export function useExtractOptionsForNg(loaders: any, dataset: any, dataType: any
|
|
|
29
21
|
/**
|
|
30
22
|
* @returns [viewerState]
|
|
31
23
|
*/
|
|
32
|
-
export function useNeuroglancerViewerState(
|
|
24
|
+
export function useNeuroglancerViewerState(theme: any, segmentationLayerScopes: any, segmentationChannelScopesByLayer: any, segmentationLayerCoordination: any, segmentationChannelCoordination: any, obsSegmentationsUrls: any, obsSegmentationsData: any, pointLayerScopes: any, pointLayerCoordination: any, obsPointsUrls: any, obsPointsData: any, pointMultiIndicesData: any): any;
|
|
33
25
|
export namespace DEFAULT_NG_PROPS {
|
|
34
26
|
let layout: string;
|
|
35
27
|
let position: number[];
|
|
36
28
|
let projectionOrientation: number[];
|
|
37
29
|
let projectionScale: number;
|
|
38
30
|
let crossSectionScale: number;
|
|
31
|
+
namespace dimensions {
|
|
32
|
+
let x: (string | number)[];
|
|
33
|
+
let y: (string | number)[];
|
|
34
|
+
let z: (string | number)[];
|
|
35
|
+
}
|
|
36
|
+
let layers: never[];
|
|
39
37
|
}
|
|
40
38
|
//# sourceMappingURL=data-hook-ng-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-hook-ng-utils.d.ts","sourceRoot":"","sources":["../src/data-hook-ng-utils.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data-hook-ng-utils.d.ts","sourceRoot":"","sources":["../src/data-hook-ng-utils.js"],"names":[],"mappings":"AAgDA;;;;KAIK;AACL,sDAHa,MAAM,GACJ;IAAE,CAAC,EAAC,CAAC,MAAM,EAAC,IAAI,CAAC,CAAC;IAAC,CAAC,EAAC,CAAC,MAAM,EAAC,IAAI,CAAC,CAAC;IAAC,CAAC,EAAC,CAAC,MAAM,EAAC,IAAI,CAAC,CAAA;CAAE,CA+BnE;AAED,2FAQC;AAED;;;;;;;;GAQG;AACH;;GAEG;AACH,yXAiJC"}
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
1
|
import { DataType } from '@vitessce/constants-internal';
|
|
2
|
+
import { cloneDeep } from 'lodash-es';
|
|
3
|
+
import { useMemoCustomComparison, customIsEqualForInitialViewerState } from './use-memo-custom-comparison.js';
|
|
4
|
+
import { getPointsShader } from './shader-utils.js';
|
|
3
5
|
export const DEFAULT_NG_PROPS = {
|
|
4
6
|
layout: '3d',
|
|
5
7
|
position: [0, 0, 0],
|
|
6
8
|
projectionOrientation: [0, 0, 0, 1],
|
|
7
9
|
projectionScale: 1024,
|
|
8
10
|
crossSectionScale: 1,
|
|
11
|
+
dimensions: {
|
|
12
|
+
x: [1, 'nm'],
|
|
13
|
+
y: [1, 'nm'],
|
|
14
|
+
z: [1, 'nm'],
|
|
15
|
+
},
|
|
16
|
+
layers: [],
|
|
9
17
|
};
|
|
10
18
|
function toPrecomputedSource(url) {
|
|
11
19
|
if (!url) {
|
|
12
|
-
|
|
20
|
+
throw new Error('toPrecomputedSource: URL is required');
|
|
13
21
|
}
|
|
14
22
|
return `precomputed://${url}`;
|
|
15
23
|
}
|
|
@@ -36,8 +44,8 @@ function isInNanometerRange(value, unit, minNm = 1, maxNm = 100) {
|
|
|
36
44
|
* @param {object} opts
|
|
37
45
|
* @returns {{ x:[number,'nm'], y:[number,'nm'], z:[number,'nm'] }}
|
|
38
46
|
*/
|
|
39
|
-
function normalizeDimensionsToNanometers(opts) {
|
|
40
|
-
const { dimensionUnit, dimensionX, dimensionY, dimensionZ } = opts;
|
|
47
|
+
export function normalizeDimensionsToNanometers(opts) {
|
|
48
|
+
const { dimensionUnit, dimensionX, dimensionY, dimensionZ, ...otherOptions } = opts;
|
|
41
49
|
if (!dimensionUnit || !dimensionX || !dimensionY || !dimensionZ) {
|
|
42
50
|
console.warn('Missing dimension info');
|
|
43
51
|
}
|
|
@@ -48,70 +56,25 @@ function normalizeDimensionsToNanometers(opts) {
|
|
|
48
56
|
console.warn('Dimension was converted to nm units');
|
|
49
57
|
}
|
|
50
58
|
return {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
// The dimension-related fields are formatted differently in the fileDef.options
|
|
60
|
+
// vs. what the viewerState expects.
|
|
61
|
+
dimensions: {
|
|
62
|
+
x: xNm ? [dimensionX, dimensionUnit] : [1, 'nm'],
|
|
63
|
+
y: yNm ? [dimensionY, dimensionUnit] : [1, 'nm'],
|
|
64
|
+
z: zNm ? [dimensionZ, dimensionUnit] : [1, 'nm'],
|
|
65
|
+
},
|
|
66
|
+
// The non-dimension-related options can be passed through without modification.
|
|
67
|
+
...otherOptions,
|
|
54
68
|
};
|
|
55
69
|
}
|
|
56
|
-
export function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
?? loader?.coordinationValues?.fileUid
|
|
65
|
-
?? undefined;
|
|
66
|
-
const { position, projectionOrientation, projectionScale, crossSectionScale } = loader?.options ?? {};
|
|
67
|
-
const isPrecomputed = loader?.fileType.includes('precomputed');
|
|
68
|
-
if (!isPrecomputed) {
|
|
69
|
-
console.warn('Filetype needs to be precomputed');
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
key,
|
|
73
|
-
type: 'segmentation',
|
|
74
|
-
fileUid,
|
|
75
|
-
layout: DEFAULT_NG_PROPS.layout,
|
|
76
|
-
url,
|
|
77
|
-
source: toPrecomputedSource(url),
|
|
78
|
-
name: fileUid ?? key?.name ?? 'segmentation',
|
|
79
|
-
// For precomputed: nm is the unit used
|
|
80
|
-
dimensions: normalizeDimensionsToNanometers(loader?.options),
|
|
81
|
-
// If not provided, no error, but difficult to see the data
|
|
82
|
-
position: Array.isArray(position) && position.length === 3
|
|
83
|
-
? position : DEFAULT_NG_PROPS.position,
|
|
84
|
-
// If not provided, will have a default orientation
|
|
85
|
-
projectionOrientation: Array.isArray(projectionOrientation)
|
|
86
|
-
&& projectionOrientation.length === 4
|
|
87
|
-
? projectionOrientation : DEFAULT_NG_PROPS.projectionOrientation,
|
|
88
|
-
projectionScale: Number.isFinite(projectionScale)
|
|
89
|
-
? projectionScale : DEFAULT_NG_PROPS.projectionScale,
|
|
90
|
-
crossSectionScale: Number.isFinite(crossSectionScale)
|
|
91
|
-
? crossSectionScale : DEFAULT_NG_PROPS.crossSectionScale,
|
|
92
|
-
};
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
export function useExtractOptionsForNg(loaders, dataset, dataType) {
|
|
96
|
-
const extractedEntities = useMemo(() => extractDataTypeEntities(loaders, dataset, dataType), [loaders, dataset, dataType]);
|
|
97
|
-
const layers = useMemo(() => extractedEntities
|
|
98
|
-
.filter(t => t.source)
|
|
99
|
-
.map(t => ({
|
|
100
|
-
type: t.type,
|
|
101
|
-
source: t.source,
|
|
102
|
-
segments: [],
|
|
103
|
-
name: t.name || 'segmentation',
|
|
104
|
-
})), [extractedEntities]);
|
|
105
|
-
const viewerState = useMemo(() => ({
|
|
106
|
-
dimensions: extractedEntities[0]?.dimensions,
|
|
107
|
-
position: extractedEntities[0]?.position,
|
|
108
|
-
crossSectionScale: extractedEntities[0]?.crossSectionScale,
|
|
109
|
-
projectionOrientation: extractedEntities[0]?.projectionOrientation,
|
|
110
|
-
projectionScale: extractedEntities[0]?.projectionScale,
|
|
111
|
-
layers,
|
|
112
|
-
layout: extractedEntities[0].layout,
|
|
113
|
-
}));
|
|
114
|
-
return [viewerState];
|
|
70
|
+
export function toNgLayerName(dataType, layerScope, channelScope = null) {
|
|
71
|
+
if (dataType === DataType.OBS_SEGMENTATIONS) {
|
|
72
|
+
return `obsSegmentations-${layerScope}-${channelScope}`;
|
|
73
|
+
}
|
|
74
|
+
if (dataType === DataType.OBS_POINTS) {
|
|
75
|
+
return `obsPoints-${layerScope}`;
|
|
76
|
+
}
|
|
77
|
+
throw new Error(`Unsupported data type: ${dataType}`);
|
|
115
78
|
}
|
|
116
79
|
/**
|
|
117
80
|
* Get the parameters for NG's viewerstate.
|
|
@@ -125,6 +88,111 @@ export function useExtractOptionsForNg(loaders, dataset, dataType) {
|
|
|
125
88
|
/**
|
|
126
89
|
* @returns [viewerState]
|
|
127
90
|
*/
|
|
128
|
-
export function useNeuroglancerViewerState(
|
|
129
|
-
|
|
91
|
+
export function useNeuroglancerViewerState(theme, segmentationLayerScopes, segmentationChannelScopesByLayer, segmentationLayerCoordination, segmentationChannelCoordination, obsSegmentationsUrls, obsSegmentationsData, pointLayerScopes, pointLayerCoordination, obsPointsUrls, obsPointsData, pointMultiIndicesData) {
|
|
92
|
+
const viewerState = useMemoCustomComparison(() => {
|
|
93
|
+
let result = cloneDeep(DEFAULT_NG_PROPS);
|
|
94
|
+
// ======= SEGMENTATIONS =======
|
|
95
|
+
// Iterate over segmentation layers and channels.
|
|
96
|
+
segmentationLayerScopes.forEach((layerScope) => {
|
|
97
|
+
const layerCoordination = segmentationLayerCoordination[0][layerScope];
|
|
98
|
+
const channelScopes = segmentationChannelScopesByLayer[layerScope] || [];
|
|
99
|
+
const layerData = obsSegmentationsData[layerScope];
|
|
100
|
+
const layerUrl = obsSegmentationsUrls[layerScope]?.[0]?.url;
|
|
101
|
+
if (layerUrl && layerData) {
|
|
102
|
+
const { spatialLayerVisible, } = layerCoordination || {};
|
|
103
|
+
channelScopes.forEach((channelScope) => {
|
|
104
|
+
const channelCoordination = segmentationChannelCoordination[0]?.[layerScope]?.[channelScope];
|
|
105
|
+
const { spatialChannelVisible, } = channelCoordination || {};
|
|
106
|
+
result = {
|
|
107
|
+
...result,
|
|
108
|
+
layers: [
|
|
109
|
+
...result.layers,
|
|
110
|
+
{
|
|
111
|
+
type: 'segmentation',
|
|
112
|
+
source: toPrecomputedSource(layerUrl),
|
|
113
|
+
segments: [],
|
|
114
|
+
name: toNgLayerName(DataType.OBS_SEGMENTATIONS, layerScope, channelScope),
|
|
115
|
+
visible: spatialLayerVisible && spatialChannelVisible, // Both layer and channel
|
|
116
|
+
// visibility must be true for the layer to be visible.
|
|
117
|
+
// TODO: update this to extract specific properties from
|
|
118
|
+
// neuroglancerOptions as needed.
|
|
119
|
+
...(layerData.neuroglancerOptions ?? {}),
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
// ======= POINTS =======
|
|
127
|
+
// Iterate over point layers.
|
|
128
|
+
pointLayerScopes.forEach((layerScope) => {
|
|
129
|
+
const layerCoordination = pointLayerCoordination[0][layerScope];
|
|
130
|
+
const layerData = obsPointsData[layerScope];
|
|
131
|
+
const layerUrl = obsPointsUrls[layerScope]?.[0]?.url;
|
|
132
|
+
const featureIndex = pointMultiIndicesData[layerScope]?.featureIndex;
|
|
133
|
+
if (layerUrl && layerData) {
|
|
134
|
+
const { spatialLayerVisible, spatialLayerOpacity, obsColorEncoding, spatialLayerColor, featureSelection, featureFilterMode, featureColor, } = layerCoordination || {};
|
|
135
|
+
// Dynamically construct the shader based on the color encoding
|
|
136
|
+
// and other coordination values.
|
|
137
|
+
const shader = getPointsShader({
|
|
138
|
+
theme,
|
|
139
|
+
featureIndex,
|
|
140
|
+
spatialLayerOpacity,
|
|
141
|
+
obsColorEncoding,
|
|
142
|
+
spatialLayerColor,
|
|
143
|
+
featureSelection,
|
|
144
|
+
featureFilterMode,
|
|
145
|
+
featureColor,
|
|
146
|
+
featureIndexProp: layerData.neuroglancerOptions?.featureIndexProp,
|
|
147
|
+
pointIndexProp: layerData.neuroglancerOptions?.pointIndexProp,
|
|
148
|
+
});
|
|
149
|
+
result = {
|
|
150
|
+
...result,
|
|
151
|
+
layers: [
|
|
152
|
+
...result.layers,
|
|
153
|
+
{
|
|
154
|
+
type: 'annotation',
|
|
155
|
+
source: {
|
|
156
|
+
url: toPrecomputedSource(layerUrl),
|
|
157
|
+
subsources: {
|
|
158
|
+
default: true,
|
|
159
|
+
},
|
|
160
|
+
enableDefaultSubsources: false,
|
|
161
|
+
},
|
|
162
|
+
tab: 'annotations',
|
|
163
|
+
shader,
|
|
164
|
+
name: toNgLayerName(DataType.OBS_POINTS, layerScope),
|
|
165
|
+
visible: spatialLayerVisible,
|
|
166
|
+
// Options from layerData.neuroglancerOptions
|
|
167
|
+
// like projectionAnnotationSpacing:
|
|
168
|
+
projectionAnnotationSpacing: layerData.neuroglancerOptions
|
|
169
|
+
?.projectionAnnotationSpacing ?? 1.0,
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
// TODO: is this needed?
|
|
173
|
+
// The selected layer here will overwrite anything
|
|
174
|
+
// that was previously specified.
|
|
175
|
+
selectedLayer: {
|
|
176
|
+
// size: ? // TODO: is this needed?
|
|
177
|
+
layer: toNgLayerName(DataType.OBS_POINTS, layerScope),
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
return result;
|
|
183
|
+
}, {
|
|
184
|
+
theme,
|
|
185
|
+
segmentationLayerScopes,
|
|
186
|
+
segmentationChannelScopesByLayer,
|
|
187
|
+
segmentationLayerCoordination,
|
|
188
|
+
segmentationChannelCoordination,
|
|
189
|
+
obsSegmentationsUrls,
|
|
190
|
+
obsSegmentationsData,
|
|
191
|
+
pointLayerScopes,
|
|
192
|
+
pointLayerCoordination,
|
|
193
|
+
obsPointsUrls,
|
|
194
|
+
obsPointsData,
|
|
195
|
+
pointMultiIndicesData,
|
|
196
|
+
}, customIsEqualForInitialViewerState);
|
|
197
|
+
return viewerState;
|
|
130
198
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a shader for spatialLayerColor encoding with no feature selection.
|
|
3
|
+
* All points get the static color.
|
|
4
|
+
* @param {[number, number, number]} staticColor RGB (0-255).
|
|
5
|
+
* @param {number} opacity Opacity (0-1).
|
|
6
|
+
* @returns {string} A GLSL shader string.
|
|
7
|
+
*/
|
|
8
|
+
export function getSpatialLayerColorShader(staticColor: [number, number, number], opacity: number): string;
|
|
9
|
+
/**
|
|
10
|
+
* Generate a shader for spatialLayerColor encoding with feature selection.
|
|
11
|
+
* Selected features get the static color; unselected get the default color.
|
|
12
|
+
* @param {[number, number, number]} staticColor RGB (0-255).
|
|
13
|
+
* @param {number} opacity Opacity (0-1).
|
|
14
|
+
* @param {number[]} featureIndices Numeric indices of selected features.
|
|
15
|
+
* @param {[number, number, number]} defaultColor RGB (0-255) for unselected points.
|
|
16
|
+
* @param {string} featureIndexProp The property name for the feature index in the shader.
|
|
17
|
+
* @returns {string} A GLSL shader string.
|
|
18
|
+
*/
|
|
19
|
+
export function getSpatialLayerColorWithSelectionShader(staticColor: [number, number, number], opacity: number, featureIndices: number[], defaultColor: [number, number, number], featureIndexProp: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Generate a shader for spatialLayerColor encoding with feature selection
|
|
22
|
+
* and featureFilterMode='featureSelection' (hide unselected points).
|
|
23
|
+
* @param {[number, number, number]} staticColor RGB (0-255).
|
|
24
|
+
* @param {number} opacity Opacity (0-1).
|
|
25
|
+
* @param {number[]} featureIndices Numeric indices of selected features.
|
|
26
|
+
* @param {string} featureIndexProp The property name for the feature index in the shader.
|
|
27
|
+
* @returns {string} A GLSL shader string.
|
|
28
|
+
*/
|
|
29
|
+
export function getSpatialLayerColorFilteredShader(staticColor: [number, number, number], opacity: number, featureIndices: number[], featureIndexProp: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Generate a shader for geneSelection encoding with no feature selection.
|
|
32
|
+
* All points get the static color (since no features are selected to
|
|
33
|
+
* determine per-feature colors).
|
|
34
|
+
* @param {[number, number, number]} staticColor RGB (0-255).
|
|
35
|
+
* @param {number} opacity Opacity (0-1).
|
|
36
|
+
* @returns {string} A GLSL shader string.
|
|
37
|
+
*/
|
|
38
|
+
export function getGeneSelectionNoSelectionShader(staticColor: [number, number, number], opacity: number): string;
|
|
39
|
+
/**
|
|
40
|
+
* Generate a shader for geneSelection encoding with feature selection.
|
|
41
|
+
* Each selected feature gets its color from featureColor; unselected
|
|
42
|
+
* points get the default color.
|
|
43
|
+
* @param {number[]} featureIndices Numeric indices of selected features.
|
|
44
|
+
* @param {[number, number, number][]} featureColors RGB (0-255) for each
|
|
45
|
+
* selected feature, in the same order as featureIndices.
|
|
46
|
+
* @param {[number, number, number]} staticColor Fallback RGB (0-255)
|
|
47
|
+
* for selected features without a specified color.
|
|
48
|
+
* @param {[number, number, number]} defaultColor RGB (0-255) for
|
|
49
|
+
* unselected points.
|
|
50
|
+
* @param {number} opacity Opacity (0-1).
|
|
51
|
+
* @param {string} featureIndexProp The property name for the feature index in the shader.
|
|
52
|
+
* @returns {string} A GLSL shader string.
|
|
53
|
+
*/
|
|
54
|
+
export function getGeneSelectionWithSelectionShader(featureIndices: number[], featureColors: [number, number, number][], staticColor: [number, number, number], defaultColor: [number, number, number], opacity: number, featureIndexProp: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Generate a shader for geneSelection encoding with feature selection
|
|
57
|
+
* and featureFilterMode='featureSelection' (hide unselected points).
|
|
58
|
+
* @param {number[]} featureIndices Numeric indices of selected features.
|
|
59
|
+
* @param {[number, number, number][]} featureColors RGB (0-255) for each
|
|
60
|
+
* selected feature.
|
|
61
|
+
* @param {[number, number, number]} staticColor Fallback RGB (0-255).
|
|
62
|
+
* @param {number} opacity Opacity (0-1).
|
|
63
|
+
* @param {string} featureIndexProp The property name for the feature index in the shader.
|
|
64
|
+
* @returns {string} A GLSL shader string.
|
|
65
|
+
*/
|
|
66
|
+
export function getGeneSelectionFilteredShader(featureIndices: number[], featureColors: [number, number, number][], staticColor: [number, number, number], opacity: number, featureIndexProp: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Generate a shader for randomByFeature encoding with no feature selection.
|
|
69
|
+
* Each feature gets a deterministic color from PALETTE based on its index.
|
|
70
|
+
* @param {number} opacity Opacity (0-1).
|
|
71
|
+
* @param {string} featureIndexProp The property name for the feature index in the shader.
|
|
72
|
+
* @returns {string} A GLSL shader string.
|
|
73
|
+
*/
|
|
74
|
+
export function getRandomByFeatureShader(opacity: number, featureIndexProp: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* Generate a shader for randomByFeature encoding with feature selection.
|
|
77
|
+
* Selected features get their deterministic palette color; unselected
|
|
78
|
+
* points get the default color.
|
|
79
|
+
* @param {number[]} featureIndices Numeric indices of selected features.
|
|
80
|
+
* @param {[number, number, number]} defaultColor RGB (0-255) for unselected.
|
|
81
|
+
* @param {number} opacity Opacity (0-1).
|
|
82
|
+
* @param {string} featureIndexProp The property name for the feature index in the shader.
|
|
83
|
+
* @returns {string} A GLSL shader string.
|
|
84
|
+
*/
|
|
85
|
+
export function getRandomByFeatureWithSelectionShader(featureIndices: number[], defaultColor: [number, number, number], opacity: number, featureIndexProp: string): string;
|
|
86
|
+
/**
|
|
87
|
+
* Generate a shader for randomByFeature encoding with feature selection
|
|
88
|
+
* and featureFilterMode='featureSelection' (hide unselected points).
|
|
89
|
+
* @param {number[]} featureIndices Numeric indices of selected features.
|
|
90
|
+
* @param {number} opacity Opacity (0-1).
|
|
91
|
+
* @param {string} featureIndexProp The property name for the feature index in the shader.
|
|
92
|
+
* @returns {string} A GLSL shader string.
|
|
93
|
+
*/
|
|
94
|
+
export function getRandomByFeatureFilteredShader(featureIndices: number[], opacity: number, featureIndexProp: string): string;
|
|
95
|
+
/**
|
|
96
|
+
* Generate a shader for random-per-point encoding with no feature selection.
|
|
97
|
+
* Each point gets a pseudo-random color based on its index.
|
|
98
|
+
* @param {number} opacity Opacity (0-1).
|
|
99
|
+
* @param {string} featureIndexProp The property name for the feature index in the shader.
|
|
100
|
+
* @param {string} pointIndexProp The property name for the point index in the shader.
|
|
101
|
+
* @returns {string} A GLSL shader string.
|
|
102
|
+
*/
|
|
103
|
+
export function getRandomPerPointShader(opacity: number, featureIndexProp: string, pointIndexProp: string): string;
|
|
104
|
+
/**
|
|
105
|
+
* Generate a shader for random-per-point encoding with feature selection.
|
|
106
|
+
* Selected points get a pseudo-random color; unselected get the default color.
|
|
107
|
+
* @param {number[]} featureIndices Numeric indices of selected features.
|
|
108
|
+
* @param {[number, number, number]} defaultColor RGB (0-255) for unselected.
|
|
109
|
+
* @param {number} opacity Opacity (0-1).
|
|
110
|
+
* @param {string} featureIndexProp The property name for the feature index in the shader.
|
|
111
|
+
* @param {string} pointIndexProp The property name for the point index in the shader.
|
|
112
|
+
* @returns {string} A GLSL shader string.
|
|
113
|
+
*/
|
|
114
|
+
export function getRandomPerPointWithSelectionShader(featureIndices: number[], defaultColor: [number, number, number], opacity: number, featureIndexProp: string, pointIndexProp: string): string;
|
|
115
|
+
/**
|
|
116
|
+
* Generate a shader for random-per-point encoding with feature selection
|
|
117
|
+
* and featureFilterMode='featureSelection' (hide unselected points).
|
|
118
|
+
* @param {number[]} featureIndices Numeric indices of selected features.
|
|
119
|
+
* @param {number} opacity Opacity (0-1).
|
|
120
|
+
* @param {string} featureIndexProp The property name for the feature index in the shader.
|
|
121
|
+
* @param {string} pointIndexProp The property name for the point index in the shader.
|
|
122
|
+
* @returns {string} A GLSL shader string.
|
|
123
|
+
*/
|
|
124
|
+
export function getRandomPerPointFilteredShader(featureIndices: number[], opacity: number, featureIndexProp: string, pointIndexProp: string): string;
|
|
125
|
+
export function getPointsShader(layerCoordination: any): string;
|
|
126
|
+
//# sourceMappingURL=shader-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader-utils.d.ts","sourceRoot":"","sources":["../src/shader-utils.js"],"names":[],"mappings":"AAwCA;;;;;;GAMG;AACH,wDAJW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,WACxB,MAAM,GACJ,MAAM,CAUlB;AAGD;;;;;;;;;GASG;AACH,qEAPW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,WACxB,MAAM,kBACN,MAAM,EAAE,gBACR,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,oBACxB,MAAM,GACJ,MAAM,CA4BlB;AAGD;;;;;;;;GAQG;AACH,gEANW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,WACxB,MAAM,kBACN,MAAM,EAAE,oBACR,MAAM,GACJ,MAAM,CA0BlB;AAMD;;;;;;;GAOG;AACH,+DAJW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,WACxB,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;;;;;;;;;;GAcG;AACH,oEAXW,MAAM,EAAE,iBACR,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAE1B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,gBAExB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,WAExB,MAAM,oBACN,MAAM,GACJ,MAAM,CA+BlB;AAED;;;;;;;;;;GAUG;AACH,+DARW,MAAM,EAAE,iBACR,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAE1B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,WACxB,MAAM,oBACN,MAAM,GACJ,MAAM,CAoClB;AAMD;;;;;;GAMG;AACH,kDAJW,MAAM,oBACN,MAAM,GACJ,MAAM,CAkBlB;AAED;;;;;;;;;GASG;AACH,sEANW,MAAM,EAAE,gBACR,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,WACxB,MAAM,oBACN,MAAM,GACJ,MAAM,CAkClB;AAED;;;;;;;GAOG;AACH,iEALW,MAAM,EAAE,WACR,MAAM,oBACN,MAAM,GACJ,MAAM,CA8BlB;AAuBD;;;;;;;GAOG;AACH,iDALW,MAAM,oBACN,MAAM,kBACN,MAAM,GACJ,MAAM,CAelB;AAED;;;;;;;;;GASG;AACH,qEAPW,MAAM,EAAE,gBACR,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,WACxB,MAAM,oBACN,MAAM,kBACN,MAAM,GACJ,MAAM,CAgClB;AAED;;;;;;;;GAQG;AACH,gEANW,MAAM,EAAE,WACR,MAAM,oBACN,MAAM,kBACN,MAAM,GACJ,MAAM,CA8BlB;AAGD,gEAwKC"}
|