BALL::TFFT2D< ComplexTraits > Class Template Reference
[Fast Fourier Transforms]

A class to perform Fast Fourier Transforms and inverse Fast Fourier Transforms on regularly spaced two dimensional data. More...

#include <FFT2D.h>

Inheritance diagram for BALL::TFFT2D< ComplexTraits >:
Inheritance graph
[legend]

List of all members.


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 ()
Perform a single fast fourier transform on the data.
void doiFFT ()
Perform a single inverse fourier transform on the data.
bool translate (const Vector2 &trans_origin)
Translate the origin in physical space about {trans_origin}, i.e.
bool setPhysStepWidth (double new_width_x, double new_width_y)
Set the step width in physical space to {new_width_x, new_width_y}.
double getPhysStepWidthX () const
Returns the step width in physical space in X direction.
double getPhysStepWidthY () const
Returns the step width in physical space in Y direction.
double getFourierStepWidthX () const
Returns the step width in fourier space in X direction.
double getFourierStepWidthY () const
Returns the step width in fourier space in Y direction.
double getPhysSpaceMinX () const
Returns the minimal position of the grid in physical space in X direction.
double getPhysSpaceMinY () const
Returns the minimal position of the grid in physical space in Y direction.
double getPhysSpaceMaxX () const
Returns the maximal position of the grid in physical space in X direction.
double getPhysSpaceMaxY () const
Returns the maximal position of the grid in physical space in Y direction.
double getFourierSpaceMinX () const
Returns the minimal position of the grid in fourier space in X direction.
double getFourierSpaceMinY () const
Returns the minimal position of the grid in fourier space in Y direction.
double getFourierSpaceMaxX () const
Returns the maximal position of the grid in fourier space in X direction.
double getFourierSpaceMaxY () const
Returns the maximal position of the grid in fourier space in Y direction.
Size getMaxXIndex () const
AR: Return the largest grid position for the x direction.
Size getMaxYIndex () const
AR: Return the largest grid position for the y direction.
Size getNumberOfInverseTransforms () const
AR: Return the number of inverse transforms that have been carried out using this class.
Vector2 getGridCoordinates (Position position) const
AR: Returns the grid coordinate corresponding to the position.
Complex getData (const Vector2 &pos) const throw (Exception::OutOfGrid)
Returns the data at the grid position closest to pos , and automatically includes the correct phase factor and (symmetric) normalization.
Complex getInterpolatedValue (const Vector2 &pos) const throw (Exception::OutOfGrid)
Returns the data at point pos.
void setData (const Vector2 &pos, Complex val) throw (Exception::OutOfGrid)
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.
Complex & operator[] (const Vector2 &pos) throw (Exception::OutOfGrid)
Access the data at the grid position closest to pos .
const Complex & operator[] (const Vector2 &pos) const throw (Exception::OutOfGrid)
Access the data at the grid position closest to pos .
const Complex & operator[] (const IndexType &index) const
Nonmutable random access operator.
Complex & operator[] (const IndexType &index)
Mutable random access operator.
Complex & operator[] (const Position &pos) throw (Exception::OutOfGrid)
AR: Access the (raw) data at Position pos.
const Complex & operator[] (const Position &pos) const throw (Exception::OutOfGrid)
AR: Access the (raw) data at Position pos.
void setNumberOfFFTTransforms (Size num)
void setNumberOfiFFTTransforms (Size num)
Complex phase (const Vector2 &pos) const
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".
bool isInFourierSpace () const
AR: Returns true if the data is considered to be in Fourier space, false otherwise.
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)
Detailed constructor.
virtual ~TFFT2D ()
Destructor.
Assignment
const TFFT2D & operator= (const TFFT2D &fft_2d)
Assignment operator.
virtual void clear ()
Clear the contents.
virtual void destroy ()
Clear the contents and reset all attributes.
Predicates
bool operator== (const TFFT2D &fft_2d) const
Equality operator.

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_

