FreeMat: vtkVolumeTextureMapper3D

FreeMat

- Main Page
- Related Pages

vtkVolumeTextureMapper3D

Section: Visualization Toolkit Volume Rendering Classes

# Usage

vtkVolumeTextureMapper3D renders a volume using 3D texture mapping. This class is actually an abstract superclass - with all the actual work done by vtkOpenGLVolumeTextureMapper3D.

This mappers currently supports:

- any data type as input
- one component, or two or four non-independent components
- composite blending
- intermixed opaque geometry
- multiple volumes can be rendered if they can be sorted into back-to-front order (use the vtkFrustumCoverageCuller)

This mapper does not support:

- more than one independent component
- maximum intensity projection

Internally, this mapper will potentially change the resolution of the input data. The data will be resampled to be a power of two in each direction, and also no greater than 128*256*256 voxels (any aspect) for one or two component data, or 128*128*256 voxels (any aspect) for four component data. The limits are currently hardcoded after a check using the GL_PROXY_TEXTURE3D because some graphics drivers were always responding "yes" to the proxy call despite not being able to allocate that much texture memory.

Currently, calculations are computed using 8 bits per RGBA channel. In the future this should be expanded to handle newer boards that can support 15 bit float compositing.

This mapper supports two main families of graphics hardware: nvidia and ATI. There are two different implementations of 3D texture mapping used - one based on nvidia's GL_NV_texture_shader2 and GL_NV_register_combiners2 extension, and one based on ATI's GL_ATI_fragment_shader (supported also by some nvidia boards) To use this class in an application that will run on various hardware configurations, you should have a back-up volume rendering method. You should create a vtkVolumeTextureMapper3D, assign its input, make sure you have a current OpenGL context (you've rendered at least once), then call IsRenderSupported with a vtkVolumeProperty as an argument. This method will return 0 if the input has more than one independent component, or if the graphics hardware does not support the set of required extensions for using at least one of the two implemented methods (nvidia or ati)

.SECTION Thanks Thanks to Alexandre Gouaillard at the Megason Lab, Department of Systems Biology, Harvard Medical School https://wiki.med.harvard.edu/SysBio/Megason/ for the idea and initial patch to speed-up rendering with compressed textures.

To create an instance of class vtkVolumeTextureMapper3D, simply invoke its constructor as follows

      obj = vtkVolumeTextureMapper3D

# Methods

The class vtkVolumeTextureMapper3D has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkVolumeTextureMapper3D class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkVolumeTextureMapper3D = obj.NewInstance ()`
- `vtkVolumeTextureMapper3D = obj.SafeDownCast (vtkObject o)`
- `obj.SetSampleDistance (float )` - The distance at which to space sampling planes. This may not be honored for interactive renders. An interactive render is defined as one that has less than 1 second of allocated render time.
- `float = obj.GetSampleDistance ()` - The distance at which to space sampling planes. This may not be honored for interactive renders. An interactive render is defined as one that has less than 1 second of allocated render time.
- `int = obj. GetVolumeDimensions ()` - These are the dimensions of the 3D texture
- `float = obj. GetVolumeSpacing ()` - This is the spacing of the 3D texture
- `int = obj.IsRenderSupported (vtkVolumeProperty )` - Based on hardware and properties, we may or may not be able to render using 3D texture mapping. This indicates if 3D texture mapping is supported by the hardware, and if the other extensions necessary to support the specific properties are available.
- `int = obj.GetNumberOfPolygons ()` - Allow access to the number of polygons used for the rendering.
- `float = obj.GetActualSampleDistance ()` - Allow access to the actual sample distance used to render the image.
- `obj.SetPreferredRenderMethod (int )` - Set the preferred render method. If it is supported, this one will be used. Don't allow ATI_METHOD - it is not actually supported.
- `int = obj.GetPreferredRenderMethodMinValue ()` - Set the preferred render method. If it is supported, this one will be used. Don't allow ATI_METHOD - it is not actually supported.
- `int = obj.GetPreferredRenderMethodMaxValue ()` - Set the preferred render method. If it is supported, this one will be used. Don't allow ATI_METHOD - it is not actually supported.
- `obj.SetPreferredMethodToFragmentProgram ()` - Set the preferred render method. If it is supported, this one will be used. Don't allow ATI_METHOD - it is not actually supported.
- `obj.SetPreferredMethodToNVidia ()` - Set the preferred render method. If it is supported, this one will be used. Don't allow ATI_METHOD - it is not actually supported.
- `int = obj.GetPreferredRenderMethod ()` - Set the preferred render method. If it is supported, this one will be used. Don't allow ATI_METHOD - it is not actually supported.
- `obj.SetUseCompressedTexture (bool )` - Set/Get if the mapper use compressed textures (if supported by the hardware). Initial value is false. There are two reasons to use compressed textures: 1. rendering can be 4 times faster. 2. It saves some VRAM. There is one reason to not use compressed textures: quality may be lower than with uncompressed textures.
- `bool = obj.GetUseCompressedTexture ()` - Set/Get if the mapper use compressed textures (if supported by the hardware). Initial value is false. There are two reasons to use compressed textures: 1. rendering can be 4 times faster. 2. It saves some VRAM. There is one reason to not use compressed textures: quality may be lower than with uncompressed textures.