Hi everyone,<div><br></div><div>I think I have made an stupid mistake. Originally I was using <b>unsigned char</b> as the PixelType and then used GetPixel method to obtain</div><div><br></div><div>pixel values. While today I tried to use the RGB as pixel type and then using GetPixel().GetRed() method to read the pixels. And then</div>
<div><br></div><div>basically the problem is solved. </div><div><br></div><div><br></div><div>By basically, I mean, most of the pixel values are consistent with the matlab reading result. While when I counted the number of pixels </div>
<div><br></div><div>with each value, I found that the number of pixels with intensity 32 in itk is the sum of number of pixels with intensity 32 and 33 from </div><div><br></div><div>Matlab. So the result of Matlab is postponed for one since 32. It is like:</div>
<div><br></div><div><br></div><div>Matlab Result:    n0 n1 n2 ...  n31  n32         n33 n34 ... n253 n254 n255</div><div>itk Result:          n0 n1 n2 .... n31 n32+n33   n34 n35 ... n254  0     n255</div><div><br></div><div>
where n0 is the number of pixels with intensity 0, and so on.</div><div><br></div><div>I am wondering what may cause this problem. </div><div><br></div><div><b>Any ideas?</b></div><div><b><br></b></div><div><b>Thanks.</b></div>
<div><b>Yanqiao</b></div><div><br><div class="gmail_quote">On Thu, Jun 16, 2011 at 10:57 AM, yanqiao zhu <span dir="ltr">&lt;<a href="mailto:yanqiao.zhu@gmail.com">yanqiao.zhu@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi folks,<div><br></div><div><br></div><div>Recently I have got problems with reading tiff images. They are grayscale image in fact, but mapped to red colors. I </div><div><br></div><div>am guessing this is so-called palette-grayscale image. My problem is the default reading result of itkTIFFImageIO is</div>

<div><br></div><div>different with that of Matlab. I have counted the number of pixels with each possible value, say, from 0 to 255. The </div><div><br></div><div>results differs a lot. </div><div><br></div><div><br></div>

<div>Actually I think  Matlab is right. I used v3d to show the image and observe the pixels values. There are pixels values </div><div><br></div><div>larger than 200, while the largest possible pixel value I have got from itk is only under 100. I have tried to read some </div>

<div><br></div><div>other grayscale images without color mapping, ITK is working fine. So I am </div><div><br></div><div>guessing the problem is caused by the color mapping in my tiff image. I checked the itkTIFFImageIo file, and found </div>

<div><br></div><div>there some &quot;anonymous enum {NOFORMAT, RGB_, GRAYSCALE, PALETTE_RGB, PALETTE_GRAYSCALE, </div><div><br></div><div>OTHER}&quot;, while I don&#39;t know how to use this. Should itk get this information correct automatically? </div>

<div><br></div><div><br></div><div><br></div><div>I have tried to search online and found similar case, but don&#39;t see a clear solution. Below are the links:</div><div><br></div><div><a href="http://itk-insight-users.2283740.n2.nabble.com/GetPixel-problem-td6025567.html" target="_blank">http://itk-insight-users.2283740.n2.nabble.com/GetPixel-problem-td6025567.html</a></div>

<div><a href="http://www.itk.org/pipermail/insight-users/2005-March/012350.html" target="_blank">http://www.itk.org/pipermail/insight-users/2005-March/012350.html</a></div><div><br></div><div><br></div><div><br></div><div>
 I am a little frustrated. So if  you have any idea about this, please help me out. Thanks very much! </div>
<div><br></div><div><br></div><div>I have attached one sample tiff image for investigation purpose. </div><div><br></div><div>Best!</div><div>Yanqiao</div>
</blockquote></div><br></div>