#include <BALL/MATHS/FFT2D.h>
Public Types | |
typedef std::complex< typename ComplexTraits::ComplexPrecision > | Complex |
typedef TRegularData2D < std::complex< typename ComplexTraits::ComplexPrecision > > | ComplexVector |
typedef TRegularData2D < std::complex< typename ComplexTraits::ComplexPrecision > >::IndexType | IndexType |
Public Member Functions | |
void | doFFT () |
void | doiFFT () |
bool | translate (const Vector2 &trans_origin) |
bool | setPhysStepWidth (double new_width_x, double new_width_y) |
double | getPhysStepWidthX () const |
double | getPhysStepWidthY () const |
double | getFourierStepWidthX () const |
double | getFourierStepWidthY () const |
double | getPhysSpaceMinX () const |
double | getPhysSpaceMinY () const |
double | getPhysSpaceMaxX () const |
double | getPhysSpaceMaxY () const |
double | getFourierSpaceMinX () const |
double | getFourierSpaceMinY () const |
double | getFourierSpaceMaxX () const |
double | getFourierSpaceMaxY () const |
Size | getMaxXIndex () const |
Size | getMaxYIndex () const |
Size | getNumberOfInverseTransforms () const |
Vector2 | getGridCoordinates (Position position) const |
Complex | getData (const Vector2 &pos) const throw (Exception::OutOfGrid) |
Complex | getInterpolatedValue (const Vector2 &pos) const throw (Exception::OutOfGrid) |
void | setData (const Vector2 &pos, Complex val) throw (Exception::OutOfGrid) |
Complex & | operator[] (const Vector2 &pos) throw (Exception::OutOfGrid) |
const Complex & | operator[] (const Vector2 &pos) const throw (Exception::OutOfGrid) |
const Complex & | operator[] (const IndexType &index) const |
Complex & | operator[] (const IndexType &index) |
Complex & | operator[] (const Position &pos) throw (Exception::OutOfGrid) |
const Complex & | operator[] (const Position &pos) const throw (Exception::OutOfGrid) |
void | setNumberOfFFTTransforms (Size num) |
void | setNumberOfiFFTTransforms (Size num) |
Complex | phase (const Vector2 &pos) const |
bool | isInFourierSpace () const |
Constructors and Destructors | |
TFFT2D () | |
Default constructor. | |
TFFT2D (const TFFT2D &data) | |
Copy constructor. | |
TFFT2D (Size nX, Size nY, double stepPhysX=1., double stepPhysY=1., Vector2 origin=Vector2(0., 0.), bool inFourierSpace=false) | |
virtual | ~TFFT2D () |
Destructor. | |
Assignment | |
const TFFT2D & | operator= (const TFFT2D &fft_2d) |
Assignment operator. | |
virtual void | clear () |
virtual void | destroy () |
Predicates | |
bool | operator== (const TFFT2D &fft_2d) const |
Protected Attributes | |
Size | lengthX_ |
Size | lengthY_ |
bool | inFourierSpace_ |
Size | numPhysToFourier_ |
Size | numFourierToPhys_ |
Vector2 | origin_ |
Origin of the grid (offset). | |
double | stepPhysX_ |
double | stepPhysY_ |
double | stepFourierX_ |
double | stepFourierY_ |
Vector2 | minPhys_ |
Vector2 | maxPhys_ |
Vector2 | minFourier_ |
Vector2 | maxFourier_ |
ComplexTraits::FftwPlan | planForward_ |
ComplexTraits::FftwPlan | planBackward_ |
Size | dataLength_ |
Complex * | dataAdress_ |
bool | planCalculated_ |
A class to perform Fast Fourier Transforms and inverse Fast Fourier Transforms on regularly spaced two dimensional data.
typedef std::complex<typename ComplexTraits::ComplexPrecision> BALL::TFFT2D< ComplexTraits >::Complex |
typedef TRegularData2D<std::complex<typename ComplexTraits::ComplexPrecision> > BALL::TFFT2D< ComplexTraits >::ComplexVector |
typedef TRegularData2D<std::complex<typename ComplexTraits::ComplexPrecision> >::IndexType BALL::TFFT2D< ComplexTraits >::IndexType |
BALL::TFFT2D< ComplexTraits >::TFFT2D | ( | ) | [inline] |
Default constructor.
BALL::TFFT2D< ComplexTraits >::TFFT2D | ( | const TFFT2D< ComplexTraits > & | data | ) |
Copy constructor.
BALL::TFFT2D< ComplexTraits >::TFFT2D | ( | Size | nX, | |
Size | nY, | |||
double | stepPhysX = 1. , |
|||
double | stepPhysY = 1. , |
|||
Vector2 | origin = Vector2(0., 0.) , |
|||
bool | inFourierSpace = false | |||
) |
Detailed constructor.
nX | The number of grid points in X direction | |
nY | The number of grid points in Y direction | |
stepPhysX | The step width in X direction in physical space | |
stepPhysY | The step width in Y direction in physical space | |
origin | The origin of the coordinate system | |
inFourierSpace | Flag to decide whether the data is assumed to be in physical or fourier space |
virtual BALL::TFFT2D< ComplexTraits >::~TFFT2D | ( | ) | [virtual] |
Destructor.
virtual void BALL::TFFT2D< ComplexTraits >::clear | ( | ) | [virtual] |
Clear the contents.
Reimplemented from BALL::TRegularData2D< std::complex< ComplexTraits::ComplexPrecision > >.
virtual void BALL::TFFT2D< ComplexTraits >::destroy | ( | ) | [virtual] |
Clear the contents and reset all attributes.
void BALL::TFFT2D< ComplexTraits >::doFFT | ( | ) |
Perform a single fast fourier transform on the data.
void BALL::TFFT2D< ComplexTraits >::doiFFT | ( | ) |
Perform a single inverse fourier transform on the data.
TFFT2D< ComplexTraits >::Complex BALL::TFFT2D< ComplexTraits >::getData | ( | const Vector2 & | pos | ) | const throw (Exception::OutOfGrid) [inline] |
Returns the data at the grid position closest to pos , and automatically includes the correct phase factor and (symmetric) normalization.
Referenced by BALL::TFFT2D< ComplexTraits >::operator==().
double BALL::TFFT2D< ComplexTraits >::getFourierSpaceMaxX | ( | ) | const [inline] |
Returns the maximal position of the grid in fourier space in X direction.
References BALL::TFFT2D< ComplexTraits >::maxFourier_, and BALL::TVector2< T >::x.
double BALL::TFFT2D< ComplexTraits >::getFourierSpaceMaxY | ( | ) | const [inline] |
Returns the maximal position of the grid in fourier space in Y direction.
References BALL::TFFT2D< ComplexTraits >::maxFourier_, and BALL::TVector2< T >::y.
double BALL::TFFT2D< ComplexTraits >::getFourierSpaceMinX | ( | ) | const [inline] |
Returns the minimal position of the grid in fourier space in X direction.
References BALL::TFFT2D< ComplexTraits >::minFourier_, and BALL::TVector2< T >::x.
double BALL::TFFT2D< ComplexTraits >::getFourierSpaceMinY | ( | ) | const [inline] |
Returns the minimal position of the grid in fourier space in Y direction.
References BALL::TFFT2D< ComplexTraits >::minFourier_, and BALL::TVector2< T >::y.
double BALL::TFFT2D< ComplexTraits >::getFourierStepWidthX | ( | ) | const [inline] |
Returns the step width in fourier space in X direction.
References BALL::TFFT2D< ComplexTraits >::stepFourierX_.
double BALL::TFFT2D< ComplexTraits >::getFourierStepWidthY | ( | ) | const [inline] |
Returns the step width in fourier space in Y direction.
References BALL::TFFT2D< ComplexTraits >::stepFourierY_.
Vector2 BALL::TFFT2D< ComplexTraits >::getGridCoordinates | ( | Position | position | ) | const [inline] |
AR: Returns the grid coordinate corresponding to the position.
References BALL::TFFT2D< ComplexTraits >::inFourierSpace_, BALL::TFFT2D< ComplexTraits >::lengthX_, BALL::TFFT2D< ComplexTraits >::lengthY_, BALL::TFFT2D< ComplexTraits >::origin_, BALL::TVector2< T >::set(), BALL::TRegularData2D< ValueType >::size(), BALL::TFFT2D< ComplexTraits >::stepFourierX_, BALL::TFFT2D< ComplexTraits >::stepFourierY_, BALL::TFFT2D< ComplexTraits >::stepPhysX_, BALL::TFFT2D< ComplexTraits >::stepPhysY_, BALL::TVector2< T >::x, and BALL::TVector2< T >::y.
TFFT2D< ComplexTraits >::Complex BALL::TFFT2D< ComplexTraits >::getInterpolatedValue | ( | const Vector2 & | pos | ) | const throw (Exception::OutOfGrid) [inline] |
Returns the data at point pos. If pos is not a point on the grid, the data is linearly interpolated. This method automatically includes the correct phase factor and (symmetric) normalization.
Reimplemented from BALL::TRegularData2D< std::complex< ComplexTraits::ComplexPrecision > >.
References BALL::Maths::floor(), BALL::Constants::h, BALL::Maths::max(), BALL::Maths::min(), BALL::TVector2< T >::x, and BALL::TVector2< T >::y.
Size BALL::TFFT2D< ComplexTraits >::getMaxXIndex | ( | ) | const [inline] |
AR: Return the largest grid position for the x direction. This method returns the maximum position allowed in the grid. As the point in the origin has the indices (0, 0), this method returns the number of points in X direction minus one.
References BALL::TFFT2D< ComplexTraits >::lengthX_.
Size BALL::TFFT2D< ComplexTraits >::getMaxYIndex | ( | ) | const [inline] |
AR: Return the largest grid position for the y direction. This method returns the maximum position allowed in the grid. As the point in the origin has the indices (0, 0), this method returns the number of points in Y direction minus one.
References BALL::TFFT2D< ComplexTraits >::lengthY_.
Size BALL::TFFT2D< ComplexTraits >::getNumberOfInverseTransforms | ( | ) | const [inline] |
AR: Return the number of inverse transforms that have been carried out using this class. This is an important factor for the normalization of the data.
References BALL::TFFT2D< ComplexTraits >::numFourierToPhys_.
double BALL::TFFT2D< ComplexTraits >::getPhysSpaceMaxX | ( | ) | const [inline] |
Returns the maximal position of the grid in physical space in X direction.
References BALL::TFFT2D< ComplexTraits >::maxPhys_, and BALL::TVector2< T >::x.
double BALL::TFFT2D< ComplexTraits >::getPhysSpaceMaxY | ( | ) | const [inline] |
Returns the maximal position of the grid in physical space in Y direction.
References BALL::TFFT2D< ComplexTraits >::maxPhys_, and BALL::TVector2< T >::y.
double BALL::TFFT2D< ComplexTraits >::getPhysSpaceMinX | ( | ) | const [inline] |
Returns the minimal position of the grid in physical space in X direction.
References BALL::TFFT2D< ComplexTraits >::minPhys_, and BALL::TVector2< T >::x.
double BALL::TFFT2D< ComplexTraits >::getPhysSpaceMinY | ( | ) | const [inline] |
Returns the minimal position of the grid in physical space in Y direction.
References BALL::TFFT2D< ComplexTraits >::minPhys_, and BALL::TVector2< T >::y.
double BALL::TFFT2D< ComplexTraits >::getPhysStepWidthX | ( | ) | const [inline] |
Returns the step width in physical space in X direction.
References BALL::TFFT2D< ComplexTraits >::stepPhysX_.
double BALL::TFFT2D< ComplexTraits >::getPhysStepWidthY | ( | ) | const [inline] |
Returns the step width in physical space in Y direction.
References BALL::TFFT2D< ComplexTraits >::stepPhysY_.
bool BALL::TFFT2D< ComplexTraits >::isInFourierSpace | ( | ) | const [inline] |
AR: Returns true if the data is considered to be in Fourier space, false otherwise.
References BALL::TFFT2D< ComplexTraits >::inFourierSpace_.
const TFFT2D& BALL::TFFT2D< ComplexTraits >::operator= | ( | const TFFT2D< ComplexTraits > & | fft_2d | ) |
Assignment operator.
bool BALL::TFFT2D< ComplexTraits >::operator== | ( | const TFFT2D< ComplexTraits > & | fft_2d | ) | const [inline] |
Equality operator.
References BALL::TFFT2D< ComplexTraits >::getData(), BALL::TFFT2D< ComplexTraits >::inFourierSpace_, BALL::TFFT2D< ComplexTraits >::lengthX_, BALL::TFFT2D< ComplexTraits >::lengthY_, BALL::Maths::max(), BALL::TFFT2D< ComplexTraits >::maxFourier_, BALL::TFFT2D< ComplexTraits >::maxPhys_, BALL::Maths::min(), BALL::TFFT2D< ComplexTraits >::minFourier_, BALL::TFFT2D< ComplexTraits >::minPhys_, BALL::TFFT2D< ComplexTraits >::numFourierToPhys_, BALL::TFFT2D< ComplexTraits >::numPhysToFourier_, BALL::TFFT2D< ComplexTraits >::origin_, BALL::TFFT2D< ComplexTraits >::stepFourierX_, BALL::TFFT2D< ComplexTraits >::stepFourierY_, BALL::TFFT2D< ComplexTraits >::stepPhysX_, BALL::TFFT2D< ComplexTraits >::stepPhysY_, BALL::TVector2< T >::x, and BALL::TVector2< T >::y.
const Complex& BALL::TFFT2D< ComplexTraits >::operator[] | ( | const Position & | pos | ) | const throw (Exception::OutOfGrid) [inline] |
AR: Access the (raw) data at Position pos. Const method.
References BALL::TFFT2D< ComplexTraits >::operator[]().
Complex& BALL::TFFT2D< ComplexTraits >::operator[] | ( | const Position & | pos | ) | throw (Exception::OutOfGrid) [inline] |
AR: Access the (raw) data at Position pos.
References BALL::TFFT2D< ComplexTraits >::operator[]().
Complex& BALL::TFFT2D< ComplexTraits >::operator[] | ( | const IndexType & | index | ) | [inline] |
Mutable random access operator.
References BALL::TFFT2D< ComplexTraits >::operator[]().
const Complex& BALL::TFFT2D< ComplexTraits >::operator[] | ( | const IndexType & | index | ) | const [inline] |
Nonmutable random access operator.
References BALL::TFFT2D< ComplexTraits >::operator[]().
const TFFT2D< ComplexTraits >::Complex & BALL::TFFT2D< ComplexTraits >::operator[] | ( | const Vector2 & | pos | ) | const throw (Exception::OutOfGrid) [inline] |
Access the data at the grid position closest to pos . This function returns the "raw" data at that position.
References BALL::Maths::rint().
TFFT2D< ComplexTraits >::Complex & BALL::TFFT2D< ComplexTraits >::operator[] | ( | const Vector2 & | pos | ) | throw (Exception::OutOfGrid) [inline] |
Access the data at the grid position closest to pos . This function returns the "raw" data at that position.
References BALL::Maths::rint().
Referenced by BALL::TFFT2D< ComplexTraits >::operator[]().
TFFT2D< ComplexTraits >::Complex BALL::TFFT2D< ComplexTraits >::phase | ( | const Vector2 & | pos | ) | const [inline] |
This computes the phase factor in fourier space that results if the origin of the coordinate system in physical space is not in the "lower left corner".
References BALL::TFFT2D< ComplexTraits >::lengthX_, BALL::TFFT2D< ComplexTraits >::lengthY_, BALL::TFFT2D< ComplexTraits >::origin_, BALL::Maths::rint(), BALL::TFFT2D< ComplexTraits >::stepFourierX_, BALL::TFFT2D< ComplexTraits >::stepFourierY_, BALL::TFFT2D< ComplexTraits >::stepPhysX_, BALL::TFFT2D< ComplexTraits >::stepPhysY_, BALL::TVector2< T >::x, and BALL::TVector2< T >::y.
void BALL::TFFT2D< ComplexTraits >::setData | ( | const Vector2 & | pos, | |
Complex | val | |||
) | throw (Exception::OutOfGrid) [inline] |
Sets the data point at the grid position closest to pos to the value val , and -- if called in fourier space -- automatically includes the correct phase factor and (symmetric) normalization.
void BALL::TFFT2D< ComplexTraits >::setNumberOfFFTTransforms | ( | Size | num | ) | [inline] |
References BALL::TFFT2D< ComplexTraits >::numPhysToFourier_.
void BALL::TFFT2D< ComplexTraits >::setNumberOfiFFTTransforms | ( | Size | num | ) | [inline] |
References BALL::TFFT2D< ComplexTraits >::numFourierToPhys_.
bool BALL::TFFT2D< ComplexTraits >::setPhysStepWidth | ( | double | new_width_x, | |
double | new_width_y | |||
) | [inline] |
Set the step width in physical space to {new_width_x, new_width_y}. The step width in fourier space is automatically adjusted accordingly. {new_width_x and new_width_y} must be positive, otherwise the function does nothing and retuns false .
References BALL::TFFT2D< ComplexTraits >::lengthX_, BALL::TFFT2D< ComplexTraits >::lengthY_, BALL::TFFT2D< ComplexTraits >::maxFourier_, BALL::TFFT2D< ComplexTraits >::maxPhys_, BALL::TFFT2D< ComplexTraits >::minFourier_, BALL::TFFT2D< ComplexTraits >::minPhys_, BALL::TFFT2D< ComplexTraits >::origin_, BALL::TFFT2D< ComplexTraits >::stepFourierX_, BALL::TFFT2D< ComplexTraits >::stepFourierY_, BALL::TFFT2D< ComplexTraits >::stepPhysX_, BALL::TFFT2D< ComplexTraits >::stepPhysY_, BALL::TVector2< T >::x, and BALL::TVector2< T >::y.
bool BALL::TFFT2D< ComplexTraits >::translate | ( | const Vector2 & | trans_origin | ) | [inline] |
Translate the origin in physical space about {trans_origin}, i.e. the new origin will be located at the former position {trans_origin}. If the result is out of bounds, the function does nothing and returns false .
References BALL::TFFT2D< ComplexTraits >::lengthX_, BALL::TFFT2D< ComplexTraits >::lengthY_, BALL::TFFT2D< ComplexTraits >::maxFourier_, BALL::TFFT2D< ComplexTraits >::maxPhys_, BALL::TFFT2D< ComplexTraits >::minFourier_, BALL::TFFT2D< ComplexTraits >::minPhys_, BALL::TFFT2D< ComplexTraits >::origin_, BALL::Maths::rint(), BALL::TFFT2D< ComplexTraits >::stepFourierX_, BALL::TFFT2D< ComplexTraits >::stepFourierY_, BALL::TFFT2D< ComplexTraits >::stepPhysX_, BALL::TFFT2D< ComplexTraits >::stepPhysY_, BALL::TVector2< T >::x, and BALL::TVector2< T >::y.
Complex* BALL::TFFT2D< ComplexTraits >::dataAdress_ [protected] |
Size BALL::TFFT2D< ComplexTraits >::dataLength_ [protected] |
bool BALL::TFFT2D< ComplexTraits >::inFourierSpace_ [protected] |
Size BALL::TFFT2D< ComplexTraits >::lengthX_ [protected] |
Size BALL::TFFT2D< ComplexTraits >::lengthY_ [protected] |
Vector2 BALL::TFFT2D< ComplexTraits >::maxFourier_ [protected] |
Vector2 BALL::TFFT2D< ComplexTraits >::maxPhys_ [protected] |
Vector2 BALL::TFFT2D< ComplexTraits >::minFourier_ [protected] |
Vector2 BALL::TFFT2D< ComplexTraits >::minPhys_ [protected] |
Size BALL::TFFT2D< ComplexTraits >::numFourierToPhys_ [protected] |
Size BALL::TFFT2D< ComplexTraits >::numPhysToFourier_ [protected] |
Vector2 BALL::TFFT2D< ComplexTraits >::origin_ [protected] |
Origin of the grid (offset).
Reimplemented from BALL::TRegularData2D< std::complex< ComplexTraits::ComplexPrecision > >.
Referenced by BALL::TFFT2D< ComplexTraits >::getGridCoordinates(), BALL::TFFT2D< ComplexTraits >::operator==(), BALL::TFFT2D< ComplexTraits >::phase(), BALL::TFFT2D< ComplexTraits >::setPhysStepWidth(), and BALL::TFFT2D< ComplexTraits >::translate().
ComplexTraits::FftwPlan BALL::TFFT2D< ComplexTraits >::planBackward_ [protected] |
bool BALL::TFFT2D< ComplexTraits >::planCalculated_ [protected] |
ComplexTraits::FftwPlan BALL::TFFT2D< ComplexTraits >::planForward_ [protected] |
double BALL::TFFT2D< ComplexTraits >::stepFourierX_ [protected] |
Referenced by BALL::TFFT2D< ComplexTraits >::getFourierStepWidthX(), BALL::TFFT2D< ComplexTraits >::getGridCoordinates(), BALL::TFFT2D< ComplexTraits >::operator==(), BALL::TFFT2D< ComplexTraits >::phase(), BALL::TFFT2D< ComplexTraits >::setPhysStepWidth(), and BALL::TFFT2D< ComplexTraits >::translate().
double BALL::TFFT2D< ComplexTraits >::stepFourierY_ [protected] |
Referenced by BALL::TFFT2D< ComplexTraits >::getFourierStepWidthY(), BALL::TFFT2D< ComplexTraits >::getGridCoordinates(), BALL::TFFT2D< ComplexTraits >::operator==(), BALL::TFFT2D< ComplexTraits >::phase(), BALL::TFFT2D< ComplexTraits >::setPhysStepWidth(), and BALL::TFFT2D< ComplexTraits >::translate().
double BALL::TFFT2D< ComplexTraits >::stepPhysX_ [protected] |
Referenced by BALL::TFFT2D< ComplexTraits >::getGridCoordinates(), BALL::TFFT2D< ComplexTraits >::getPhysStepWidthX(), BALL::TFFT2D< ComplexTraits >::operator==(), BALL::TFFT2D< ComplexTraits >::phase(), BALL::TFFT2D< ComplexTraits >::setPhysStepWidth(), and BALL::TFFT2D< ComplexTraits >::translate().
double BALL::TFFT2D< ComplexTraits >::stepPhysY_ [protected] |
Referenced by BALL::TFFT2D< ComplexTraits >::getGridCoordinates(), BALL::TFFT2D< ComplexTraits >::getPhysStepWidthY(), BALL::TFFT2D< ComplexTraits >::operator==(), BALL::TFFT2D< ComplexTraits >::phase(), BALL::TFFT2D< ComplexTraits >::setPhysStepWidth(), and BALL::TFFT2D< ComplexTraits >::translate().