MantisBT - ITK
View Issue Details
0012026ITKITKpublic2011-03-30 04:462011-04-22 15:46
Thiago R. dos Santos 
kentwilliams 
highmajoralways
closedfixed 
 
 
2011-04-21
backlog
0012026: itk::LandmarkBasedTransformInitializer does not work with a float transform as template parameter
itk::LandmarkBasedTransformInitializer is templated over a transform type TTransform, which itself is templated over the scalartype.

itk::LandmarkBasedTransformInitializer works only with two specific transform types. They are defined like that:
  /** 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 ''TransformType::ScalarType' instead, because that is the actual scalar type template parameter of the template transform.

It is the same bug reported in: http://www.itk.org/Bug/view.php?id=9421 [^]
 typedef itk::Image< signed short, 3> ImageType;
  typedef itk::VersorRigid3DTransform< float > 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


If ITKVersorTransformType is changed like this:
  typedef itk::VersorRigid3DTransform< double > ITKVersorTransformType;
everything is working.
There are two relevant typedefs for the problem:

  typedef typename TransformType::ParametersType ParametersType;
  typedef typename ParametersType::ValueType ParameterValueType;

If you follow the typedef chain of ParameterValueType, eventually the class itk::TransformBase will be reached. If you take a look to ParameterValueType, you will see that it is hard coded to double.

If you modify the typedef in itk::LandmarkBasedTransformInitializer to this:

typedef typename TransformType::ScalarType ParameterValueType;

everything works fine!!
No tags attached.
Issue History
2011-03-30 04:46Thiago R. dos SantosNew Issue
2011-04-01 10:10Hans JohnsonAssigned To => kentwilliams
2011-04-01 10:10Hans JohnsonStatusnew => assigned
2011-04-22 15:46kentwilliamsResolution Date => 2011-04-21
2011-04-22 15:46kentwilliamsNote Added: 0026243
2011-04-22 15:46kentwilliamsStatusassigned => closed
2011-04-22 15:46kentwilliamsResolutionopen => fixed

Notes
(0026243)
kentwilliams   
2011-04-22 15:46   
This is fixed in ITKV4