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"><<a href="mailto:mrvillage@163.com">mrvillage@163.com</a>></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're right.i set the number of control points as you suggested,it run smoothly,but the output image is awful,it'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'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,"robert tamburo" <<a href="mailto:robert.tamburo@gmail.com" target="_blank">robert.tamburo@gmail.com</a>> 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'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"><<a href="mailto:mrvillage@163.com" target="_blank">mrvillage@163.com</a>></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 "itkImage.h"<br>#include <iostream><br>#include "itkAdaptiveOtsuThresholdImageFilter.h"<br>#include "itkImageFileReader.h"<br>#include "itkImageFileWriter.h"<br>
using namespace std;<br> void AdaptiveOtsuThresholdImage(<br> const std::string & inputFileName,<br> const std::string & outputFileName,<br> const unsigned int & radius,<br> const unsigned int & bins,<br>
const unsigned int & controlPoints,<br> const unsigned int & levels,<br> const unsigned int & samples,<br> const unsigned int & splineOrder );<br>int main()<br>{<br> AdaptiveOtsuThresholdImage("HE.png","Output.png",20,256,30,3,12,3);<br>
return 1;<br>}</div>
<div> void AdaptiveOtsuThresholdImage(<br> const std::string & inputFileName,<br> const std::string & outputFileName,<br> const unsigned int & radius,<br> const unsigned int & bins,<br> const unsigned int & controlPoints,<br>
const unsigned int & levels,<br> const unsigned int & samples,<br> const unsigned int & splineOrder )<br> {<br> /** Typedef's. */<br> const unsigned int ImageDimension = 2;<br> typedef unsigned char OutputPixelType;<br>
typedef itk::Image< OutputPixelType, ImageDimension > InputImageType;<br> typedef itk::Image< OutputPixelType, ImageDimension > OutputImageType;<br> typedef itk::ImageFileReader< InputImageType > ReaderType;<br>
typedef itk::AdaptiveOtsuThresholdImageFilter<<br> InputImageType, OutputImageType> ThresholderType;<br> typedef itk::ImageFileWriter< OutputImageType > 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->SetFileName( inputFileName.c_str() );<br> thresholder->SetInput( reader->GetOutput() );<br> /** Apply the threshold. */<br> thresholder->SetRadius( Radius );<br>
thresholder->SetNumberOfHistogramBins( bins );<br> thresholder->SetNumberOfControlPoints( controlPoints );<br> thresholder->SetNumberOfLevels( levels );<br> thresholder->SetNumberOfSamples( samples );<br>
thresholder->SetSplineOrder( splineOrder );<br> thresholder->SetInsideValue( 1 );<br> thresholder->SetOutsideValue( 0 );<br> /** Write the output image. */<br> writer->SetInput( thresholder->GetOutput() );<br>
writer->SetFileName( outputFileName.c_str() );<br> try<br> {<br> writer->Update();<br> }<br> catch( itk::ExceptionObject & excep )<br> {<br> std::cerr << "Exception caught !" << std::endl;<br>
std::cerr << excep << std::endl;<br> }<br> } </div>
<div>
<div></div>
<div>
<div></div><br>At 2011-05-20 00:42:58,"robert tamburo" <<a href="mailto:robert.tamburo@gmail.com" target="_blank">robert.tamburo@gmail.com</a>> 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->SetInput(image);</div>
<div> adaptiveThresholder->SetInsideValue(255); // foreground of output image</div>
<div> adaptiveThresholder->SetOutsideValue(0); // background of output image</div>
<div> adaptiveThresholder->SetNumberOfHistogramBins(256);</div>
<div> adaptiveThresholder->SetNumberOfControlPoints(10); // b-spline control points</div>
<div> adaptiveThresholder->SetNumberOfLevels(3); // number of b-spline levels for reconstruction (3-5)</div>
<div> adaptiveThresholder->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->SetRadius(radius); // radius of sampling region</div>
<div> adaptiveThresholder->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"><<a href="mailto:mrvillage@163.com" target="_blank">mrvillage@163.com</a>></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't know much about itk ,so i don't know how to debug it.</div>
<p>the error is located at <strong>itkBSplineScatteredDataPointSetToImageFilter.txx </strong>" <strong><font color="#ff0000">Description:itk::ERROR::PointSetToImageFilter<027CFD18>:The Collapse point component 108 is outside the corrseponding parametric domain of [0,108] " </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'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>