@kitware/vtk.js 33.0.0-beta.4 → 33.0.1
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/BREAKING_CHANGES.md +0 -3
- package/Common/Core/ScalarsToColors/Constants.js +7 -2
- package/Common/Core/ScalarsToColors.js +3 -1
- package/Rendering/Core/Actor.d.ts +20 -5
- package/Rendering/Core/Actor.js +68 -5
- package/Rendering/Core/ColorTransferFunction.js +26 -35
- package/Rendering/Core/ImageCPRMapper.d.ts +20 -1
- package/Rendering/Core/ImageCPRMapper.js +2 -1
- package/Rendering/Core/ImageProperty.d.ts +1 -20
- package/Rendering/Core/ImageProperty.js +5 -7
- package/Rendering/Core/ImageResliceMapper.d.ts +20 -1
- package/Rendering/Core/ImageResliceMapper.js +2 -1
- package/Rendering/Core/ImageSlice.d.ts +23 -7
- package/Rendering/Core/ImageSlice.js +68 -9
- package/Rendering/Core/Mapper.js +8 -16
- package/Rendering/Core/Prop3D.d.ts +2 -39
- package/Rendering/Core/Prop3D.js +2 -81
- package/Rendering/Core/ScalarBarActor.js +4 -2
- package/Rendering/Core/Volume.d.ts +20 -5
- package/Rendering/Core/Volume.js +70 -2
- package/Rendering/Core/VolumeMapper/Constants.d.ts +7 -0
- package/Rendering/Core/VolumeMapper/Constants.js +8 -2
- package/Rendering/Core/VolumeMapper.d.ts +173 -16
- package/Rendering/Core/VolumeMapper.js +51 -16
- package/Rendering/Core/VolumeProperty/Constants.d.ts +3 -12
- package/Rendering/Core/VolumeProperty/Constants.js +4 -11
- package/Rendering/Core/VolumeProperty.d.ts +5 -140
- package/Rendering/Core/VolumeProperty.js +7 -54
- package/Rendering/OpenGL/CellArrayBufferObject/helpers.js +45 -0
- package/Rendering/OpenGL/CellArrayBufferObject.js +6 -25
- package/Rendering/OpenGL/ImageCPRMapper.js +21 -30
- package/Rendering/OpenGL/ImageMapper.js +27 -27
- package/Rendering/OpenGL/ImageResliceMapper.js +183 -271
- package/Rendering/OpenGL/PolyDataMapper.js +8 -1
- package/Rendering/OpenGL/RenderWindow/resourceSharingHelper.d.ts +3 -3
- package/Rendering/OpenGL/RenderWindow/resourceSharingHelper.js +5 -8
- package/Rendering/OpenGL/SphereMapper.js +33 -13
- package/Rendering/OpenGL/VolumeMapper.js +784 -722
- package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
- package/Rendering/WebGPU/VolumePassFSQ.js +2 -2
- package/index.d.ts +0 -1
- package/macros2.js +1 -1
- package/package.json +1 -1
- package/Interaction/Manipulators/KeyboardCameraManipulator.d.ts +0 -113
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
import vtkPiecewiseFunction from './../../Common/DataModel/PiecewiseFunction';
|
|
2
|
-
import { Bounds } from './../../types';
|
|
2
|
+
import { Bounds, Range, Extent } from './../../types';
|
|
3
3
|
import vtkAbstractMapper3D, {
|
|
4
4
|
IAbstractMapper3DInitialValues,
|
|
5
5
|
} from './AbstractMapper3D';
|
|
6
|
-
import { BlendMode } from './VolumeMapper/Constants';
|
|
6
|
+
import { BlendMode, FilterMode } from './VolumeMapper/Constants';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
export interface IVolumeMapperInitialValues
|
|
12
12
|
extends IAbstractMapper3DInitialValues {
|
|
13
|
+
anisotropy?: number;
|
|
13
14
|
autoAdjustSampleDistances?: boolean;
|
|
15
|
+
averageIPScalarRange?: Range;
|
|
14
16
|
blendMode?: BlendMode;
|
|
15
17
|
bounds?: Bounds;
|
|
18
|
+
computeNormalFromOpacity?: boolean;
|
|
19
|
+
getVolumeShadowSamplingDistFactor?: number;
|
|
20
|
+
globalIlluminationReach?: number;
|
|
21
|
+
imageSampleDistance?: number;
|
|
22
|
+
localAmbientOcclusion?: boolean;
|
|
16
23
|
maximumSamplesPerRay?: number;
|
|
17
24
|
sampleDistance?: number;
|
|
18
|
-
|
|
25
|
+
LAOKernelRadius?: number;
|
|
26
|
+
LAOKernelSize?: number;
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
export interface vtkVolumeMapper extends vtkAbstractMapper3D {
|
|
@@ -41,12 +49,6 @@ export interface vtkVolumeMapper extends vtkAbstractMapper3D {
|
|
|
41
49
|
*/
|
|
42
50
|
getSampleDistance(): number;
|
|
43
51
|
|
|
44
|
-
/**
|
|
45
|
-
* Get the multipler for volume shadow sampling distance
|
|
46
|
-
* @default 5.0
|
|
47
|
-
*/
|
|
48
|
-
getVolumeShadowSamplingDistFactor(): number;
|
|
49
|
-
|
|
50
52
|
/**
|
|
51
53
|
* Sampling distance in the XY image dimensions.
|
|
52
54
|
* Default value of 1 meaning 1 ray cast per pixel. If set to 0.5, 4 rays will be cast per pixel.
|
|
@@ -82,6 +84,71 @@ export interface vtkVolumeMapper extends vtkAbstractMapper3D {
|
|
|
82
84
|
*/
|
|
83
85
|
getInteractionSampleDistanceFactor(): number;
|
|
84
86
|
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
*/
|
|
90
|
+
getAverageIPScalarRange(): Range;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
getAverageIPScalarRangeByReference(): Range;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get the blending coefficient that interpolates between surface and volume rendering
|
|
99
|
+
* @default 0.0
|
|
100
|
+
*/
|
|
101
|
+
getVolumetricScatteringBlending(): number;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Get the global illumination reach of volume shadow
|
|
105
|
+
* @default 0.0
|
|
106
|
+
*/
|
|
107
|
+
getGlobalIlluminationReach(): number;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Get the multipler for volume shadow sampling distance
|
|
111
|
+
* @default 5.0
|
|
112
|
+
*/
|
|
113
|
+
getVolumeShadowSamplingDistFactor(): number;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Get anisotropy of volume shadow scatter
|
|
117
|
+
* @default 0.0
|
|
118
|
+
*/
|
|
119
|
+
getAnisotropy(): number;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Get local ambient occlusion flag
|
|
123
|
+
* @default false
|
|
124
|
+
*/
|
|
125
|
+
getLocalAmbientOcclusion(): boolean;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Get kernel size for local ambient occlusion
|
|
129
|
+
* @default 15
|
|
130
|
+
*/
|
|
131
|
+
getLAOKernelSize(): number;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get kernel radius for local ambient occlusion
|
|
135
|
+
* @default 7
|
|
136
|
+
*/
|
|
137
|
+
getLAOKernelRadius(): number;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @param x
|
|
142
|
+
* @param y
|
|
143
|
+
*/
|
|
144
|
+
setAverageIPScalarRange(x: number, y: number): boolean;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
*
|
|
148
|
+
* @param {Range} averageIPScalarRange
|
|
149
|
+
*/
|
|
150
|
+
setAverageIPScalarRangeFrom(averageIPScalarRange: Range): boolean;
|
|
151
|
+
|
|
85
152
|
/**
|
|
86
153
|
* Set blend mode to COMPOSITE_BLEND
|
|
87
154
|
* @param {BlendMode} blendMode
|
|
@@ -119,13 +186,6 @@ export interface vtkVolumeMapper extends vtkAbstractMapper3D {
|
|
|
119
186
|
*/
|
|
120
187
|
setSampleDistance(sampleDistance: number): boolean;
|
|
121
188
|
|
|
122
|
-
/**
|
|
123
|
-
* Set the multipler for volume shadow sampling distance. This function is only effective when volumeScatterBlendCoef is greater than 0.
|
|
124
|
-
* For VSSampleDistanceFactor >= 1.0, volume shadow sampling distance = VSSampleDistanceFactor * SampleDistance.
|
|
125
|
-
* @param VSSampleDistanceFactor
|
|
126
|
-
*/
|
|
127
|
-
setVolumeShadowSamplingDistFactor(VSSampleDistanceFactor: number): void;
|
|
128
|
-
|
|
129
189
|
/**
|
|
130
190
|
*
|
|
131
191
|
* @param imageSampleDistance
|
|
@@ -158,6 +218,102 @@ export interface vtkVolumeMapper extends vtkAbstractMapper3D {
|
|
|
158
218
|
interactionSampleDistanceFactor: number
|
|
159
219
|
): boolean;
|
|
160
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Set the normal computation to be dependent on the transfer function.
|
|
223
|
+
* By default, the mapper relies on the scalar gradient for computing normals at sample locations
|
|
224
|
+
* for lighting calculations. This is an approximation and can lead to inaccurate results.
|
|
225
|
+
* When enabled, this property makes the mapper compute normals based on the accumulated opacity
|
|
226
|
+
* at sample locations. This can generate a more accurate representation of edge structures in the
|
|
227
|
+
* data but adds an overhead and drops frame rate.
|
|
228
|
+
* @param computeNormalFromOpacity
|
|
229
|
+
*/
|
|
230
|
+
setComputeNormalFromOpacity(computeNormalFromOpacity: boolean): boolean;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Set the blending coefficient that determines the interpolation between surface and volume rendering.
|
|
234
|
+
* Default value of 0.0 means shadow effect is computed with phong model.
|
|
235
|
+
* Value of 1.0 means shadow is created by volume occlusion.
|
|
236
|
+
* @param volumeScatterBlendCoef
|
|
237
|
+
*/
|
|
238
|
+
setVolumetricScatteringBlending(volumeScatterBlendCoef: number): void;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Set the global illumination reach of volume shadow. This function is only effective when volumeScatterBlendCoef is greater than 0.
|
|
242
|
+
* Default value of 0.0 means only the neighboring voxel is considered when creating global shadow.
|
|
243
|
+
* Value of 1.0 means the shadow ray traverses through the entire volume.
|
|
244
|
+
* @param globalIlluminationReach
|
|
245
|
+
*/
|
|
246
|
+
setGlobalIlluminationReach(globalIlluminationReach: number): void;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Set the multipler for volume shadow sampling distance. This function is only effective when volumeScatterBlendCoef is greater than 0.
|
|
250
|
+
* For VSSampleDistanceFactor >= 1.0, volume shadow sampling distance = VSSampleDistanceFactor * SampleDistance.
|
|
251
|
+
* @param VSSampleDistanceFactor
|
|
252
|
+
*/
|
|
253
|
+
setVolumeShadowSamplingDistFactor(VSSampleDistanceFactor: number): void;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Set anisotropy of volume shadow scatter. This function is only effective when volumeScatterBlendCoef is greater than 0.
|
|
257
|
+
* Default value of 0.0 means light scatters uniformly in all directions.
|
|
258
|
+
* Value of -1.0 means light scatters backward, value of 1.0 means light scatters forward.
|
|
259
|
+
* @param anisotropy
|
|
260
|
+
*/
|
|
261
|
+
setAnisotropy(anisotropy: number): void;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Set whether to turn on local ambient occlusion (LAO). LAO is only effective if shading is on and volumeScatterBlendCoef is set to 0.
|
|
265
|
+
* LAO effect is added to ambient lighting, so the ambient component of the actor needs to be great than 0.
|
|
266
|
+
* @param localAmbientOcclusion
|
|
267
|
+
*/
|
|
268
|
+
setLocalAmbientOcclusion(localAmbientOcclusion: boolean): void;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Set kernel size for local ambient occlusion. It specifies the number of rays that are randomly sampled in the hemisphere.
|
|
272
|
+
* Value is clipped between 1 and 32.
|
|
273
|
+
* @param LAOKernelSize
|
|
274
|
+
*/
|
|
275
|
+
setLAOKernelSize(LAOKernelSize: number): void;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Set kernel radius for local ambient occlusion. It specifies the number of samples that are considered on each random ray.
|
|
279
|
+
* Value must be greater than or equal to 1.
|
|
280
|
+
* @param LAOKernelRadius
|
|
281
|
+
*/
|
|
282
|
+
setLAOKernelRadius(LAOKernelRadius: number): void;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Set kernel size for local ambient occlusion. It specifies the number of rays that are randomly sampled in the hemisphere.
|
|
286
|
+
* Value is clipped between 1 and 32.
|
|
287
|
+
* @param LAOKernelSize
|
|
288
|
+
*/
|
|
289
|
+
setLAOKernelSize(LAOKernelSize: number): void;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Set kernel radius for local ambient occlusion. It specifies the number of samples that are considered on each random ray.
|
|
293
|
+
* Value must be greater than or equal to 1.
|
|
294
|
+
* @param LAOKernelRadius
|
|
295
|
+
*/
|
|
296
|
+
setLAOKernelRadius(LAOKernelRadius: number): void;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Tells the mapper to only update the specified extents.
|
|
300
|
+
*
|
|
301
|
+
* If there are zero extents, the mapper updates the entire volume texture.
|
|
302
|
+
* Otherwise, the mapper will only update the texture by the specified extents
|
|
303
|
+
* during the next render call.
|
|
304
|
+
*
|
|
305
|
+
* This array is cleared after a successful render.
|
|
306
|
+
* @param extents
|
|
307
|
+
*/
|
|
308
|
+
setUpdatedExtents(extents: Extent[]): boolean;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Retrieves the updated extents.
|
|
312
|
+
*
|
|
313
|
+
* This array is cleared after every successful render.
|
|
314
|
+
*/
|
|
315
|
+
getUpdatedExtents(): Extent[];
|
|
316
|
+
|
|
161
317
|
/**
|
|
162
318
|
*
|
|
163
319
|
*/
|
|
@@ -293,5 +449,6 @@ export declare const vtkVolumeMapper: {
|
|
|
293
449
|
newInstance: typeof newInstance;
|
|
294
450
|
extend: typeof extend;
|
|
295
451
|
BlendMode: typeof BlendMode;
|
|
452
|
+
FilterMode: typeof FilterMode;
|
|
296
453
|
};
|
|
297
454
|
export default vtkVolumeMapper;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
|
+
import { H as createUninitializedBounds, E as clampValue, K as floor } from '../../Common/Core/Math/index.js';
|
|
2
3
|
import Constants from './VolumeMapper/Constants.js';
|
|
3
4
|
import vtkAbstractMapper3D from './AbstractMapper3D.js';
|
|
4
|
-
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
5
5
|
import vtkPiecewiseFunction from '../../Common/DataModel/PiecewiseFunction.js';
|
|
6
6
|
|
|
7
7
|
const {
|
|
8
|
-
BlendMode
|
|
8
|
+
BlendMode,
|
|
9
|
+
FilterMode
|
|
9
10
|
} = Constants;
|
|
10
11
|
function createRadonTransferFunction(firstAbsorbentMaterialHounsfieldValue, firstAbsorbentMaterialAbsorption, maxAbsorbentMaterialHounsfieldValue, maxAbsorbentMaterialAbsorption, outputTransferFunction) {
|
|
11
12
|
let ofun = null;
|
|
@@ -20,7 +21,6 @@ function createRadonTransferFunction(firstAbsorbentMaterialHounsfieldValue, firs
|
|
|
20
21
|
ofun.addPoint(maxAbsorbentMaterialHounsfieldValue, maxAbsorbentMaterialAbsorption);
|
|
21
22
|
return ofun;
|
|
22
23
|
}
|
|
23
|
-
const methodNamesMovedToVolumeProperties = ['getAnisotropy', 'getComputeNormalFromOpacity', 'getFilterMode', 'getFilterModeAsString', 'getGlobalIlluminationReach', 'getIpScalarRange', 'getIpScalarRangeByReference', 'getLAOKernelRadius', 'getLAOKernelSize', 'getLocalAmbientOcclusion', 'getPreferSizeOverAccuracy', 'getVolumetricScatteringBlending', 'setAnisotropy', 'setAverageIPScalarRange', 'setComputeNormalFromOpacity', 'setFilterMode', 'setFilterModeToNormalized', 'setFilterModeToOff', 'setFilterModeToRaw', 'setGlobalIlluminationReach', 'setIpScalarRange', 'setIpScalarRangeFrom', 'setLAOKernelRadius', 'setLAOKernelSize', 'setLocalAmbientOcclusion', 'setPreferSizeOverAccuracy', 'setVolumetricScatteringBlending'];
|
|
24
24
|
|
|
25
25
|
// ----------------------------------------------------------------------------
|
|
26
26
|
// Static API
|
|
@@ -41,12 +41,20 @@ function vtkVolumeMapper(publicAPI, model) {
|
|
|
41
41
|
...publicAPI
|
|
42
42
|
};
|
|
43
43
|
publicAPI.getBounds = () => {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const input = publicAPI.getInputData();
|
|
45
|
+
if (!input) {
|
|
46
|
+
model.bounds = createUninitializedBounds();
|
|
47
|
+
} else {
|
|
48
|
+
if (!model.static) {
|
|
49
|
+
publicAPI.update();
|
|
50
|
+
}
|
|
51
|
+
model.bounds = input.getBounds();
|
|
46
52
|
}
|
|
47
|
-
model.bounds = [...publicAPI.getInputData().getBounds()];
|
|
48
53
|
return model.bounds;
|
|
49
54
|
};
|
|
55
|
+
publicAPI.update = () => {
|
|
56
|
+
publicAPI.getInputData();
|
|
57
|
+
};
|
|
50
58
|
publicAPI.setBlendModeToComposite = () => {
|
|
51
59
|
publicAPI.setBlendMode(BlendMode.COMPOSITE_BLEND);
|
|
52
60
|
};
|
|
@@ -66,15 +74,26 @@ function vtkVolumeMapper(publicAPI, model) {
|
|
|
66
74
|
publicAPI.setBlendMode(BlendMode.RADON_TRANSFORM_BLEND);
|
|
67
75
|
};
|
|
68
76
|
publicAPI.getBlendModeAsString = () => macro.enumToString(BlendMode, model.blendMode);
|
|
77
|
+
publicAPI.setAverageIPScalarRange = (min, max) => {
|
|
78
|
+
console.warn('setAverageIPScalarRange is deprecated use setIpScalarRange');
|
|
79
|
+
publicAPI.setIpScalarRange(min, max);
|
|
80
|
+
};
|
|
81
|
+
publicAPI.getFilterModeAsString = () => macro.enumToString(FilterMode, model.filterMode);
|
|
82
|
+
publicAPI.setFilterModeToOff = () => {
|
|
83
|
+
publicAPI.setFilterMode(FilterMode.OFF);
|
|
84
|
+
};
|
|
85
|
+
publicAPI.setFilterModeToNormalized = () => {
|
|
86
|
+
publicAPI.setFilterMode(FilterMode.NORMALIZED);
|
|
87
|
+
};
|
|
88
|
+
publicAPI.setFilterModeToRaw = () => {
|
|
89
|
+
publicAPI.setFilterMode(FilterMode.RAW);
|
|
90
|
+
};
|
|
91
|
+
publicAPI.setGlobalIlluminationReach = gl => superClass.setGlobalIlluminationReach(clampValue(gl, 0.0, 1.0));
|
|
92
|
+
publicAPI.setVolumetricScatteringBlending = vsb => superClass.setVolumetricScatteringBlending(clampValue(vsb, 0.0, 1.0));
|
|
69
93
|
publicAPI.setVolumeShadowSamplingDistFactor = vsdf => superClass.setVolumeShadowSamplingDistFactor(vsdf >= 1.0 ? vsdf : 1.0);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const removedMethod = () => {
|
|
74
|
-
throw new Error(`The method "volumeMapper.${removedMethodName}()" doesn't exist anymore. ` + `It is a rendering property that has been moved to the volume property. ` + `Replace your code with:\n` + `volumeActor.getProperty().${removedMethodName}()\n`);
|
|
75
|
-
};
|
|
76
|
-
publicAPI[removedMethodName] = removedMethod;
|
|
77
|
-
});
|
|
94
|
+
publicAPI.setAnisotropy = at => superClass.setAnisotropy(clampValue(at, -0.99, 0.99));
|
|
95
|
+
publicAPI.setLAOKernelSize = ks => superClass.setLAOKernelSize(floor(clampValue(ks, 1, 32)));
|
|
96
|
+
publicAPI.setLAOKernelRadius = kr => superClass.setLAOKernelRadius(kr >= 1 ? kr : 1);
|
|
78
97
|
}
|
|
79
98
|
|
|
80
99
|
// ----------------------------------------------------------------------------
|
|
@@ -83,7 +102,7 @@ function vtkVolumeMapper(publicAPI, model) {
|
|
|
83
102
|
|
|
84
103
|
// TODO: what values to use for averageIPScalarRange to get GLSL to use max / min values like [-Math.inf, Math.inf]?
|
|
85
104
|
const defaultValues = initialValues => ({
|
|
86
|
-
bounds: [
|
|
105
|
+
bounds: [1, -1, 1, -1, 1, -1],
|
|
87
106
|
sampleDistance: 1.0,
|
|
88
107
|
imageSampleDistance: 1.0,
|
|
89
108
|
maximumSamplesPerRay: 1000,
|
|
@@ -91,7 +110,22 @@ const defaultValues = initialValues => ({
|
|
|
91
110
|
initialInteractionScale: 1.0,
|
|
92
111
|
interactionSampleDistanceFactor: 1.0,
|
|
93
112
|
blendMode: BlendMode.COMPOSITE_BLEND,
|
|
113
|
+
ipScalarRange: [-1000000.0, 1000000.0],
|
|
114
|
+
filterMode: FilterMode.OFF,
|
|
115
|
+
// ignored by WebGL so no behavior change
|
|
116
|
+
preferSizeOverAccuracy: false,
|
|
117
|
+
// Whether to use halfFloat representation of float, when it is inaccurate
|
|
118
|
+
computeNormalFromOpacity: false,
|
|
119
|
+
// volume shadow parameters
|
|
120
|
+
volumetricScatteringBlending: 0.0,
|
|
121
|
+
globalIlluminationReach: 0.0,
|
|
94
122
|
volumeShadowSamplingDistFactor: 5.0,
|
|
123
|
+
anisotropy: 0.0,
|
|
124
|
+
// local ambient occlusion
|
|
125
|
+
localAmbientOcclusion: false,
|
|
126
|
+
LAOKernelSize: 15,
|
|
127
|
+
LAOKernelRadius: 7,
|
|
128
|
+
updatedExtents: [],
|
|
95
129
|
colorTextureWidth: 1024,
|
|
96
130
|
opacityTextureWidth: 1024,
|
|
97
131
|
labelOutlineTextureWidth: 1024,
|
|
@@ -104,7 +138,8 @@ function extend(publicAPI, model) {
|
|
|
104
138
|
let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
105
139
|
Object.assign(model, defaultValues(initialValues));
|
|
106
140
|
vtkAbstractMapper3D.extend(publicAPI, model, initialValues);
|
|
107
|
-
macro.setGet(publicAPI, model, ['sampleDistance', 'imageSampleDistance', 'maximumSamplesPerRay', 'autoAdjustSampleDistances', 'initialInteractionScale', 'interactionSampleDistanceFactor', 'blendMode', 'volumeShadowSamplingDistFactor', 'colorTextureWidth', 'opacityTextureWidth', 'labelOutlineTextureWidth']);
|
|
141
|
+
macro.setGet(publicAPI, model, ['sampleDistance', 'imageSampleDistance', 'maximumSamplesPerRay', 'autoAdjustSampleDistances', 'initialInteractionScale', 'interactionSampleDistanceFactor', 'blendMode', 'filterMode', 'preferSizeOverAccuracy', 'computeNormalFromOpacity', 'volumetricScatteringBlending', 'globalIlluminationReach', 'volumeShadowSamplingDistFactor', 'anisotropy', 'localAmbientOcclusion', 'LAOKernelSize', 'LAOKernelRadius', 'updatedExtents', 'colorTextureWidth', 'opacityTextureWidth', 'labelOutlineTextureWidth']);
|
|
142
|
+
macro.setGetArray(publicAPI, model, ['ipScalarRange'], 2);
|
|
108
143
|
macro.event(publicAPI, model, 'lightingActivated');
|
|
109
144
|
|
|
110
145
|
// Object methods
|
|
@@ -10,7 +10,9 @@ export declare enum OpacityMode {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export declare enum ColorMixPreset {
|
|
13
|
-
|
|
13
|
+
// Add a `//VTK::CustomColorMix` tag to the Fragment shader
|
|
14
|
+
// See usage in file `testColorMix` and in function `setColorMixPreset`
|
|
15
|
+
CUSTOM = 0,
|
|
14
16
|
|
|
15
17
|
// Two components preset
|
|
16
18
|
// Out color: sum of colors weighted by opacity
|
|
@@ -21,22 +23,11 @@ export declare enum ColorMixPreset {
|
|
|
21
23
|
// Out color: color of the first component, colorized by second component with an intensity that is the second component's opacity
|
|
22
24
|
// Out opacity: opacity of the first component
|
|
23
25
|
COLORIZE = 2,
|
|
24
|
-
|
|
25
|
-
// Add a `//VTK::CustomColorMix` tag to the Fragment shader
|
|
26
|
-
// See usage in file `testColorMix` and in function `setColorMixPreset`
|
|
27
|
-
CUSTOM = 3,
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export declare enum FilterMode {
|
|
31
|
-
OFF = 0,
|
|
32
|
-
NORMALIZED = 1,
|
|
33
|
-
RAW = 2,
|
|
34
26
|
}
|
|
35
27
|
|
|
36
28
|
declare const _default: {
|
|
37
29
|
InterpolationType: typeof InterpolationType;
|
|
38
30
|
OpacityMode: typeof OpacityMode;
|
|
39
31
|
ColorMixPreset: typeof ColorMixPreset;
|
|
40
|
-
FilterMode: typeof FilterMode;
|
|
41
32
|
};
|
|
42
33
|
export default _default;
|
|
@@ -8,21 +8,14 @@ const OpacityMode = {
|
|
|
8
8
|
PROPORTIONAL: 1
|
|
9
9
|
};
|
|
10
10
|
const ColorMixPreset = {
|
|
11
|
-
|
|
11
|
+
CUSTOM: 0,
|
|
12
12
|
ADDITIVE: 1,
|
|
13
|
-
COLORIZE: 2
|
|
14
|
-
CUSTOM: 3
|
|
15
|
-
};
|
|
16
|
-
const FilterMode = {
|
|
17
|
-
OFF: 0,
|
|
18
|
-
NORMALIZED: 1,
|
|
19
|
-
RAW: 2
|
|
13
|
+
COLORIZE: 2
|
|
20
14
|
};
|
|
21
15
|
var Constants = {
|
|
22
16
|
InterpolationType,
|
|
23
17
|
OpacityMode,
|
|
24
|
-
ColorMixPreset
|
|
25
|
-
FilterMode
|
|
18
|
+
ColorMixPreset
|
|
26
19
|
};
|
|
27
20
|
|
|
28
|
-
export { ColorMixPreset,
|
|
21
|
+
export { ColorMixPreset, InterpolationType, OpacityMode, Constants as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import vtkPiecewiseFunction from './../../Common/DataModel/PiecewiseFunction';
|
|
2
2
|
import { vtkObject } from './../../interfaces';
|
|
3
|
-
import {
|
|
3
|
+
import { Nullable } from './../../types';
|
|
4
4
|
import vtkColorTransferFunction from './ColorTransferFunction';
|
|
5
5
|
import { ColorMixPreset, InterpolationType, OpacityMode } from './VolumeProperty/Constants';
|
|
6
6
|
|
|
@@ -13,7 +13,6 @@ export interface IVolumePropertyInitialValues {
|
|
|
13
13
|
specularPower?: number;
|
|
14
14
|
useLabelOutline?: boolean;
|
|
15
15
|
labelOutlineThickness?: number | number[];
|
|
16
|
-
colorMixPreset?: ColorMixPreset;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
export interface vtkVolumeProperty extends vtkObject {
|
|
@@ -72,7 +71,7 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
72
71
|
/**
|
|
73
72
|
*
|
|
74
73
|
*/
|
|
75
|
-
getColorMixPreset(): ColorMixPreset
|
|
74
|
+
getColorMixPreset(): Nullable<ColorMixPreset>;
|
|
76
75
|
|
|
77
76
|
/**
|
|
78
77
|
*
|
|
@@ -195,7 +194,7 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
195
194
|
|
|
196
195
|
/**
|
|
197
196
|
* Set the color mix code to a preset value
|
|
198
|
-
*
|
|
197
|
+
* Set to null to use no preset
|
|
199
198
|
* See the test `testColorMix` for an example on how to use this preset.
|
|
200
199
|
*
|
|
201
200
|
* If set to `CUSTOM`, a tag `//VTK::CustomColorMix` is made available to the
|
|
@@ -203,9 +202,9 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
203
202
|
* will be used to mix the colors from each component.
|
|
204
203
|
* Each component is available as a rgba vec4: `comp0`, `comp1`...
|
|
205
204
|
* There are other useful functions or variable available. To find them,
|
|
206
|
-
* see `//VTK::
|
|
205
|
+
* see `//VTK::CustomComponentsColorMix::Impl` tag in `vtkVolumeFS.glsl`.
|
|
207
206
|
*/
|
|
208
|
-
setColorMixPreset(preset: ColorMixPreset): boolean;
|
|
207
|
+
setColorMixPreset(preset: Nullable<ColorMixPreset>): boolean;
|
|
209
208
|
|
|
210
209
|
/**
|
|
211
210
|
* Does the data have independent components, or do some define color only?
|
|
@@ -371,140 +370,6 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
371
370
|
* Get the interpolation type for sampling a volume as a string.
|
|
372
371
|
*/
|
|
373
372
|
getInterpolationTypeAsString(): string;
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
*
|
|
377
|
-
*/
|
|
378
|
-
getAverageIPScalarRange(): Range;
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
*
|
|
382
|
-
*/
|
|
383
|
-
getAverageIPScalarRangeByReference(): Range;
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Get the blending coefficient that interpolates between surface and volume rendering
|
|
387
|
-
* @default 0.0
|
|
388
|
-
*/
|
|
389
|
-
getVolumetricScatteringBlending(): number;
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Get the global illumination reach of volume shadow
|
|
393
|
-
* @default 0.0
|
|
394
|
-
*/
|
|
395
|
-
getGlobalIlluminationReach(): number;
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* Get anisotropy of volume shadow scatter
|
|
399
|
-
* @default 0.0
|
|
400
|
-
*/
|
|
401
|
-
getAnisotropy(): number;
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Get local ambient occlusion flag
|
|
405
|
-
* @default false
|
|
406
|
-
*/
|
|
407
|
-
getLocalAmbientOcclusion(): boolean;
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Get kernel size for local ambient occlusion
|
|
411
|
-
* @default 15
|
|
412
|
-
*/
|
|
413
|
-
getLAOKernelSize(): number;
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Get kernel radius for local ambient occlusion
|
|
417
|
-
* @default 7
|
|
418
|
-
*/
|
|
419
|
-
getLAOKernelRadius(): number;
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
*
|
|
423
|
-
* @param x
|
|
424
|
-
* @param y
|
|
425
|
-
*/
|
|
426
|
-
setAverageIPScalarRange(x: number, y: number): boolean;
|
|
427
|
-
|
|
428
|
-
/**
|
|
429
|
-
*
|
|
430
|
-
* @param {Range} averageIPScalarRange
|
|
431
|
-
*/
|
|
432
|
-
setAverageIPScalarRangeFrom(averageIPScalarRange: Range): boolean;
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Set the normal computation to be dependent on the transfer function.
|
|
436
|
-
* By default, the mapper relies on the scalar gradient for computing normals at sample locations
|
|
437
|
-
* for lighting calculations. This is an approximation and can lead to inaccurate results.
|
|
438
|
-
* When enabled, this property makes the mapper compute normals based on the accumulated opacity
|
|
439
|
-
* at sample locations. This can generate a more accurate representation of edge structures in the
|
|
440
|
-
* data but adds an overhead and drops frame rate.
|
|
441
|
-
* @param computeNormalFromOpacity
|
|
442
|
-
*/
|
|
443
|
-
setComputeNormalFromOpacity(computeNormalFromOpacity: boolean): boolean;
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* Set the blending coefficient that determines the interpolation between surface and volume rendering.
|
|
447
|
-
* Default value of 0.0 means shadow effect is computed with phong model.
|
|
448
|
-
* Value of 1.0 means shadow is created by volume occlusion.
|
|
449
|
-
* @param volumeScatterBlendCoef
|
|
450
|
-
*/
|
|
451
|
-
setVolumetricScatteringBlending(volumeScatterBlendCoef: number): void;
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Set the global illumination reach of volume shadow. This function is only effective when volumeScatterBlendCoef is greater than 0.
|
|
455
|
-
* Default value of 0.0 means only the neighboring voxel is considered when creating global shadow.
|
|
456
|
-
* Value of 1.0 means the shadow ray traverses through the entire volume.
|
|
457
|
-
* @param globalIlluminationReach
|
|
458
|
-
*/
|
|
459
|
-
setGlobalIlluminationReach(globalIlluminationReach: number): void;
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* Set anisotropy of volume shadow scatter. This function is only effective when volumeScatterBlendCoef is greater than 0.
|
|
463
|
-
* Default value of 0.0 means light scatters uniformly in all directions.
|
|
464
|
-
* Value of -1.0 means light scatters backward, value of 1.0 means light scatters forward.
|
|
465
|
-
* @param anisotropy
|
|
466
|
-
*/
|
|
467
|
-
setAnisotropy(anisotropy: number): void;
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Set whether to turn on local ambient occlusion (LAO). LAO is only effective if shading is on and volumeScatterBlendCoef is set to 0.
|
|
471
|
-
* LAO effect is added to ambient lighting, so the ambient component of the actor needs to be great than 0.
|
|
472
|
-
* @param localAmbientOcclusion
|
|
473
|
-
*/
|
|
474
|
-
setLocalAmbientOcclusion(localAmbientOcclusion: boolean): void;
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Set kernel size for local ambient occlusion. It specifies the number of rays that are randomly sampled in the hemisphere.
|
|
478
|
-
* Value is clipped between 1 and 32.
|
|
479
|
-
* @param LAOKernelSize
|
|
480
|
-
*/
|
|
481
|
-
setLAOKernelSize(LAOKernelSize: number): void;
|
|
482
|
-
|
|
483
|
-
/**
|
|
484
|
-
* Set kernel radius for local ambient occlusion. It specifies the number of samples that are considered on each random ray.
|
|
485
|
-
* Value must be greater than or equal to 1.
|
|
486
|
-
* @param LAOKernelRadius
|
|
487
|
-
*/
|
|
488
|
-
setLAOKernelRadius(LAOKernelRadius: number): void;
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* Informs the mapper to only update the specified extents at the next render.
|
|
492
|
-
*
|
|
493
|
-
* If there are zero extents, the mapper updates the entire volume texture.
|
|
494
|
-
* Otherwise, the mapper will only update the texture by the specified extents
|
|
495
|
-
* during the next render call.
|
|
496
|
-
*
|
|
497
|
-
* This array is cleared after a successful render.
|
|
498
|
-
* @param extents
|
|
499
|
-
*/
|
|
500
|
-
setUpdatedExtents(extents: Extent[]): boolean;
|
|
501
|
-
|
|
502
|
-
/**
|
|
503
|
-
* Retrieves the updated extents.
|
|
504
|
-
*
|
|
505
|
-
* This array is cleared after every successful render.
|
|
506
|
-
*/
|
|
507
|
-
getUpdatedExtents(): Extent[];
|
|
508
373
|
}
|
|
509
374
|
|
|
510
375
|
/**
|