[Insight-users] strange "errors " with TransformPoint() of VersorRigid3DTransform

Luis Ibanez luis.ibanez at kitware.com
Thu May 6 10:16:11 EDT 2010


Hi Peter,

Please look at the ITK Software Guide

   http://www.itk.org/ItkSoftwareGuide.pdf


In particular the "Image Registration" chapter.

and pay special attention to section

  8.3.1. "Direction of the Transform Mapping"

in pdf-page 358.


You will see that the Transform computed
by the registration framework is one that
maps points from the physical space of the
Fixed image to the physical space of the
Moving image.


In your case, it seems that you want to
map points from the physical space of
the Moving image, into the physical space
of the Fixed image. Therefore you should
use the inverse of the transform that you
get from the image registration process.


Also, please make sure that the points are
actually representing physical coordinates,
and not image indexes.


     Regards,


           Luis


-------------------------------------------------------------------
On Tue, May 4, 2010 at 7:56 AM, Peter Varga <vpeter at ilsb.tuwien.ac.at>wrote:

> Dear Dr. Ibanez,
>
> I would have a question regarding the VersorRigid3DTransform of ITK.
> Let's say I registered two images and I'd like to apply the evaluated
> transformation to a point could (which is prepared from the movingImage
> outside of ITK before the registration task and read in as an input).
>
> So the usual thing:The relevant parts of the code are the following:
>
>  typedef itk::VersorRigid3DTransform< double >          TransformType;
>  TransformType::Pointer      transform     = TransformType::New();
>  registration->SetTransform(     transform     );
>
> then the transform is initialized,
>
>  registration->SetInitialTransformParameters( transform->GetParameters() );
>
> then the registration is executed,
>
>  OptimizerType::ParametersType finalParameters =
> registration->GetLastTransformParameters();
>  transform->SetParameters( finalParameters );
>
> then a resampler is applied to the movingImage, with
>
>  finalResampler->SetTransform( transform );
>
> then I read in a pointSet from an ASCII file (movingMeshPointSet) and would
> like to apply the above evaluated transformation on this pointSet
>
>  TransformType::Pointer      pointTransform     = TransformType::New();
>  pointTransform->SetCenter( transform->GetCenter() );
>  pointTransform->SetParameters( transform->GetParameters() );
>
>  PointSetType::Pointer outputMeshPointSet = PointSetType::New();
>  PointsContainer::Pointer outputMeshPointContainer =
> PointsContainer::New();
>  PointType outputMeshPoint;
>
>  for(int i = 0; i < movingMeshPointSet->GetNumberOfPoints(); i++)
>   {
>   movingMeshPointSet->GetPoint( i, &movingMeshPoint );
>   outputMeshPoint =  pointTransform->TransformPoint( movingMeshPoint );
>   outputMeshPointContainer->InsertElement( i, outputMeshPoint );
>   }
>  outputMeshPointSet->SetPoints(outputMeshPointContainer);
>
>
> OK, sorry for the long intro, the question is the following:
> If I understand it right, "transform" and "pointTransform " should be the
> same transformations.
> When running this code through several examples, I experienced something
> really weird: in some cases it worked really nicely, the mesh (point could)
> was transformed exactly as the movingImage. BUT in other cases (and I cannot
> find a rule for that) I had to invert (*(-1)) the rotation or the
> translation (or both) parts of the transformation to get the correct result.
> I guess the "transform->TransformPoint()" command should do the same thing
> that a resampling filter with the "transform" taken in the
> "->SetTransform()"....
> Or is it related to the fact that in the registration the inverse
> transformation is evaluated (that maps fixedImage=>movingImage)? Still it
> should be consistent.
>
> Just one more sentence: I have similar problems in the inverse case:
> there's an application where I estimate the transformation using PC2PC
> registration of meshes and apply that on the corresponding movingImage ---
> in some cases copying the parameters of the PC2PC transformation provided
> the correct results, in other cases I had to use  -1*parameters to have it
> right... strange...
>
> Maybe I did something wrong... but I don't get how I could get the correct
> results in some cases and not in the others.
>
> Thank you very much for your answer in advance!
>
> Best regards,
> Peter
>
> --
> Peter Varga
> Institute for Lightweight Design and Structural Biomechanics
> Vienna University of Technology (TU-Wien)
> Gusshausstrasse 27-29
> A-1040 Vienna
> Austria
> Tel. +43 1 58801 317 32
> Fax +43 1 58801 317 99
> E-mail: vpeter at ilsb.tuwien.ac.at
> DVR: 0005886
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100506/a28c35cb/attachment-0001.htm>


More information about the Insight-users mailing list