<div dir="ltr">Hi Cory,<br><br>I use QtCreator, so the cmake lists is auomagically managed by qmake. In fact  I don&#39;t even know how to create cmakeLists.txt and I never required with QtCreator.<br><br>I have managed to make a simple function as shown below.<br>
<br>It converts 2 vtkImageData into itkImages, both are 3D. The conversion works pretty well and verified with old itkConvolutionImageFilter. Then I convolve with the latest filter. I copied all the necessary files from itk4.0 to the src folder such as itkDivideByConstantImageFilter,....<br>
<br>Hope you will be able to manage with this<br><br><span style=" color:#000080;">#include</span><span style=" color:#008000;">&quot;itkVTKImageToImageFilter.h&quot;</span>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">&quot;itkImageToVTKImageFilter.h&quot;</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000080;">#include</span><span style=" color:#008000;">&quot;itkImage.h&quot;</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000080;">#include</span><span style=" color:#008000;">&quot;itkConvolutionImageFilter.h&quot;</span></pre>


<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000080;">#include</span><span style=" color:#008000;">&quot;vtkImageData.h&quot;</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000080;">#include</span><span style=" color:#008000;">&quot;QDebug&quot;</span></pre>


<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span>main<span style=" color:#000000;">(</span>vtkImageData<span style=" color:#000000;">*</span><span style=" color:#c0c0c0;"> </span>input<span style=" color:#000000;">,</span>vtkImageData<span style=" color:#000000;">*</span><span style=" color:#c0c0c0;"> </span>kernel<span style=" color:#000000;">)</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;">{</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#008000;">//Convert</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">input</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">vtkImageData</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">to</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">itkImage</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;">  </span>itk<span style=" color:#000000;">::</span>Image<span style=" color:#000000;">&lt;</span><span style=" color:#808000;">unsigned</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#000000;">,</span><span style=" color:#000080;">3</span><span style=" color:#000000;">&gt;</span><span style=" color:#c0c0c0;"> </span>ImageType<span style=" color:#000000;">;</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;">  </span>itk<span style=" color:#000000;">::</span>VTKImageToImageFilter<span style=" color:#000000;">&lt;</span>ImageType<span style=" color:#000000;">&gt;</span>VTKImageToImageType<span style=" color:#000000;">;</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">VTKImageToImageType<span style=" color:#000000;">::</span>Pointer<span style=" color:#c0c0c0;"> </span>converter<span style=" color:#000000;">=</span>VTKImageToImageType<span style=" color:#000000;">::</span>New<span style=" color:#000000;">();</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">converter<span style=" color:#000000;">-&gt;</span>SetInput<span style=" color:#000000;">(</span>input<span style=" color:#000000;">-&gt;</span>GetOutput<span style=" color:#000000;">());</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">converter<span style=" color:#000000;">-&gt;</span>Update<span style=" color:#000000;">();</span></pre>


<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#008000;">//Convert</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">kernel</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">vtkImageData</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">to</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">itkImage</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;">  </span>itk<span style=" color:#000000;">::</span>Image<span style=" color:#000000;">&lt;</span><span style=" color:#808000;">unsigned</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#000000;">,</span><span style=" color:#000080;">3</span><span style=" color:#000000;">&gt;</span><span style=" color:#c0c0c0;"> </span>ImageTypeKernel<span style=" color:#000000;">;</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span>itk<span style=" color:#000000;">::</span>VTKImageToImageFilter<span style=" color:#000000;">&lt;</span>ImageTypeKernel<span style=" color:#000000;">&gt;</span>VTKImageToImageTypeKernel<span style=" color:#000000;">;</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">VTKImageToImageTypeKernel<span style=" color:#000000;">::</span>Pointer<span style=" color:#c0c0c0;"> </span>converterKernel<span style=" color:#000000;">=</span>VTKImageToImageTypeKernel<span style=" color:#000000;">::</span>New<span style=" color:#000000;">();</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">converterKernel<span style=" color:#000000;">-&gt;</span>SetInput<span style=" color:#000000;">(</span>kernel<span style=" color:#000000;">);</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">converterKernel<span style=" color:#000000;">-&gt;</span>Update<span style=" color:#000000;">();</span></pre>


