[Insight-users] 1D Convolution with Gaussian Kernel using

Antonio Gómez Barquero agb1 at alu.upct.es
Wed Nov 16 11:21:47 EST 2011


SORRY, the last e-mail was icomplete, here is ok:

 

My goal is to calculate the calculation in each row of a 2D-image ( in the
x-direction)

After following the tip from Cory I am trying to use the
‘ConvolutionImageFilter’, and make a kernel with the Gaussian values I
calculate before.

I took a look to this example (
<http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/ConvolutionImageFilter
>
http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/ConvolutionImageFilter)
and my question is how to include the values of the Gaussian filter to the
kernel, I tried wit the code below and it compiles, but it seems the
execution has no end when I update the convolutionFilter
 Because of that I
think that I am doing something wrong. My code is below and is not so much,
if some can give some help I would appreciate that really a lot !!!!.

 

      typedef itk::ConvolutionImageFilter <ImageType> ConvFilterType;

 

      ImageType::Pointer kernel = ImageType::New();

      CreateKernel(kernel, Gaussian , 256);

 

      //Convolve image with kernel

      ConvFilterType::Pointer convolutionFilter = ConvFilterType::New();

      convolutionFilter->SetInput(Li_itk);

      convolutionFilter->SetImageKernelInput(kernel);

      convolutionFilter->Update();

 

void Reg_image_v2::CreateKernel(Reg_image_v2::ImageType::Pointer kernel,
double *Gaussian, unsigned int width) {

 

      ImageType::IndexType start;

      start.Fill(0);

      ImageType::SizeType size;

      size.Fill(width);

      ImageType::RegionType region;

      region.SetSize(size);

      region.SetIndex(start);

      kernel->SetRegions(region);

      kernel->Allocate();

      

      ImageType::IndexType pixelIndex;

      for (int i = 0 ; i < width ; i ++){

            pixelIndex[0] = i ;

            pixelIndex[1] = 0 ;

            kernel->SetPixel(pixelIndex,Gaussian[i]);

      }

      itk::ImageRegionIterator<ImageType> imageIterator(kernel, region);

   while(!imageIterator.IsAtEnd()) 

    {

    //imageIterator.Set??

    ++imageIterator; //operator++  increments the iterator one position in
the positive direction

    }

 

 

} // end createKernel

 

 

Antonio Gómez Barquero

 

Ingeniero de Telecomunicaciones -Becario Investigador asociado a Actividades
de I+D+I 

GTTS ( Grupo de Tratamiento y Teoría de la Señal)[  <http://gtts.upct.es/>
http://gtts.upct.es/]

UPCT (Universidad Politécnica de Cartagena)[  <http://www.upct.es/>
http://www.upct.es/]

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111116/71421805/attachment.htm>


More information about the Insight-users mailing list