[Insight-users] Problem with CenteredTransformInitializer

Luis Ibanez luis.ibanez at kitware.com
Wed Nov 11 10:49:40 EST 2009


Hi Gerald,

Thanks for pointing this out.

Yes, the Transforms:

  *  itk::ScaleTransform
  *  itk::ScaleLogarithmicTransform
  *  itk::BSplineDeformableTransform


are not suitable for the CenteredTransformInitializer.


Note however that we already have a new initializer
specialized for BSplineDeformableTransforms:


 Insight/Code/Review/
    itkBSplineDeformableTransformInitializer.h
    itkBSplineDeformableTransformInitializer.txx

These initializer is described in
the following Insight Journal paper:

http://www.insight-journal.org/browse/publication/216
http://hdl.handle.net/1926/1338



 Regards,


        Luis


----------------------------------------------------------------------------------
On Wed, Nov 11, 2009 at 2:12 AM, Lodron, Gerald
<Gerald.Lodron at joanneum.at> wrote:
> Thanks,
>
> The same problem appears for the itk::ScaleTransform, itk::ScaleLogarithmicTransform and the itk::BSplineTransform.
>
> Best regards
>
>
>
>
> Well,
> There are good reasons for not deriving the Translation transform from the itkMatrixOffsetTransformBase.
>
> A translation only requires N additions, (in an N-dimensional space).
>
> If we were using the itkMatrixOffsetTransformBase for performing a translation, we will be doing N^2 multiplications and N^2 additions to get the equivalent result.
>
> That said,
> It is true that we could declare the OffsetType in the TranslationTransform.
>
> I just trying doing so, and the next API changes required are:
>
> +* SetCenter() method
> +* SetTranslation() method
>
> It seem to be a bit of a stretch to add a SetCenter method, (which doesn't makes sense for a Translation Transform) just for the sake of using the CenteredTransformInitializer.
>
> A better solution seem to be to add a class:
>
>       TranslationTransformInitializer
>
> Please find that new class attached.
>
>
>    Let us know if you find any problems with it.
>
>
>
>        Thanks
>
>
>             Luis
>
>
>
> -------------------------------------------------------------------------------------
> On Tue, Nov 10, 2009 at 2:44 AM, Karthik Krishnan <karthik.krishnan at kitware.com> wrote:
>> 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>
>> 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]
>>> 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
>>> >
>>> _____________________________________
>>> 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
>>
>>
>> _________________________________
>> Karthik Krishnan
>> R&D Engineer,
>> Kitware Inc.
>> Ph: +1 5188814919, +91 9538477060
>>
>


More information about the Insight-users mailing list