[Insight-developers] Convolution on Complex data

Phillip George Dayan Ward pgwar1 at student.monash.edu
Sun Apr 28 19:23:04 EDT 2013


Hey ITK Dev,

I've had no luck on the user list with this question. Does anyone have any
experience with using ConvolutionImageFilter with complex datasets and
complex kernels?

I'm receiving the following error during the compile process just from
instantiating the filter with the type std::complex<float>

ITK/Modules/Core/Common/include/itkPixelTraits.h:49:60: error: no member
      named 'Length' in 'std::complex<double>'
  itkStaticConstMacro(Dimension, unsigned int, TPixelType::Length);

I'm also receiving:

ITK/Modules/Core/Common/include/itkPixelTraits.h:52:32: error: no type named
      'ValueType' in 'std::complex<double>'
  typedef typename TPixelType::ValueType ValueType;

ITK/Modules/Core/Common/include/itkNeighborhoodInnerProduct.hxx:52:7:
error:
      cannot convert 'const std::complex<double>' to 'OutputPixelValueType'
(aka 'double') without a conversion
      operator
      static_cast< OutputPixelValueType >( *o_it ) *

ITK/Modules/Filtering/ImageStatistics/include/itkStatisticsImageFilter.hxx:288:51:
error:
      invalid operands to binary expression ('RealType' (aka
'complex<double>') and 'int')
             / ( static_cast< RealType >( count ) - 1 );

ITK/Modules/Filtering/ImageStatistics/include/itkStatisticsImageFilter.hxx:329:16:
error:
      invalid operands to binary expression ('PixelType' (aka
'std::complex<double>') and 'PixelType')
    if ( value > max )

code:
          typedef itk::Image< std::complex<double>, 4> ComplexImageType;

          ComplexImageType::RegionType region;
          region.SetSize(0,15);
          region.SetSize(1,30);
          region.SetSize(2,100);
          region.SetSize(3,100);

          ComplexImageType::RegionType kernelRegion;
          kernelRegion.SetSize(0,1);
          kernelRegion.SetSize(1,30);
          kernelRegion.SetSize(2,100);
          kernelRegion.SetSize(3,100);

          ComplexImageType::Pointer image = ComplexImageType::New();
          image->SetRegions(region);
          image->Allocate();
          image->FillBuffer(std::complex<double>(1.0,1.0));

          ComplexImageType::Pointer kernel = ComplexImageType::New();
          kernel->SetRegions(kernelRegion);
          kernel->Allocate();
          kernel->FillBuffer(std::complex<double>(1.0,1.0));

          typedef itk::ConvolutionImageFilter<ComplexImageType>
ConvolutionFilterType;
          ConvolutionFilterType::Pointer convolutionFilter =
ConvolutionFilterType::New();
          convolutionFilter->SetInput(image);
          convolutionFilter->SetKernelImage(kernel);
          convolutionFilter->Update();

I have the same errors in 3D, 2D and 1D.

Cheers,
phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20130429/95f7aefa/attachment.htm>


More information about the Insight-developers mailing list