X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=include%2Ffourier.h;h=fd34545570251d552859f4388b77ff7a86b2a420;hp=b956fcc15b7ab5859cbff429590f3c7ac62c33b0;hb=f13a8c004b8f182b42d9e4df2bcd7c7f030bf1ad;hpb=3ea498d51ce4597e9649cd21f155b51175ea0bea diff --git a/include/fourier.h b/include/fourier.h index b956fcc..fd34545 100644 --- a/include/fourier.h +++ b/include/fourier.h @@ -7,9 +7,7 @@ ** Date Started: Dec 2000 ** ** This is part of the CTSim program -** Copyright (c) 1983-2001 Kevin Rosenberg -** -** $Id: fourier.h,v 1.7 2001/03/21 21:45:31 kevin Exp $ +** Copyright (c) 1983-2009 Kevin Rosenberg ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -26,6 +24,9 @@ ******************************************************************************/ #include +#ifdef HAVE_FFTW +#include +#endif class ImageFile; @@ -34,6 +35,11 @@ public: static void shuffleFourierToNaturalOrder (ImageFile& im); static void shuffleNaturalToFourierOrder (ImageFile& im); +#ifdef HAVE_FFTW + static void shuffleFourierToNaturalOrder (fftw_complex* pc, const int n); + static void shuffleNaturalToFourierOrder (fftw_complex* pc, const int n); +#endif + // Odd Number of Points // Natural Frequency Order: -(n-1)/2...-1,0,1...(n-1)/2 // Fourier Frequency Order: 0, 1..(n-1)/2,-(n-1)/2...-1 @@ -41,7 +47,7 @@ public: // Natural Frequency Order: -n/2...-1,0,1...((n/2)-1) // Fourier Frequency Order: 0,1...((n/2)-1),-n/2...-1 template - static void shuffleNaturalToFourierOrder (T* pVector, const int n) + static void shuffleNaturalToFourierOrder (T* pVector, const int n) { T* pTemp = new T [n]; int i; @@ -74,7 +80,7 @@ public: int i; if (isOdd(n)) { // Odd int iHalfN = (n - 1) / 2; - + pTemp[iHalfN] = pVector[0]; for (i = 0; i < iHalfN; i++) pTemp[i + 1 + iHalfN] = pVector[i + 1]; @@ -88,7 +94,7 @@ public: for (i = 0; i < iHalfN - 1; i++) pTemp[i + iHalfN + 1] = pVector[i+1]; } - + for (i = 0; i < n; i++) pVector[i] = pTemp[i]; delete pTemp;