There are non-zero pixels in your image. They have a value of 1. You need to rescale the intensities (in code or in viewer) to visualize them. Or you could set the inside value to 255 instead of 1.<br><br><div><br><div class="gmail_quote">
2011/5/20 Quan <span dir="ltr">&lt;<a href="mailto:mrvillage@163.com">mrvillage@163.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>hello robert,</div>

<div>you&#39;re right.i set the number of control points as you suggested,it run smoothly,but the output image is awful,it&#39;s just a black images,all pixels value are 0,i just dont know why!what about your result?i have tried several images,but the results are all same ,they are black.i&#39;m confused!</div>

<div>thanks </div>
<div>Quan</div><div><div></div><div class="h5">
<div></div><br>At 2011-05-20 21:36:59,&quot;robert tamburo&quot; &lt;<a href="mailto:robert.tamburo@gmail.com" target="_blank">robert.tamburo@gmail.com</a>&gt; wrote:<br>
<blockquote style="border-left:#ccc 1px solid;margin:0px 0px 0px 0.8ex;padding-left:1ex">Thanks for sending the code. Your input image wasn&#39;t attached, but I was able to recreate the error with my own image. I lowered the number of control points to 10 and the code executed without error. <br>
<br>
<div class="gmail_quote">2011/5/19 Quan <span dir="ltr">&lt;<a href="mailto:mrvillage@163.com" target="_blank">mrvillage@163.com</a>&gt;</span><br>
<blockquote style="border-left:#ccc 1px solid;margin:0px 0px 0px 0.8ex;padding-left:1ex" class="gmail_quote">
<div>oh,i retry once more but failed again.my environment is Windows7+win32+VS2010+itk.i can get through the compile and bulid process.however,when i run the prog,the error occures.i cut a picture that descibes the error in attachment .also,my input image HE.png is 2D unsigned char type. </div>

<div>i list my source code bellow:<br>#include &quot;itkImage.h&quot;<br>#include &lt;iostream&gt;<br>#include &quot;itkAdaptiveOtsuThresholdImageFilter.h&quot;<br>#include &quot;itkImageFileReader.h&quot;<br>#include &quot;itkImageFileWriter.h&quot;<br>
using namespace std;<br> void AdaptiveOtsuThresholdImage(<br>   const std::string &amp; inputFileName,<br>   const std::string &amp; outputFileName,<br>   const unsigned int &amp; radius,<br>   const unsigned int &amp; bins,<br>
   const unsigned int &amp; controlPoints,<br>   const unsigned int &amp; levels,<br>   const unsigned int &amp; samples,<br>   const unsigned int &amp; splineOrder );<br>int main()<br>{<br> AdaptiveOtsuThresholdImage(&quot;HE.png&quot;,&quot;Output.png&quot;,20,256,30,3,12,3);<br>
 return 1;<br>}</div>
<div> void AdaptiveOtsuThresholdImage(<br>   const std::string &amp; inputFileName,<br>   const std::string &amp; outputFileName,<br>   const unsigned int &amp; radius,<br>   const unsigned int &amp; bins,<br>   const unsigned int &amp; controlPoints,<br>
   const unsigned int &amp; levels,<br>   const unsigned int &amp; samples,<br>   const unsigned int &amp; splineOrder )<br> {<br>   /** Typedef&#39;s. */<br>   const     unsigned int    ImageDimension = 2;<br>   typedef unsigned char                                 OutputPixelType;<br>
   typedef itk::Image&lt; OutputPixelType, ImageDimension &gt; InputImageType;<br>   typedef itk::Image&lt; OutputPixelType, ImageDimension &gt; OutputImageType;<br>   typedef itk::ImageFileReader&lt; InputImageType &gt;        ReaderType;<br>
   typedef itk::AdaptiveOtsuThresholdImageFilter&lt;<br>     InputImageType, OutputImageType&gt;                    ThresholderType;<br>   typedef itk::ImageFileWriter&lt; OutputImageType &gt;       WriterType;<br>   typedef ThresholderType::InputSizeType                RadiusType;</div>

<div>   /** Declarations. */<br>   ReaderType::Pointer reader = ReaderType::New();<br>   ThresholderType::Pointer thresholder = ThresholderType::New();<br>   WriterType::Pointer writer = WriterType::New();<br>   RadiusType Radius; Radius.Fill( radius );</div>

<div>   /** Read in the inputImage. */<br>   reader-&gt;SetFileName( inputFileName.c_str() );<br>   thresholder-&gt;SetInput( reader-&gt;GetOutput() );<br>   /** Apply the threshold. */<br>   thresholder-&gt;SetRadius( Radius );<br>
   thresholder-&gt;SetNumberOfHistogramBins( bins );<br>   thresholder-&gt;SetNumberOfControlPoints( controlPoints );<br>   thresholder-&gt;SetNumberOfLevels( levels );<br>   thresholder-&gt;SetNumberOfSamples( samples );<br>
   thresholder-&gt;SetSplineOrder( splineOrder );<br>   thresholder-&gt;SetInsideValue( 1 );<br>   thresholder-&gt;SetOutsideValue( 0 );<br>   /** Write the output image. */<br>   writer-&gt;SetInput( thresholder-&gt;GetOutput() );<br>
   writer-&gt;SetFileName( outputFileName.c_str() );<br>   try<br>    {<br>    writer-&gt;Update();<br>    }<br>  catch( itk::ExceptionObject &amp; excep )<br>    {<br>    std::cerr &lt;&lt; &quot;Exception caught !&quot; &lt;&lt; std::endl;<br>
    std::cerr &lt;&lt; excep &lt;&lt; std::endl;<br>    }<br> }  </div>
