[Insight-users] Number of Connected component in a binary image

Zachary Pincus zpincus at stanford.edu
Tue Jul 6 13:10:42 EDT 2004


The typical approach would be to use the ConnectedComponentImageFilter 
to turn a binary image into an image where each connected component is 
uniquely labeled. Then use the RelabelComponentImageFilter to turn that 
image into an image where each component is uniquely and consecutively 
labeled. This latter filter then has a method "GetNumberOfObjects" that 
you can call.

If this seems a bit inefficient to you, and all you want is really the 
object count, you could modify the ConnectedComponentImageFilter to do 
this. (Hint: you'd need to change only the code that compromises the 
third pass, where the filter is looking up values from the equivalence 
table.)

Zach Pincus

Department of Biochemistry and Program in Biomedical Informatics
Stanford University School of Medicine



On Jul 5, 2004, at 8:30 AM, aissa arar wrote:

> Hallo itk community!
>
> Is there in itk a filter that retuns the number of clusters of 
> connected pixels in a binary image?
>   
> Thank you in advance,
>  
> Aissa
>
>  Créez gratuitement votre Yahoo! Mail avec 100 Mo de stockage !
> Créez votre Yahoo! Mail
>
>  Dialoguez en direct avec vos amis grâce à Yahoo! Messenger 
> !_______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list