[Insight-users] Problems using CastImageFilter with itk::DeformableMesh3DFilter::GradientImageType
Th. Boettger
t.boettger@dkfz-heidelberg.de
Mon, 30 Sep 2002 13:58:35 +0200
Hallo everybody,
I just want t convert an Image of Type
itk::DeformableMesh3DFilter::GradientImageType to another format, for
instance an image consisting of unsigned short values. I'm trying to use the
itk::CastImageFilter in the following way:
// mesh definition
typedef itk::DefaultStaticMeshTraits<double, 3, 3, double,double,double>
MeshTraits;
typedef itk::Mesh<double,3,MeshTraits> InputMeshType;
typedef itk::Mesh<float, 3, itk::DefaultStaticMeshTraits< float, 3, 3,
float, float > > MeshType;
// deform filter def
typedef itk::DeformableMesh3DFilter<InputMeshType,InputMeshType>
Deformable3DFilterType;
// img type def
typedef Deformable3DFilterType::GradientImageType GradientImageType;
typedef itk::Image<unsigned short,3> OriginalImageType;
// cast filter def
typedef itk::CastImageFilter< GradientImageType, OriginalImageType>
OriginalCastFilterType;
OriginalCastFilterType::Pointer originalCastFilter =
OriginalCastFilterType::New();
The compiler says:
:\home\boettger\Insight\Code\BasicFilters\itkCastImageFilter.h(46) : error
C2440: 'static_cast' : cannot convert from 'const
itk::Image<TPixel,VImageDimension>::PixelType' to
'itk::Image<TPixel,VImageDimension>::PixelType'
with
[
TPixel=itk::DeformableMesh3DFilter<InputMeshType,InputMeshType>::GradientTyp
e,
VImageDimension=3
]
and
[
TPixel=unsigned short,
VImageDimension=3
]
No user-defined-conversion operator available that can perform this
conversion, or the operator cannot be called
c:\home\boettger\Insight\Code\BasicFilters\itkCastImageFilter.h(45)
: while compiling class-template member function
'itk::Image<TPixel,VImageDimension>::PixelType
itk::Functor::Cast<TInput,TOutput>::operator ()(const TInput &)'
with
[
TPixel=unsigned short,
VImageDimension=3,
TInput=itk::Image<itk::DeformableMesh3DFilter<InputMeshType,InputMeshType>::
GradientType,3>::PixelType,
TOutput=itk::Image<unsigned short,3>::PixelType
]
c:\home\boettger\Insight\Code\BasicFilters\itkUnaryFunctorImageFilter.h(102)
: see reference to class template instantiation
'itk::Functor::Cast<TInput,TOutput>' being compiled
with
[
TInput=itk::Image<itk::DeformableMesh3DFilter<InputMeshType,InputMeshType>::
GradientType,3>::PixelType,
TOutput=itk::Image<unsigned short,3>::PixelType
]
c:\home\boettger\Insight\Code\BasicFilters\itkCastImageFilter.h(58)
: see reference to class template instantiation
'itk::UnaryFunctorImageFilter<TInputImage,TOutputImage,TFunction>' being
compiled
with
[
TInputImage=GradientImageType,
TOutputImage=OriginalImageType,
TFunction=itk::Functor::Cast<itk::Image<itk::DeformableMesh3DFilter<InputMes
hType,InputMeshType>::GradientType,3>::PixelType,itk::Image<unsigned
short,3>::PixelType>
]
main.cpp(448) : see reference to class template instantiation
'itk::CastImageFilter<TInputImage,TOutputImage>' being compiled
with
[
TInputImage=GradientImageType,
TOutputImage=OriginalImageType
]
Could anyone please help me?
Thanks,
Thomas
---
Dipl.-Inform. Thomas Boettger
Deutsches Krebsforschungszentrum (German Cancer Research Center)
Div. Medical and Biological Informatics H0100 Tel: (+49) 6221-42 2328
Im Neuenheimer Feld 280 Fax: (+49) 6221-42 2345
D-69120 Heidelberg e-mail: t.boettger@dkfz.de
Germany http://www.dkfz.de/mbi/people/thomasb.shtml