[Insight-users] Problem with CenteredTransformInitializer

Lodron, Gerald Gerald.Lodron at joanneum.at
Tue Nov 10 02:59:09 EST 2009


Oh I think my C++ vodoo is not good enough to fix that bug, i am only a poor user. Changes in the ITK code should really be made from someone which is knowing what he does, I would make more worse than better i think. I am currently in the learning phase and does not really know what 90 % of the code really does!

________________________________
Von: Karthik Krishnan [mailto:karthik.krishnan at kitware.com]
Gesendet: Dienstag, 10. November 2009 08:44
An: Lodron, Gerald
Cc: Luis Ibanez; Insight users (insight-users at itk.org)
Betreff: Re: [Insight-users] Problem with CenteredTransformInitializer

Yes, it appears to use some typedefs such as OffsetType specific to itk::MatrixOffsetTransformBase. Sadly, itk::TranslationTransform etc aren't derived from itk::MatrixOffsetTransformBase.

Try to add the line

  typedef OutputVectorType OffsetType;

to itk::TranslationTransform and see if it works for you. If so, please send us the patch.

thanks

On Mon, Nov 9, 2009 at 1:23 PM, Lodron, Gerald <Gerald.Lodron at joanneum.at<mailto:Gerald.Lodron at joanneum.at>> wrote:

I am not sure if i understand this CenteredTransformInitializer class, can anyone explain me why itk::CenteredTransformInitializer does work for itk::AffineTransform but not for itk::TranslationTransform or itk::ScaleTransform?

Maybe it is a bug?

Best regards!






-----Ursprüngliche Nachricht-----
Von: Luis Ibanez [mailto:luis.ibanez at kitware.com<mailto:luis.ibanez at kitware.com>]
Gesendet: Montag, 09. November 2009 01:25
An: Lodron, Gerald
Cc: Insight users (insight-users at itk.org<mailto:insight-users at itk.org>)
Betreff: Re: [Insight-users] Problem with CenteredTransformInitializer

Hi Gerald,

Please post to the mailing list the compilation error that
you get with this code.

It will make a lot easier for us to advise you if we can
see the error message.


Also,
please note that the following construction is incorrect:

  RegistrationType * m_Registration = RegistrationType::New();

It should be:

  RegistrationType::Pointer  m_Registration = RegistrationType::New();



along the same lines, the statement:

TransformType* m_Transformation =
    itk::AffineTransform<double, VImageDimension>::New();

should be

TransformType::Pointer m_Transformation =
    itk::AffineTransform<double, VImageDimension>::New();


If you don't assign a newly created ITK object to a SmartPointer,
the object will be destroyed by the next line in the code.

If you are getting run-time errors, this misuse of the New() method
may explain what is happening with your program at run-time.
Introducing a proper use of SmartPointers may fix the problem.

---

For more information about the use of SmartPointers in ITK, please
read the introductory chapters of the ITK Software Guide:

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

and the Tutorials:

          http://www.itk.org/ITK/help/tutorials.html

in particular:
http://www.itk.org/CourseWare/Training/GettingStarted-I.pdf




   Regards,


          Luis


-----------------------------------------------------------
On Fri, Nov 6, 2009 at 6:09 AM, Lodron, Gerald
<Gerald.Lodron at joanneum.at<mailto:Gerald.Lodron at joanneum.at>> wrote:
>
> Hello
>
> I try to make a rigid 3 d registration of two singed short images, i always get a compiler error when i want to use the CenteredTransformInitializer, here is my code
>
>
> template <class TPixelSource=signed short,class TPixelTarget=signed short, unsigned int VImageDimension=3>
>
>        typedef itk::Image< TPixelTarget, VImageDimension >                     TargetImageType;
>        typedef itk::Image< TPixelSource, VImageDimension >                     SourceImageType;
>        typedef float                                                                   InternalPixelType;
>        typedef itk::Image< InternalPixelType, VImageDimension >                InternalImageType;
>
>        typedef itk::MultiResolutionImageRegistrationMethod<InternalImageType, InternalImageType >              RegistrationType;
>        typedef typename RegistrationType::TransformType                        TransformType;
>        typedef itk::CenteredTransformInitializer<TransformType, TargetImageType, SourceImageType >             InitializerType;
>
>        RegistrationType*       m_Registration = RegistrationType::New();
>
>        TransformType* m_Transformation = itk::AffineTransform<double, VImageDimension>::New();
>
>        m_Registration->SetTransform(m_Transformation);
>
>        InitializerType* m_InitTransform = InitializerType::New();
>        m_InitTransform->SetTransform(   m_Transformation ); //exception
>
>
> Would be great if anyone could give me a hint,
>
> Best regards
> _____________________________________
> Powered by www.kitware.com<http://www.kitware.com>
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
_____________________________________
Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.html

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users


_________________________________
Karthik Krishnan
R&D Engineer,
Kitware Inc.
Ph: +1 5188814919, +91 9538477060
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20091110/74be6f2d/attachment.htm>


More information about the Insight-users mailing list