<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body 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>
<br>
<div class="moz-cite-prefix">Le 16/01/2017 à 15:50, Dženan Zukić a
écrit :<br>
</div>
<blockquote
cite="mid:CAPf2UMQ0TrRk5fw=k+nATAkpBqiKntZh3Ka_PXeLB+XRvmNcjg@mail.gmail.com"
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 moz-do-not-send="true"
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
moz-do-not-send="true"
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
moz-do-not-send="true" href="mailto:insight-users@itk.org"
target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:insight-users@itk.org">insight-users@itk.org</a></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 moz-do-not-send="true"
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 !
Yann</p>
</div>
______________________________<wbr>_______
Powered by <a moz-do-not-send="true" href="http://www.kitware.com" rel="noreferrer" target="_blank">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">http://www.kitware.com/<wbr>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">http://www.kitware.com/<wbr>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">http://www.itk.org/Wiki/ITK_<wbr>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">http://public.kitware.com/<wbr>mailman/listinfo/insight-users</a>
</blockquote></div>
</div>
</blockquote>
</body></html>