[Insight-developers] Request for testing help: itkImageIOBase.cxx

Kent Williams kent at psychiatry.uiowa.edu
Thu Jul 13 14:57:13 EDT 2006


Today I rewrote the big ugly macro associated with 
itk::ImageIOBase::SetPixelTypeInfo() that handles setting the 
ComponentType, PixelType, and NumberOfComponents. 

I turned the macro into a templated function which smart compilers will 
inline to pretty much the same code as the macro version;  what I need 
to know is if it will blow the mind of the Borland or Microsoft 
compilers.  So if anyone uses those as their main compilers, could you 
download the attached file into Insight/Code/IO and tell me if it causes 
problems?

I can argue pretty strongly that this is a major improvement over the 
macro.  Preprocessor macros make it nearly impossible to debug, for one 
thing.  For another, the macros make for this insult to C++ syntax:

if itkCheckPTypeMacro(char, CHAR)
else if itkCheckPTypeMacro(unsigned char, UCHAR)
else if itkCheckPTypeMacro(short, SHORT)
else if itkCheckPTypeMacro(unsigned short, USHORT)
else if itkCheckPTypeMacro(int, INT)

If no-one is willing or able to test this for me I'll check it in first 
thing tomorrow morning and see if it breaks any builds.

I'm think this code could be telescoped into something even more 
concise, but it would involve having a template specialization for every 
supported pixel data type.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itkImageIOBase.cxx
Type: text/x-c++src
Size: 20627 bytes
Desc: not available
Url : http://www.itk.org/mailman/private/insight-developers/attachments/20060713/4257cf3c/itkImageIOBase.cxx


More information about the Insight-developers mailing list