Detailed Description

template<typename ComplexTraits>
class BALL::TFFT2D< ComplexTraits >

A class to perform Fast Fourier Transforms and inverse Fast Fourier Transforms on regularly spaced two dimensional data.
This class makes use of the freely available library FFTW, which can be found at http://www.fftw.org coordinate system can be handled automatically. The normaliztion is chosen symmetrically.
S/TFFT2D.h

Constructor & Destructor Documentation

template<typename ComplexTraits>
BALL::TFFT2D< ComplexTraits >::TFFT2D ( Size nX,
Size nY,
double stepPhysX = 1.,
double stepPhysY = 1.,
Vector2 origin = Vector2(0., 0.),
bool inFourierSpace = false
)

Detailed constructor.

Parameters:
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

Member Function Documentation

template<typename ComplexTraits >
TFFT2D< ComplexTraits >::Complex BALL::TFFT2D< ComplexTraits >::getInterpolatedValue ( const Vector2 & pos ) const throw (Exception::OutOfGrid)

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::Maths::max(), BALL::Maths::min(), BALL::TVector2< T >::x, and BALL::TVector2< T >::y.

template<typename ComplexTraits >
Size BALL::TFFT2D< ComplexTraits >::getMaxXIndex ( ) const

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.

template<typename ComplexTraits >
Size BALL::TFFT2D< ComplexTraits >::getMaxYIndex ( ) const

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.

template<typename ComplexTraits >
Size BALL::TFFT2D< ComplexTraits >::getNumberOfInverseTransforms ( ) const

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.

template<typename ComplexTraits>
const Complex& BALL::TFFT2D< ComplexTraits >::operator[] ( const Position & pos ) const throw (Exception::OutOfGrid)

AR: Access the (raw) data at Position pos.

Const method.

References BALL::TFFT2D< ComplexTraits >::operator[]().

template<typename ComplexTraits>
Complex& BALL::TFFT2D< ComplexTraits >::operator[] ( const IndexType & index )

Mutable random access operator.

Note:
No range checking is done. For a more robust version, please use getData.

References BALL::TFFT2D< ComplexTraits >::operator[]().

template<typename ComplexTraits>
const Complex& BALL::TFFT2D< ComplexTraits >::operator[] ( const IndexType & index ) const

Nonmutable random access operator.

Note:
No range checking is done. For a more robust version, please use getData.

References BALL::TFFT2D< ComplexTraits >::operator[]().

template<typename ComplexTraits >
const TFFT2D< ComplexTraits >::Complex & BALL::TFFT2D< ComplexTraits >::operator[] ( const Vector2 & pos ) const throw (Exception::OutOfGrid)

Access the data at the grid position closest to pos .

This function returns the "raw" data at that position.

References BALL::Maths::rint(), BALL::TVector2< T >::x, and BALL::TVector2< T >::y.

template<typename ComplexTraits >
TFFT2D< ComplexTraits >::Complex & BALL::TFFT2D< ComplexTraits >::operator[] ( const Vector2 & pos ) throw (Exception::OutOfGrid)

Access the data at the grid position closest to pos .

This function returns the "raw" data at that position.

References BALL::Maths::rint(), BALL::TVector2< T >::x, and BALL::TVector2< T >::y.

Referenced by BALL::TFFT2D< ComplexTraits >::operator[]().

template<typename ComplexTraits >
bool BALL::TFFT2D< ComplexTraits >::setPhysStepWidth ( double new_width_x,
double new_width_y
)

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 >::origin_, BALL::TVector2< T >::x, and BALL::TVector2< T >::y.

template<typename ComplexTraits >
bool BALL::TFFT2D< ComplexTraits >::translate ( const Vector2 & trans_origin )

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 >::origin_, BALL::Maths::rint(), BALL::TVector2< T >::x, and BALL::TVector2< T >::y.


Generated on Thu Aug 6 18:30:34 2009 for BALL by doxygen 1.5.8