<div>
<div></div>
<div>
<div></div><br>At 2011-05-20 00:42:58,&quot;robert tamburo&quot; &lt;<a href="mailto:robert.tamburo@gmail.com" target="_blank">robert.tamburo@gmail.com</a>&gt; wrote:<br>
<blockquote style="border-left:#ccc 1px solid;margin:0px 0px 0px 0.8ex;padding-left:1ex">I have not encountered this error. I have used this filter on a 2D, unsigned char image with the following chunk of code: <br>
<div>
<div>  AdaptiveThresholdFilterType::Pointer adaptiveThresholder= AdaptiveThresholdFilterType::New();</div>
<div>  adaptiveThresholder-&gt;SetInput(image);</div>
<div>  adaptiveThresholder-&gt;SetInsideValue(255); // foreground of output image</div>
<div>  adaptiveThresholder-&gt;SetOutsideValue(0); // background of output image</div>
<div>  adaptiveThresholder-&gt;SetNumberOfHistogramBins(256);</div>
<div>  adaptiveThresholder-&gt;SetNumberOfControlPoints(10); // b-spline control points</div>
<div>  adaptiveThresholder-&gt;SetNumberOfLevels(3); // number of b-spline levels for reconstruction (3-5)</div>
<div>  adaptiveThresholder-&gt;SetNumberOfSamples(12); // number of points to randomly sample</div>
<div>  CharImageType::SizeType radius;</div>
<div>  radius[0] = 20;  </div>
<div>  radius[1] = 20;</div>
<div>  adaptiveThresholder-&gt;SetRadius(radius); // radius of sampling region</div>
<div>  adaptiveThresholder-&gt;Update();</div>
<div><br></div>
<div>It would be helpful if you could make available (minimal) code and an image that exhibits your problem (code and pictures are close to universal!). Also, keep the discussion on the list.</div>
<div><br>
<div class="gmail_quote">2011/5/19 Quan <span dir="ltr">&lt;<a href="mailto:mrvillage@163.com" target="_blank">mrvillage@163.com</a>&gt;</span><br>
<blockquote style="border-left:#ccc 1px solid;margin:0px 0px 0px 0.8ex;padding-left:1ex" class="gmail_quote">
<div>hi robert tamburo:</div>
<div>thanks for your <a href="http://help.in/" target="_blank">help.in</a> fact ,i also read the paper,and downnload the code at </div>
<div><a href="http://praxix.googlecode.com/svn/trunk/src/thresholdimage/" target="_blank">http://praxix.googlecode.com/svn/trunk/src/thresholdimage/</a></div>
<div>but what bothers me is that some errors occured when i run the project,it makes so</div>
<div>upset as i don&#39;t know much about itk ,so i don&#39;t know how to debug it.</div>
<p>the error is located at <strong>itkBSplineScatteredDataPointSetToImageFilter.txx </strong>&quot;  <strong><font color="#ff0000">Description:itk::ERROR::PointSetToImageFilter&lt;027CFD18&gt;:The Collapse point component 108 is outside the corrseponding parametric domain of [0,108] &quot; </font></strong>.have you ever met this kind of error,it seems that some other guy has the same problem with this filer,so i wanna a alternative mathod.Can u point out where is wrong and give me some advice?as i not native english speeker so it&#39;s hard for me  to get the useful infomation by searching the internet,and also ,you may fell hard to read my e-mail,but i will be appreaciate for your help.</p>

<p>in addition ,how do you think about my english,bad,so-so,good,excellent,or D,C,B,A?</p>
<p>thanks.</p><br><br><span title="neteasefooter"><span></span></span></blockquote></div><br></div></div></blockquote><br><br><span title="neteasefooter"><span></span></span></div></div></blockquote></div><br></blockquote>
<br><br><span title="neteasefooter"><span></span></span></div></div></blockquote></div><br></div>