[Insight-users] RecursiveGaussianImageFilter problems

Luis Ibanez luis.ibanez@kitware.com
Mon, 06 May 2002 15:39:42 -0400


Hi Bjorn,


What is the pixel type that you are using for you ImageType ?

The output of the FirstOrder and SecondOrder derivatives will
have negative components that get your visualization code
confused.

Or even worst, if your pixel type is something like "unsigned char"
(and you use the same for the output of the filter), the potential
negative values will be rolled around 255.

The filter uses "doubles" for internal computation and then they
are casted (just C-like casting) to the output pixel type.


The "ideal" way of using this filter is to use the "RealType" for
the output image like:

typedef     unsigned char     InputPixelType;
typedef    itk::NumericTraits< InputPixelType>::RealType   OutputPixelType;

typedef    itk::Image< InputPixelType, 3 >   InputImageType;
typedef   itk::Image<   OutputPixelType, 3 > OutputImageType;

and finally:

typedef itk::RecursiveGaussianImageFilter< InputImageType, 
OutputImageType >  myFilter;

The choices of RealType in itkNumericTraits.h   are reasonable ones.

You can just decide on the type directly and say for example:

typedef   float OutpuPixelType;

Take into account that the fact of selecting the output pixel type
doesn't mean that the filte will attempt to fill the dynamic range of this
type.   That is, if the input pixel type was unsigned char,  and you select
double as outputpixel type, the double values will still be around 255.

-----

I tried to see the image at the URL that you indicated by the
link just points to the same web page.

Please let me know if  I can use another URL to see the images
you are getting.    


Thanks


   Luis


BTW
It is a very nice idea to report problems in this way:
both showing the code and the resulting images.  


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

Bjorn Hanch Sollie wrote:

>I downloaded the cvs code yesterday, and I've been trying to use the
>RecursiveGaussianImageFilter (a big thanks to everyone who responded
>and gave me some advice).  It seemed to work fine at first, but then I
>ran into some problems, which I have illustrated in a series of
>pictures here:
>
>     <URL:http://www.pvv.org/~bhs/seg2.html>
>
>These are images from a 8 bit raw volume with spacing 1.0 in all three
>dimensions.  Using a sigma of 1.5 seems to work fine for ZeroOrder
>filtering, but the palette of the FirstOrder images (as well as the
>SecondOrder ones, not on display) is distorted.  I fail to see the
>reason for this, and since the images aren't very useful as they are,
>I'll be very grateful for some further assistance.
>
>The relevant code from my program is as follows:
>
>  // Run a RecursiveGaussianImageFilter filter
>  typedef itk::RecursiveGaussianImageFilter<ImageType, ImageType> PotentialFilter;
>  PotentialFilter::Pointer recgauss = PotentialFilter::New();
>  recgauss->SetSigma(1.5);
>  recgauss->SetDirection(0);
>  recgauss->SetNormalizeAcrossScale(true);
>  recgauss->SetOrder(PotentialFilter::ZeroOrder);
>  recgauss->SetInput(input);
>  recgauss->Update();
>
>-Bjorn
>