[Insight-users] Complex convolution

Phillip George Dayan Ward pgwar1 at student.monash.edu
Sun Apr 21 23:02:43 EDT 2013


Hey ITK,

I'm attempting to use the convolution filter, on a complex image, with a
complex kernel. Both the kernel and image have 4 dimensions.

I feel like I either missed a warning saying complex type is not supported,
or I have failed to implement it properly.

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();

Cheers,
Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130422/9ecd79cc/attachment.htm>


More information about the Insight-users mailing list