@kitware/vtk.js 25.1.2 → 25.2.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/Rendering/Core/Actor.d.ts +5 -4
- package/Rendering/Core/ImageSlice.d.ts +25 -1
- package/Rendering/Core/Light.d.ts +36 -2
- package/Rendering/Core/Light.js +10 -4
- package/Rendering/Core/Property.d.ts +120 -0
- package/Rendering/Core/Property.js +17 -1
- package/Rendering/Core/Texture.js +31 -0
- package/Rendering/Core/Volume.d.ts +6 -5
- package/Rendering/Core/VolumeMapper.d.ts +1 -1
- package/Rendering/Core/VolumeProperty.d.ts +32 -30
- package/Rendering/WebGPU/Actor2D.js +2 -0
- package/Rendering/WebGPU/BufferManager.js +1 -1
- package/Rendering/WebGPU/CellArrayMapper.js +220 -50
- package/Rendering/WebGPU/Glyph3DMapper.js +2 -1
- package/Rendering/WebGPU/ImageMapper.js +11 -8
- package/Rendering/WebGPU/Pipeline.js +0 -12
- package/Rendering/WebGPU/RenderEncoder.js +0 -1
- package/Rendering/WebGPU/Renderer.js +109 -4
- package/Rendering/WebGPU/SimpleMapper.js +6 -2
- package/Rendering/WebGPU/SphereMapper.js +2 -2
- package/Rendering/WebGPU/StickMapper.js +2 -2
- package/Rendering/WebGPU/Texture.js +8 -0
- package/Rendering/WebGPU/Types.js +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Bounds } from './../../types';
|
|
1
|
+
import { Bounds, Nullable } from './../../types';
|
|
2
2
|
import vtkMapper from './Mapper';
|
|
3
3
|
import vtkProp3D, { IProp3DInitialValues } from './Prop3D';
|
|
4
|
-
import vtkProperty from './Property';
|
|
4
|
+
import vtkProperty, { IPropertyInitialValues } from './Property';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
@@ -62,7 +62,7 @@ export interface vtkActor extends vtkProp3D {
|
|
|
62
62
|
/**
|
|
63
63
|
* Get the Mapper that this actor is getting its data from.
|
|
64
64
|
*/
|
|
65
|
-
getMapper():
|
|
65
|
+
getMapper(): Nullable<vtkMapper>;
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* Get the property object that controls this actors surface
|
|
@@ -82,8 +82,9 @@ export interface vtkActor extends vtkProp3D {
|
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* Create a new property suitable for use with this type of Actor.
|
|
85
|
+
* @param {IPropertyInitialValues} [initialValues] (default: {})
|
|
85
86
|
*/
|
|
86
|
-
makeProperty(): vtkProperty;
|
|
87
|
+
makeProperty(initialValues?: IPropertyInitialValues): vtkProperty;
|
|
87
88
|
|
|
88
89
|
/**
|
|
89
90
|
* Set the property object that controls this actors backface surface
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bounds } from './../../types';
|
|
2
|
-
import vtkImageProperty from './ImageProperty';
|
|
2
|
+
import vtkImageProperty, { IImagePropertyInitialValues } from './ImageProperty';
|
|
3
3
|
import vtkImageMapper from './ImageMapper';
|
|
4
4
|
import vtkProp3D, { IProp3DInitialValues } from './Prop3D';
|
|
5
5
|
|
|
@@ -23,6 +23,12 @@ export interface vtkImageSlice extends vtkProp3D {
|
|
|
23
23
|
*/
|
|
24
24
|
getBounds(): Bounds;
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Get the bounds for this mapper as [xmin, xmax, ymin, ymax,zmin, zmax].
|
|
28
|
+
* @return {Bounds} The bounds for the mapper.
|
|
29
|
+
*/
|
|
30
|
+
getBoundsByReference(): Bounds;
|
|
31
|
+
|
|
26
32
|
/**
|
|
27
33
|
* Get the bounds for a given slice as [xmin, xmax, ymin, ymax,zmin, zmax].
|
|
28
34
|
* @param {Number} slice The slice index.
|
|
@@ -111,6 +117,24 @@ export interface vtkImageSlice extends vtkProp3D {
|
|
|
111
117
|
* and the Renderer will do the images in their own pass.
|
|
112
118
|
*/
|
|
113
119
|
hasTranslucentPolygonalGeometry(): boolean;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Create a new property suitable for use with this type of Actor.
|
|
123
|
+
* @param {IImageSliceInitialValues} [initialValues] (default: {})
|
|
124
|
+
*/
|
|
125
|
+
makeProperty(initialValues?: IImagePropertyInitialValues): vtkImageProperty;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
*
|
|
129
|
+
* @param {vtkImageMapper} mapper The vtkImageMapper instance.
|
|
130
|
+
*/
|
|
131
|
+
setMapper(mapper: vtkImageMapper): boolean;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
*
|
|
135
|
+
* @param {vtkImageProperty} property The vtkImageProperty instance.
|
|
136
|
+
*/
|
|
137
|
+
setProperty(property: vtkImageProperty): boolean;
|
|
114
138
|
}
|
|
115
139
|
|
|
116
140
|
/**
|
|
@@ -5,7 +5,7 @@ import { RGBColor, Vector3 } from './../../types';
|
|
|
5
5
|
export enum LIGHT_TYPES {
|
|
6
6
|
'HeadLight',
|
|
7
7
|
'CameraLight',
|
|
8
|
-
'SceneLight'
|
|
8
|
+
'SceneLight',
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface ILightInitialValues {
|
|
@@ -17,6 +17,7 @@ export interface ILightInitialValues {
|
|
|
17
17
|
positional?: boolean;
|
|
18
18
|
exponent?: number;
|
|
19
19
|
coneAngle?: number;
|
|
20
|
+
coneFalloff?: number;
|
|
20
21
|
attenuationValues?: number[];
|
|
21
22
|
lightType?: LIGHT_TYPES;
|
|
22
23
|
shadowAttenuation?: number;
|
|
@@ -54,6 +55,15 @@ export interface vtkLight extends vtkObject {
|
|
|
54
55
|
*/
|
|
55
56
|
getConeAngle(): number;
|
|
56
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Get the lighting falloff angle of a positional light in degrees.
|
|
60
|
+
* This is the angle that sets how much the cone will be extended to
|
|
61
|
+
* smooth the border. A value of 0 indicates that the spot light will
|
|
62
|
+
* have a completely sharp edge (this does not mean completely sharp
|
|
63
|
+
* lighting, just that the border will be sharp).
|
|
64
|
+
*/
|
|
65
|
+
getConeFalloff(): number;
|
|
66
|
+
|
|
57
67
|
/**
|
|
58
68
|
* Set the position and focal point of a light based on elevation and azimuth.
|
|
59
69
|
* The light is moved so it is shining from the given angle. Angles are
|
|
@@ -174,6 +184,16 @@ export interface vtkLight extends vtkObject {
|
|
|
174
184
|
*/
|
|
175
185
|
setConeAngle(coneAngle: number): boolean;
|
|
176
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Set the lighting falloff angle of a positional light in degrees.
|
|
189
|
+
* This is the angle that sets how much the cone will be extended to
|
|
190
|
+
* smooth the border. A value of 0 indicates that the spot light will
|
|
191
|
+
* have a completely sharp edge (this does not mean completely sharp
|
|
192
|
+
* lighting, just that the border will be sharp).
|
|
193
|
+
* @param {Number} coneFalloff The cone falloff angle.
|
|
194
|
+
*/
|
|
195
|
+
setConeFalloff(coneFalloff: number): boolean;
|
|
196
|
+
|
|
177
197
|
/**
|
|
178
198
|
* Set the position and focal point of a light based on elevation and
|
|
179
199
|
* azimuth. The light is moved so it is shining from the given angle. Angles
|
|
@@ -184,6 +204,20 @@ export interface vtkLight extends vtkObject {
|
|
|
184
204
|
*/
|
|
185
205
|
setDirectionAngle(elevation: number, azimuth: number): boolean;
|
|
186
206
|
|
|
207
|
+
/**
|
|
208
|
+
* Set the direction vector of the light from X, Y, and Z values
|
|
209
|
+
* @param {Number} x The x coordinate.
|
|
210
|
+
* @param {Number} y The y coordinate.
|
|
211
|
+
* @param {Number} z The z coordinate.
|
|
212
|
+
*/
|
|
213
|
+
setDirection(x: number, y: number, z: number): boolean;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Set the direction vector of the light from X, Y, and Z values
|
|
217
|
+
* @param {Vector3} direction
|
|
218
|
+
*/
|
|
219
|
+
setDirection(direction: Vector3): boolean;
|
|
220
|
+
|
|
187
221
|
/**
|
|
188
222
|
* Set the exponent of the cosine used in positional lighting.
|
|
189
223
|
* @param {Number} exponent The exponent of the cosine.
|
|
@@ -299,7 +333,7 @@ export function extend(publicAPI: object, model: object, initialValues?: ILightI
|
|
|
299
333
|
/**
|
|
300
334
|
* Method use to create a new instance of vtkLight with the focal point at the origin and its position
|
|
301
335
|
* set to [0, 0, 1]. The light is a SceneLight, its color is white, intensity=1, the light is turned on,
|
|
302
|
-
* positional lighting is off, coneAngle=30, AttenuationValues=[1, 0, 0], exponent=1 and the transformMatrix is null.
|
|
336
|
+
* positional lighting is off, coneAngle=30, coneFalloff=5, AttenuationValues=[1, 0, 0], exponent=1 and the transformMatrix is null.
|
|
303
337
|
* @param {ILightInitialValues} [initialValues] for pre-setting some of its content
|
|
304
338
|
*/
|
|
305
339
|
export function newInstance(initialValues?: ILightInitialValues): vtkLight;
|
package/Rendering/Core/Light.js
CHANGED
|
@@ -33,14 +33,19 @@ function vtkLight(publicAPI, model) {
|
|
|
33
33
|
|
|
34
34
|
publicAPI.getDirection = function () {
|
|
35
35
|
if (model.directionMTime < model.mtime) {
|
|
36
|
-
model.direction
|
|
37
|
-
model.direction[1] = model.focalPoint[1] - model.position[1];
|
|
38
|
-
model.direction[2] = model.focalPoint[2] - model.position[2];
|
|
36
|
+
vec3.sub(model.direction, model.focalPoint, model.position);
|
|
39
37
|
normalize(model.direction);
|
|
40
38
|
model.directionMTime = model.mtime;
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
return model.direction;
|
|
42
|
+
}; // Sets the direction from a vec3 instead of a focal point
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
publicAPI.setDirection = function (directionVector) {
|
|
46
|
+
var newFocalPoint = new Float64Array(3);
|
|
47
|
+
vec3.sub(newFocalPoint, model.position, directionVector);
|
|
48
|
+
model.focalPoint = newFocalPoint;
|
|
44
49
|
};
|
|
45
50
|
|
|
46
51
|
publicAPI.setDirectionAngle = function (elevation, azimuth) {
|
|
@@ -89,6 +94,7 @@ var DEFAULT_VALUES = {
|
|
|
89
94
|
positional: false,
|
|
90
95
|
exponent: 1,
|
|
91
96
|
coneAngle: 30,
|
|
97
|
+
coneFalloff: 5,
|
|
92
98
|
attenuationValues: [1, 0, 0],
|
|
93
99
|
transformMatrix: null,
|
|
94
100
|
lightType: 'SceneLight',
|
|
@@ -102,7 +108,7 @@ function extend(publicAPI, model) {
|
|
|
102
108
|
Object.assign(model, DEFAULT_VALUES, initialValues); // Build VTK API
|
|
103
109
|
|
|
104
110
|
macro.obj(publicAPI, model);
|
|
105
|
-
macro.setGet(publicAPI, model, ['intensity', 'switch', 'positional', 'exponent', 'coneAngle', 'transformMatrix', 'lightType', 'shadowAttenuation', 'attenuationValues']);
|
|
111
|
+
macro.setGet(publicAPI, model, ['intensity', 'switch', 'positional', 'exponent', 'coneAngle', 'coneFalloff', 'transformMatrix', 'lightType', 'shadowAttenuation', 'attenuationValues']);
|
|
106
112
|
macro.setGetArray(publicAPI, model, ['color', 'position', 'focalPoint', 'attenuationValues'], 3); // Object methods
|
|
107
113
|
|
|
108
114
|
vtkLight(publicAPI, model);
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import { vtkObject } from './../../interfaces';
|
|
2
2
|
import { RGBColor } from './../../types';
|
|
3
3
|
import { Interpolation, Representation, Shading } from './Property/Constants';
|
|
4
|
+
import { vtkTexture } from './Texture';
|
|
4
5
|
|
|
5
6
|
export interface IPropertyInitialValues {
|
|
6
7
|
color?: RGBColor;
|
|
7
8
|
ambientColor?: RGBColor;
|
|
8
9
|
diffuseColor?: RGBColor;
|
|
9
10
|
specularColor?: RGBColor;
|
|
11
|
+
diffuseTexture?: vtkTexture;
|
|
12
|
+
metallicTexture?: vtkTexture;
|
|
13
|
+
roughnessTexture?: vtkTexture;
|
|
14
|
+
normalTexture?: vtkTexture;
|
|
15
|
+
ambientOcclusionTexture?: vtkTexture;
|
|
16
|
+
emissionTexture?: vtkTexture;
|
|
10
17
|
edgeColor?: RGBColor;
|
|
11
18
|
ambient?: number;
|
|
12
19
|
diffuse?: number;
|
|
20
|
+
metallic?: number;
|
|
21
|
+
roughness?: number;
|
|
22
|
+
normalStrength?: number;
|
|
23
|
+
emission?: number;
|
|
24
|
+
baseIOR?: number;
|
|
13
25
|
specular?: number;
|
|
14
26
|
specularPower?: number;
|
|
15
27
|
opacity?: number;
|
|
@@ -161,6 +173,36 @@ export interface vtkProperty extends vtkObject {
|
|
|
161
173
|
*/
|
|
162
174
|
getSpecular(): number;
|
|
163
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Get the roughness coefficient.
|
|
178
|
+
* @default 1
|
|
179
|
+
*/
|
|
180
|
+
getRoughness(): number;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Get the metallic coefficient.
|
|
184
|
+
* @default 0
|
|
185
|
+
*/
|
|
186
|
+
getMetallic(): number;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Get the index of refraction.
|
|
190
|
+
* @default 0
|
|
191
|
+
*/
|
|
192
|
+
getBaseIOR(): number;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Get the strength of the normal map.
|
|
196
|
+
* @default 1
|
|
197
|
+
*/
|
|
198
|
+
getNormalStrength(): number;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Get the emission coefficient.
|
|
202
|
+
* @default 0
|
|
203
|
+
*/
|
|
204
|
+
getEmission(): number;
|
|
205
|
+
|
|
164
206
|
/**
|
|
165
207
|
* Get the specular surface color.
|
|
166
208
|
* @return {RGBColor} Array of RGB color.
|
|
@@ -178,6 +220,36 @@ export interface vtkProperty extends vtkObject {
|
|
|
178
220
|
*/
|
|
179
221
|
getSpecularPower(): number;
|
|
180
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Get the diffuse texture.
|
|
225
|
+
*/
|
|
226
|
+
getDiffuseTexture(): vtkTexture;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Get the metallic texture.
|
|
230
|
+
*/
|
|
231
|
+
getMetallicTexture(): vtkTexture;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Get the roughness texture.
|
|
235
|
+
*/
|
|
236
|
+
getRoughnessTexture(): vtkTexture;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Get the normal texture.
|
|
240
|
+
*/
|
|
241
|
+
getNormalTexture(): vtkTexture;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Get the ambient occlusion texture.
|
|
245
|
+
*/
|
|
246
|
+
getAmbientOcclusionTexture(): vtkTexture;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Get the emission texture.
|
|
250
|
+
*/
|
|
251
|
+
getEmissionTexture(): vtkTexture;
|
|
252
|
+
|
|
181
253
|
/**
|
|
182
254
|
* Set the ambient lighting coefficient.
|
|
183
255
|
* @param {Number} ambient The ambient lighting coefficient.
|
|
@@ -385,6 +457,18 @@ export interface vtkProperty extends vtkObject {
|
|
|
385
457
|
*/
|
|
386
458
|
setSpecular(specular: number): boolean;
|
|
387
459
|
|
|
460
|
+
/**
|
|
461
|
+
* Set the normal map strength.
|
|
462
|
+
* @param {Boolean} normal
|
|
463
|
+
*/
|
|
464
|
+
setNormalStrength(normalStrength: number): boolean;
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Set the ambient occlusion map strength.
|
|
468
|
+
* @param {Boolean} emission
|
|
469
|
+
*/
|
|
470
|
+
setEmission(emission: number): boolean;
|
|
471
|
+
|
|
388
472
|
/**
|
|
389
473
|
* Set the specular surface color.
|
|
390
474
|
* @param {Number} r Defines the red component (between 0 and 1)
|
|
@@ -410,6 +494,42 @@ export interface vtkProperty extends vtkObject {
|
|
|
410
494
|
* @param {Number} specularPower
|
|
411
495
|
*/
|
|
412
496
|
setSpecularPower(specularPower: number): boolean;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Set the diffuse texture.
|
|
500
|
+
* @param {vtkTexture} diffuseTexture
|
|
501
|
+
*/
|
|
502
|
+
setDiffuseTexture(diffuseTexture: vtkTexture): boolean;
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Set the metallic texture.
|
|
506
|
+
* @param {vtkTexture} metallicTexture
|
|
507
|
+
*/
|
|
508
|
+
setMetallicTexture(metallicTexture: vtkTexture): boolean;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Set the roughness texture.
|
|
512
|
+
* @param {vtkTexture} roughnessTexture
|
|
513
|
+
*/
|
|
514
|
+
setRoughnessTexture(roughnessTexture: vtkTexture): boolean;
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Set the normal texture.
|
|
518
|
+
* @param {vtkTexture} normalTexture
|
|
519
|
+
*/
|
|
520
|
+
setNormalTexture(normalTexture: vtkTexture): boolean;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Set the ambient occlusion texture.
|
|
524
|
+
* @param {vtkTexture} ambientOcclusionTexture
|
|
525
|
+
*/
|
|
526
|
+
setAmbientOcclusionTexture(ambientOcclusionTexture: vtkTexture): boolean;
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Set the emission texture.
|
|
530
|
+
* @param {vtkTexture} emissionTexture
|
|
531
|
+
*/
|
|
532
|
+
setEmissionTexture(emissionTexture: vtkTexture): boolean;
|
|
413
533
|
}
|
|
414
534
|
|
|
415
535
|
/**
|
|
@@ -58,6 +58,17 @@ function vtkProperty(publicAPI, model) {
|
|
|
58
58
|
return [].concat(model.color);
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
+
publicAPI.setSpecularPower = function (specularPower) {
|
|
62
|
+
var roughness = 1 / Math.max(1.0, specularPower);
|
|
63
|
+
|
|
64
|
+
if (model.roughness !== roughness || model.specularPower !== specularPower) {
|
|
65
|
+
model.specularPower = specularPower; // Specular power still needs to be set as long as webgl is using it (otherwise testShaderReplacementsClear fails)
|
|
66
|
+
|
|
67
|
+
model.roughness = roughness;
|
|
68
|
+
publicAPI.modified();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
61
72
|
publicAPI.addShaderVariable = notImplemented('AddShaderVariable');
|
|
62
73
|
|
|
63
74
|
publicAPI.setInterpolationToFlat = function () {
|
|
@@ -104,6 +115,11 @@ var DEFAULT_VALUES = {
|
|
|
104
115
|
edgeColor: [0, 0, 0],
|
|
105
116
|
ambient: 0,
|
|
106
117
|
diffuse: 1,
|
|
118
|
+
metallic: 0,
|
|
119
|
+
roughness: 0.6,
|
|
120
|
+
normalStrength: 1,
|
|
121
|
+
emission: 1,
|
|
122
|
+
baseIOR: 1.45,
|
|
107
123
|
specular: 0,
|
|
108
124
|
specularPower: 1,
|
|
109
125
|
opacity: 1,
|
|
@@ -124,7 +140,7 @@ function extend(publicAPI, model) {
|
|
|
124
140
|
Object.assign(model, DEFAULT_VALUES, initialValues); // Build VTK API
|
|
125
141
|
|
|
126
142
|
macro.obj(publicAPI, model);
|
|
127
|
-
macro.setGet(publicAPI, model, ['lighting', 'interpolation', 'ambient', 'diffuse', 'specular', 'specularPower', 'opacity', 'edgeVisibility', 'lineWidth', 'pointSize', 'backfaceCulling', 'frontfaceCulling', 'representation']);
|
|
143
|
+
macro.setGet(publicAPI, model, ['lighting', 'interpolation', 'ambient', 'diffuse', 'metallic', 'roughness', 'normalStrength', 'emission', 'baseIOR', 'specular', 'specularPower', 'opacity', 'edgeVisibility', 'lineWidth', 'pointSize', 'backfaceCulling', 'frontfaceCulling', 'representation', 'diffuseTexture', 'metallicTexture', 'roughnessTexture', 'normalTexture', 'ambientOcclusionTexture', 'emissionTexture']);
|
|
128
144
|
macro.setGetArray(publicAPI, model, ['ambientColor', 'specularColor', 'diffuseColor', 'edgeColor'], 3); // Object methods
|
|
129
145
|
|
|
130
146
|
vtkProperty(publicAPI, model);
|
|
@@ -72,6 +72,37 @@ function vtkTexture(publicAPI, model) {
|
|
|
72
72
|
|
|
73
73
|
publicAPI.modified();
|
|
74
74
|
};
|
|
75
|
+
|
|
76
|
+
publicAPI.getDimensionality = function () {
|
|
77
|
+
var width = 0;
|
|
78
|
+
var height = 0;
|
|
79
|
+
var depth = 1;
|
|
80
|
+
|
|
81
|
+
if (publicAPI.getInputData()) {
|
|
82
|
+
var data = publicAPI.getInputData();
|
|
83
|
+
width = data.getDimensions()[0];
|
|
84
|
+
height = data.getDimensions()[1];
|
|
85
|
+
depth = data.getDimensions()[2];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (model.jsImageData) {
|
|
89
|
+
width = model.jsImageData.width;
|
|
90
|
+
height = model.jsImageData.height;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (model.canvas) {
|
|
94
|
+
width = model.canvas.width;
|
|
95
|
+
height = model.canvas.height;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (model.image) {
|
|
99
|
+
width = model.image.width;
|
|
100
|
+
height = model.image.height;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
var dimensionality = (width > 1) + (height > 1) + (depth > 1);
|
|
104
|
+
return dimensionality;
|
|
105
|
+
};
|
|
75
106
|
} // ----------------------------------------------------------------------------
|
|
76
107
|
// Object factory
|
|
77
108
|
// ----------------------------------------------------------------------------
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Bounds } from './../../types';
|
|
1
|
+
import { Bounds, Nullable } from './../../types';
|
|
2
2
|
import vtkProp3D, { IProp3DInitialValues } from './Prop3D';
|
|
3
3
|
import vtkVolumeMapper from './VolumeMapper';
|
|
4
|
-
import vtkVolumeProperty from './VolumeProperty';
|
|
4
|
+
import vtkVolumeProperty, { IVolumePropertyInitialValues } from './VolumeProperty';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
@@ -20,7 +20,7 @@ export interface vtkVolume extends vtkProp3D {
|
|
|
20
20
|
/**
|
|
21
21
|
* Get the volume mapper
|
|
22
22
|
*/
|
|
23
|
-
getMapper(): vtkVolumeMapper
|
|
23
|
+
getMapper(): Nullable<vtkVolumeMapper>;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* For some exporters and other other operations we must be able to collect
|
|
@@ -63,9 +63,10 @@ export interface vtkVolume extends vtkProp3D {
|
|
|
63
63
|
getRedrawMTime(): number;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* Create a new property suitable for use with this type of Actor.
|
|
67
|
+
* @param {IVolumePropertyInitialValues} [initialValues] (default: {})
|
|
67
68
|
*/
|
|
68
|
-
makeProperty():
|
|
69
|
+
makeProperty(initialValues?: IVolumePropertyInitialValues): vtkVolumeProperty;
|
|
69
70
|
|
|
70
71
|
/**
|
|
71
72
|
* Set the volume mapper
|
|
@@ -5,7 +5,7 @@ import { BlendMode, FilterMode } from './VolumeMapper/Constants';
|
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
interface IVolumeMapperInitialValues extends IAbstractMapperInitialValues {
|
|
8
|
+
export interface IVolumeMapperInitialValues extends IAbstractMapperInitialValues {
|
|
9
9
|
bounds?: Bounds;
|
|
10
10
|
blendMode?: BlendMode;
|
|
11
11
|
sampleDistance?: number;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import vtkPiecewiseFunction from './../../Common/DataModel/PiecewiseFunction';
|
|
1
2
|
import { vtkObject } from './../../interfaces';
|
|
3
|
+
import vtkColorTransferFunction from './ColorTransferFunction';
|
|
2
4
|
import { InterpolationType, OpacityMode } from './VolumeProperty/Constants';
|
|
3
5
|
|
|
4
|
-
interface IVolumePropertyInitialValues {
|
|
6
|
+
export interface IVolumePropertyInitialValues {
|
|
5
7
|
independentComponents?: boolean;
|
|
6
8
|
shade?: number;
|
|
7
9
|
ambient?: number;
|
|
@@ -33,7 +35,7 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
33
35
|
|
|
34
36
|
/**
|
|
35
37
|
*
|
|
36
|
-
* @param {Number} index
|
|
38
|
+
* @param {Number} index
|
|
37
39
|
*/
|
|
38
40
|
getColorChannels(index: number): number;
|
|
39
41
|
|
|
@@ -44,25 +46,25 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
44
46
|
|
|
45
47
|
/**
|
|
46
48
|
*
|
|
47
|
-
* @param {Number} index
|
|
49
|
+
* @param {Number} index
|
|
48
50
|
*/
|
|
49
51
|
getGradientOpacityMaximumOpacity(index: number): number;
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
*
|
|
53
|
-
* @param {Number} index
|
|
55
|
+
* @param {Number} index
|
|
54
56
|
*/
|
|
55
57
|
getGradientOpacityMaximumValue(index: number): number;
|
|
56
58
|
|
|
57
59
|
/**
|
|
58
60
|
*
|
|
59
|
-
* @param {Number} index
|
|
61
|
+
* @param {Number} index
|
|
60
62
|
*/
|
|
61
63
|
getGradientOpacityMinimumOpacity(index: number): number;
|
|
62
64
|
|
|
63
65
|
/**
|
|
64
66
|
*
|
|
65
|
-
* @param {Number} index
|
|
67
|
+
* @param {Number} index
|
|
66
68
|
*/
|
|
67
69
|
getGradientOpacityMinimumValue(index: number): number;
|
|
68
70
|
|
|
@@ -73,15 +75,15 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
73
75
|
|
|
74
76
|
/**
|
|
75
77
|
* Get the unit distance on which the scalar opacity transfer function is defined.
|
|
76
|
-
* @param {Number} index
|
|
78
|
+
* @param {Number} index
|
|
77
79
|
*/
|
|
78
80
|
getScalarOpacityUnitDistance(index: number): number;
|
|
79
81
|
|
|
80
82
|
/**
|
|
81
83
|
* Get the currently set gray transfer function. Create one if none set.
|
|
82
|
-
* @param {Number} index
|
|
84
|
+
* @param {Number} index
|
|
83
85
|
*/
|
|
84
|
-
getGrayTransferFunction(index: number):
|
|
86
|
+
getGrayTransferFunction(index: number): vtkPiecewiseFunction;
|
|
85
87
|
|
|
86
88
|
/**
|
|
87
89
|
*
|
|
@@ -98,13 +100,13 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
98
100
|
* Get the currently set RGB transfer function. Create one if none set.
|
|
99
101
|
* @param {Number} index
|
|
100
102
|
*/
|
|
101
|
-
getRGBTransferFunction(index: number):
|
|
103
|
+
getRGBTransferFunction(index: number): vtkColorTransferFunction;
|
|
102
104
|
|
|
103
105
|
/**
|
|
104
106
|
* Get the scalar opacity transfer function. Create one if none set.
|
|
105
107
|
* @param {Number} index
|
|
106
108
|
*/
|
|
107
|
-
getScalarOpacity(index: number):
|
|
109
|
+
getScalarOpacity(index: number): vtkPiecewiseFunction;
|
|
108
110
|
|
|
109
111
|
/**
|
|
110
112
|
* Get the shading of a volume.
|
|
@@ -147,37 +149,37 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
147
149
|
/**
|
|
148
150
|
*
|
|
149
151
|
* @param {Number} index
|
|
150
|
-
* @param {Number} value
|
|
152
|
+
* @param {Number} value
|
|
151
153
|
*/
|
|
152
154
|
setGradientOpacityMaximumOpacity(index: number, value: number): boolean;
|
|
153
155
|
|
|
154
156
|
/**
|
|
155
157
|
*
|
|
156
158
|
* @param {Number} index
|
|
157
|
-
* @param {Number} value
|
|
159
|
+
* @param {Number} value
|
|
158
160
|
*/
|
|
159
161
|
setGradientOpacityMaximumValue(index: number, value: number): boolean;
|
|
160
162
|
|
|
161
163
|
/**
|
|
162
164
|
*
|
|
163
165
|
* @param {Number} index
|
|
164
|
-
* @param {Number} value
|
|
166
|
+
* @param {Number} value
|
|
165
167
|
*/
|
|
166
168
|
setGradientOpacityMinimumOpacity(index: number, value: number): boolean;
|
|
167
169
|
|
|
168
170
|
/**
|
|
169
171
|
*
|
|
170
172
|
* @param {Number} index
|
|
171
|
-
* @param {Number} value
|
|
173
|
+
* @param {Number} value
|
|
172
174
|
*/
|
|
173
175
|
setGradientOpacityMinimumValue(index: number, value: number): boolean;
|
|
174
176
|
|
|
175
177
|
/**
|
|
176
178
|
* Set the color of a volume to a gray transfer function
|
|
177
179
|
* @param {Number} index
|
|
178
|
-
* @param func
|
|
180
|
+
* @param {vtkPiecewiseFunction} func
|
|
179
181
|
*/
|
|
180
|
-
setGrayTransferFunction(index: number, func:
|
|
182
|
+
setGrayTransferFunction(index: number, func: vtkPiecewiseFunction): boolean;
|
|
181
183
|
|
|
182
184
|
/**
|
|
183
185
|
* Does the data have independent components, or do some define color only?
|
|
@@ -204,14 +206,14 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
204
206
|
|
|
205
207
|
/**
|
|
206
208
|
*
|
|
207
|
-
* @param {Number} labelOutlineThickness
|
|
209
|
+
* @param {Number} labelOutlineThickness
|
|
208
210
|
*/
|
|
209
211
|
setLabelOutlineThickness(labelOutlineThickness: number): boolean;
|
|
210
212
|
|
|
211
213
|
/**
|
|
212
214
|
*
|
|
213
215
|
* @param {Number} index
|
|
214
|
-
* @param {Number} value
|
|
216
|
+
* @param {Number} value
|
|
215
217
|
*/
|
|
216
218
|
setOpacityMode(index: number, value: number): boolean;
|
|
217
219
|
|
|
@@ -219,7 +221,7 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
219
221
|
* Set the unit distance on which the scalar opacity transfer function is
|
|
220
222
|
* defined.
|
|
221
223
|
* @param {Number} index
|
|
222
|
-
* @param {Number} value
|
|
224
|
+
* @param {Number} value
|
|
223
225
|
*/
|
|
224
226
|
setScalarOpacityUnitDistance(index: number, value: number): boolean;
|
|
225
227
|
|
|
@@ -234,7 +236,7 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
234
236
|
* turning shading off is generally the same as setting ambient=1,
|
|
235
237
|
* diffuse=0, specular=0. Shading can be independently turned on/off per
|
|
236
238
|
* component.
|
|
237
|
-
* @param {Number} shade
|
|
239
|
+
* @param {Number} shade
|
|
238
240
|
*/
|
|
239
241
|
setShade(shade: number): boolean;
|
|
240
242
|
|
|
@@ -252,35 +254,35 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
252
254
|
|
|
253
255
|
/**
|
|
254
256
|
*
|
|
255
|
-
* @param {
|
|
256
|
-
* @param {
|
|
257
|
+
* @param {Number} index
|
|
258
|
+
* @param {Boolean} value
|
|
257
259
|
*/
|
|
258
260
|
setUseGradientOpacity(index: number, value: boolean): boolean;
|
|
259
261
|
|
|
260
262
|
/**
|
|
261
263
|
*
|
|
262
|
-
* @param {Boolean} useLabelOutline
|
|
264
|
+
* @param {Boolean} useLabelOutline
|
|
263
265
|
*/
|
|
264
266
|
setUseLabelOutline(useLabelOutline: boolean): boolean;
|
|
265
267
|
|
|
266
268
|
/**
|
|
267
269
|
* Set the color of a volume to an RGB transfer function
|
|
268
270
|
* @param {Number} index
|
|
269
|
-
* @param func
|
|
271
|
+
* @param {vtkColorTransferFunction} func
|
|
270
272
|
*/
|
|
271
|
-
setRGBTransferFunction(index: number, func:
|
|
273
|
+
setRGBTransferFunction(index: number, func: vtkColorTransferFunction): boolean;
|
|
272
274
|
|
|
273
275
|
/**
|
|
274
276
|
* Set the scalar opacity of a volume to a transfer function
|
|
275
277
|
* @param {Number} index
|
|
276
|
-
* @param func
|
|
278
|
+
* @param {vtkPiecewiseFunction} func
|
|
277
279
|
*/
|
|
278
|
-
setScalarOpacity(index: number, func:
|
|
280
|
+
setScalarOpacity(index: number, func: vtkPiecewiseFunction): boolean;
|
|
279
281
|
|
|
280
282
|
/**
|
|
281
283
|
* Set the scalar component weights.
|
|
282
284
|
* @param {Number} index
|
|
283
|
-
* @param {Number} value
|
|
285
|
+
* @param {Number} value
|
|
284
286
|
*/
|
|
285
287
|
setComponentWeight(index: number, value: number): boolean;
|
|
286
288
|
|
|
@@ -292,7 +294,7 @@ export interface vtkVolumeProperty extends vtkObject {
|
|
|
292
294
|
|
|
293
295
|
/**
|
|
294
296
|
* Set the interpolation type for sampling a volume.
|
|
295
|
-
* @param {InterpolationType} interpolationType
|
|
297
|
+
* @param {InterpolationType} interpolationType
|
|
296
298
|
*/
|
|
297
299
|
setInterpolationType(interpolationType: InterpolationType): boolean;
|
|
298
300
|
|