[Insight-users] Bug in itk::LandmarkBasedTransformInitializer?

Luis Ibanez luis.ibanez at kitware.com
Sat Aug 15 21:37:03 EDT 2009


Hi Neuhaus,


<self rant>

This illustrates once again the Nefarious consequences of
using dynamic_casting inside ITK classes to try to discover
the type of the template parameters....

Just FYI: the LandmarkBasedTransformInitializer uses the
sub-optimal approach of using dynamic_casts and a sequence
of switch/case statements for selecting different implementations.

Every use of dynamic_casting is a symptom of bad design when
using Generic Programming.

</self rant>


In your case, the difficulty arises from the fact that the template
parameter of your VersorRigid3DTransform is probably "float"
while the one used in the LandmarkBasedTransformInitializer
is probably "double".

You may want to try declaring your transform as:

typedef itk::VersorRigid3DTransform< double >  ITKVersorTransformType;

>

Also, could you please file a bug report about this issue in the bug tracker
?
http://public.kitware.com/Bug/my_view_page.php

In that way we can address this issue in ITK 4.0.


     Thanks


           Luis


------------------------------------------------------------------------------------
On Thu, Aug 13, 2009 at 10:43 AM, Neuhaus Jochen <
j.neuhaus at dkfz-heidelberg.de> wrote:

> Hi List,
>
> I try to initialize a transform using
> itk::LandmarkBasedTransformInitializer the following way:
>
>  typedef itk::Image< signed short, 3>  ImageType;
>  typedef itk::VersorRigid3DTransform< MyPointType::ValueType >
> ITKVersorTransformType;
>  typedef itk::LandmarkBasedTransformInitializer<
> ITKVersorTransformType, ImageType, ImageType > TransformInitializerType;
>  ITKVersorTransformType::Pointer transform =
> ITKVersorTransformType::New();
>  TransformInitializerType::Pointer init =
> TransformInitializerType::New();
>  init->SetTransform(transform);
>  ...
>  init->InitializeTransform();
>
> Everything compiles fine. But when I execute the code, the following
> warning appears:
> WARNING: In
> v:\windows\source\itk3120\code\common\itkLandmarkBasedTransformInitializ
> er.txx, line 413
> LandmarkBasedTransformInitializer (0000000004156C10): Landmark
> initialization using the specified input transform not implemented
>
> WARNING: In
> v:\windows\source\itk3120\code\common\itkLandmarkBasedTransformInitializ
> er.txx, line 418
> LandmarkBasedTransformInitializer (0000000004156C10): Landmark
> initialization using the specified input transform not implemented
>
>
> I traced the problem to the following issue:
>
> My MyPointType::ValueType is float. If I change it to double, everything
> works fine.
>
> Itk:: LandmarkBasedTransformInitializer defines the supported transforms
> like this:
>  /**  Supported Transform typedefs */
>  typedef VersorRigid3DTransform< ParameterValueType >
>
> VersorRigid3DTransformType;
>  typedef Rigid2DTransform< ParameterValueType > Rigid2DTransformType;
>
>
> looking deep into the inheritance hierarchy, I found that
> ParameterValueType ultimately is hardcoded to float. In my opinion,
> ParameterValueType is just the wrong type here. It should use
> 'ScalarType' instead, because that is the actual template parameter.
>
> Has anybody encountered this problem? Is there a better way to achieve
> this? Should I just submit a bug report to ITK?
>
>
> Thanks,
>  Jochen
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090815/a5054735/attachment.htm>


More information about the Insight-users mailing list