I have used int and unsigned char. But when I took the value of a pixel of the un-rescaled image, it was 204. When I solved the rescale equation by hand  for value 204 and for rescale values [0,255], I get the value 113,58. So I should have taken the value 114.Instead of this when I get the value of the rescaled image then I get the value 113.Why is this happening?<br>
<br><div class="gmail_quote">2011/6/12 john smith <span dir="ltr">&lt;<a href="mailto:mkitkinsightuser@gmail.com">mkitkinsightuser@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Thanks for your response.<br>If I use int or unsigned char, then 113.581 would be 114 and 113.281 would be 113. Is this correct?<div><div></div><div class="h5"><br><br><br><div class="gmail_quote">2011/6/12 David Doria <span dir="ltr">&lt;<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>On Sun, Jun 12, 2011 at 12:32 PM, john smith &lt;<a href="mailto:mkitkinsightuser@gmail.com" target="_blank">mkitkinsightuser@gmail.com</a>&gt; wrote:<br>


&gt; Hi to all,<br>
&gt;<br>
&gt; I am using a reader to read an image and then pass the reader to a<br>
&gt; RescaleIntensityImageFilter, with which I rescale the image from 0 to<br>
&gt; 255.Then I am using an index type pointer tto get the pixel value, as it<br>
&gt; seems bellow:<br>
&gt;<br>
&gt;  InputImageType::Pointer image = filter_rescale-&gt;GetOutput();<br>
&gt;              InputImageType::IndexType index =<br>
&gt; filter_rescale-&gt;GetOutput()-&gt;GetLargestPossibleRegion().GetIndex();<br>
&gt;<br>
&gt;                            InputImageType::IndexType currentIndex;<br>
&gt;                            currentIndex[0] = k2;<br>
&gt;                            currentIndex[1] = k1;<br>
&gt;                            currentIndex[2] =<br>
&gt; ui-&gt;verticalScrollBar_z-&gt;value();<br>
&gt;                            InputImageType::PixelType currentValue =<br>
&gt; image-&gt;GetPixel(currentIndex);<br>
&gt;<br>
&gt; But when I get the values of currentIndex, I get for example a value<br>
&gt; 113.581. I want to know in this case which rounding would be correct, the<br>
&gt; 113 value or the 114 value.And how I could achieve this rounding?<br>
&gt;<br>
&gt; Thanks in advance<br>
<br>
<br>
</div></div>You could set the OutputImageType of the RescaleImageFilter to<br>
unsigned char or int or something and it would cast it for you, so you<br>
wouldn&#39;t have to deal with rounding. And what do you mean the<br>
&quot;correct&quot; rounding? According to any rounding I know, 113.581 would be<br>
rounded to 114.<br>
<font color="#888888"><br>
David<br>
</font></blockquote></div><br><div style="padding:0px;margin-left:0px;margin-top:0px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%">
</div>
</div></div></blockquote></div><br><div style="visibility: hidden; left: -5000px; position: absolute; z-index: 9999; padding: 0px; margin-left: 0px; margin-top: 0px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 130%;" id="avg_ls_inline_popup">
</div>