[Insight-users] image ~> binary threshold?

Neil Panjwani paniwani at gmail.com
Fri Apr 8 17:35:12 EDT 2011


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.

On Fri, Apr 8, 2011 at 5:28 PM, G G <greenlander1986 at gmail.com> wrote:

> 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 :)
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110408/d7562fc1/attachment.htm>


More information about the Insight-users mailing list