[Insight-users] Fill holes in mask

Radhika Sivaramakrishna Radhika Sivaramakrishna" <radshashi at earthlink.net
Thu, 22 Jan 2004 13:44:31 -0800


Hi Luis,
The holes are not very big in relation to the size of my ON region. Your
option B sounds really good and I will implement it.

Meanwhile I had a question regarding using atlas based segmentation.

I already have a few T2-weighted images with the intracranial volume (ICV)
labelled (binary images with ones in ICV region and zeros elsewhere). I want
to use this to be able to segment the ICV in future T2-weighted images. I am
sure they will benefit from an atlas segmentation, since the regions look
very similar to each other.

I was thinking of first registering an image for which I have a
corresponding mask available with an unknown image, and obtaining a
deformation field using the demons algorithm. I will then deform the
corresponding mask using the same field and use this as a starting mask for
the hybrid segmentation process which uses a combination of fuzzy
connectedness and voronoi segmentation. Can you tell me if this is the way
to go or you can recommend a different approach?

Thanks
Radhika



----- Original Message ----- 
From: "Luis Ibanez" <luis.ibanez at kitware.com>
To: "Radhika Sivaramakrishna" <radshashi at earthlink.net>
Cc: <insight-users at itk.org>
Sent: Thursday, January 22, 2004 12:12 PM
Subject: Re: [Insight-users] Fill holes in mask


> Hi Radhika,
>
> How big are the holes ?
>
>
> -------------------
>
> Option (A):
>
> You may want to try the GrayscaleFillholeImageFilter
>
>
http://www.itk.org/Insight/Doxygen/html/classitk_1_1GrayscaleFillholeImageFilter.html
>
> If size is enough for characterizing the holes
> you could use the connected components filter
>
>
http://www.itk.org/Insight/Doxygen/html/classitk_1_1ConnectedComponentImageFilter.html
>
> then collect the number of pixels per component
> in order to identify the labeled regions that you
> need to set ON in order to fill the holes.
>
> ------------------
>
> Option (B):
>
> You can use the
>
> ThresholdConnectedImageFilter
>
http://www.itk.org/Insight/Doxygen/html/classitk_1_1ConnectedThresholdImageFilter.html
>
> Use the first pixel of the image as seed point
> (assuming it is in the exterior of the shape)
> and segment the "exterior" of your shape.
> (this filter uses a flood fill iterator internally).
>
>
> Then make a logical OR
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1OrImageFilter.html
>
> between the exterior and the shape, which will give you
> the negative map of the holes. If you negate this map
> and do an OR between the map and the original shape, you
> will end up with the shape without holes.
>
>
> Image-->SegmentExterior--> OR ---> NOT ---> OR---> No holes
>     |                       ^                 ^
>     |                       |                 |
>     +-----------------------+---------------- +
>
>
> Note that we don't have a NOT image filter, you can
> easily fabricate a NOR image filter out of the
> existing OR filter just by changing line 56 from
>
>      return static_cast<TOutput>( A | B );
>
> to
>
>      return static_cast<TOutput>( ~ ( A | B ) );
>
>
>
> Actually, if you plan to do this very often,
> you may get much better performance and less
> memory consumption if you compose the entire
> boolean operation in a single filter
>
>           A OR NOT( A OR B )
>
>           ( A | ~ ( A |  B )
>
> where A is the pixel from the input image and
> B is the pixel from the segmented exterior.
>
>
>
> Regards,
>
>
>    Luis
>
>
> --------------------------------
> Radhika Sivaramakrishna wrote:
>
> > Hi,
> > I have a mask (binary image) with a few holes in the ON region. And I
> > want to fill those holes. Is there
> > already a procedure in ITK which does this automatically? Or can someone
> > recommend a simple procedure to do this? Basically I think I need a
> > flood fill operation but not sure how to use it in this context.
> >
> > Radhika
> >
>
>
>
>