[ITK] [ITK-users] read palette image as scalar image + palette, instead of RGB image

Dženan Zukić dzenanz at gmail.com
Mon Jan 16 09:50:59 EST 2017


Hi Yann,

the relevant part of code for PNG format is in itkPNGImageIO.cxx,
approximately lines 365-395 (link
<https://github.com/InsightSoftwareConsortium/ITK/blob/578d3660e71022680d3abf313ad8b84ce2a7dd66/Modules/IO/PNG/src/itkPNGImageIO.cxx#L365-L393>).
You will need to modify that. If you modify it in a way so it can be useful
for others, please submit your patch to code review
<https://itk.org/Wiki/ITK/Git/Develop>.

To get access to the specialized functions of the PNG reader, you would
instantiate it directly:
itk::PNGImageIO::Pointer imageIO = ...
std::vector<RGBPixel> colorTable = imageIO->GetColorTable(); //call a
function you added to PNG reader

Hope this helps,
Dženan

On Sun, Jan 15, 2017 at 11:07 AM, asertyuio via Insight-users <
insight-users at itk.org> wrote:

> Hi all,
>
> I want to read a palette image as a scalar image with its indexes + a
> vector of RGB, corresponding to the image palette. The format of the image
> is TIFF, but can be png or gif as well.
>
> When I'm reading such palette image, the itk::ImageIOBase, as implemented
> here
> <https://itk.org/ITKExamples/src/IO/ImageBase/ReadUnknownImageType/Documentation.html>,
> tels me that the image has a RGB pixel type.
>
> itk::ImageIOBase::Pointer imageIO =
>     itk::ImageIOFactory::CreateImageIO(
>         fileName, itk::ImageIOFactory::ReadMode);
>
> Is it possible to know, *through ITK*, whether the image is actually a
> palette image, *i.e.* scalar image along with a color palette, and read
> this image as a scalar image + palette ? I need have access to the index,
> as stored in the file as well as the color palette used in the file.
>
> For now, my only solution is to use freeImagePlus to identify and read
> this type of image. I haven't found any function in the class ImageIOBase
> that could relate to that.
>
> Any help would be appreciated, thanks a lot !
>
> Yann
>
> _____________________________________
> 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://www.kitware.com/products/protraining.php
>
> 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://public.kitware.com/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170116/d54da2f2/attachment.html>
-------------- next part --------------
_____________________________________
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://www.kitware.com/products/protraining.php

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://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list