That looks fine. Must be a problem with either the image (not within those ranges), your reader, your writer, or the way you visualize the output.<br><br><div class="gmail_quote">On Fri, Apr 8, 2011 at 5:28 PM, G G <span dir="ltr">&lt;<a href="mailto:greenlander1986@gmail.com">greenlander1986@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 I would like to convert image to binary image.<br>I have mha/mhd image in 3D in grayscale. <br>So I ask you, how should I convert my image to binary image?<br>

I tried to use binary threshold image filter. But when I use it, I dont get black&amp;white image, black&amp;dark gray&amp;white image<br>
I am using this code bellow<br><br><span style="font-family:courier new,monospace">  typedef itk::BinaryThresholdImageFilter &lt;ImageType, ImageType&gt; BinaryThresholdImageFilterType;</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">  BinaryThresholdImageFilterType::Pointer thresholdFilter = BinaryThresholdImageFilterType::New();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  thresholdFilter-&gt;SetInput(reader-&gt;GetOutput());</span><br style="font-family:courier new,monospace">


<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  thresholdFilter-&gt;SetOutsideValue( 0 );</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  thresholdFilter-&gt;SetInsideValue(  255  );</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">  thresholdFilter-&gt;SetLowerThreshold( 10 );</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  thresholdFilter-&gt;SetUpperThreshold( 255 );</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">  thresholdFilter-&gt;Update();</span><br><br>where could be problem? Thanks for ideas :)<br>
<br>_____________________________________<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/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</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_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>