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:<br>
<br><a href="http://www.vtk.org/Wiki/VTK/Image_Rendering_Classes" target="_blank">http://www.vtk.org/Wiki/VTK/Image_Rendering_Classes</a><br><br>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.<br>
<br>The three new classes that I recommend for people to use are the following:<br>vtkImageSlice - the new actor class for images<br>vtkImageResliceMapper - mapper for drawing images for MPR viewers<br>vtkImageProperty - for controlling lookup tables, window/level, opacity, etc<br>
<br>Typical use cases:<br><br>1) For an MPR viewer, use vtkInteractorStyleImage and set it to your desired view orientation. Then set the following properties in vtkImageResliceMapper:<br>mapper->SliceFacesCameraOn()<br>
mapper->SliceAtFocalPointOn()<br>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.<br><br>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:<br>
mapper->SetSlicePlane(plane) <br>mapper->ResampleToScreenPixelsOff()<br>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<br>
<br>Features:<div>1) oblique views (obviously!)<br></div><div>2) nearest-neighbor, linear, and cubic interpolation</div><div>3) modify image orientation with respect to world coords by setting vtkImageSlice's UserMatrix<br>
4) fully multi-threaded reslicing and color mapping operations</div><div>5) streaming, i.e. only pulls the data needed for rendering</div><div>6) works well with very large images (as long as they fit in memory)</div><div>
7) LOD-style interaction (switches to faster rendering for interaction)</div><div>8) blend images by adding multiple vtkImageSlice objects to a vtkImageStack<br>9) checkerboard images by setting "CheckerboardOn" in the vtkImageProperty<br>
10) thick-slab views (see vtkImageResliceMapper for details)<br>11) works with vtkCellPicker for picking image voxels as points or cells<br> <br></div><div>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.<br>
<br>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.<br>
</div><div><br></div><div> - David</div>