[Insight-users] NeighborhoodConnectedImageFilter question
Luis Ibanez
luis.ibanez at kitware.com
Thu Aug 3 19:13:18 EDT 2006
Hi Henning,
Ah !
The beauty of Open Source software,
There are no secrets for those who read the code !! :-)
Please look at teh code in
Insight/Code/BasicFilters/
itkNeighborhoodConnectedImageFilter.txx
The visiting of the image is implemented in 25 lines
of code between line 90 and 115.
The actual operation is performed by the
Insight/Code/Common/
itkNeighborhoodBinaryThresholdImageFunction.h
itkNeighborhoodBinaryThresholdImageFunction.txx
in the EvaluateAtIndex() method in lines 79 - 92
In order to answer whether a pixel should be included or
not, this image function require *ALL* its neighbors to
be also inside the intensity range defined by the upper
and lower thresholds.
So, if a pixel and all its neigbors except one are inside
the intensity range, then the pixel is rejected for being
included in the region. This is why this filter is equivalent
to running the ConnectedThreshold filter and then an erosion.
You may want to simply experiment with the ConnectedThreshold
filter, and if you actually find that you need to fill holes,
then you can add the Erosion, or Dilation, or one of the
FillHoles that are based on voting schemes.
You will find descriptions of the Mathematical Morphology
filters and the Voting filters in the ITK Software Guide
http://www.itk.org/ItkSoftwareGuide.pdf
Regards,
Luis
--------------------
Henning Meyer wrote:
> Hello,
>
> I use NeighborhoodConnectedImageFilter which works nicely for me, but
> is a bit slow. So my question is - how does it work? As far as I
> understood it could be implemented as a binary erosion and a
> ConnectedComponentImageFilter. Is it done this way? Or would there be
> any performance gain in doing it this way?
>
> Henning
> _______________________________________________
> 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