[Insight-users] GradientMagnitudeImageFilter

Luis Ibanez luis . ibanez at kitware . com
Tue, 27 Aug 2002 10:41:41 -0400


Hi Zein,

The GradientMagnitudeImageFilter compute the Magnitude of the
image gradient. That is, the result is a image of Scalars and
not an image of Vectors.

The compilation error is due to the fact that this filter cannot
manage an Image of vectors as output.



If you actually need the image of gradient vectors associated
with each pixel in your input image, you may want to use one
of the following filters:

1) GradientImageFilter
http://www.itk.org/Insight/Doxygen/html/classitk_1_1GradientImageFilter.html#_details

2) GradientRecursiveGaussianImageFilter
http://www.itk.org/Insight/Doxygen/html/classitk_1_1GradientRecursiveGaussianImageFilter.html

Both of them produce an image of CovariantVectors as output.

Gradients are "Covariant Vectors" (They behave different than Vectors
under affine transforms).

The GradientImageFilter computes the gradient by convolution with a
first derivative kernel.

The GradientRecursiveGaussianImageFilter computes the gradient by
using a IIR filter. The result is equivalent to first smoothing the
input image with a gaussian filter and then apply a derivative
operator. The advantage of the IIR filter is that it performs a
constant number of operation for doing the filtering independently
of how big is the sigma of the gaussian used for smoothing.
Note that when you use this filter you are required to provide a
value for the sigma that will control how much smoothing is applied
to the image. This is what is usually required for scale space
analysis.


Please let us know if you have further questions,

Thanks

Luis

====================================================

Zein Salah wrote:
> Hi all,
> 
> I am trying to use the GradientMagnitudeImageFilter to obtain a 
> derivative of an image. Just by allocating an object of this class, I 
> got a list of error that are pasted bellow.
> 
>  
> 
> These are my definitions:
> 
> typedef 
> itk::Vector<float,ImageDimension>                                   
> VectorType; 
> 
> typedef itk::Image<VectorType, ImageDimension>                         
> DerivativeImageType;
> typedef itk::GradientMagnitudeImageFilter< InputImageType, 
> DerivativeImageType>  DerivativeFilterType;
> 
>  
> 
> and this is the definition of the filter that produces the errors:
> 
> DerivativeFilterType::Pointer deriv = DerivativeFilterType::New();
> 
>  
> 
> Is there a bug in the GradientMagnitudeImageFilter??
> 
>  
> 
> Do any body have an idea about where the problem could be???
> 
>  
> 
> many thanks in advance!
> 
>  
> 
> Zein
> 
>  
> 
>  
>