@kitware/vtk.js 33.2.0 → 34.0.0-beta.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 +10 -0
- 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/VolumePassFSQ.js +2 -2
- package/index.d.ts +1 -0
- package/macros.js +1 -1
- package/macros2.js +8 -3
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mat4, quat } from 'gl-matrix';
|
|
2
2
|
import { Bounds, Vector3, Range } from './../../types';
|
|
3
3
|
import vtkProp, { IPropInitialValues } from './Prop';
|
|
4
|
+
import { vtkObject } from './../../interfaces';
|
|
4
5
|
|
|
5
6
|
export interface IProp3DInitialValues extends IPropInitialValues {
|
|
6
7
|
origin?: number[];
|
|
@@ -19,11 +20,17 @@ export interface vtkProp3D extends vtkProp {
|
|
|
19
20
|
addPosition(deltaXYZ: number[]): void;
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
|
-
* Get the bounds as [xmin, xmax, ymin, ymax, zmin, zmax].
|
|
23
|
-
*
|
|
23
|
+
* Get the bounds of this actor as [xmin, xmax, ymin, ymax, zmin, zmax].
|
|
24
|
+
* They are the bounds of the underlying mapper, transformed using the actor's matrix.
|
|
25
|
+
* @return {Bounds} The bounds for the actor.
|
|
24
26
|
*/
|
|
25
27
|
getBounds(): Bounds;
|
|
26
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Same as getBounds() but the returned array is not copied, so it should not be written to.
|
|
31
|
+
*/
|
|
32
|
+
getBoundsByReference(): Bounds;
|
|
33
|
+
|
|
27
34
|
/**
|
|
28
35
|
* Check if there was a modification or transformation.
|
|
29
36
|
* @default null
|
|
@@ -131,6 +138,21 @@ export interface vtkProp3D extends vtkProp {
|
|
|
131
138
|
*/
|
|
132
139
|
getUserMatrix(): mat4;
|
|
133
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Get the actor property for the specified mapper input port, which defaults to 0
|
|
143
|
+
* It controls this actors rendering properties. If one isn’t specified,
|
|
144
|
+
* then one will be generated automatically. Multiple actors can share one
|
|
145
|
+
* property object.
|
|
146
|
+
* @param {number} mapperInputPort Defaults to 0
|
|
147
|
+
*/
|
|
148
|
+
getProperty(mapperInputPort?: number): vtkObject;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Get the actor properties array
|
|
152
|
+
* Each element of the array corresponds to a mapper input port
|
|
153
|
+
*/
|
|
154
|
+
getProperties(): vtkObject[];
|
|
155
|
+
|
|
134
156
|
/**
|
|
135
157
|
* Rotate the Prop3D in degrees about the X axis using the right hand
|
|
136
158
|
* rule. The axis is the Prop3D’s X axis, which can change as other
|
|
@@ -256,6 +278,21 @@ export interface vtkProp3D extends vtkProp {
|
|
|
256
278
|
* Generate the matrix based on internal model.
|
|
257
279
|
*/
|
|
258
280
|
computeMatrix(): void;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Set the actor property for the specified mapper input port, which defaults to 0
|
|
284
|
+
* @param {vtkObject} property
|
|
285
|
+
* @param {number} mapperInputPort Is 0 when not given
|
|
286
|
+
*/
|
|
287
|
+
setProperty(mapperInputPort: number, property: vtkObject): boolean;
|
|
288
|
+
setProperty(property: vtkObject): boolean;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Set the actor properties array
|
|
292
|
+
* Each element of the array corresponds to a mapper input port
|
|
293
|
+
* @param {vtkObject[]} properties
|
|
294
|
+
*/
|
|
295
|
+
setProperties(properties: vtkObject[]): boolean;
|
|
259
296
|
}
|
|
260
297
|
|
|
261
298
|
/**
|
package/Rendering/Core/Prop3D.js
CHANGED
|
@@ -121,6 +121,54 @@ function vtkProp3D(publicAPI, model) {
|
|
|
121
121
|
model.matrixMTime.modified();
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
|
+
publicAPI.getBoundsByReference = () => {
|
|
125
|
+
if (model.mapper === null) {
|
|
126
|
+
return model.bounds;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Check for the special case when the mapper's bounds are unknown
|
|
130
|
+
const bds = model.mapper.getBounds();
|
|
131
|
+
if (!bds || bds.length !== 6) {
|
|
132
|
+
return bds;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Check for the special case when the actor is empty.
|
|
136
|
+
if (bds[0] > bds[1]) {
|
|
137
|
+
// No need to copy bds, a new array is created when calling getBounds()
|
|
138
|
+
model.mapperBounds = bds;
|
|
139
|
+
model.bounds = [...vtkBoundingBox.INIT_BOUNDS];
|
|
140
|
+
model.boundsMTime.modified();
|
|
141
|
+
return bds;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Check if we have cached values for these bounds - we cache the
|
|
145
|
+
// values returned by model.mapper.getBounds() and we store the time
|
|
146
|
+
// of caching. If the values returned this time are different, or
|
|
147
|
+
// the modified time of this class is newer than the cached time,
|
|
148
|
+
// then we need to rebuild.
|
|
149
|
+
if (!model.mapperBounds || !bds.every((_, i) => bds[i] === model.mapperBounds[i]) || publicAPI.getMTime() > model.boundsMTime.getMTime()) {
|
|
150
|
+
macro.vtkDebugMacro('Recomputing bounds...');
|
|
151
|
+
// No need to copy bds, a new array is created when calling getBounds()
|
|
152
|
+
model.mapperBounds = bds;
|
|
153
|
+
|
|
154
|
+
// Compute actor bounds from matrix and mapper bounds
|
|
155
|
+
publicAPI.computeMatrix();
|
|
156
|
+
const transposedMatrix = new Float64Array(16);
|
|
157
|
+
mat4.transpose(transposedMatrix, model.matrix);
|
|
158
|
+
vtkBoundingBox.transformBounds(bds, transposedMatrix, model.bounds);
|
|
159
|
+
model.boundsMTime.modified();
|
|
160
|
+
}
|
|
161
|
+
return model.bounds;
|
|
162
|
+
};
|
|
163
|
+
publicAPI.getBounds = () => {
|
|
164
|
+
const bounds = publicAPI.getBoundsByReference();
|
|
165
|
+
// Handle case when bounds are not iterable (for example null or undefined)
|
|
166
|
+
try {
|
|
167
|
+
return [...bounds];
|
|
168
|
+
} catch {
|
|
169
|
+
return bounds;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
124
172
|
publicAPI.getCenter = () => vtkBoundingBox.getCenter(model.bounds);
|
|
125
173
|
publicAPI.getLength = () => vtkBoundingBox.getLength(model.bounds);
|
|
126
174
|
publicAPI.getXRange = () => vtkBoundingBox.getXRange(model.bounds);
|
|
@@ -131,6 +179,35 @@ function vtkProp3D(publicAPI, model) {
|
|
|
131
179
|
publicAPI.computeMatrix();
|
|
132
180
|
}
|
|
133
181
|
publicAPI.onModified(updateIdentityFlag);
|
|
182
|
+
publicAPI.getProperty = function () {
|
|
183
|
+
let mapperInputPort = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
184
|
+
if (model.properties[mapperInputPort] == null) {
|
|
185
|
+
model.properties[mapperInputPort] = publicAPI.makeProperty?.();
|
|
186
|
+
}
|
|
187
|
+
return model.properties[mapperInputPort];
|
|
188
|
+
};
|
|
189
|
+
publicAPI.setProperty = (firstArg, secondArg) => {
|
|
190
|
+
// Two options for argument layout:
|
|
191
|
+
// - (mapperInputPort, property)
|
|
192
|
+
// - (property)
|
|
193
|
+
const useInputPortArgument = Number.isInteger(firstArg);
|
|
194
|
+
const [mapperInputPort, property] = useInputPortArgument ? [firstArg, secondArg] : [0, firstArg];
|
|
195
|
+
if (model.properties[mapperInputPort] === property) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
model.properties[mapperInputPort] = property;
|
|
199
|
+
return true;
|
|
200
|
+
};
|
|
201
|
+
publicAPI.getMTime = () => {
|
|
202
|
+
let mt = model.mtime;
|
|
203
|
+
model.properties.forEach(property => {
|
|
204
|
+
if (property !== null) {
|
|
205
|
+
const time = property.getMTime();
|
|
206
|
+
mt = time > mt ? time : mt;
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
return mt;
|
|
210
|
+
};
|
|
134
211
|
}
|
|
135
212
|
|
|
136
213
|
// ----------------------------------------------------------------------------
|
|
@@ -143,7 +220,8 @@ const DEFAULT_VALUES = {
|
|
|
143
220
|
orientation: [0, 0, 0],
|
|
144
221
|
rotation: null,
|
|
145
222
|
scale: [1, 1, 1],
|
|
146
|
-
bounds: [
|
|
223
|
+
bounds: [...vtkBoundingBox.INIT_BOUNDS],
|
|
224
|
+
properties: [],
|
|
147
225
|
userMatrix: null,
|
|
148
226
|
userMatrixMTime: null,
|
|
149
227
|
cachedProp3D: null,
|
|
@@ -163,9 +241,10 @@ function extend(publicAPI, model) {
|
|
|
163
241
|
macro.obj(model.matrixMTime);
|
|
164
242
|
|
|
165
243
|
// Build VTK API
|
|
166
|
-
macro.get(publicAPI, model, ['
|
|
244
|
+
macro.get(publicAPI, model, ['isIdentity']);
|
|
167
245
|
macro.getArray(publicAPI, model, ['orientation']);
|
|
168
246
|
macro.setGetArray(publicAPI, model, ['origin', 'position', 'scale'], 3);
|
|
247
|
+
macro.setGet(publicAPI, model, ['properties']);
|
|
169
248
|
|
|
170
249
|
// Object internal instance
|
|
171
250
|
model.matrix = mat4.identity(new Float64Array(16));
|
|
@@ -974,6 +974,12 @@ export interface vtkRenderWindowInteractor extends vtkObject {
|
|
|
974
974
|
/**
|
|
975
975
|
* Add an HTMLElement as the new container for the interactor.
|
|
976
976
|
* All events will be bound to this new container.
|
|
977
|
+
*
|
|
978
|
+
* container will gain the tabIndex=0 attribute to catch keyboard events.
|
|
979
|
+
* container must have focus (manually via click or tab, or programmatically
|
|
980
|
+
* via `.focus()`) to receive keypress events
|
|
981
|
+
* Outline on focus can be customized with CSS :focus pseudo-class.
|
|
982
|
+
*
|
|
977
983
|
* Any old container will be removed along with its listeners.
|
|
978
984
|
*/
|
|
979
985
|
setContainer(container: Nullable<HTMLElement>): boolean;
|
|
@@ -188,11 +188,13 @@ function vtkRenderWindowInteractor(publicAPI, model) {
|
|
|
188
188
|
});
|
|
189
189
|
container.addEventListener('pointerup', publicAPI.handlePointerUp);
|
|
190
190
|
container.addEventListener('pointercancel', publicAPI.handlePointerCancel);
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
container.addEventListener('keypress', publicAPI.handleKeyPress);
|
|
192
|
+
container.addEventListener('keydown', publicAPI.handleKeyDown);
|
|
193
|
+
// Observe keyup on document in case the focus changes
|
|
194
|
+
// between keydown and keyup.
|
|
193
195
|
document.addEventListener('keyup', publicAPI.handleKeyUp);
|
|
194
196
|
document.addEventListener('pointerlockchange', publicAPI.handlePointerLockChange);
|
|
195
|
-
|
|
197
|
+
container.tabIndex = 0; // to receive key events
|
|
196
198
|
// using touchAction is more performant than preventDefault
|
|
197
199
|
// in a touchstart handler.
|
|
198
200
|
container.style.touchAction = 'none';
|
|
@@ -237,8 +239,8 @@ function vtkRenderWindowInteractor(publicAPI, model) {
|
|
|
237
239
|
container.removeEventListener('pointerup', publicAPI.handlePointerUp);
|
|
238
240
|
container.removeEventListener('pointercancel', publicAPI.handlePointerCancel);
|
|
239
241
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
+
container.removeEventListener('keypress', publicAPI.handleKeyPress);
|
|
243
|
+
container.removeEventListener('keydown', publicAPI.handleKeyDown);
|
|
242
244
|
document.removeEventListener('keyup', publicAPI.handleKeyUp);
|
|
243
245
|
document.removeEventListener('pointerlockchange', publicAPI.handlePointerLockChange);
|
|
244
246
|
pointerCache.clear();
|
|
@@ -29,22 +29,6 @@ export interface vtkVolume extends vtkProp3D {
|
|
|
29
29
|
*/
|
|
30
30
|
getVolumes(): vtkVolume[];
|
|
31
31
|
|
|
32
|
-
/**
|
|
33
|
-
* Get the volume property
|
|
34
|
-
*/
|
|
35
|
-
getProperty(): vtkVolumeProperty;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Get the bounds for this mapper as [xmin, xmax, ymin, ymax,zmin, zmax].
|
|
39
|
-
* @return {Bounds} The bounds for the mapper.
|
|
40
|
-
*/
|
|
41
|
-
getBounds(): Bounds;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Get the bounds as [xmin, xmax, ymin, ymax, zmin, zmax].
|
|
45
|
-
*/
|
|
46
|
-
getBoundsByReference(): Bounds;
|
|
47
|
-
|
|
48
32
|
/**
|
|
49
33
|
* Get the `Modified Time` which is a monotonic increasing integer
|
|
50
34
|
* global for all vtkObjects.
|
|
@@ -75,11 +59,12 @@ export interface vtkVolume extends vtkProp3D {
|
|
|
75
59
|
*/
|
|
76
60
|
setMapper(mapper: vtkVolumeMapper): boolean;
|
|
77
61
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
62
|
+
// Inherited from vtkProp3D, but takes a vtkVolumeProperty instead of a generic vtkObject
|
|
63
|
+
getProperty(mapperInputPort?: number): vtkVolumeProperty;
|
|
64
|
+
getProperties(): vtkVolumeProperty[];
|
|
65
|
+
setProperty(mapperInputPort: number, property: vtkVolumeProperty): boolean;
|
|
82
66
|
setProperty(property: vtkVolumeProperty): boolean;
|
|
67
|
+
setProperties(properties: vtkVolumeProperty[]): boolean;
|
|
83
68
|
}
|
|
84
69
|
|
|
85
70
|
/**
|
package/Rendering/Core/Volume.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import { mat4, vec3 } from 'gl-matrix';
|
|
2
1
|
import { m as macro } from '../../macros2.js';
|
|
3
|
-
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
4
2
|
import vtkProp3D from './Prop3D.js';
|
|
5
3
|
import vtkVolumeProperty from './VolumeProperty.js';
|
|
6
4
|
|
|
7
|
-
const {
|
|
8
|
-
vtkDebugMacro
|
|
9
|
-
} = macro;
|
|
10
|
-
|
|
11
5
|
// ----------------------------------------------------------------------------
|
|
12
6
|
// vtkVolume methods
|
|
13
7
|
// ----------------------------------------------------------------------------
|
|
@@ -15,66 +9,8 @@ const {
|
|
|
15
9
|
function vtkVolume(publicAPI, model) {
|
|
16
10
|
// Set our className
|
|
17
11
|
model.classHierarchy.push('vtkVolume');
|
|
18
|
-
publicAPI.getVolumes = () => publicAPI;
|
|
12
|
+
publicAPI.getVolumes = () => [publicAPI];
|
|
19
13
|
publicAPI.makeProperty = vtkVolumeProperty.newInstance;
|
|
20
|
-
publicAPI.getProperty = () => {
|
|
21
|
-
if (model.property === null) {
|
|
22
|
-
model.property = publicAPI.makeProperty();
|
|
23
|
-
}
|
|
24
|
-
return model.property;
|
|
25
|
-
};
|
|
26
|
-
publicAPI.getBounds = () => {
|
|
27
|
-
if (model.mapper === null) {
|
|
28
|
-
return model.bounds;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Check for the special case when the mapper's bounds are unknown
|
|
32
|
-
const bds = model.mapper.getBounds();
|
|
33
|
-
if (!bds || bds.length !== 6) {
|
|
34
|
-
return bds;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Check for the special case when the actor is empty.
|
|
38
|
-
if (bds[0] > bds[1]) {
|
|
39
|
-
model.mapperBounds = bds.concat(); // copy the mapper's bounds
|
|
40
|
-
model.bounds = [1, -1, 1, -1, 1, -1];
|
|
41
|
-
model.boundsMTime.modified();
|
|
42
|
-
return bds;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Check if we have cached values for these bounds - we cache the
|
|
46
|
-
// values returned by model.mapper.getBounds() and we store the time
|
|
47
|
-
// of caching. If the values returned this time are different, or
|
|
48
|
-
// the modified time of this class is newer than the cached time,
|
|
49
|
-
// then we need to rebuild.
|
|
50
|
-
const zip = rows => rows[0].map((_, c) => rows.map(row => row[c]));
|
|
51
|
-
if (!model.mapperBounds || !zip([bds, model.mapperBounds]).reduce((a, b) => a && b[0] === b[1], true) || publicAPI.getMTime() > model.boundsMTime.getMTime()) {
|
|
52
|
-
vtkDebugMacro('Recomputing bounds...');
|
|
53
|
-
model.mapperBounds = bds.map(x => x);
|
|
54
|
-
const bbox = [];
|
|
55
|
-
vtkBoundingBox.getCorners(bds, bbox);
|
|
56
|
-
publicAPI.computeMatrix();
|
|
57
|
-
const tmp4 = new Float64Array(16);
|
|
58
|
-
mat4.transpose(tmp4, model.matrix);
|
|
59
|
-
bbox.forEach(pt => vec3.transformMat4(pt, pt, tmp4));
|
|
60
|
-
|
|
61
|
-
/* eslint-disable no-multi-assign */
|
|
62
|
-
model.bounds[0] = model.bounds[2] = model.bounds[4] = Number.MAX_VALUE;
|
|
63
|
-
model.bounds[1] = model.bounds[3] = model.bounds[5] = -Number.MAX_VALUE;
|
|
64
|
-
/* eslint-enable no-multi-assign */
|
|
65
|
-
model.bounds = model.bounds.map((d, i) => i % 2 === 0 ? bbox.reduce((a, b) => a > b[i / 2] ? b[i / 2] : a, d) : bbox.reduce((a, b) => a < b[(i - 1) / 2] ? b[(i - 1) / 2] : a, d));
|
|
66
|
-
model.boundsMTime.modified();
|
|
67
|
-
}
|
|
68
|
-
return model.bounds;
|
|
69
|
-
};
|
|
70
|
-
publicAPI.getMTime = () => {
|
|
71
|
-
let mt = model.mtime;
|
|
72
|
-
if (model.property !== null) {
|
|
73
|
-
const time = model.property.getMTime();
|
|
74
|
-
mt = time > mt ? time : mt;
|
|
75
|
-
}
|
|
76
|
-
return mt;
|
|
77
|
-
};
|
|
78
14
|
publicAPI.getRedrawMTime = () => {
|
|
79
15
|
let mt = model.mtime;
|
|
80
16
|
if (model.mapper !== null) {
|
|
@@ -96,9 +32,7 @@ function vtkVolume(publicAPI, model) {
|
|
|
96
32
|
// ----------------------------------------------------------------------------
|
|
97
33
|
|
|
98
34
|
const DEFAULT_VALUES = {
|
|
99
|
-
mapper: null
|
|
100
|
-
property: null,
|
|
101
|
-
bounds: [1, -1, 1, -1, 1, -1]
|
|
35
|
+
mapper: null
|
|
102
36
|
};
|
|
103
37
|
|
|
104
38
|
// ----------------------------------------------------------------------------
|
|
@@ -115,9 +49,7 @@ function extend(publicAPI, model) {
|
|
|
115
49
|
macro.obj(model.boundsMTime);
|
|
116
50
|
|
|
117
51
|
// Build VTK API
|
|
118
|
-
macro.set(publicAPI, model, ['property']);
|
|
119
52
|
macro.setGet(publicAPI, model, ['mapper']);
|
|
120
|
-
macro.getArray(publicAPI, model, ['bounds'], 6);
|
|
121
53
|
|
|
122
54
|
// Object methods
|
|
123
55
|
vtkVolume(publicAPI, model);
|
|
@@ -8,14 +8,7 @@ export declare enum BlendMode {
|
|
|
8
8
|
LABELMAP_EDGE_PROJECTION_BLEND = 6,
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export declare enum FilterMode {
|
|
12
|
-
OFF = 0,
|
|
13
|
-
NORMALIZED = 1,
|
|
14
|
-
RAW = 2,
|
|
15
|
-
}
|
|
16
|
-
|
|
17
11
|
declare const _default: {
|
|
18
12
|
BlendMode: typeof BlendMode;
|
|
19
|
-
FilterMode: typeof FilterMode;
|
|
20
13
|
};
|
|
21
14
|
export default _default;
|
|
@@ -7,14 +7,8 @@ const BlendMode = {
|
|
|
7
7
|
RADON_TRANSFORM_BLEND: 5,
|
|
8
8
|
LABELMAP_EDGE_PROJECTION_BLEND: 6
|
|
9
9
|
};
|
|
10
|
-
const FilterMode = {
|
|
11
|
-
OFF: 0,
|
|
12
|
-
NORMALIZED: 1,
|
|
13
|
-
RAW: 2
|
|
14
|
-
};
|
|
15
10
|
var Constants = {
|
|
16
|
-
BlendMode
|
|
17
|
-
FilterMode
|
|
11
|
+
BlendMode
|
|
18
12
|
};
|
|
19
13
|
|
|
20
|
-
export { BlendMode,
|
|
14
|
+
export { BlendMode, Constants as default };
|
|
@@ -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;
|