[Insight-users] Connected Component Image Filter

Luis Ibanez luis . ibanez at kitware . com
Mon, 15 Dec 2003 14:41:06 -0500


Hi Radhika,

About the use of the ConnectedComponentImageFilter:

1) The Maximum number of labels is set to the "max()" value
    of the pixel type used for the output image.

    What image type are you using for this filter ?

    "38" doesn't sounds like the max value of any of the
    typical C types.
    How are you finding this value ? Using a Get.. method ?


2) The ConnectedComponentImageFilter uses a face-connectivity,
    that is the equivalent of 4 connected in 2D and 6 connected
    in 3D... and in general 2N connected in ND.

    The filter visits the image looking that the neighbors of
    a pixel in the "face" directions.

    The core functionality for the ConnectedComponentImageFilter
    can be seen in the file:

    Insight/Code/BasicFilters/itkConnectedComponentsImageFilter.txx

    In particular in lines 96-105 are:

---------------------------------------------------------------
>   unsigned int d;
>   typename NeighborhoodIteratorType::OffsetType offset;
> 
>   offset.Fill(0);
>   for (d=0; d < InputImageType::ImageDimension; ++d)
>     {
>     offset[d] = -1;
>     nit.ActivateOffset(offset);
>     offset[d] = 0;
>     }
---------------------------------------------------------------

     If you want to use other type of connectivity, you can
     simply replace here the offset that you want to visit
     from every pixel.



Please let us know if you have further questions,


   Thanks


   Luis




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

> Hi,
> 
> I am using the connected component image filter and I have the following 
> questions:
> 
>  
> 
> 1)       I am getting a warning message that the number of labels 
> exceeds the number of available labels for the output type. When I use 
> the RelabelConnectedComponent filter and check number of objects, it 
> reports 38, so I do not understand what is exceeded.
> 
> 2)       Does the connected component image Filter basically perform a 
> type of pixel aggregation to accumulate the pixels for each separate 
> object? In case of a 2D image, does it use a 4-connected neighbor or 
> 8-connected neighbor. Is this a parameter we can set?
> 
> Thanks
> 
> Radhika
> 
>  
> 
> -----------------------------------------------------
> 
> Confidentiality Notice.
> 
> This email message is for the sole use of the intended recipient(s) and 
> may contain confidential and privileged information. Any unauthorized 
> review, use, disclosure or distribution is prohibited. If you are not 
> the intended recipient, please contact the sender by reply email and 
> destroy all copies of the original message. If you are the intended 
> recipient, please be advised that the content of this message is subject 
> to access, review and disclosure by the sender's Email System Administrator.
>