[Insight-users] Complex convolution
Bradley Lowekamp
blowekamp at mail.nih.gov
Mon Apr 22 08:56:40 EDT 2013
Hello,
Do you get the same error with just a 3D image?
Brad
On Apr 21, 2013, at 11:02 PM, Phillip George Dayan Ward <pgwar1 at student.monash.edu> wrote:
> 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
> _____________________________________
> 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://www.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-users
More information about the Insight-users
mailing list