[vtkusers] Joining two images
David Gobbi
dgobbi at irus.rri.ca
Wed Sep 19 00:47:47 EDT 2001
Hi David,
By default, vtkImageReslice will automatically adjust
the Origin of the output so that the output image
is centered. This is useful for when people want to
do simple operations like image rotation, permuting
axes, or flipping the image but it effectively nullifies
any translation as far as the appearance of the output
image is concerned (i.e. the data coordinates of the image
have been translated, but the image looks the same).
The best thing is to set the output Spacing, Origin, and Extent
to the same as the input Spacing, Origin and Extent:
reslice->GetInput()->UpdateInformation();
reslice->SetOutputSpacing(reslice->GetInput()->GetSpacing());
reslice->SetOutputOrigin(reslice->GetInput()->GetOrigin());
reslice->SetOutputExtent(reslice->GetInput()->GetWholeExtent());
In newer versions of vtkImageReslice, a short way of doing
exactly the same thing is
reslice->SetInformationInput(reslice->GetInput());
The SetInformationInput() method is also very useful if
you want the output sampling of vtkImageReslice to match
that of of the image you are registering to, e.g.
reslice->SetInformationInput(reader2->GetOutput());
One of the confusions with the vtk imaging pipeline is
that some filters operate in terms of voxels (i.e.
structured coordinates) and some filters operate in
terms of data coordinates. In the geometry pipeline,
everything is done in data coordinates so there is
no confusion. Personally, I wish that the imaging
pipeline was the same way.
I hope this helps.
- David
--
David Gobbi, MSc dgobbi at irus.rri.ca
Advanced Imaging Research Group
Robarts Research Institute, University of Western Ontario
On Wed, 19 Sep 2001, David Pont wrote:
> I have changed my pipeline to use vtkImageBlend instead of vtkImageAppend
> and now I get some output which is almost what I want. The pipeline is:
>
> vtkTIFFReader
> vtkImageReslice
> vtkTransform::New();
> vtkTransform->RotateWXYZ( rotate_angle );
> vtkTransform->Translate( translate_X, translate_Y, 0 );
> vtkImageReslice->SetResliceTransform( above vtkTransform );
> vtkImageReslice->Update();
> vtkImageReslice->GetOutput()->GetWholeExtent();
> to obtain the outer extent for the two images.
> vtkImageConstantPad->SetOutputWholeExtent();
> with the outer extent
> vtkImageBlend
> vtkTIFFWriter
>
> The output is almost perfect: two transformed images overlayed and saved in
> a TIFF file; except that the Translate appears to do nothing. Any experts in
> Reslice know what I might be doing wrong?. I am surprised I get the Rotate
> but not the Translate. Do they need separate transforms, separate Reslices?
>
> regards
> Dave Pont
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
> _______________________________________________
> 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