[Insight-users] Problem with CenteredTransformInitializer

Luis Ibanez luis.ibanez at kitware.com
Sun Nov 8 19:25:16 EST 2009


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> 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
>
> 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
>


More information about the Insight-users mailing list