[Insight-users] image ~> binary threshold?

G G greenlander1986 at gmail.com
Fri Apr 8 17:28:59 EDT 2011


Hi I would like to convert image to binary image.
I have mha/mhd image in 3D in grayscale.
So I ask you, how should I convert my image to binary image?
I tried to use binary threshold image filter. But when I use it, I dont get
black&white image, black&dark gray&white image
I am using this code bellow

  typedef itk::BinaryThresholdImageFilter <ImageType, ImageType>
BinaryThresholdImageFilterType;
  BinaryThresholdImageFilterType::Pointer thresholdFilter =
BinaryThresholdImageFilterType::New();
  thresholdFilter->SetInput(reader->GetOutput());

  thresholdFilter->SetOutsideValue( 0 );
  thresholdFilter->SetInsideValue(  255  );
  thresholdFilter->SetLowerThreshold( 10 );
  thresholdFilter->SetUpperThreshold( 255 );
  thresholdFilter->Update();

where could be problem? Thanks for ideas :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110408/203643ff/attachment.htm>


More information about the Insight-users mailing list