[Insight-developers] Proposal: Changing NumericTraits of vector types to use macros

Bradley Lowekamp blowekamp at mail.nih.gov
Fri Nov 27 11:16:59 EST 2009


Hello,

The next logical step after adding itk::NumericTraits<long long> is to also add it to all the vector types that also have numeric traits defined. Unfortunately I am lazy, and manually going through all these files, and close to 5,000 lines of code, to perform copy, paste, edit seems like too much work.

Looking at itkNumericTratisVariableLengthVectorPixel.h:
http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Common/itkNumericTraitsVariableLengthVectorPixel.h?revision=1.7&root=Insight&view=markup

This seems to have an elegant macro which both does total template specialization and partial specialization when needed. It seems like much less work to implement similar macros in each file. One important change I'd make to similar macros for other types is to make the "ElementTypes" (which are needed for bcc) private so as to not add additional traits that have not been defined as part of the interface.

As a "good" side effect, this will help maintainability and correct errors that currently exist in the traits. For example  the many numeric traits for for char vector types still have the char vector type as the PrintType, which is wrong because it'll print ASCII value instead of numbers. There are also missing trait types in many vector types as well. For example the CovariantVector traits are missing the FloatType.


Brad


========================================================
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/20091127/2f9787a7/attachment.htm>


More information about the Insight-developers mailing list