[Insight-users] Gradient filter problems

Luis Ibanez luis.ibanez@kitware.com
Thu, 02 May 2002 12:06:41 -0400


Bjorn,

I agree with Stephen,

Let's say that the intensity profile of your
pipe-like object is like the figure below:


       +-+                    +-+
       | |                    | |  
       | |                    | |
_______| |____________________| |_____

       A B          ^         C D
                    |
            Center of the pipe


Any Edge detector based on first derivative
should return to you peaks at the positions
A,B,C and D. 


If what you actually want is the center
of the pipe wall, that is, the middle point
between A and B, then you may want to follow
Stephen's advice and use a second derivative
filter.  (a Laplacian for example).


Also, keep in mind the derivatives have to be
computed at a particular scale.  If you are
looking for the middle point of the wall, you
may first blurr the image with a gaussian filter
using a sigma equals to the wall width.

Then compute second derivatives (the laplacian)
on the blurred image. That image will give you
peaks in the middle of the walls.

You can get a sense of how to combine the filters
by looking at the GaussianFilter example in

    Insight/Examples/GaussianFilter/

The "GaussianFilter2D" will process 2D image in PNG
format. While the "GaussianFilter" will process 3D
images in MetaImage format.

You may also find interesting the Curve2DExtractor
example which is actually intended to detect and
extract the central lines of blood vessels in 2D
angiograms.

http://www.itk.org/HTML/Curve2DExtraction.htm


For computing laplacioans at a certain scale  you
can combine filters of the class:

    itkRecursiveGaussianImageFilter


http://www.itk.org/Doxygen/html/classitk_1_1RecursiveGaussianImageFilter.html 


SetSigma() to the width of the wall you are
looking for. This filter is applied along a particular
direction selected with SetDirection(). The same
filter can be used for blurring, computing first
derivative after blurring and computing second derivative
after blurring.  This is selected with the method
SetOrder().

This filter is quite fast because it uses a IIR
recursive filter which approximates very well a gausssian
by using a constant number of operations.


Please let us know if you encounter any problem
detecting the contours.


Thanks


   Luis






Stephen R. Aylward wrote:

> Hi,
>
> What you are asking for is a second-derivative-magnitude-image-filter 
> - something that captures "barness" instead of "edgeness."   The issue 
> becomes the scale (i.e. width) of the lines that you are looking for. 
> Are all of your lines of the same width?  If so, then this filter 
> could be easily created by modifying the GradientMagnitudeImageFilter...
>
> Does that sound like what you need?
>
> Stephen
>
>
> Bjorn Hanch Sollie wrote:
>
>> Hi all,
>>
>> I find that when I use the GradientMagnitudeImageFilter I obtain
>> double edges in the filtered picture.  For example single line
>> (typically about one pixel wide in the data I'm working with) turns
>> into two lines in the output image, one line on either side of where
>> the actual line is.
>>
>> The result of this is that when I do edge detection on a volume of a
>> rather thin pipe-shaped structure, the filtered image contains one
>> pipe within the other, and this makes it significantly harder to
>> segment the picture afterwards.
>>
>> I assume the filter "sees" the pixel-wide line as two transitions,
>> from dark to light to dark, for example, thus producing two edges
>> rather than one, but this makes little sense for my application,
>> unfortunately, and I've seen other similar filters producing only one
>> edge in this instance.
>>
>> So, what I want is an edge-detection filter where the detected edges
>> are actually in the same place as the boundaries I'm interested in.
>> It isn't really obvious to me why the GradientMagnitudeImageFilter
>> doesn't do this in the first place, so if I'm really looking for
>> another filter, I'd be happy if someone can point me in the right
>> direction.
>>
>> -Bjorn
>>
>
>