[Insight-developers] transform internal types

Bradley Lowekamp blowekamp at mail.nih.gov
Thu May 6 11:11:13 EDT 2010


Hello,

I am not sure making the TransformBase a tempted type is a good idea.

The registration framework uses this class as a polymorphic interface to transforms. So that one interface can be used to manipulate multiple types. This is different then much of ITK which uses templated objects with out explicit virtual interfaces. By making TransformBase have a templeted argument there is no longer a single interface as TransformBase<double> is a different type then TransformBase<float> are different types!

Your initial post indicated that you are trying to pass these arguments to the GPU, and that is the motivation for needing floats. Perhaps it would be easier to use an adaptor design pattern to change the interface of TransformBase, so that the array could be converted when it needs to be uploaded to the GPU?

Good luck,
Brad

On May 6, 2010, at 10:45 AM, M.Staring at lumc.nl wrote:

> Hi,
> 
>> 
>> However, backward compatibility problems occur:
>> 1) Transform< float,  indim, outdim > is changed wrt the 
>> ParametersType
>> 2) there is no ParametersType typedef in TransformBase 
>> anymore, so code that uses TransformBase::ParametersType does 
>> not work anymore.
> 
> When I tried to really implement it, I got in trouble with (2) moving
> the ParametersType typedef from TransformBase, because the TransformIO
> classes depend on it.
> 
> So, as an alternative solution I added a template parameter TScalarType
> to the TransformBase, like
> 
> #ifdef ITK_USE_TRANSFORM_SCALARTYPE_FOR_PARAMETERSTYPE
> template <class TScalarType = double >
> #endif
> 
> and then do:
> 
> #ifdef ITK_USE_TRANSFORM_SCALARTYPE_FOR_PARAMETERSTYPE
>  typedef  TScalarType                     ParametersValueType;
>  typedef  Array< ParametersValueType >    ParametersType;
> #else
>  typedef  double                          ParametersValueType;
>  typedef  Array< ParametersValueType >    ParametersType;
> #endif
> 
> I also had to make some small changes to TransformIO classes. The
> complete patch is attached to this email. The good news is that the
> experimental build succeeded.
> 
> With kind regards,
> 
> Marius
> <Insight_changes1.patch><ATT00001..txt>

========================================================
Bradley Lowekamp  
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20100506/320218e1/attachment.htm>


More information about the Insight-developers mailing list