[vtkusers] Announcement: New image rendering classes for VTK

David Gobbi david.gobbi at gmail.com
Sun Jun 26 18:15:52 EDT 2011


I'm pleased to announce that I have finally completed my work on several new
image rendering classes for VTK.  They are in the VTK git development tree,
and a few of you have already tried them out (if you are one of those
people, note that several feature and performance enhancements were added
last week).  More info can be found at the following wiki page:

http://www.vtk.org/Wiki/VTK/Image_Rendering_Classes

In brief, these classes replace vtkImageActor and provide a much higher
level of functionality.  They are new VTK actor and mapper classes
specifically meant for image viewing.  What they are not: they are not
widgets or viewers, although they provide machinery that can be used to
write widget and viewer classes.  In other words, they are meant for people
who like to roll their own image viewers.

The three new classes that I recommend for people to use are the following:
vtkImageSlice - the new actor class for images
vtkImageResliceMapper - mapper for drawing images for MPR viewers
vtkImageProperty - for controlling lookup tables, window/level, opacity, etc

Typical use cases:

1) For an MPR viewer, use vtkInteractorStyleImage and set it to your desired
view orientation. Then set the following properties in
vtkImageResliceMapper:
mapper->SliceFacesCameraOn()
mapper->SliceAtFocalPointOn()
The interactor will then allow you to pan, zoom, window/level, and (in 3D
mode) rotate and slice.  See
VTK/Examples/ImageProcessing/ImageInteractorReslice.py for an example.

2) For a 3D ortho object, use multiple vtkImageResliceMapper objects, and
for each one make a vtkPlane that describes the normal and position of the
slice to extract. Then call these methods:
mapper->SetSlicePlane(plane)
mapper->ResampleToScreenPixelsOff()
Turning the "ResampleToScreenPixels" option Off makes rotation faster, so it
is recommended when rotations are going to be common operations.  Example:
VTK/Rendering/Testing/Cxx/TestImageResliceMapperOffAxis.cxx

Features:
1) oblique views (obviously!)
2) nearest-neighbor, linear, and cubic interpolation
3) modify image orientation with respect to world coords by setting
vtkImageSlice's UserMatrix
4) fully multi-threaded reslicing and color mapping operations
5) streaming, i.e. only pulls the data needed for rendering
6) works well with very large images (as long as they fit in memory)
7) LOD-style interaction (switches to faster rendering for interaction)
8) blend images by adding multiple vtkImageSlice objects to a vtkImageStack
9) checkerboard images by setting "CheckerboardOn" in the vtkImageProperty
10) thick-slab views (see vtkImageResliceMapper for details)
11) works with vtkCellPicker for picking image voxels as points or cells

For large image viewing, on a 4GB computer (64-bit OS X) I've displayed
images up to 3GB in size with full interactivity, but YMMV.  As long as the
mapper's ResampleToScreenPixels option is On, the mapper will never try to
load the full image onto the GPU (which is what causes the vtkImageActor to
be slow for large images).  The size of the images that you can display is
limited only by main memory, I have displayed stacks of RGB images that are
10000x10000 pixels in size.

I do not plan to push these into the VTK 5.8 release (even if Kitware were
to give me the go-ahead), because the VTK development tree has diverged too
far from the VTK 5.8 release tree.  These new image classes are only
possible due to recent improvements that I've made to the picker, lookup
table, and image reslice classes and they probably depend on a handful of
recent changes made by other people, as well.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110626/e63924f0/attachment.htm>


More information about the vtkusers mailing list