#include <vtkSmartVolumeMapper.h>
vtkSmartVolumeMapper is a volume mapper that will delegate to a specific volume mapper based on rendering parameters and available hardware. Use the SetRequestedRenderMode() method to control the behavior of the selection. The following options are available:
vtkSmartVolumeMapper::DefaultRenderMode: Allow the vtkSmartVolumeMapper to select the best mapper based on rendering parameters and hardware support. If GPU ray casting is supported, this mapper will be used for all rendering. If not, then if 3D texture mapping is supported, it will be used for interactive rendering and the vtkFixedPointRayCastMapper will be used for still rendering. If 3D texture mapping is not supported, then the vtkFixedPointRayCastMapper will be used exclusively. This is the default requested render mode, and is generally the best option. When you use this option, your volume will always be rendered, but the method used to render it may vary based on parameters and platform.
vtkSmartVolumeMapper::RayCastAndTextureRenderMode: Use the vtkVolumeTextureMapper3D for interactive rendering, and the vtkFixedPointVolumeRayCastMapper for still renders. If 3D texture mapping is not supported, then the ray caster will be used exclusively. When you use this option your volume will always be rendered, but the method used for interactive rendering will vary based on parameters and platform. The decision on whether a particular render is interactive or still is based on the adjustable parameter InteractiveUpdateRate. If the DesiredUpdateRate found in the vtkRenderWindow that initiated the Render is at or above the InteractiveUpdateRate value, then the render is considered interactive, otherwise it is considered a still render.
vtkSmartVolumeMapper::RayCastRenderMode: Use the vtkFixedPointVolumeRayCastMapper for both interactive and still rendering. When you use this option your volume will always be rendered with the vtkFixedPointVolumeRayCastMapper.
vtkSmartVolumeMapper::TextureRenderMode: Use the vtkVolumeTextureMapper3D, if supported, for both interactive and still rendering. If 3D texture mapping is not supported (either by the hardware, or due to the rendering parameters) then no image will be rendered. Use this option only if you have already checked for support based on the current hardware, number of scalar components, and rendering parameters in the vtkVolumeProperty. Also note that the vtkVolumeTextureMapper3D does not support window / level operations on the final image, so FinalColorWindow must be at the default value of 1.0 and FinalColorLevel must be at the default value of 0.5.
vtkSmartVolumeMapper::GPURenderMode: Use the vtkGPUVolumeRayCastMapper, if supported, for both interactive and still rendering. If the GPU ray caster is not supported (due to hardware limitations or rendering parameters) then no image will be rendered. Use this option only if you have already checked for supported based on the current hardware, number of scalar components, and rendering parameters in the vtkVolumeProperty.
You can adjust the contrast and brightness in the rendered image using the FinalColorWindow and FinalColorLevel ivars. By default the FinalColorWindow is set to 1.0, and the FinalColorLevel is set to 0.5, which applies no correction to the computed image. To apply the window / level operation to the computer image color, first a Scale and Bias value are computed:
scale = 1.0 / this->FinalColorWindow bias = 0.5 - this->FinalColorLevel / this->FinalColorWindow
To compute a new color (R', G', B', A') from an existing color (R,G,B,A) for a pixel, the following equation is used:
R' = R*scale + bias*A G' = G*scale + bias*A B' = B*scale + bias*A A' = A
Note that bias is multiplied by the alpha component before adding because the red, green, and blue component of the color are already pre-multiplied by alpha. Also note that the window / level operation leaves the alpha component unchanged - it only adjusts the RGB values.
-----------------------------------------------------------------------------
Definition at line 123 of file vtkSmartVolumeMapper.h.
anonymous enum |
DefaultRenderMode | |
RayCastAndTextureRenderMode | |
RayCastRenderMode | |
TextureRenderMode | |
GPURenderMode | |
UndefinedRenderMode | |
InvalidRenderMode |
Definition at line 160 of file vtkSmartVolumeMapper.h.
vtkSmartVolumeMapper::vtkSmartVolumeMapper | ( | ) | [protected] |
vtkSmartVolumeMapper::~vtkSmartVolumeMapper | ( | ) | [protected] |
static vtkSmartVolumeMapper* vtkSmartVolumeMapper::New | ( | ) | [static] |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
Reimplemented from vtkAlgorithm.
virtual const char* vtkSmartVolumeMapper::GetClassName | ( | ) | [virtual] |
Reimplemented from vtkVolumeMapper.
static int vtkSmartVolumeMapper::IsTypeOf | ( | const char * | name | ) | [static] |
Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkVolumeMapper.
virtual int vtkSmartVolumeMapper::IsA | ( | const char * | name | ) | [virtual] |
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkVolumeMapper.
static vtkSmartVolumeMapper* vtkSmartVolumeMapper::SafeDownCast | ( | vtkObject * | o | ) | [static] |
Reimplemented from vtkVolumeMapper.
void vtkSmartVolumeMapper::PrintSelf | ( | ostream & | os, | |
vtkIndent | indent | |||
) | [virtual] |
Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from vtkVolumeMapper.
virtual void vtkSmartVolumeMapper::SetFinalColorWindow | ( | float | ) | [virtual] |
Set the final color window. This controls the contrast of the image. The default value is 1.0. The Window can be negative (this causes a "negative" effect on the image) Although Window can be set to 0.0, any value less than 0.00001 and greater than or equal to 0.0 will be set to 0.00001, and any value greater than -0.00001 but less than or equal to 0.0 will be set to -0.00001. Initial value is 1.0.
virtual float vtkSmartVolumeMapper::GetFinalColorWindow | ( | ) | [virtual] |
Get the final color window. Initial value is 1.0.
virtual void vtkSmartVolumeMapper::SetFinalColorLevel | ( | float | ) | [virtual] |
Set the final color level. The level controls the brightness of the image. The final color window will be centered at the final color level, and together represent a linear remapping of color values. The default value for the level is 0.5.
virtual float vtkSmartVolumeMapper::GetFinalColorLevel | ( | ) | [virtual] |
Get the final color level.
void vtkSmartVolumeMapper::SetRequestedRenderMode | ( | int | mode | ) |
Set the requested render mode. The default is vtkSmartVolumeMapper::DefaultRenderMode.
void vtkSmartVolumeMapper::SetRequestedRenderModeToDefault | ( | ) |
Set the requested render mode to vtkSmartVolumeMapper::DefaultRenderMode. This is the best option for an application that must adapt to different data types, harware, and rendering parameters.
void vtkSmartVolumeMapper::SetRequestedRenderModeToRayCastAndTexture | ( | ) |
Set the requested render mode to vtkSmartVolumeMapper::RayCastAndTextureRenderMode. This is a good option if you want to avoid using advanced OpenGL functionality, but would still like to used 3D texture mapping, if available, for interactive rendering.
void vtkSmartVolumeMapper::SetRequestedRenderModeToRayCast | ( | ) |
Set the requested render mode to vtkSmartVolumeMapper::RayCastRenderMode. This option will use software rendering exclusively. This is a good option if you know there is no hardware acceleration.
virtual int vtkSmartVolumeMapper::GetRequestedRenderMode | ( | ) | [virtual] |
Get the requested render mode.
virtual void vtkSmartVolumeMapper::SetInteractiveUpdateRate | ( | double | ) | [virtual] |
Set the rate at or above this render will be considered interactive. If the DesiredUpdateRate of the vtkRenderWindow that caused the Render falls at or above this rate, the render is considered interactive and the mapper may be adjusted (depending on the render mode). Initial value is 1.0e-5.
virtual double vtkSmartVolumeMapper::GetInteractiveUpdateRate | ( | ) | [virtual] |
Get the update rate at or above which this is considered an interactive render. Initial value is 1.0e-5.
int vtkSmartVolumeMapper::GetLastUsedRenderMode | ( | ) |
This will return the render mode used during the previous call to Render().
virtual void vtkSmartVolumeMapper::SetMaxMemoryInBytes | ( | vtkIdType | ) | [virtual] |
Value passed to the GPU mapper. Ignored by other mappers. Maximum size of the 3D texture in GPU memory. Will default to the size computed from the graphics card. Can be adjusted by the user. Useful if the automatic detection is defective or missing.
virtual vtkIdType vtkSmartVolumeMapper::GetMaxMemoryInBytes | ( | ) | [virtual] |
Value passed to the GPU mapper. Ignored by other mappers. Maximum size of the 3D texture in GPU memory. Will default to the size computed from the graphics card. Can be adjusted by the user. Useful if the automatic detection is defective or missing.
virtual void vtkSmartVolumeMapper::SetMaxMemoryFraction | ( | float | ) | [virtual] |
Value passed to the GPU mapper. Ignored by other mappers. Maximum fraction of the MaxMemoryInBytes that should be used to hold the texture. Valid values are 0.1 to 1.0.
virtual float vtkSmartVolumeMapper::GetMaxMemoryFraction | ( | ) | [virtual] |
Value passed to the GPU mapper. Ignored by other mappers. Maximum fraction of the MaxMemoryInBytes that should be used to hold the texture. Valid values are 0.1 to 1.0.
virtual void vtkSmartVolumeMapper::SetInterpolationMode | ( | int | ) | [virtual] |
Set interpolation mode for downsampling (lowres GPU) (initial value: cubic).
virtual int vtkSmartVolumeMapper::GetInterpolationMode | ( | ) | [virtual] |
Set interpolation mode for downsampling (lowres GPU) (initial value: cubic).
void vtkSmartVolumeMapper::SetInterpolationModeToNearestNeighbor | ( | ) |
Set interpolation mode for downsampling (lowres GPU) (initial value: cubic).
void vtkSmartVolumeMapper::SetInterpolationModeToLinear | ( | ) |
Set interpolation mode for downsampling (lowres GPU) (initial value: cubic).
void vtkSmartVolumeMapper::SetInterpolationModeToCubic | ( | ) |
Set interpolation mode for downsampling (lowres GPU) (initial value: cubic).
void vtkSmartVolumeMapper::CreateCanonicalView | ( | vtkRenderer * | ren, | |
vtkVolume * | volume, | |||
vtkVolume * | volume2, | |||
vtkImageData * | image, | |||
int | blend_mode, | |||
double | viewDirection[3], | |||
double | viewUp[3] | |||
) |
This method can be used to render a representative view of the input data into the supplied image given the supplied blending mode, view direction, and view up vector.
void vtkSmartVolumeMapper::Render | ( | vtkRenderer * | , | |
vtkVolume * | ||||
) | [virtual] |
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Initialize rendering for this volume.
Implements vtkVolumeMapper.
void vtkSmartVolumeMapper::ReleaseGraphicsResources | ( | vtkWindow * | ) | [virtual] |
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being consumed by this mapper. The parameter window could be used to determine which graphic resources to release.
Reimplemented from vtkVolumeMapper.
void vtkSmartVolumeMapper::ConnectMapperInput | ( | vtkVolumeMapper * | m | ) | [protected] |
Connect input of the vtkSmartVolumeMapper to the input of the internal volume mapper by doing a shallow to avoid memory leaks.
void vtkSmartVolumeMapper::ConnectFilterInput | ( | vtkImageResample * | f | ) | [protected] |
Connect input of the vtkSmartVolumeMapper to the input of the internal resample filter by doing a shallow to avoid memory leaks.
void vtkSmartVolumeMapper::Initialize | ( | vtkRenderer * | ren, | |
vtkVolume * | vol | |||
) | [protected] |
void vtkSmartVolumeMapper::ComputeRenderMode | ( | vtkRenderer * | ren, | |
vtkVolume * | vol | |||
) | [protected] |
float vtkSmartVolumeMapper::FinalColorWindow [protected] |
Definition at line 290 of file vtkSmartVolumeMapper.h.
float vtkSmartVolumeMapper::FinalColorLevel [protected] |
Definition at line 291 of file vtkSmartVolumeMapper.h.
vtkIdType vtkSmartVolumeMapper::MaxMemoryInBytes [protected] |
Definition at line 294 of file vtkSmartVolumeMapper.h.
float vtkSmartVolumeMapper::MaxMemoryFraction [protected] |
Definition at line 295 of file vtkSmartVolumeMapper.h.
int vtkSmartVolumeMapper::InterpolationMode [protected] |
Definition at line 298 of file vtkSmartVolumeMapper.h.
int vtkSmartVolumeMapper::RequestedRenderMode [protected] |
Definition at line 303 of file vtkSmartVolumeMapper.h.
int vtkSmartVolumeMapper::CurrentRenderMode [protected] |
Definition at line 304 of file vtkSmartVolumeMapper.h.
int vtkSmartVolumeMapper::Initialized [protected] |
Definition at line 307 of file vtkSmartVolumeMapper.h.
Definition at line 308 of file vtkSmartVolumeMapper.h.
int vtkSmartVolumeMapper::TextureSupported [protected] |
Definition at line 309 of file vtkSmartVolumeMapper.h.
int vtkSmartVolumeMapper::GPUSupported [protected] |
Definition at line 310 of file vtkSmartVolumeMapper.h.
int vtkSmartVolumeMapper::RayCastSupported [protected] |
Definition at line 311 of file vtkSmartVolumeMapper.h.
int vtkSmartVolumeMapper::LowResGPUNecessary [protected] |
Definition at line 312 of file vtkSmartVolumeMapper.h.
vtkImageResample* vtkSmartVolumeMapper::GPUResampleFilter [protected] |
Definition at line 316 of file vtkSmartVolumeMapper.h.
double vtkSmartVolumeMapper::InteractiveUpdateRate [protected] |
Definition at line 321 of file vtkSmartVolumeMapper.h.
Definition at line 334 of file vtkSmartVolumeMapper.h.
vtkGPUVolumeRayCastMapper* vtkSmartVolumeMapper::GPUMapper [protected] |
Definition at line 335 of file vtkSmartVolumeMapper.h.
Definition at line 336 of file vtkSmartVolumeMapper.h.
Definition at line 337 of file vtkSmartVolumeMapper.h.
int vtkSmartVolumeMapper::InitializedBlendMode [protected] |
Definition at line 343 of file vtkSmartVolumeMapper.h.