Introduction
vtk-js includes support for volume rendering using hardware GPU acceleration. The
capabilities may change over time but as of this writing it includes support
for :
- multi-component data
- at least 24 bits linear resolution
- support for all native data types, 16 bit, float, etc
- opacity transfer functions
- color transfer functions
- volume interpolation of nearest, fast linear and linear
- automatic intermixing of opaque surfaces with volumes
Using volume rendering in vtk-js is very much like using it VTK is you are
familiar with VTK. The main objects are :
- RenderWindow/Renderer as usual
- Volume - similar to Actor, holds the property and mapper
- VolumeMapper - takes an ImageData as input
- VolumeProperty - holds the opacity and color transfer functions
- PiecewiseFunction - a piecewise interpolated function, good for opacity
transfer functions - ColorTransferFunction - similar to PiecewiseFunction but support an RGB
value at each point.
Usage
// Load the rendering pieces we want to use (for both WebGL and WebGPU) |
See Also
Methods
extend
Method use to decorate a given object (publicAPI+model) with vtkVolume characteristics.
Argument | Type | Required | Description |
---|---|---|---|
publicAPI |
Yes | object on which methods will be bounds (public) | |
model |
Yes | object on which data structure will be bounds (protected) | |
initialValues |
IVolumeInitialValues | No | (default: {}) |
getBounds
Get the bounds for this mapper as [xmin, xmax, ymin, ymax,zmin, zmax].
getBoundsByReference
Get the bounds as [xmin, xmax, ymin, ymax, zmin, zmax].
getMTime
Get the Modified Time
which is a monotonic increasing integer
global for all vtkObjects.
This allow to solve a question such as:
- Is that object created/modified after another one?
- Do I need to re-execute this filter, or not? …
getMapper
Get the volume mapper
getProperty
Get the volume property
getRedrawMTime
Get the mtime of anything that would cause the rendered image to appear
differently
getVolumes
For some exporters and other other operations we must be able to collect
all the actors or volumes.
makeProperty
Create a new property suitable for use with this type of Actor.
Argument | Type | Required | Description |
---|---|---|---|
initialValues |
IVolumePropertyInitialValues | No | (default: {}) |
newInstance
Method use to create a new instance of vtkVolume
setMapper
Set the volume mapper
Argument | Type | Required | Description |
---|---|---|---|
mapper |
vtkVolumeMapper | Yes |
setProperty
Set the volume property
Argument | Type | Required | Description |
---|---|---|---|
property |
vtkVolumeProperty | Yes |
Source
import { Bounds, Nullable } from '../../../types'; |
import { vec3, mat4 } from 'gl-matrix'; |