[Insight-users] itkVTKImageToImageFilter

Yan Pingkun engp1734 at nus.edu.sg
Tue, 23 Mar 2004 19:57:27 +0800


Hi Luis,

Thanks for your instruction. I put a try/catch there and it told me
"Input scalar type is unsigned char but should be float".
Then I changed the image data type and it works now!

Regards,
Pingkun

-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com]=20
Sent: Tuesday, March 23, 2004 2:51 PM
To: Yan Pingkun
Cc: insight-users at itk.org; mathieu.malaterre at kitware.com
Subject: Re: [Insight-users] itkVTKImageToImageFilter



Hi Yan,

You are using incompatible versions
of Insight and InsightApplications.

Please syncronize your checkouts.

The itkVTKImageToImageFilter in


      InsightApplications/Auxiliary/vtk


depends on the itkVTKImageImport in


      Insight/Code/BasicFilters


Both files should correspond to the
same release of ITK or to the same
CVS date.


About the crash... did you tried adding
a try/catch block around the Update()
invokation  ?



    Regards,



       Luis


-----------------------
Yan Pingkun wrote:
> Dear all,
> =20
> In my project, I need to convert vtk image to itk image. So I write
> following program:
> =20
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> VtkImageToItkImageFilterType::Pointer v2iFilter =3D
> VtkImageToItkImageFilterType::New();
> v2iFilter->SetInput(stencil->GetOutput());
> this->m_pItkImage =3D v2iFilter->GetImporter()->GetOutput();
> v2iFilter->GetImporter()->Update();
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> =20
> Then I encountered two problems. The first is compiling error: error=20
> C2977: 'VTKImageImport' : too many template arguments I found that the

> VTKImageImport file under basicfilters folder has been updated. But=20
> the file "itkVTKImageToImageFilter.h" is still using the old=20
> interface. So I modified it and this error disappear.
> =20
> The second problem is run time error. The program always crash when is
> comes to
> v2iFilter->GetImporter()->Update();
> =20
> Any body can help? Thanks!
> =20
> Regards,
> Pingkun
> =20
> To Mathieu: My problem may not caused by vtkImageStencil but by this
> filter...