<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hi Yann,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">the relevant part of code for PNG format is in itkPNGImageIO.cxx, approximately lines 365-395 (<a href="https://github.com/InsightSoftwareConsortium/ITK/blob/578d3660e71022680d3abf313ad8b84ce2a7dd66/Modules/IO/PNG/src/itkPNGImageIO.cxx#L365-L393">link</a>). 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 <a href="https://itk.org/Wiki/ITK/Git/Develop">code review</a>.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">To get access to the specialized functions of the PNG reader, you would instantiate it directly:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">itk::PNGImageIO::Pointer imageIO = ...</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">std::vector<RGBPixel> colorTable = imageIO->GetColorTable(); //call a function you added to PNG reader</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hope this helps,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Dženan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 15, 2017 at 11:07 AM, asertyuio via Insight-users <span dir="ltr"><<a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  

    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p>Hi all,</p>
    <p>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.</p>
    <p> When I'm reading such palette image, the <code>itk::ImageIOBase</code>,
      as implemented <a href="https://itk.org/ITKExamples/src/IO/ImageBase/ReadUnknownImageType/Documentation.html" rel="nofollow noreferrer" target="_blank">here</a>, tels me that the image has a
      RGB pixel type. <br>
    </p>
    <pre class="m_-8133688850348573011lang-cpp m_-8133688850348573011prettyprint m_-8133688850348573011prettyprinted"><code><span class="m_-8133688850348573011pln">itk</span><span class="m_-8133688850348573011pun">::</span><span class="m_-8133688850348573011typ">ImageIOBase</span><span class="m_-8133688850348573011pun">::</span><span class="m_-8133688850348573011typ">Pointer</span><span class="m_-8133688850348573011pln"> imageIO </span><span class="m_-8133688850348573011pun">=</span><span class="m_-8133688850348573011pln">
    itk</span><span class="m_-8133688850348573011pun">::</span><span class="m_-8133688850348573011typ">ImageIOFactory</span><span class="m_-8133688850348573011pun">::</span><span class="m_-8133688850348573011typ">CreateIma<wbr>geIO</span><span class="m_-8133688850348573011pun">(</span><span class="m_-8133688850348573011pln">
        fileName</span><span class="m_-8133688850348573011pun">,</span><span class="m_-8133688850348573011pln"> itk</span><span class="m_-8133688850348573011pun">::</span><span class="m_-8133688850348573011typ">ImageIOFactory</span><span class="m_-8133688850348573011pun">::</span><span class="m_-8133688850348573011typ">ReadMode</span><span class="m_-8133688850348573011pun">)<wbr>;</span></code></pre>
    <p>Is it possible to know, <strong>through ITK</strong>, whether
      the image is actually a palette image, <em>i.e.</em> 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.</p>
    <p>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
      <code>ImageIOBase</code> that could relate to that.</p>
    <p>Any help would be appreciated, thanks a lot !
      <br>
      <br>
      Yann</p>
  </div>

<br>______________________________<wbr>_______<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_<wbr>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div>