<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">this would be a good addition to ITK, please submit a patch to Gerrit. I think it is more logical to keep it in itkBPMImageIO, itkTiffImageIO, and itkPNGImageIO instead of adding it to itkImageFileReader because not all formats support color palette. Whoever needs this functionality could access it through ImageIO.</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">Regards,</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 Wed, Jan 25, 2017 at 8:52 AM, Lowekamp, Bradley (NIH/NLM/LHC) [C] <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
This sounds like a great addition.
<div><br>
</div>
<div>I would not implement the method in ImageFileReader yet. It should be easily enough to add it later.</div>
<div><br>
</div>
<div>Are you planning of exposing the palette after loading? The MetaDataDictionary could be used for this. But we don’t have any palette data structure or established conventions yet.</div>
<div><br>
</div>
<div>I look forward to seeing your patch.</div>
<div>Brad</div>
<div><br>
<div>
<blockquote type="cite">
<div>On Jan 24, 2017, at 10:06 AM, asertyuio via Insight-users <<a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a>> wrote:</div>
<br class="m_-5651454586515436954Apple-interchange-newline">
<div>
<div text="#000000" bgcolor="#FFFFFF">
<p>Hi Dženan,</p>
<p>Thanks, you gave me the right direction!</p>
<p>I have adapted itkBPMImageIO, itkTiffImageIO, and itkPNGImageIO so that the user have the choice to expand the color palette or not, and retrive a vector of RGBPixel corresponding to this palette. I will try to submit these changes to gerrit.<br>
</p>
<p>I'm not quite sure whether I should push a bit more so that this choice could be set directly in itkImageReader. Do you have any advice ?</p>
<p>Thanks for your answer,</p>
<p>Yann<br>
</p><div><div class="h5">
<br>
<div class="m_-5651454586515436954moz-cite-prefix">Le 16/01/2017 à 15:50, Dženan Zukić a écrit :<br>
</div>
<blockquote type="cite">
<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" target="_blank">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" target="_blank">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"></a><a class="m_-5651454586515436954moz-txt-link-abbreviated" 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_-5651454586515436954m_-8133688850348573011lang-cpp m_-5651454586515436954m_-8133688850348573011prettyprint m_-5651454586515436954m_-8133688850348573011prettyprinted"><code><span class="m_-5651454586515436954m_-8133688850348573011pln">itk</span><span class="m_-5651454586515436954m_-8133688850348573011pun">::</span><span class="m_-5651454586515436954m_-8133688850348573011typ">ImageIOBase</span><span class="m_-5651454586515436954m_-8133688850348573011pun">::</span><span class="m_-5651454586515436954m_-8133688850348573011typ">Pointer</span><span class="m_-5651454586515436954m_-8133688850348573011pln"> imageIO </span><span class="m_-5651454586515436954m_-8133688850348573011pun">=</span><span class="m_-5651454586515436954m_-8133688850348573011pln">
itk</span><span class="m_-5651454586515436954m_-8133688850348573011pun">::</span><span class="m_-5651454586515436954m_-8133688850348573011typ">ImageIOFactory</span><span class="m_-5651454586515436954m_-8133688850348573011pun">::</span><span class="m_-5651454586515436954m_-8133688850348573011typ">CreateIma<wbr>geIO</span><span class="m_-5651454586515436954m_-8133688850348573011pun">(</span><span class="m_-5651454586515436954m_-8133688850348573011pln">
fileName</span><span class="m_-5651454586515436954m_-8133688850348573011pun">,</span><span class="m_-5651454586515436954m_-8133688850348573011pln"> itk</span><span class="m_-5651454586515436954m_-8133688850348573011pun">::</span><span class="m_-5651454586515436954m_-8133688850348573011typ">ImageIOFactory</span><span class="m_-5651454586515436954m_-8133688850348573011pun">::</span><span class="m_-5651454586515436954m_-8133688850348573011typ">ReadMode</span><span class="m_-5651454586515436954m_-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 ! Yann</p>
</div>
______________________________<wbr>_______ Powered by <a href="http://www.kitware.com/" rel="noreferrer" target="_blank">
www.kitware.com</a> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">
http://www.kitware.com/opensou<wbr>rce/opensource.html</a> Kitware offers ITK Training Courses, for more information visit:
<a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank">
http://www.kitware.com/product<wbr>s/protraining.php</a> Please keep messages on-topic and check the ITK FAQ at:
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">
http://www.itk.org/Wiki/ITK_FA<wbr>Q</a> Follow this link to subscribe/unsubscribe:
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">
http://public.kitware.com/mail<wbr>man/listinfo/insight-users</a> </blockquote>
</div>
</div>
</blockquote>
</div></div></div><div><div class="h5">
______________________________<wbr>_______<br>
Powered by <a href="http://www.kitware.com" 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" 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" 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" 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" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/insight-users</a><br>
</div></div></div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote></div><br></div>