<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
This sounds like a great addition.
<div class=""><br class="">
</div>
<div class="">I would not implement the method in ImageFileReader yet. It should be easily enough to add it later.</div>
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">I look forward to seeing your patch.</div>
<div class="">Brad</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Jan 24, 2017, at 10:06 AM, asertyuio via Insight-users <<a href="mailto:insight-users@itk.org" class="">insight-users@itk.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div text="#000000" bgcolor="#FFFFFF" class="">
<p class="">Hi Dženan,</p>
<p class="">Thanks, you gave me the right direction!</p>
<p class="">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 class="">
</p>
<p class="">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 class="">Thanks for your answer,</p>
<p class="">Yann<br class="">
</p>
<br class="">
<div class="moz-cite-prefix">Le 16/01/2017 à 15:50, Dženan Zukić a écrit :<br class="">
</div>
<blockquote cite="mid:CAPf2UMQ0TrRk5fw=k+nATAkpBqiKntZh3Ka_PXeLB+XRvmNcjg@mail.gmail.com" type="cite" class="">
<div dir="ltr" class="">
<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 class="">
</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 moz-do-not-send="true" href="https://github.com/InsightSoftwareConsortium/ITK/blob/578d3660e71022680d3abf313ad8b84ce2a7dd66/Modules/IO/PNG/src/itkPNGImageIO.cxx#L365-L393" class="">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 moz-do-not-send="true" href="https://itk.org/Wiki/ITK/Git/Develop" class="">code review</a>.</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
<br class="">
</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 class="">
</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 class="">
<div class="gmail_quote">On Sun, Jan 15, 2017 at 11:07 AM, asertyuio via Insight-users
<span dir="ltr" class=""><<a moz-do-not-send="true" href="mailto:insight-users@itk.org" target="_blank" class=""></a><a class="moz-txt-link-abbreviated" href="mailto:insight-users@itk.org">insight-users@itk.org</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF" class="">
<p class="">Hi all,</p>
<p class="">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 class="">When I'm reading such palette image, the <code class="">itk::ImageIOBase</code>, as implemented
<a moz-do-not-send="true" href="https://itk.org/ITKExamples/src/IO/ImageBase/ReadUnknownImageType/Documentation.html" rel="nofollow noreferrer" target="_blank" class="">
here</a>, tels me that the image has a RGB pixel type. <br class="">
</p>
<pre class="m_-8133688850348573011lang-cpp m_-8133688850348573011prettyprint m_-8133688850348573011prettyprinted"><code class=""><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 class="">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 class="">;</span></code></pre>
<p class="">Is it possible to know, <strong class="">through ITK</strong>, whether the image is actually a palette image,
<em class="">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 class="">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 class="">ImageIOBase</code> that could relate to that.</p>
<p class="">Any help would be appreciated, thanks a lot ! Yann</p>
</div>
______________________________<wbr class="">_______ Powered by <a moz-do-not-send="true" href="http://www.kitware.com/" rel="noreferrer" target="_blank" class="">
www.kitware.com</a> Visit other Kitware open-source projects at <a moz-do-not-send="true" href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank" class="">
http://www.kitware.com/<wbr class="">opensource/opensource.html</a> Kitware offers ITK Training Courses, for more information visit:
<a moz-do-not-send="true" href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank" class="">
http://www.kitware.com/<wbr class="">products/protraining.php</a> Please keep messages on-topic and check the ITK FAQ at:
<a moz-do-not-send="true" href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank" class="">
http://www.itk.org/Wiki/ITK_<wbr class="">FAQ</a> Follow this link to subscribe/unsubscribe:
<a moz-do-not-send="true" href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank" class="">
http://public.kitware.com/<wbr class="">mailman/listinfo/insight-users</a> </blockquote>
</div>
</div>
</blockquote>
</div>
_____________________________________<br class="">
Powered by <a href="http://www.kitware.com" class="">www.kitware.com</a><br class="">
<br class="">
Visit other Kitware open-source projects at<br class="">
<a href="http://www.kitware.com/opensource/opensource.html" class="">http://www.kitware.com/opensource/opensource.html</a><br class="">
<br class="">
Kitware offers ITK Training Courses, for more information visit:<br class="">
http://www.kitware.com/products/protraining.php<br class="">
<br class="">
Please keep messages on-topic and check the ITK FAQ at:<br class="">
http://www.itk.org/Wiki/ITK_FAQ<br class="">
<br class="">
Follow this link to subscribe/unsubscribe:<br class="">
http://public.kitware.com/mailman/listinfo/insight-users<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>