[Insight-users] Inaccuracy in fftw calculation

Cory Quammen cquammen at cs.unc.edu
Wed Oct 5 11:43:51 EDT 2011


Antonio,

Sorry, I misunderstood. I thought you had a problem with the ITK FFT
filters when enabling FFTW in ITK.

You may want to ask the FFTW mailing list about your problem.

Cory

2011/10/5 Antonio Gómez Barquero <agb1 at alu.upct.es>:
>
> The code is here:
>
>        // FFT CALCULATION
>        // Inizialization of the neccesary elemnets for calculating the FFT.
>
>
>        fftw_plan p1;  //variable for storing the FFT
>        int N_fft= ancho*alto;  //number of points of the image
>        fftw_complex *F1 =(fftw_complex*)
> fftw_malloc(sizeof(fftw_complex)*alto*((ancho/2)+1));  // result pointer
>        p1 = fftw_plan_dft_r2c_2d(alto,ancho, f1, F1, FFTW_ESTIMATE);  //
> FFT planning
>        fftw_execute(p1);  // FFT calculation
>        fftw_destroy_plan(p1); // plan is destroyed
>
> I want to do the FFT to double pointer called f1, it is the force vector
> calculated from the gradient of an image (dT1):
>
>        f1 = new double[ancho*alto]; //double *f1 = (double*)
> malloc(sizeof(double)*ancho*alto);
>        for ( int x= 0; x<alto; x++){
>        for (int y = 0; y<ancho; y++){
>                *(f1+ancho*x+y) =
> gamma*(R[ancho*x+y]-T[ancho*x+y])*dT1[ancho*x+y]; // f1=gamma*L.*dT1;
>        }
>        }
>
> Everything is also done for the second dimension.
>
> Thanks Cory!
>
> Antonio
>
> -----Mensaje original-----
> De: Cory Quammen [mailto:cquammen at cs.unc.edu]
> Enviado el: miércoles, 05 de octubre de 2011 16:53
> Para: Antonio Gómez Barquero
> CC: insight-users at itk.org
> Asunto: Re: [Insight-users] Inaccuracy in fftw calculation
>
> Please post your code that is exhibiting the problem and state what version
> of ITK you are using.
>
> Thanks,
> Cory
>
> 2011/10/5 Antonio Gómez Barquero <agb1 at alu.upct.es>:
>> Inaccuracy in fftw calculation
>>
>>
>>
>> I am calculating the fft of an image which pixels are double with the
>> FFTW library, for that purpose i am using the library
>> fftw(http://www.fftw.org/) library in Visual Studio 2008 and using ITK.
>>
>>
>>
>> When I calculate the fft from a double pointer, with the method
>> ‘fftw_plan_dft_c2r_2d’, it makes the calculation but introducing
>> inaccuracy, it is around +- 0.5…
>>
>>
>>
>> I don’t really know what is wrong, maybe the spacing between pixels?
>> The type of the data used? Did someone have this problem or something
>> similar before?
>>
>>
>>
>> Many thanks in advanced.
>>
>>
>>
>> Antonio Gómez Barquero
>>
>>
>>
>> Ingeniero de Telecomunicaciones -Becario Investigador asociado a
>> Actividades de I+D+I
>>
>> GTTS ( Grupo de Tratamiento y Teoría de la Señal)[
>> http://gtts.upct.es/]
>>
>> UPCT (Universidad Politécnica de Cartagena)[ http://www.upct.es/]
>>
>>
>>
>> _____________________________________
>> 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.html
>>
>> 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
>>
>>
>
>
>
> --
> Cory Quammen
> Research Associate
> Department of Computer Science
> The University of North Carolina at Chapel Hill
>
>



-- 
Cory Quammen
Research Associate
Department of Computer Science
The University of North Carolina at Chapel Hill


More information about the Insight-users mailing list