[Insight-users] Problem with itkConvolutionImageFilter from git

Jothy jothybasu at gmail.com
Fri Sep 16 10:10:52 EDT 2011


Hi Cory,

I use QtCreator, so the cmake lists is auomagically managed by qmake. In
fact  I don't even know how to create cmakeLists.txt and I never required
with QtCreator.

I have managed to make a simple function as shown below.

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,....

Hope you will be able to manage with this

#include"itkVTKImageToImageFilter.h"

#include "itkImageToVTKImageFilter.h"

#include"itkImage.h"

#include"itkConvolutionImageFilter.h"

#include"vtkImageData.h"

#include"QDebug"

void main(vtkImageData* input,vtkImageData* kernel)

{

//Convert input vtkImageData to itkImage

typedef  itk::Image<unsigned int,3> ImageType;

typedef  itk::VTKImageToImageFilter<ImageType>VTKImageToImageType;

VTKImageToImageType::Pointer converter=VTKImageToImageType::New();

converter->SetInput(input->GetOutput());

converter->Update();

//Convert kernel vtkImageData to itkImage

typedef  itk::Image<unsigned int,3> ImageTypeKernel;

typedef itk::VTKImageToImageFilter<ImageTypeKernel>VTKImageToImageTypeKernel;

VTKImageToImageTypeKernel::Pointer
converterKernel=VTKImageToImageTypeKernel::New();

converterKernel->SetInput(kernel);

converterKernel->Update();

//Crashes while executing htis

qDebug()<<"Convolving....";

typedef  itk::ConvolutionImageFilter<ImageType> ConvolutionFilterType;

ConvolutionFilterType::Pointer convoluter= ConvolutionFilterType::New();

convoluter->SetInput(converter->GetOutput());

convoluter->SetImageKernelInput(converterKernel->GetOutput());

//convoluter->SetOutputRegionModeToSame();

convoluter->Update();

qDebug()<<"Convolving done....";

}

Thanks

Jothy



On Fri, Sep 16, 2011 at 2:23 PM, Cory Quammen <cquammen at cs.unc.edu> wrote:

> Jothy,
>
> Could you post a minimal compilable and runnable example with an
> accompanying CMakeLists.txt file that gives the compilation error?
>
> Thanks,
> Cory
>
> On Fri, Sep 16, 2011 at 7:39 AM, Jothy <jothybasu at gmail.com> wrote:
> > Hi all,
> >
> > I am trying to use the itkConvolutionImageFilter from git (since some of
> the
> > bugs are fixed in this). i was able to sucessfully use the older version
> of
> > this downloaded from the Insight journal. But I get the following errors
> > with the git version.
> >
> > In file included from ..\BIOSIM2\/itkConvolutionImageFilter.h:197,
> >
> > from ..\BIOSIM2\myimagefilters.cpp:48:
> >
> > ..\BIOSIM2\/itkConvolutionImageFilter.hxx: In member function 'typename
> > itk::ConvolutionImageFilter<TInputImage, TKernelImage,
> > TOutputImage>::OutputRegionType itk::ConvolutionImageFilter<TInputImage,
> > TKernelImage, TOutputImage>::GetValidRegion() const [with TInputImage =
> > itk::Image<unsigned int, 3u>, TKernelImage = itk::Image<unsigned int,
> 3u>,
> > TOutputImage = itk::Image<unsigned int, 3u>]':
> >
> > ..\BIOSIM2\/itkConvolutionImageFilter.hxx:200: instantiated from 'void
> > itk::ConvolutionImageFilter<TInputImage, TKernelImage,
> > TOutputImage>::GenerateOutputInformation() [with TInputImage =
> > itk::Image<unsigned int, 3u>, TKernelImage = itk::Image<unsigned int,
> 3u>,
> > TOutputImage = itk::Image<unsigned int, 3u>]'
> >
> > ..\BIOSIM2\myimagefilters.cpp:494: instantiated from here
> >
> > ..\BIOSIM2\/itkConvolutionImageFilter.hxx:267: error: passing 'const
> > itk::ConvolutionImageFilter<itk::Image<unsigned int, 3u>,
> > itk::Image<unsigned int, 3u>, itk::Image<unsigned int, 3u> >' as 'this'
> > argument of 'const TInputImage* itk::ImageToImageFilter<TInputImage,
> > TOutputImage>::GetInput() [with TInputImage = itk::Image<unsigned int,
> 3u>,
> > TOutputImage = itk::Image<unsigned int, 3u>]' discards qualifiers
> >
> > And here is the code I use to convolve
> >
> > typedef itk::ConvolutionImageFilter<ImageType> ConvolutionFilterType;
> >
> > ConvolutionFilterType::Pointer convoluter= ConvolutionFilterType::New();
> >
> > convoluter->SetInput(converter->GetOutput());
> >
> > convoluter->SetImageKernelInput(converterKernel->GetOutput());
> >
> > convoluter->Update();
> >
> >
> > Any hints
> >
> > Jothy
> >
> >
> >
> >
> > --
> > Jothybasu K Selvaraj
> > PhD Student
> > University of Liverpool
> > Liverpool,UK
> >
> >
> > _____________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Kitware offers ITK Training Courses, for more information visit:
> > http://www.kitware.com/products/protraining.html
> >
> > Please keep messages on-topic and check the ITK FAQ at:
> > http://www.itk.org/Wiki/ITK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.itk.org/mailman/listinfo/insight-users
> >
> >
>
>
>
> --
> Cory Quammen
> Research Associate
> Department of Computer Science
> The University of North Carolina at Chapel Hill
>



-- 
Jothybasu K Selvaraj
PhD Student
University of Liverpool
Liverpool,UK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110916/2033c022/attachment.htm>


More information about the Insight-users mailing list