[vtk-developers] Extracting component while loading PNG files

Pierre Barbier de Reuille pbarbier at ucalgary.ca
Mon Jun 4 15:25:14 EDT 2007


Hello,

As of now, when you load a (set of) PNG image(s), if the PNG was saved
as palette, it will be loaded as RGB(A). The problem is, most PNG
converted I know will always create palette-PNGs, event if the image is
gray-scaled. That means, you end up using 3 times the memory really
needed to load the image. Moreover, you need to add a
vtkExtractComponent object, which add another copy of the data. In my
case, I have 512x512x512 volumetric data, and this copy of the data is
just too much.

So I modified vtkPNGReader to allow the user to specify if he wants to
extract one of the components while loading. I attach the patch to this
mail.

I think it might be good to add that directly to vtkImageReader2.
However, I am unsure of the correct way to do this (ie. did I propose a
correct interface or not), and also about the fact that you might want
this kind of functionality in the image readers.

Thank you,

Pierre
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IO_vtkPNGReader_cxx.patch
Type: text/x-patch
Size: 3344 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20070604/78bff740/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IO_vtkPNGReader_h.patch
Type: text/x-patch
Size: 796 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20070604/78bff740/attachment-0003.bin>


More information about the vtk-developers mailing list