[ITK Community] [Insight-users] Obtaining Real Result from Inverse Fourier Transform

Bradley Lowekamp brad at lowekamp.net
Fri Nov 22 13:43:56 EST 2013


Hello,

Have you tries specifying the output image type for the filter:
http://www.itk.org/Doxygen/html/classitk_1_1InverseFFTImageFilter.html

typedef itk::VnlInverseFFTImageFilter<ComplexImageType, ComplexImageType> FFTInverseFitlterType;

I have not tried this my self but it would be my first guess.

Brad


On Nov 22, 2013, at 1:27 PM, DVigneault <davis.vigneault at gmail.com> wrote:

> All--
> 
> I have a magnitude MRI image with vertical stripes, which produce harmonics
> in the spectral domain.  I've isolated one of those harmonics and used the
> VnlInferseFFTImageFilter to produce a spatial image from the isolated
> harmonic.  I'd now like to do an operation on that image, which requires
> that I access both the imaginary and real components of the output in the
> spatial domain.  However, I've only been able to access one component of the
> result.
> 
> The code I'm using for performing the inverse transform is:
> 
> typedef itk::VnlInverseFFTImageFilter< ComplexImageType > 
> FFTInverseFilterType;
> typedef FFTInverseFilterType::OutputImageType SpatialImageType;
>    FFTInverseFilterType::Pointer fftInverseFilter =
> FFTInverseFilterType::New();
>    fftInverseFilter->SetInput( maskedShiftFilter->GetOutput() );
>    try {
>        fftInverseFilter->Update();
>        std::cerr << "fftInverseFilter->Update() excecuted successfully." <<
> std::endl; }
>    catch( itk::ExceptionObject & excp ) {
>        std::cerr << "Error during fftInverseFilter->Update(): " <<
> std::endl;
>        std::cerr << excp << std::endl;
>        return EXIT_FAILURE; }
> 
> I'm using this function to view the pixel values:
> 
> typedef FFTInverseFilterType::OutputImageType SpatialImageType;
> 
> void OutputImage( SpatialImageType::Pointer image )
> {
>    itk::ImageRegionConstIterator< SpatialImageType >
> imageIterator(image,image->GetLargestPossibleRegion());
> 
>    while(!imageIterator.IsAtEnd())
>    {
>        // Get the value of the current pixel
>        SpatialImageType::PixelType val = imageIterator.Get();
>        std::cout << val << std::endl;
> 
>        ++imageIterator;
>    }
> }
> 
> The values I'm getting from this function look like this:
> 
> -0.354988
> -0.43072
> -0.519287
> -0.615867
> -0.714985
> -0.810802
> ...
> 
> I've used a very similar function on the spectral image to get out complex
> values, which come out like this:
> 
> (102.69,143.811)
> (-490.191,-181.034)
> (-290.731,-346.93)
> (17.2402,-449.111)
> (-247.687,-201.641)
> ...
> 
> Any idea what I'm doing wrong?
> 
> Best, and thanks,
> 
> --Davis
> 
> 
> 
> --
> View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Obtaining-Real-Result-from-Inverse-Fourier-Transform-tp7584430.html
> Sent from the ITK Insight Users mailing list archive at Nabble.com.
> _____________________________________
> 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

_____________________________________
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 Community mailing list