[ITK] Using spatialObjects as filters

Matt McCormick matt.mccormick at kitware.com
Thu Apr 9 10:38:40 EDT 2015


On Thu, Apr 9, 2015 at 9:17 AM, Leslie Solorzano <lesolorzanov at gmail.com> wrote:
> Hello world.

:-)


> I want to use a gaussianSpatialObject and a
> SpatialObjectToImageStatisticsCalculator to filter an image and make a
> gaussian convolution. Why not using a DiscreteGaussianImageFilter? easy, I
> need a gaussian with different radii in each dimension and I need to be able
> to set the size, the maximum value and the sigma, which only a
> gaussianSpatialObject can offer me.

> is there anyway I can use DiscreteGaussianImageFilter with different radii?
> can I set the maximum value?

Yes, DiscreteGaussianImageFilter will give much better performance.

To set a different Gaussian width in each direction, something like:

  typedef itk::DiscreteGaussianImageFilter< ImageType, ImageType>
GaussianFilterType;
  typedef GaussianFilterType::ArrayType VariancesType;
  VariancesType variances;
  variances[0] = 1.1;
  variances[1] = 0.5;
  variances[2] = 7.7;
  GaussianFilterType::Pointer gaussianFilter = GaussianFilterType::New();
  gaussianFilter->SetVariance( variances );

would set different variances in each direction for a 3D image.

HTH,
Matt


More information about the Community mailing list