[Insight-users] declaring a ITK registration metric using std::complex<> image

Karthik Krishnan Karthik.Krishnan at kitware.com
Sun Apr 16 21:47:22 EDT 2006


On Fri, 2006-04-14 at 14:20 -0700, Rick Shilling wrote:
> I want to use a MutualInformationImageToImageMetric type between two
> images with std::complex<double> at their pixel type:
> 
> typedef std::complex< double > COMPLEXPIXEL;
> typedef itk::Image< COMPLEXPIXEL , 3>  ImageType;  
> typedef itk::MutualInformationImageToImageMetric<ImageType,ImageType>
> MetricType;
> MetricType::Pointer metric  = MetricType::New();
> 
> VC++6.0/win2K produces compiler errors listed below regarding
> instantiating the metric pointer.  Though, I've seen
> std::complex<double> being used as a pixel type for itk::Image<,> in
> other examples.  Does anyone know if it is possible to use
> std::complex<> in the imagetype template for the
> MutualInformationImageToImageMetric or for any other ITK metric?  
> 

I don't think you can use Image< std::complex< .. >, N > for any metric.
Most metrics assume that the pixel types in the image are scalar (or at
least mathematically support several operations that scalars do).
Besides their mathematical formulation would usually make no sense for
such pixel types.

> Regards,
> Rick
> 
> 
> 
> C:\InsightToolkit-2.2.0\Code\BasicFilters
> \itkRecursiveSeparableImageFilter.txx(306) : error C2440:
> 'static_cast' : cannot convert from 'class std::complex<double>' to
> 'float'
>         No user-defined-conversion operator available that can perform
> this conversion, or the operator cannot be called
>         C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
> \xstring(583) : while compiling class-template member function 'void
> __thiscall itk::RecursiveSeparableImageFilter<class itk::Image<class
> std::complex<double>,3>,class itk::Image<float,3> 
> >::GenerateData(void)'
> C:\InsightToolkit-2.2.0\Code\BasicFilters
> \itkGradientRecursiveGaussianImageFilter.txx(226) : error C2784:
> 'class vnl_vector_fixed<T,n> __cdecl operator /(const class
> vnl_vector_fixed<T,n> &,T)' : could not deduce template argument for
> 'const class v
> nl_vector_fixed<T,n> &' from 'float'
>         C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
> \xstring(583) : while compiling class-template member function 'void
> __thiscall itk::GradientRecursiveGaussianImageFilter<class
> itk::Image<class std::complex<double>,3>,class itk::Image<cl
> ass itk::CovariantVector<class std::complex<double>,3>,3>
> >::GenerateData(void)'
> C:\InsightToolkit-2.2.0\Code\BasicFilters
> \itkGradientRecursiveGaussianImageFilter.txx(226) : error C2784:
> 'class vnl_matrix_fixed<T,m,n> __cdecl operator /(const class
> vnl_matrix_fixed<T,m,n> &,T)' : could not deduce template argument for
> 'const cla
> ss vnl_matrix_fixed<T,num_rows,num_cols> &' from 'float'
>         C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
> \xstring(583) : while compiling class-template member function 'void
> __thiscall itk::GradientRecursiveGaussianImageFilter<class
> itk::Image<class std::complex<double>,3>,class itk::Image<cl
> ass itk::CovariantVector<class std::complex<double>,3>,3>
> >::GenerateData(void)'
> C:\InsightToolkit-2.2.0\Code\BasicFilters
> \itkGradientRecursiveGaussianImageFilter.txx(226) : error C2782:
> 'class std::complex<_Ty> __cdecl std::operator /(const _Ty &,const
> class std::complex<_Ty> &)' : template parameter '_Ty' is ambiguous
>         could be 'double'
>         or       'float'
>         C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
> \xstring(583) : while compiling class-template member function 'void
> __thiscall itk::GradientRecursiveGaussianImageFilter<class
> itk::Image<class std::complex<double>,3>,class itk::Image<cl
> ass itk::CovariantVector<class std::complex<double>,3>,3>
> >::GenerateData(void)'
> C:\InsightToolkit-2.2.0\Code\BasicFilters
> \itkGradientRecursiveGaussianImageFilter.txx(226) : error C2784:
> 'class std::complex<_Ty> __cdecl std::operator /(const class
> std::complex<_Ty> &,const _Ty &)' : could not deduce template argument
> for 'const 
> class std::complex<_Ty> &' from 'float'
>         C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
> \xstring(583) : while compiling class-template member function 'void
> __thiscall itk::GradientRecursiveGaussianImageFilter<class
> itk::Image<class std::complex<double>,3>,class itk::Image<cl
> ass itk::CovariantVector<class std::complex<double>,3>,3>
> >::GenerateData(void)'
> C:\InsightToolkit-2.2.0\Code\BasicFilters
> \itkGradientRecursiveGaussianImageFilter.txx(226) : error C2784:
> 'class std::complex<_Ty> __cdecl std::operator /(const class
> std::complex<_Ty> &,const class std::complex<_Ty> &)' : could not
> deduce template 
> argument for 'const class std::complex<_Ty> &' from 'float'
>         C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
> \xstring(583) : while compiling class-template member function 'void
> __thiscall itk::GradientRecursiveGaussianImageFilter<class
> itk::Image<class std::complex<double>,3>,class itk::Image<cl
> ass itk::CovariantVector<class std::complex<double>,3>,3>
> >::GenerateData(void)'
> C:\InsightToolkit-2.2.0\Code\BasicFilters
> \itkGradientRecursiveGaussianImageFilter.txx(226) : error C2677:
> binary '/' : no global operator defined which takes type 'const class
> std::complex<double>' (or there is no acceptable conversion)
>         C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
> \xstring(583) : while compiling class-template member function 'void
> __thiscall itk::GradientRecursiveGaussianImageFilter<class
> itk::Image<class std::complex<double>,3>,class itk::Image<cl
> ass itk::CovariantVector<class std::complex<double>,3>,3>
> >::GenerateData(void)'
> C:\InsightToolkit-2.2.0\Code\Common
> \itkCentralDifferenceImageFunction.txx(78) : error C2679: binary '=' :
> no operator defined which takes a right-hand operand of type 'const
> class std::complex<double>' (or there is no acceptable conversion)
>         C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
> \xstring(583) : while compiling class-template member function 'class
> itk::CovariantVector<double,3> __thiscall
> itk::CentralDifferenceImageFunction<class itk::Image<class
> std::complex<doub
> le>,3>,double>::EvaluateAtIndex(const class itk::Index<3> &) const'
> C:\InsightToolkit-2.2.0\Code\Common
> \itkCentralDifferenceImageFunction.txx(81) : error C2784: 'class
> std::complex<_Ty> &__cdecl std::operator -=(class std::complex<_Ty>
> &,const class std::complex<_U> &)' : could not deduce template
> argument for 'clas
> s std::complex<_Ty> &' from 'double'
>         C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
> \xstring(583) : while compiling class-template member function 'class
> itk::CovariantVector<double,3> __thiscall
> itk::CentralDifferenceImageFunction<class itk::Image<class
> std::complex<doub
> le>,3>,double>::EvaluateAtIndex(const class itk::Index<3> &) const'
> C:\InsightToolkit-2.2.0\Code\Common
> \itkCentralDifferenceImageFunction.txx(81) : error C2677: binary
> '-=' : no global operator defined which takes type 'const class
> std::complex<double>' (or there is no acceptable conversion)
>         C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
> \xstring(583) : while compiling class-template member function 'class
> itk::CovariantVector<double,3> __thiscall
> itk::CentralDifferenceImageFunction<class itk::Image<class
> std::complex<doub
> le>,3>,double>::EvaluateAtIndex(const class itk::Index<3> &) const'
> Error executing cl.exe.
> 
> 
> 
> ______________________________________________________________________
> Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using Yahoo!
> Messenger with Voice.
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list