Introduction
vtkVolumeMapper inherits from vtkMapper.
A volume mapper that performs ray casting on the GPU using fragment programs.
Methods
createRadonTransferFunction
Create an absorption transfer function to set to the mapper when blend mode is RADON.
The transfer function is a linear ramp between the lowest material with absorption and
the material with maximum absorption. Voxel values lower than the lowest material with
absorption will have no absorption associated. Voxel values higher than the maximum
absorbent material will have the same absorption than the max absorbent material.
The associated color transfer function is typically black to white between 0 and 1.
An alternative is to create your own transfer function with HU/absorption pairs. e.g.
const ofun = vtkPiecewiseFunction.newInstance();
ofun.addPointLong(-1000,0, 1, 1); // air, “1, 1)” to flatten the function
ofun.addPoint(-10, 0.01); // fat
ofun.addPoint(-10, 0.015); // water
ofun.addPointLong(1000, 0.03, 1, 1); // bone
ofun.addPoint(3000, 1); // silver
Argument | Type | Required | Description |
---|---|---|---|
firstAbsorbentMaterialHounsfieldValue: |
number | Yes | Define minimum voxel value (in hounsfield unit) with non zero absorption (e.g. water (0), fat(-10)…). Any voxel value lower than this parameter will have no absorption (absorption === 0) |
firstAbsorbentMaterialAbsorption: |
number | Yes | Absorption attributed to voxels with firstAbsorbentMaterialHounsfieldValue (e.g. 0 or 0.01) |
maxAbsorbentMaterialHounsfieldValue: |
number | Yes | Define maximum voxel value (in hounsfield unit) with increasing absorption (e.g. bone (1000)) |
maxAbsorbentMaterialAbsorption: |
number | Yes | Absorption attributed to voxels >= maxAbsorbentMaterialHounsfieldValue (e.g. 0.03) |
outputTransferFunction: |
vtkPiecewiseFunction | Yes | To provide optionally to avoid instantiating a new transfer function each time. |
extend
Method use to decorate a given object (publicAPI+model) with vtkVolumeMapper 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 |
IVolumeMapperInitialValues | No | (default: {}) |
getAnisotropy
Get anisotropy of volume shadow scatter
getAutoAdjustSampleDistances
getAverageIPScalarRange
getAverageIPScalarRangeByReference
getBlendMode
getBlendModeAsString
getBounds
Get the bounds for this mapper as [xmin, xmax, ymin, ymax,zmin, zmax].
getGlobalIlluminationReach
Get the global illumination reach of volume shadow
getImageSampleDistance
Sampling distance in the XY image dimensions.
Default value of 1 meaning 1 ray cast per pixel. If set to 0.5, 4 rays will be cast per pixel.
If set to 2.0, 1 ray will be cast for every 4 (2 by 2) pixels. T
getInitialInteractionScale
Get at what scale the quality is reduced when interacting for the first time with the volume
It should should be set before any call to render for this volume
The higher the scale is, the lower the quality of rendering is during interaction
getInteractionSampleDistanceFactor
Get by how much the sample distance should be increased when interacting
This feature is only implemented in the OpenGL volume mapper
getLAOKernelRadius
Get kernel radius for local ambient occlusion
getLAOKernelSize
Get kernel size for local ambient occlusion
getLocalAmbientOcclusion
Get local ambient occlusion flag
getMaximumSamplesPerRay
getSampleDistance
Get the distance between samples used for rendering
getUpdatedExtents
Retrieves the updated extents.
This array is cleared after every successful render.
getVolumeShadowSamplingDistFactor
Get the multipler for volume shadow sampling distance
getVolumetricScatteringBlending
Get the blending coefficient that interpolates between surface and volume rendering
newInstance
Method use to create a new instance of vtkVolumeMapper
setAnisotropy
Set anisotropy of volume shadow scatter. This function is only effective when volumeScatterBlendCoef is greater than 0.
Default value of 0.0 means light scatters uniformly in all directions.
Value of -1.0 means light scatters backward, value of 1.0 means light scatters forward.
Argument | Type | Required | Description |
---|---|---|---|
anisotropy |
Yes |
setAutoAdjustSampleDistances
Argument | Type | Required | Description |
---|---|---|---|
autoAdjustSampleDistances |
Yes |
setAverageIPScalarRange
Argument | Type | Required | Description |
---|---|---|---|
x |
Yes | ||
y |
Yes |
setAverageIPScalarRangeFrom
Argument | Type | Required | Description |
---|---|---|---|
averageIPScalarRange |
Range | Yes |
setBlendMode
Set blend mode to COMPOSITE_BLEND
Argument | Type | Required | Description |
---|---|---|---|
blendMode |
BlendMode | Yes |
setBlendModeToAverageIntensity
Set blend mode to AVERAGE_INTENSITY_BLEND
setBlendModeToComposite
Set blend mode to COMPOSITE_BLEND
setBlendModeToMaximumIntensity
Set blend mode to MAXIMUM_INTENSITY_BLEND
setBlendModeToMinimumIntensity
Set blend mode to MINIMUM_INTENSITY_BLEND
setBlendModeToRadonTransform
Set blend mode to RADON_TRANSFORM_BLEND
setComputeNormalFromOpacity
Set the normal computation to be dependent on the transfer function.
By default, the mapper relies on the scalar gradient for computing normals at sample locations
for lighting calculations. This is an approximation and can lead to inaccurate results.
When enabled, this property makes the mapper compute normals based on the accumulated opacity
at sample locations. This can generate a more accurate representation of edge structures in the
data but adds an overhead and drops frame rate.
Argument | Type | Required | Description |
---|---|---|---|
computeNormalFromOpacity |
Yes |
setGlobalIlluminationReach
Set the global illumination reach of volume shadow. This function is only effective when volumeScatterBlendCoef is greater than 0.
Default value of 0.0 means only the neighboring voxel is considered when creating global shadow.
Value of 1.0 means the shadow ray traverses through the entire volume.
Argument | Type | Required | Description |
---|---|---|---|
globalIlluminationReach |
Yes |
setImageSampleDistance
Argument | Type | Required | Description |
---|---|---|---|
imageSampleDistance |
Yes |
setInitialInteractionScale
Argument | Type | Required | Description |
---|---|---|---|
initialInteractionScale |
Yes |
setInteractionSampleDistanceFactor
Argument | Type | Required | Description |
---|---|---|---|
interactionSampleDistanceFactor |
Yes |
setLAOKernelRadius
Set kernel radius for local ambient occlusion. It specifies the number of samples that are considered on each random ray.
Value must be greater than or equal to 1.
Argument | Type | Required | Description |
---|---|---|---|
LAOKernelRadius |
Yes |
setLAOKernelRadius
Set kernel radius for local ambient occlusion. It specifies the number of samples that are considered on each random ray.
Value must be greater than or equal to 1.
Argument | Type | Required | Description |
---|---|---|---|
LAOKernelRadius |
Yes |
setLAOKernelSize
Set kernel size for local ambient occlusion. It specifies the number of rays that are randomly sampled in the hemisphere.
Value is clipped between 1 and 32.
Argument | Type | Required | Description |
---|---|---|---|
LAOKernelSize |
Yes |
setLAOKernelSize
Set kernel size for local ambient occlusion. It specifies the number of rays that are randomly sampled in the hemisphere.
Value is clipped between 1 and 32.
Argument | Type | Required | Description |
---|---|---|---|
LAOKernelSize |
Yes |
setLocalAmbientOcclusion
Set whether to turn on local ambient occlusion (LAO). LAO is only effective if shading is on and volumeScatterBlendCoef is set to 0.
LAO effect is added to ambient lighting, so the ambient component of the actor needs to be great than 0.
Argument | Type | Required | Description |
---|---|---|---|
localAmbientOcclusion |
Yes |
setMaximumSamplesPerRay
Argument | Type | Required | Description |
---|---|---|---|
maximumSamplesPerRay |
Yes |
setSampleDistance
Get the distance between samples used for rendering
Argument | Type | Required | Description |
---|---|---|---|
sampleDistance |
Yes |
setUpdatedExtents
Tells the mapper to only update the specified extents.
If there are zero extents, the mapper updates the entire volume texture.
Otherwise, the mapper will only update the texture by the specified extents
during the next render call.
This array is cleared after a successful render.
Argument | Type | Required | Description |
---|---|---|---|
extents |
Yes |
setVolumeShadowSamplingDistFactor
Set the multipler for volume shadow sampling distance. This function is only effective when volumeScatterBlendCoef is greater than 0.
For VSSampleDistanceFactor >= 1.0, volume shadow sampling distance = VSSampleDistanceFactor * SampleDistance.
Argument | Type | Required | Description |
---|---|---|---|
VSSampleDistanceFactor |
Yes |
setVolumetricScatteringBlending
Set the blending coefficient that determines the interpolation between surface and volume rendering.
Default value of 0.0 means shadow effect is computed with phong model.
Value of 1.0 means shadow is created by volume occlusion.
Argument | Type | Required | Description |
---|---|---|---|
volumeScatterBlendCoef |
Yes |
update
Source
export declare enum BlendMode { |
export const BlendMode = { |
import vtkPiecewiseFunction from '../../../Common/DataModel/PiecewiseFunction'; |
import macro from 'vtk.js/Sources/macros'; |