[vtkusers] Joining two images

David Gobbi dgobbi at irus.rri.ca
Tue Sep 18 16:24:54 EDT 2001

Hi David,

Take a close read of the documentation for the SetResliceAxes()
and SetResliceTransform() method.

The main issue is that the Transform is applied in terms of the
data coordinates of the input voxels and output voxels, so
unless you are fairly confident about precisely what "data
coordinates" are for images you should study e.g. the
VTK User's Guide section on images.

Also, the best thing is to play with some of the tcl or python
examples that use vtkImageReslice, i.e. start with something
that works and then bend it to suit your needs (rather than
starting from scratch).

 - David

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

On Tue, 18 Sep 2001, David Pont wrote:

> Hi all,
>   I want to join two images which must be translated and rotated to be
> aligned. My pipeline begins (one per image):
>   vtkTIFFReader
>   vtkReslice     - SetOutputOrigin = translate
>     vtkTransform - RotateWXYZ      = rotate
> Then for each image I do:
>   vtkReslice->Update();
>   vtkReslice->GetOutput()->GetWholeExtent();
> to get the new extent of the images, generally increased due to rotation. I
> obtain the outer extent for the two images.
> The pipeline continues:
>   vtkConstantPad->SetOutputWholeExtent();   with the outer extent
>   vtkImageAppend - SetAppendAxis( 2 );  here the twin pipeline meets
>   vtkTIFFWriter  - SetDimensionality( 2 );
> But all I get out is a completely black image, although of a plausable size.
>   Any clues ? I have done quite a bit of vtk but never any vtkImage stuff.
>   regards
>     Dave Pont

More information about the vtkusers mailing list