[Insight-users] Bounding box of on pixels in an image

Luis Ibanez luis . ibanez at kitware . com
Wed, 10 Dec 2003 16:53:19 -0500


Hi Radhika,

There is not an ITK filter that will compute the bounding box
for the ON pixels in a binary mask image.

You could do it easily, as you suggested, by visiting all the
pixels using an iterator and computing the min/max index
component along each dimension.

That will be a nice question for an ITK exam  :-)


Regards,


    Luis


--------------------------------
Radhika Sivaramakrishna wrote:

> Hi Luis,
>  
> This question may have been asked before. I have a binary 2D image. I 
> want to find the bounding box (min,max of x and y) of all ON pixels in 
> the image. The only way I can think of is, Getting index of each on 
> pixel using an iterator and finding min, max values on x and y. Is there 
> already a function to do this?
>  
> Also, is there a function to find # of ON pixels in a binary image? Or 
> do we have to again use an iterator to count ON pixels?
>  
> Radhika