[Insight-users] Problem with CenteredTransformInitializer
Lodron, Gerald
Gerald.Lodron at joanneum.at
Mon Nov 9 02:25:00 EST 2009
Thanks for your reply,
I changed the code to ::Pointer and found the error. The problem were the lines:
typedef typename RegistrationType::TransformType TransformType;
TransformType* m_Transformation = itk::AffineTransform<double, VImageDimension>::New();
typedef itk::CenteredTransformInitializer<TransformType, TargetImageType, SourceImageType > InitializerType;
It seems that the RegistrationType::TransformType is "too general" for the InitializerType (i don't know how to say it otherwords). The typedef works but in the New constructor of the initializer a type was searched wich does not exist in the transformtype. When I replace the transformtype into a specific transformation, e.g.:
typedef typename itk::AffineTransform<double, VImageDimension> TransformType;
TransformType* m_Transformation = itk::AffineTransform<double, VImageDimension>::New();
It works. I wanted to make that stuff arbitrary from the transformation, but it seems that it does not work for the initializer so i will make it so.
Best regards
-----Ursprüngliche Nachricht-----
Von: Luis Ibanez [mailto:luis.ibanez at kitware.com]
Gesendet: Montag, 09. November 2009 01:25
An: Lodron, Gerald
Cc: Insight users (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> 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