[ITK] Finding non-zero pixels

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Jun 3 08:40:44 EDT 2014


Hello,

You can find the answer to you question with in the code:
https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkImageBase.h#L403-L417

The return of false or 0 indicate that the index is out of bounds. The index should still be set, just be sure not to use on to get access to a pixel as it's invalid.

Brad

On Jun 3, 2014, at 8:32 AM, Girish, Gavaskar Ruturaj <gavaskar.ruturaj.girish at philips.com> wrote:

> Hello,
>  
> Thanks Brad, that was just what I needed, because pixels equal to the threshold value are not set to OutsideValue.
> I have one more question (actually three). What does it mean when the method itk::Image::TransformPhysicalPointToIndex(point,pixelIndex) returns a 0? Do the index coordinates still get stored in pixelIndex? Why are they not useful?
>  
> Thanks & Regards,
> Ruturaj
>  
> From: Bradley Lowekamp [mailto:blowekamp at mail.nih.gov] 
> Sent: Tuesday, June 03, 2014 5:43 PM
> To: Girish, Gavaskar Ruturaj
> Cc: community at itk.org
> Subject: Re: [ITK] Finding non-zero pixels
>  
> Hello,
>  
> There quite a large number of ways to do this in ITK. Have you looked at the ThresholdImageFilter[1]?
>  
> Brad
>  
> [1] http://www.itk.org/Doxygen/html/classitk_1_1ThresholdImageFilter.html
>  
> On Jun 3, 2014, at 2:34 AM, Girish, Gavaskar Ruturaj <gavaskar.ruturaj.girish at philips.com> wrote:
> 
> 
> Dear all,
>  
> I have a grayscale image. I want a binary mask which is white where the pixels in the original image are non-zero, and black elsewhere. Which filter(s) can I use for this task?
>  
> Thanks & Regards,
> Ruturaj
>  
> The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140603/41fc2403/attachment-0002.html>


More information about the Community mailing list