[Insight-developers] Convolution on Complex data
Matt McCormick
matt.mccormick at kitware.com
Mon May 6 13:36:04 EDT 2013
Hi Phil,
I have not tried, but in Git master there were recently fixes to
NumericTraits for std::complex.
Secondly, you may want to try multiplying FFT's instead.
HTH,
Matt
On Sun, Apr 28, 2013 at 11:23 PM, Phillip George Dayan Ward
<pgwar1 at student.monash.edu> wrote:
> 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
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>
More information about the Insight-developers
mailing list