[vtkusers] vtkImageReslice changes

David Gobbi dgobbi at irus.rri.on.ca
Wed May 9 16:37:25 EDT 2001

Hi Everyone,

I've made most of the changes I've planned for vtkImageReslice and
hope to be able to commit the changes soon.  I'm providing a preview
here so that people can give feedback.


First, the OutputAlwaysCenteredOnInput option is gone.  Where people
used to use it, they should instead use the new (not yet committed)
vtkImageChangeInformation class to modify the data Origin in order to
center their image:

  vtkImageChangeInformation centerImage
  centerImage SetInput [whatever GetOutput]
  centerImage CenterImageOn

  vtkTransform transform
  transform RotateZ 45

  vtkImageReslice reslice
  reslice SetTransform transform
  reslice SetInput [centerImage GetOutput]

I think that this should satisfy any people who are currently
using OutputCenteredOnInput, particularly because not only
will rotation and scale occur as most people will expect
(i.e. about the center of the image) but translation will as well.


Next, the whole system by which the default Extent, Origin and
Spacing of the output were chosen has been overhauled.  Previously
the defaults were generally not useful to people, and I was
continuously telling everyone to explicitly set the
OutputSpacing, OutputExtent and OutputOrigin.  Hopefully
this will no longer be necessary (and everyone who listened
to me will have 100% backwards compatibility).


I've done some tweaking to the interface to make the interface
as task-centric as possible.  Previously my goal was to have
the interface as abstract and general as possible, but .. um ..
most VTK users are not as abstract as I am.

The tasks that I've identified are:

a) standard photoshop-style rotation, scale and translation
   (i.e. where people don't give a darn about voxel spacings or
   origins or weird stuff like that -- a voxel is a voxel dammit!)

b) resampling of data sets for e.g. image registration or overlay,
   where voxel spacing & origin are all-important -- this includes
   the application of warp transformations to the image

c) extraction of arbitrary slices from a volume, which can be
   easily used in conjunction with a) or b) above or simply by

To facilitate b) above, there is a new method called
SetInformationInput(anotherImage) that allows you to resample
one image so that it has the same origin, extent and spacing
as another image.

To facilitate c) above, I've added convenient methods for
specifying the orientation of the slice that you want to
extract via a set of direction cosines, and for specifying
the position of the slice via a translation vector.  This
was already possible via the ResliceAxes, but it was a little
hard for people to figure out the best way to do it.

That covers most of the changes.  Any comments are welcome.
I hope to have it ready to commit soon.   I can send the .h
file to anyone who wants more detailed info.

 - David

  David Gobbi, MSc                    dgobbi at irus.rri.on.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario

More information about the vtkusers mailing list