[Insight-users] Find largest connected object in a Volume

Luis Ibanez luis . ibanez at kitware . com
Fri, 27 Jun 2003 08:18:10 -0400


Hi Sateesh,

We probably don't have a specific filter for
doing this operation.

However you could take the binary image resulting
from your thresholding and do:

1) Invert it, so the pixels in the objects
    of interest are set to zero, and the
    background is nonzero, (e.g. 255)

2) Run the watershed filter on it using a
    water level of 0.5. This will label all
    the basins in the image using a different
    label number for each one.

    Watersheads are treated in:
    http://www . itk . org/ItkSoftwareGuide . pdf
    Section 8.2

3) Compute the histogram of the watershed
    output image. This will give you a count
    of how many pixels have been assigned to
    each label.

    Histograms are treated in
    http://www . itk . org/ItkSoftwareGuide . pdf
    Chapter 9

4) Search the histogram for its max count
    value,... the bin having this maximum
    count is the one associated with the
    largest object in the image.

5) Use the ThresholdImage filter for selecting
    only the pixels with values = max.label.


----

Another option, if you are willing to have
user interaction, is to ask the user to
click on the specific object and then just
run ThresholdConnectedImageFilter, which
will grow a regin there.  It will be up to
the user to select the largest object in
the image.


Regards,



    Luis


-------------
cspl wrote:
> Hi Luis and all,
>    I am in need of help on connectivity filter. Let me explain my 
> requirment.
>    I have a volume of some slices. I have to find the largest object in 
> the entire volume. Initiallly i will threshold the image so that it will 
> in binary format. Then i have to use 6-connectivity of find the largest 
> object in the volume. The largest object should be labeled 1. Is there 
> any filter which solves my problem. I should use 6-connectivity. Please 
> do suggest me if there are other alternatives too.
>    
>    Please help me in this regard.
>  
>    Thanks in advance.
>  
> -Regards,
>   Sateesh.