[vtkusers] Adjusting vtkImageReslice extent when slicing a volume

David Gobbi dgobbi at irus.rri.on.ca
Mon Aug 21 12:05:08 EDT 2000


Hi Jim,

Since you are planning to apply a fourier transform to the resulting
slice (and assuming that you care about performance) it really is a
good idea to set an output extent that is a power of 2 in each direction
rather than to have the extent automatically chosen for you.

Also, since you are always going to want the slice to intersect the centre
of the volume things get a little easier.  Here are a few notes that might
help:

- the ResliceTransform should only perform rotation, no translation
- Reslice->OutputSpacing should be set the same as the spacing of the
  input FT volume
- Reslice->OutputExtent should be e.g. (0,255,0,255,0,0) to give you
  a power of two in X and Y
- Reslice->OutputOrigin should be e.g. (-127.5,-127.5,0) which puts
  coordinate (0.0, 0.0, 0.0) at the centre of the output slice
- Reslice->SetInterpolationModeToLinear() should be used

Also,

- coordinate (0.0, 0.0, 0.0) must lie at the centre of the input FT
  volume (you should compute this from the Spacing, Origin and WholeExtent
  of the input volume to ensure that this is so)

Final note: The OutputOrigin above might be out by half a voxel depending
on where the FFT filter puts (0.0, 0.0, 0.0) at the center or at the
edge of a voxel -- if at the center, then e.g. OutputOrigin(-127,-127,0)
should be used if the OutputExtent is (0,255,0,255,0,0)

Hope this helps.  Remember that the data coordinates (x,y,z) and the
voxel indices (i,j,k) are _not_ the same thing.  If you aren't comfortable
converting from one to the other, then here are the equations (these 
equations are very important for anyone who uses the VTK imaging pipeline
or vtkStructuredPoints data sets)

 x = origin[0] + i*spacing[0]
 y = origin[1] + j*spacing[1]
 z = origin[2] + k*spacing[2]

center[0] = origin[0] + 0.5*(wholeExtent[0] + wholeExtent[1])*spacing[0]
center[1] = origin[1] + 0.5*(wholeExtent[2] + wholeExtent[3])*spacing[1]
center[2] = origin[2] + 0.5*(wholeExtent[4] + wholeExtent[5])*spacing[2]

 - David

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

On Fri, 18 Aug 2000, Jim Morash wrote:

> 
> Hi,
> I'm using vtkImageReslice to take an oblique slice through a volume of
> data. The user interface includes controls to adjust the x,y and z
> rotation of the slice plane. Since the behavior, coordinate-wise, of the
> slice plane is somewhat confusing, I have not had a great deal of luck
> in trying to write the code to adjust the origin and extents myself. I
> have tried using the command
> "vtkImageReslice::OutputAlwaysCenteredOnInputOn", which results in an
> automatic adjustment of the slice plane to be a rectangular volume
> always large enough to enclose the data volume, no matter what its
> rotation (ie, tangent to the corners of the data volume). Is it possible
> to tell the vtkImageReslice that I am perfectly happy with its
> auto-adjusting capabilities, but that I only want it to be
> two-dimensional?
> thanks
> --Jim Morash
> 
> jmorash at mit.edu                     http://web.mit.edu/jmorash/www
> ------------------------------------------------------------------
> The universe is an archipelago, with small islands of habitable
> ground separated by vast seas of space.  --Freeman Dyson
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
> 





More information about the vtkusers mailing list