X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=include%2Ffourier.h;h=f1067ddd9350029e639d24b6fe1f4d44674caad4;hp=b956fcc15b7ab5859cbff429590f3c7ac62c33b0;hb=1a050c98763fbbc0662731b0b76953acede6f5d7;hpb=3ea498d51ce4597e9649cd21f155b51175ea0bea diff --git a/include/fourier.h b/include/fourier.h index b956fcc..f1067dd 100644 --- a/include/fourier.h +++ b/include/fourier.h @@ -9,7 +9,7 @@ ** 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 $ +** $Id$ ** ** 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 +26,9 @@ ******************************************************************************/ #include +#ifdef HAVE_FFTW +#include +#endif class ImageFile; @@ -34,6 +37,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 +49,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 +82,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 +96,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;