<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#008000;">//Crashes</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">while</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">executing</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">htis</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qDebug<span style=" color:#000000;">()&lt;&lt;</span><span style=" color:#008000;">&quot;Convolving....&quot;</span><span style=" color:#000000;">;</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;">  </span>itk<span style=" color:#000000;">::</span>ConvolutionImageFilter<span style=" color:#000000;">&lt;</span>ImageType<span style=" color:#000000;">&gt;</span><span style=" color:#c0c0c0;"> </span>ConvolutionFilterType<span style=" color:#000000;">;</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">ConvolutionFilterType<span style=" color:#000000;">::</span>Pointer<span style=" color:#c0c0c0;"> </span>convoluter<span style=" color:#000000;">=</span><span style=" color:#c0c0c0;"> </span>ConvolutionFilterType<span style=" color:#000000;">::</span>New<span style=" color:#000000;">();</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">convoluter<span style=" color:#000000;">-&gt;</span>SetInput<span style=" color:#000000;">(</span>converter<span style=" color:#000000;">-&gt;</span>GetOutput<span style=" color:#000000;">());</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">convoluter<span style=" color:#000000;">-&gt;</span>SetImageKernelInput<span style=" color:#000000;">(</span>converterKernel<span style=" color:#000000;">-&gt;</span>GetOutput<span style=" color:#000000;">());</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#008000;">//convoluter-&gt;SetOutputRegionModeToSame();</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">convoluter<span style=" color:#000000;">-&gt;</span>Update<span style=" color:#000000;">();</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">qDebug<span style=" color:#000000;">()&lt;&lt;</span><span style=" color:#008000;">&quot;Convolving</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">done....&quot;</span><span style=" color:#000000;">;<br>
<br></span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;">}<br><br>Thanks<br><br>Jothy<br></span></pre><br><br><div class="gmail_quote">
On Fri, Sep 16, 2011 at 2:23 PM, Cory Quammen <span dir="ltr">&lt;<a href="mailto:cquammen@cs.unc.edu">cquammen@cs.unc.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Jothy,<br>
<br>
Could you post a minimal compilable and runnable example with an<br>
accompanying CMakeLists.txt file that gives the compilation error?<br>
<br>
Thanks,<br>
Cory<br>
<div><div></div><div class="h5"><br>
On Fri, Sep 16, 2011 at 7:39 AM, Jothy &lt;<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>&gt; wrote:<br>
&gt; Hi all,<br>
&gt;<br>
&gt; I am trying to use the itkConvolutionImageFilter from git (since some of the<br>
&gt; bugs are fixed in this). i was able to sucessfully use the older version of<br>
&gt; this downloaded from the Insight journal. But I get the following errors<br>
&gt; with the git version.<br>
&gt;<br>
&gt; In file included from ..\BIOSIM2\/itkConvolutionImageFilter.h:197,<br>
&gt;<br>
&gt; from ..\BIOSIM2\myimagefilters.cpp:48:<br>
&gt;<br>
&gt; ..\BIOSIM2\/itkConvolutionImageFilter.hxx: In member function &#39;typename<br>
&gt; itk::ConvolutionImageFilter&lt;TInputImage, TKernelImage,<br>
&gt; TOutputImage&gt;::OutputRegionType itk::ConvolutionImageFilter&lt;TInputImage,<br>
&gt; TKernelImage, TOutputImage&gt;::GetValidRegion() const [with TInputImage =<br>
&gt; itk::Image&lt;unsigned int, 3u&gt;, TKernelImage = itk::Image&lt;unsigned int, 3u&gt;,<br>
&gt; TOutputImage = itk::Image&lt;unsigned int, 3u&gt;]&#39;:<br>
&gt;<br>
&gt; ..\BIOSIM2\/itkConvolutionImageFilter.hxx:200: instantiated from &#39;void<br>
&gt; itk::ConvolutionImageFilter&lt;TInputImage, TKernelImage,<br>
&gt; TOutputImage&gt;::GenerateOutputInformation() [with TInputImage =<br>
&gt; itk::Image&lt;unsigned int, 3u&gt;, TKernelImage = itk::Image&lt;unsigned int, 3u&gt;,<br>
&gt; TOutputImage = itk::Image&lt;unsigned int, 3u&gt;]&#39;<br>
&gt;<br>
&gt; ..\BIOSIM2\myimagefilters.cpp:494: instantiated from here<br>
&gt;<br>
&gt; ..\BIOSIM2\/itkConvolutionImageFilter.hxx:267: error: passing &#39;const<br>
&gt; itk::ConvolutionImageFilter&lt;itk::Image&lt;unsigned int, 3u&gt;,<br>
&gt; itk::Image&lt;unsigned int, 3u&gt;, itk::Image&lt;unsigned int, 3u&gt; &gt;&#39; as &#39;this&#39;<br>
&gt; argument of &#39;const TInputImage* itk::ImageToImageFilter&lt;TInputImage,<br>
&gt; TOutputImage&gt;::GetInput() [with TInputImage = itk::Image&lt;unsigned int, 3u&gt;,<br>
&gt; TOutputImage = itk::Image&lt;unsigned int, 3u&gt;]&#39; discards qualifiers<br>
&gt;<br>
&gt; And here is the code I use to convolve<br>
&gt;<br>
&gt; typedef itk::ConvolutionImageFilter&lt;ImageType&gt; ConvolutionFilterType;<br>
&gt;<br>
&gt; ConvolutionFilterType::Pointer convoluter= ConvolutionFilterType::New();<br>
&gt;<br>
&gt; convoluter-&gt;SetInput(converter-&gt;GetOutput());<br>
&gt;<br>
&gt; convoluter-&gt;SetImageKernelInput(converterKernel-&gt;GetOutput());<br>
&gt;<br>
&gt; convoluter-&gt;Update();<br>
&gt;<br>
&gt;<br>
&gt; Any hints<br>
&gt;<br>
&gt; Jothy<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Jothybasu K Selvaraj<br>
&gt; PhD Student<br>
&gt; University of Liverpool<br>
&gt; Liverpool,UK<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _____________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt; <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;<br>
&gt;<br>
<font color="#888888"><br>
<br>
<br>
--<br>
Cory Quammen<br>
Research Associate<br>
Department of Computer Science<br>
The University of North Carolina at Chapel Hill<br>
</font></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Jothybasu K Selvaraj<br>PhD Student<br>University of Liverpool<br>Liverpool,UK<br></div><br>
</div>