@kitware/vtk.js 33.3.2 → 34.0.0-beta.2
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 +10 -0
- package/IO/Geometry/GLTFImporter/Decoder.js +21 -35
- package/IO/Geometry/GLTFImporter/ORMTexture.worker.js +42 -0
- package/IO/Geometry/GLTFImporter/Parser.js +6 -15
- package/IO/Geometry/GLTFImporter/Reader.js +10 -7
- package/IO/Geometry/GLTFImporter/Utils.js +27 -9
- package/Interaction/Manipulators/KeyboardCameraManipulator.d.ts +113 -0
- package/Rendering/Core/Actor.d.ts +5 -20
- package/Rendering/Core/Actor.js +5 -68
- package/Rendering/Core/ImageCPRMapper.d.ts +1 -20
- package/Rendering/Core/ImageCPRMapper.js +1 -2
- package/Rendering/Core/ImageProperty.d.ts +20 -1
- package/Rendering/Core/ImageProperty.js +7 -5
- package/Rendering/Core/ImageResliceMapper.d.ts +1 -20
- package/Rendering/Core/ImageResliceMapper.js +1 -2
- package/Rendering/Core/ImageSlice.d.ts +7 -23
- package/Rendering/Core/ImageSlice.js +9 -68
- package/Rendering/Core/Prop3D.d.ts +39 -2
- package/Rendering/Core/Prop3D.js +81 -2
- package/Rendering/Core/RenderWindowInteractor.d.ts +6 -0
- package/Rendering/Core/RenderWindowInteractor.js +7 -5
- package/Rendering/Core/Volume.d.ts +5 -20
- package/Rendering/Core/Volume.js +2 -70
- package/Rendering/Core/VolumeMapper/Constants.d.ts +0 -7
- package/Rendering/Core/VolumeMapper/Constants.js +2 -8
- package/Rendering/Core/VolumeMapper.d.ts +16 -173
- package/Rendering/Core/VolumeMapper.js +16 -51
- package/Rendering/Core/VolumeProperty/Constants.d.ts +12 -3
- package/Rendering/Core/VolumeProperty/Constants.js +11 -4
- package/Rendering/Core/VolumeProperty.d.ts +140 -5
- package/Rendering/Core/VolumeProperty.js +54 -7
- package/Rendering/OpenGL/Framebuffer.js +7 -1
- package/Rendering/OpenGL/ImageCPRMapper.js +72 -27
- package/Rendering/OpenGL/ImageMapper.js +71 -33
- package/Rendering/OpenGL/ImageResliceMapper.js +306 -183
- package/Rendering/OpenGL/OrderIndependentTranslucentPass.js +20 -3
- package/Rendering/OpenGL/PolyDataMapper.js +8 -9
- package/Rendering/OpenGL/RenderWindow/resourceSharingHelper.d.ts +3 -3
- package/Rendering/OpenGL/RenderWindow/resourceSharingHelper.js +8 -5
- package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/pingpong.js +7 -1
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +20 -3
- package/Rendering/OpenGL/Texture.d.ts +110 -62
- package/Rendering/OpenGL/Texture.js +145 -37
- package/Rendering/OpenGL/VolumeMapper.js +763 -783
- package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
- package/Rendering/WebGPU/CellArrayMapper.js +17 -17
- package/Rendering/WebGPU/PolyDataMapper.js +15 -35
- package/Rendering/WebGPU/Renderer.js +1 -1
- package/Rendering/WebGPU/Texture.js +12 -13
- package/Rendering/WebGPU/TextureManager.js +7 -12
- package/Rendering/WebGPU/VolumePassFSQ.js +2 -2
- package/_virtual/rollup-plugin-worker-loader__module_Sources/IO/Geometry/GLTFImporter/ORMTexture.worker.js +296 -0
- package/index.d.ts +1 -0
- package/macros.js +1 -1
- package/macros2.js +8 -3
- package/package.json +1 -1
|
@@ -1,30 +1,22 @@
|
|
|
1
1
|
import { vtkPiecewiseFunction } from './../../Common/DataModel/PiecewiseFunction';
|
|
2
|
-
import { Bounds
|
|
2
|
+
import { Bounds } from './../../types';
|
|
3
3
|
import {
|
|
4
4
|
vtkAbstractMapper3D,
|
|
5
5
|
IAbstractMapper3DInitialValues,
|
|
6
6
|
} from './AbstractMapper3D';
|
|
7
|
-
import { BlendMode
|
|
7
|
+
import { BlendMode } from './VolumeMapper/Constants';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
export interface IVolumeMapperInitialValues
|
|
13
13
|
extends IAbstractMapper3DInitialValues {
|
|
14
|
-
anisotropy?: number;
|
|
15
14
|
autoAdjustSampleDistances?: boolean;
|
|
16
|
-
averageIPScalarRange?: Range;
|
|
17
15
|
blendMode?: BlendMode;
|
|
18
16
|
bounds?: Bounds;
|
|
19
|
-
computeNormalFromOpacity?: boolean;
|
|
20
|
-
getVolumeShadowSamplingDistFactor?: number;
|
|
21
|
-
globalIlluminationReach?: number;
|
|
22
|
-
imageSampleDistance?: number;
|
|
23
|
-
localAmbientOcclusion?: boolean;
|
|
24
17
|
maximumSamplesPerRay?: number;
|
|
25
18
|
sampleDistance?: number;
|
|
26
|
-
|
|
27
|
-
LAOKernelSize?: number;
|
|
19
|
+
volumeShadowSamplingDistFactor?: number;
|
|
28
20
|
}
|
|
29
21
|
|
|
30
22
|
export interface vtkVolumeMapper extends vtkAbstractMapper3D {
|
|
@@ -50,6 +42,12 @@ export interface vtkVolumeMapper extends vtkAbstractMapper3D {
|
|
|
50
42
|
*/
|
|
51
43
|
getSampleDistance(): number;
|
|
52
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Get the multipler for volume shadow sampling distance
|
|
47
|
+
* @default 5.0
|
|
48
|
+
*/
|
|
49
|
+
getVolumeShadowSamplingDistFactor(): number;
|
|
50
|
+
|
|
53
51
|
/**
|
|
54
52
|
* Sampling distance in the XY image dimensions.
|
|
55
53
|
* Default value of 1 meaning 1 ray cast per pixel. If set to 0.5, 4 rays will be cast per pixel.
|
|
@@ -85,71 +83,6 @@ export interface vtkVolumeMapper extends vtkAbstractMapper3D {
|
|
|
85
83
|
*/
|
|
86
84
|
getInteractionSampleDistanceFactor(): number;
|
|
87
85
|
|
|
88
|
-
/**
|
|
89
|
-
*
|
|
90
|
-
*/
|
|
91
|
-
getAverageIPScalarRange(): Range;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
*
|
|
95
|
-
*/
|
|
96
|
-
getAverageIPScalarRangeByReference(): Range;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Get the blending coefficient that interpolates between surface and volume rendering
|
|
100
|
-
* @default 0.0
|
|
101
|
-
*/
|
|
102
|
-
getVolumetricScatteringBlending(): number;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Get the global illumination reach of volume shadow
|
|
106
|
-
* @default 0.0
|
|
107
|
-
*/
|
|
108
|
-
getGlobalIlluminationReach(): number;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Get the multipler for volume shadow sampling distance
|
|
112
|
-
* @default 5.0
|
|
113
|
-
*/
|
|
114
|
-
getVolumeShadowSamplingDistFactor(): number;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Get anisotropy of volume shadow scatter
|
|
118
|
-
* @default 0.0
|
|
119
|
-
*/
|
|
120
|
-
getAnisotropy(): number;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Get local ambient occlusion flag
|
|
124
|
-
* @default false
|
|
125
|
-
*/
|
|
126
|
-
getLocalAmbientOcclusion(): boolean;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Get kernel size for local ambient occlusion
|
|
130
|
-
* @default 15
|
|
131
|
-
*/
|
|
132
|
-
getLAOKernelSize(): number;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Get kernel radius for local ambient occlusion
|
|
136
|
-
* @default 7
|
|
137
|
-
*/
|
|
138
|
-
getLAOKernelRadius(): number;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
*
|
|
142
|
-
* @param x
|
|
143
|
-
* @param y
|
|
144
|
-
*/
|
|
145
|
-
setAverageIPScalarRange(x: number, y: number): boolean;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
*
|
|
149
|
-
* @param {Range} averageIPScalarRange
|
|
150
|
-
*/
|
|
151
|
-
setAverageIPScalarRangeFrom(averageIPScalarRange: Range): boolean;
|
|
152
|
-
|
|
153
86
|
/**
|
|
154
87
|
* Set blend mode to COMPOSITE_BLEND
|
|
155
88
|
* @param {BlendMode} blendMode
|
|
@@ -187,6 +120,13 @@ export interface vtkVolumeMapper extends vtkAbstractMapper3D {
|
|
|
187
120
|
*/
|
|
188
121
|
setSampleDistance(sampleDistance: number): boolean;
|
|
189
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Set the multipler for volume shadow sampling distance. This function is only effective when volumeScatterBlendCoef is greater than 0.
|
|
125
|
+
* For VSSampleDistanceFactor >= 1.0, volume shadow sampling distance = VSSampleDistanceFactor * SampleDistance.
|
|
126
|
+
* @param VSSampleDistanceFactor
|
|
127
|
+
*/
|
|
128
|
+
setVolumeShadowSamplingDistFactor(VSSampleDistanceFactor: number): void;
|
|
129
|
+
|
|
190
130
|
/**
|
|
191
131
|
*
|
|
192
132
|
* @param imageSampleDistance
|
|
@@ -219,102 +159,6 @@ export interface vtkVolumeMapper extends vtkAbstractMapper3D {
|
|
|
219
159
|
interactionSampleDistanceFactor: number
|
|
220
160
|
): boolean;
|
|
221
161
|
|
|
222
|
-
/**
|
|
223
|
-
* Set the normal computation to be dependent on the transfer function.
|
|
224
|
-
* By default, the mapper relies on the scalar gradient for computing normals at sample locations
|
|
225
|
-
* for lighting calculations. This is an approximation and can lead to inaccurate results.
|
|
226
|
-
* When enabled, this property makes the mapper compute normals based on the accumulated opacity
|
|
227
|
-
* at sample locations. This can generate a more accurate representation of edge structures in the
|
|
228
|
-
* data but adds an overhead and drops frame rate.
|
|
229
|
-
* @param computeNormalFromOpacity
|
|
230
|
-
*/
|
|
231
|
-
setComputeNormalFromOpacity(computeNormalFromOpacity: boolean): boolean;
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Set the blending coefficient that determines the interpolation between surface and volume rendering.
|
|
235
|
-
* Default value of 0.0 means shadow effect is computed with phong model.
|
|
236
|
-
* Value of 1.0 means shadow is created by volume occlusion.
|
|
237
|
-
* @param volumeScatterBlendCoef
|
|
238
|
-
*/
|
|
239
|
-
setVolumetricScatteringBlending(volumeScatterBlendCoef: number): void;
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Set the global illumination reach of volume shadow. This function is only effective when volumeScatterBlendCoef is greater than 0.
|
|
243
|
-
* Default value of 0.0 means only the neighboring voxel is considered when creating global shadow.
|
|
244
|
-
* Value of 1.0 means the shadow ray traverses through the entire volume.
|
|
245
|
-
* @param globalIlluminationReach
|
|
246
|
-
*/
|
|
247
|
-
setGlobalIlluminationReach(globalIlluminationReach: number): void;
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Set the multipler for volume shadow sampling distance. This function is only effective when volumeScatterBlendCoef is greater than 0.
|
|
251
|
-
* For VSSampleDistanceFactor >= 1.0, volume shadow sampling distance = VSSampleDistanceFactor * SampleDistance.
|
|
252
|
-
* @param VSSampleDistanceFactor
|
|
253
|
-
*/
|
|
254
|
-
setVolumeShadowSamplingDistFactor(VSSampleDistanceFactor: number): void;
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Set anisotropy of volume shadow scatter. This function is only effective when volumeScatterBlendCoef is greater than 0.
|
|
258
|
-
* Default value of 0.0 means light scatters uniformly in all directions.
|
|
259
|
-
* Value of -1.0 means light scatters backward, value of 1.0 means light scatters forward.
|
|
260
|
-
* @param anisotropy
|
|
261
|
-
*/
|
|
262
|
-
setAnisotropy(anisotropy: number): void;
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Set whether to turn on local ambient occlusion (LAO). LAO is only effective if shading is on and volumeScatterBlendCoef is set to 0.
|
|
266
|
-
* LAO effect is added to ambient lighting, so the ambient component of the actor needs to be great than 0.
|
|
267
|
-
* @param localAmbientOcclusion
|
|
268
|
-
*/
|
|
269
|
-
setLocalAmbientOcclusion(localAmbientOcclusion: boolean): void;
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Set kernel size for local ambient occlusion. It specifies the number of rays that are randomly sampled in the hemisphere.
|
|
273
|
-
* Value is clipped between 1 and 32.
|
|
274
|
-
* @param LAOKernelSize
|
|
275
|
-
*/
|
|
276
|
-
setLAOKernelSize(LAOKernelSize: number): void;
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Set kernel radius for local ambient occlusion. It specifies the number of samples that are considered on each random ray.
|
|
280
|
-
* Value must be greater than or equal to 1.
|
|
281
|
-
* @param LAOKernelRadius
|
|
282
|
-
*/
|
|
283
|
-
setLAOKernelRadius(LAOKernelRadius: number): void;
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Set kernel size for local ambient occlusion. It specifies the number of rays that are randomly sampled in the hemisphere.
|
|
287
|
-
* Value is clipped between 1 and 32.
|
|
288
|
-
* @param LAOKernelSize
|
|
289
|
-
*/
|
|
290
|
-
setLAOKernelSize(LAOKernelSize: number): void;
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Set kernel radius for local ambient occlusion. It specifies the number of samples that are considered on each random ray.
|
|
294
|
-
* Value must be greater than or equal to 1.
|
|
295
|
-
* @param LAOKernelRadius
|
|
296
|
-
*/
|
|
297
|
-
setLAOKernelRadius(LAOKernelRadius: number): void;
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Tells the mapper to only update the specified extents.
|
|
301
|
-
*
|
|
302
|
-
* If there are zero extents, the mapper updates the entire volume texture.
|
|
303
|
-
* Otherwise, the mapper will only update the texture by the specified extents
|
|
304
|
-
* during the next render call.
|
|
305
|
-
*
|
|
306
|
-
* This array is cleared after a successful render.
|
|
307
|
-
* @param extents
|
|
308
|
-
*/
|
|
309
|
-
setUpdatedExtents(extents: Extent[]): boolean;
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Retrieves the updated extents.
|
|
313
|
-
*
|
|
314
|
-
* This array is cleared after every successful render.
|
|
315
|
-
*/
|
|
316
|
-
getUpdatedExtents(): Extent[];
|
|
317
|
-
|
|
318
162
|
/**
|
|
319
163
|
*
|
|
320
164
|
*/
|
|
@@ -450,6 +294,5 @@ export declare const vtkVolumeMapper: {
|
|
|
450
294
|
newInstance: typeof newInstance;
|
|
451
295
|
extend: typeof extend;
|
|
452
296
|
BlendMode: typeof BlendMode;
|
|
453
|
-
FilterMode: typeof FilterMode;
|
|
454
297
|
};
|
|
455
298
|
export default vtkVolumeMapper;
|
|
@@ -1,12 +1,11 @@
|
|
|
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';
|
|
3
2
|
import Constants from './VolumeMapper/Constants.js';
|
|
4
3
|
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
|
|
9
|
-
FilterMode
|
|
8
|
+
BlendMode
|
|
10
9
|
} = Constants;
|
|
11
10
|
function createRadonTransferFunction(firstAbsorbentMaterialHounsfieldValue, firstAbsorbentMaterialAbsorption, maxAbsorbentMaterialHounsfieldValue, maxAbsorbentMaterialAbsorption, outputTransferFunction) {
|
|
12
11
|
let ofun = null;
|
|
@@ -21,6 +20,7 @@ function createRadonTransferFunction(firstAbsorbentMaterialHounsfieldValue, firs
|
|
|
21
20
|
ofun.addPoint(maxAbsorbentMaterialHounsfieldValue, maxAbsorbentMaterialAbsorption);
|
|
22
21
|
return ofun;
|
|
23
22
|
}
|
|
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,20 +41,12 @@ function vtkVolumeMapper(publicAPI, model) {
|
|
|
41
41
|
...publicAPI
|
|
42
42
|
};
|
|
43
43
|
publicAPI.getBounds = () => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
model.bounds = createUninitializedBounds();
|
|
47
|
-
} else {
|
|
48
|
-
if (!model.static) {
|
|
49
|
-
publicAPI.update();
|
|
50
|
-
}
|
|
51
|
-
model.bounds = input.getBounds();
|
|
44
|
+
if (!model.static) {
|
|
45
|
+
publicAPI.update();
|
|
52
46
|
}
|
|
47
|
+
model.bounds = [...publicAPI.getInputData().getBounds()];
|
|
53
48
|
return model.bounds;
|
|
54
49
|
};
|
|
55
|
-
publicAPI.update = () => {
|
|
56
|
-
publicAPI.getInputData();
|
|
57
|
-
};
|
|
58
50
|
publicAPI.setBlendModeToComposite = () => {
|
|
59
51
|
publicAPI.setBlendMode(BlendMode.COMPOSITE_BLEND);
|
|
60
52
|
};
|
|
@@ -74,26 +66,15 @@ function vtkVolumeMapper(publicAPI, model) {
|
|
|
74
66
|
publicAPI.setBlendMode(BlendMode.RADON_TRANSFORM_BLEND);
|
|
75
67
|
};
|
|
76
68
|
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));
|
|
93
69
|
publicAPI.setVolumeShadowSamplingDistFactor = vsdf => superClass.setVolumeShadowSamplingDistFactor(vsdf >= 1.0 ? vsdf : 1.0);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
70
|
+
|
|
71
|
+
// Instead of a "undefined is not a function" error, give more context and advice for these widely used methods
|
|
72
|
+
methodNamesMovedToVolumeProperties.forEach(removedMethodName => {
|
|
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
|
+
});
|
|
97
78
|
}
|
|
98
79
|
|
|
99
80
|
// ----------------------------------------------------------------------------
|
|
@@ -102,7 +83,7 @@ function vtkVolumeMapper(publicAPI, model) {
|
|
|
102
83
|
|
|
103
84
|
// TODO: what values to use for averageIPScalarRange to get GLSL to use max / min values like [-Math.inf, Math.inf]?
|
|
104
85
|
const defaultValues = initialValues => ({
|
|
105
|
-
bounds: [
|
|
86
|
+
bounds: [...vtkBoundingBox.INIT_BOUNDS],
|
|
106
87
|
sampleDistance: 1.0,
|
|
107
88
|
imageSampleDistance: 1.0,
|
|
108
89
|
maximumSamplesPerRay: 1000,
|
|
@@ -110,22 +91,7 @@ const defaultValues = initialValues => ({
|
|
|
110
91
|
initialInteractionScale: 1.0,
|
|
111
92
|
interactionSampleDistanceFactor: 1.0,
|
|
112
93
|
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,
|
|
122
94
|
volumeShadowSamplingDistFactor: 5.0,
|
|
123
|
-
anisotropy: 0.0,
|
|
124
|
-
// local ambient occlusion
|
|
125
|
-
localAmbientOcclusion: false,
|
|
126
|
-
LAOKernelSize: 15,
|
|
127
|
-
LAOKernelRadius: 7,
|
|
128
|
-
updatedExtents: [],
|
|
129
95
|
colorTextureWidth: 1024,
|
|
130
96
|
opacityTextureWidth: 1024,
|
|
131
97
|
labelOutlineTextureWidth: 1024,
|
|
@@ -138,8 +104,7 @@ function extend(publicAPI, model) {
|
|
|
138
104
|
let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
139
105
|
Object.assign(model, defaultValues(initialValues));
|
|
140
106
|
vtkAbstractMapper3D.extend(publicAPI, model, initialValues);
|
|
141
|
-
macro.setGet(publicAPI, model, ['sampleDistance', 'imageSampleDistance', 'maximumSamplesPerRay', 'autoAdjustSampleDistances', 'initialInteractionScale', 'interactionSampleDistanceFactor', 'blendMode', '
|
|
142
|
-
macro.setGetArray(publicAPI, model, ['ipScalarRange'], 2);
|
|
107
|
+
macro.setGet(publicAPI, model, ['sampleDistance', 'imageSampleDistance', 'maximumSamplesPerRay', 'autoAdjustSampleDistances', 'initialInteractionScale', 'interactionSampleDistanceFactor', 'blendMode', 'volumeShadowSamplingDistFactor', 'colorTextureWidth', 'opacityTextureWidth', 'labelOutlineTextureWidth']);
|
|
143
108
|
macro.event(publicAPI, model, 'lightingActivated');
|
|
144
109
|
|
|
145
110
|
// Object methods
|
|
@@ -10,9 +10,7 @@ export declare enum OpacityMode {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export declare enum ColorMixPreset {
|
|
13
|
-
|
|
14
|
-
// See usage in file `testColorMix` and in function `setColorMixPreset`
|
|
15
|
-
CUSTOM = 0,
|
|
13
|
+
DEFAULT = 0,
|
|
16
14
|
|
|
17
15
|
// Two components preset
|
|
18
16
|
// Out color: sum of colors weighted by opacity
|
|
@@ -23,11 +21,22 @@ export declare enum ColorMixPreset {
|
|
|
23
21
|
// Out color: color of the first component, colorized by second component with an intensity that is the second component's opacity
|
|
24
22
|
// Out opacity: opacity of the first component
|
|
25
23
|
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,
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
declare const _default: {
|
|
29
37
|
InterpolationType: typeof InterpolationType;
|
|
30
38
|
OpacityMode: typeof OpacityMode;
|
|
31
39
|
ColorMixPreset: typeof ColorMixPreset;
|
|
40
|
+
FilterMode: typeof FilterMode;
|
|
32
41
|
};
|
|
33
42
|
export default _default;
|
|
@@ -8,14 +8,21 @@ const OpacityMode = {
|
|
|
8
8
|
PROPORTIONAL: 1
|
|
9
9
|
};
|
|
10
10
|
const ColorMixPreset = {
|
|
11
|
-
|
|
11
|
+
DEFAULT: 0,
|
|
12
12
|
ADDITIVE: 1,
|
|
13
|
-
COLORIZE: 2
|
|
13
|
+
COLORIZE: 2,
|
|
14
|
+
CUSTOM: 3
|
|
15
|
+
};
|
|
16
|
+
const FilterMode = {
|
|
17
|
+
OFF: 0,
|
|
18
|
+
NORMALIZED: 1,
|
|
19
|
+
RAW: 2
|
|
14
20
|
};
|
|
15
21
|
var Constants = {
|
|
16
22
|
InterpolationType,
|
|
17
23
|
OpacityMode,
|
|
18
|
-
ColorMixPreset
|
|
24
|
+
ColorMixPreset,
|
|
25
|
+
FilterMode
|
|
19
26
|
};
|
|
20
27
|
|
|
21
|
-
export { ColorMixPreset, InterpolationType, OpacityMode, Constants as default };
|
|
28
|
+
export { ColorMixPreset, FilterMode, 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 { Nullable } from './../../types';
|
|
3
|
+
import { Extent, Nullable } from './../../types';
|
|
4
4
|
import vtkColorTransferFunction from './ColorTransferFunction';
|
|
5
5
|
import { ColorMixPreset, InterpolationType, OpacityMode } from './VolumeProperty/Constants';
|
|
6
6
|
|
|
@@ -13,6 +13,7 @@ export interface IVolumePropertyInitialValues {
|
|
|
13
13
|
specularPower?: number;
|
|
14
14
|
useLabelOutline?: boolean;
|
|
15
15
|
labelOutlineThickness?: number | number[];
|
|
16
|
+
colorMixPreset?: ColorMixPreset;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export interface vtkVolumeProperty extends vtkObject {
|
|
@@ -71,7 +72,7 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
71
72
|
/**
|
|
72
73
|
*
|
|
73
74
|
*/
|
|
74
|
-
getColorMixPreset():
|
|
75
|
+
getColorMixPreset(): ColorMixPreset;
|
|
75
76
|
|
|
76
77
|
/**
|
|
77
78
|
*
|
|
@@ -194,7 +195,7 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
194
195
|
|
|
195
196
|
/**
|
|
196
197
|
* Set the color mix code to a preset value
|
|
197
|
-
*
|
|
198
|
+
* Defaults to ColorMixPreset.DEFAULT
|
|
198
199
|
* See the test `testColorMix` for an example on how to use this preset.
|
|
199
200
|
*
|
|
200
201
|
* If set to `CUSTOM`, a tag `//VTK::CustomColorMix` is made available to the
|
|
@@ -202,9 +203,9 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
202
203
|
* will be used to mix the colors from each component.
|
|
203
204
|
* Each component is available as a rgba vec4: `comp0`, `comp1`...
|
|
204
205
|
* There are other useful functions or variable available. To find them,
|
|
205
|
-
* see `//VTK::
|
|
206
|
+
* see `//VTK::CustomColorMix` tag in `vtkVolumeFS.glsl`.
|
|
206
207
|
*/
|
|
207
|
-
setColorMixPreset(preset:
|
|
208
|
+
setColorMixPreset(preset: ColorMixPreset): boolean;
|
|
208
209
|
|
|
209
210
|
/**
|
|
210
211
|
* Does the data have independent components, or do some define color only?
|
|
@@ -370,6 +371,140 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
370
371
|
* Get the interpolation type for sampling a volume as a string.
|
|
371
372
|
*/
|
|
372
373
|
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[];
|
|
373
508
|
}
|
|
374
509
|
|
|
375
510
|
/**
|