<br><br><div class="gmail_quote">On Thu, May 26, 2011 at 6:58 PM, Neil Panjwani <span dir="ltr">&lt;<a href="mailto:paniwani@gmail.com">paniwani@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Not sure if you&#39;ve seen this already, but it&#39;s a simpler example that should work:<div><br></div><div><a href="http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/ConvolutionImageFilter" target="_blank">http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/ConvolutionImageFilter</a></div>


<div><br></div></blockquote><div>Thanks for the reply. that works... my example does not. <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div class="gmail_quote"><div><div></div><div class="h5">On Thu, May 26, 2011 at 5:04 AM, Krishnan V <span dir="ltr">&lt;<a href="mailto:v.srikrishnan@gmail.com" target="_blank">v.srikrishnan@gmail.com</a>&gt;</span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">

<br>Hi all,<br>I am trying out the convolution image filter by generating a simple Gaussian and convolving it with itself, ie, convolve a gaussian with itself. This is done in 2D. I get an output which consists of two peaks at two ends of the image along the X-axis.  This is obviously not the expected output. I have attached a simple sample code. <br>



Can someone faced a similar issue or help out with this? <br>thanks<br>krishnan<br>/************************************************************************************************************ */<br>#include &lt;itkImage.h&gt;<br>



#include &lt;itkGaussianImageSource.h&gt;<br>#include &lt;itkConvolutionImageFilter.h&gt;<br><br>typedef float PixelType;<br>typedef itk::Image&lt;PixelType, 2&gt; ImageType2D;<br>typedef itk::ImageFileReader&lt;ImageType2D&gt; Reader2D;<br>



typedef itk::ImageFileWriter&lt;ImageType2D&gt; Writer2D;<br>void convolve_test(ImageType2D::Pointer input_image, ImageType2D::Pointer kernel)<br>{<br>    typedef itk::ConvolutionImageFilter&lt;ImageType2D,ImageType2D&gt; Convolver_Type;<br>



    Convolver_Type::Pointer convolve = Convolver_Type::New();<br><br>    convolve-&gt;SetInput(kernel);<br>    convolve-&gt;SetImageKernelInput(kernel);<br>    convolve-&gt;Update();<br><br>    Writer2D::Pointer imwriter = Writer2D::New();<br>



    imwriter-&gt;SetInput(convolve-&gt;GetOutput());<br>    imwriter-&gt;SetFileName(&quot;lenna.nii&quot;);<br>    imwriter-&gt;Update();<br>    return;<br>}<br>int main(int argc, char **argv)<br>{<br>  Writer2D::Pointer writer = Writer2D::New();<br>



  ImageType2D::Pointer kernel;<br>  typedef itk::GaussianImageSource&lt;ImageType2D&gt; Gaussian_Generator_Type;<br>  Gaussian_Generator_Type::Pointer kernel_generator = Gaussian_Generator_Type::New();<br>  double sigma[3];<br>



  unsigned long size[3];<br>  double mean[3];<br><br>  Reader2D::Pointer imreader = Reader2D::New();<br>  imreader-&gt;SetFileName(argv[1]);<br>  imreader-&gt;Update();<br><br>  sigma[0] = 10.00; sigma[1] = 10.0;<br>  kernel_generator-&gt;SetSigma(sigma);<br>



<br>  kernel_generator-&gt;Update();<br>  kernel = kernel_generator-&gt;GetOutput();<br>  convolve_test( imreader-&gt;GetOutput(), kernel);<br>  /* Write the Gaussian */<br>  writer-&gt;SetFileName(&quot;Gaussian-1.nii&quot;);<br>



  writer-&gt;SetInput(kernel);<br>  writer-&gt;Update();<br> <br>  return 0;<br>}<br>
<br></div></div>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><div style="visibility: hidden; left: -5000px; position: absolute; z-index: 9999; padding: 0px; margin-left: 0px; margin-top: 0px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 130%;" id="avg_ls_inline_popup">
</div>