[Insight-developers] ImageIO & supported Pixel types -- TMP programming challenge

wanlin wanlinzhu at gmail.com
Fri Nov 12 02:13:09 EST 2010


HI, Kent,
         I think one possible way to handle this issue is to determine pixel
component type and pixel type by input a PixelType value in
ImageIOBase::SetPixelTypeInfo() but not type_info.
I upload 4 patches to demonstrate how could it work.







kind regards



wanlin



On Fri, Nov 12, 2010 at 6:28 AM, kent williams
<norman-k-williams at uiowa.edu>wrote:

> Currently, itkImageIOBase contains what many people would regard as a
> terrible offense against the commandments of Generic Programming:
>
> bool ImageIOBase::SetPixelTypeInfo(const std::type_info &ptype);
>
> This function is called with the type_info for the pixel type from
> itk::ImageFileWriter.
>
> The problem is described here:
> http://public.kitware.com/Bug/view.php?id=11426
>
> where the complaint is that ImageIO can't write images with vector pixels
> longer than 7 elements.  The reason this is the case is that there's a long
> if/then/else chain that compares the ptype to the typeid of a set of
> explicitly named types, and no one, so far, had added vectors of length > 7
> elements.
>
> This would be a great place to do some Template MetaProgramming, but it's
> complicated.  Given the ImageType::PixelType one has to discriminate the
> PixelType (e.g. scalar,rgb,vector,covariantvector, complex), the number of
> components, and the component type.
>
> I'm feeling overwhelmed trying to sort this one out; I'm submitting a topic
> to gerrit that just punts -- i.e. I increase the possible vector size
> supported without re-organizing and template-izing things.
>
> Anyone want to give it a go?
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.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-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20101112/c735127f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itkImageIOBase.h.patch
Type: text/x-diff
Size: 7491 bytes
Desc: not available
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20101112/c735127f/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itkImageIOBase.cxx.patch
Type: text/x-diff
Size: 8908 bytes
Desc: not available
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20101112/c735127f/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itkImageFileWriter.txx.patch
Type: text/x-diff
Size: 1024 bytes
Desc: not available
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20101112/c735127f/attachment-0002.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itkRawImageIO.txx.patch
Type: text/x-diff
Size: 463 bytes
Desc: not available
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20101112/c735127f/attachment-0003.patch>


More information about the Insight-developers mailing list