Xmipp
v3.23.11-Nereus
|
#include <xmipp_fftw.h>
Public Member Functions | |
FourierTransformer () | |
FourierTransformer (const FourierTransformer &fTransform) | |
FourierTransformer (int _normSign) | |
FourierTransformer & | operator= (const FourierTransformer &other) |
~FourierTransformer () | |
void | setThreadsNumber (int tNumber) |
void | changeThreadsNumber (int tNumber) |
void | destroyThreads (void) |
template<typename T , typename T1 > | |
void | FourierTransform (T &v, T1 &V, bool getCopy=true) |
void | FourierTransform () |
void | enforceHermitianSymmetry () |
void | inverseFourierTransform () |
template<typename T , typename T1 > | |
void | inverseFourierTransform (T &V, T1 &v) |
template<typename T > | |
void | getFourierAlias (T &V) |
template<typename T > | |
void | setFourierAlias (T &V) |
template<typename T > | |
void | getFourierCopy (T &V) |
template<typename T > | |
void | getCompleteFourier (T &V) |
template<typename T , typename T1 > | |
void | completeFourierTransform (T &v, T1 &V) |
template<typename T > | |
void | setFromCompleteFourier (T &V) |
void | init () |
void | clear () |
void | cleanup (void) |
void | recomputePlanR2C () |
void | Transform (int sign) |
const MultidimArray< double > & | getReal () const |
const MultidimArray< std::complex< double > > & | getComplex () const |
void | setReal (MultidimArray< double > &img) |
void | setReal (MultidimArray< std::complex< double > > &img) |
void | setFourier (const MultidimArray< std::complex< double > > &imgFourier) |
void | setNormalizationSign (int _normSign) |
Public Attributes | |
MultidimArray< double > * | fReal |
MultidimArray< std::complex< double > > * | fComplex |
MultidimArray< std::complex< double > > | fFourier |
fftw_plan | fPlanForward |
fftw_plan | fPlanBackward |
int | nthreads |
bool | threadsSetOn |
int | normSign |
double * | dataPtr |
std::complex< double > * | complexDataPtr |
Fourier Transformer class.
The memory for the Fourier transform is handled by this object. However, the memory for the real space image is handled externally and this object only has a pointer to it.
Here you have an example of use
Definition at line 60 of file xmipp_fftw.h.
FourierTransformer::FourierTransformer | ( | ) |
FourierTransformer::FourierTransformer | ( | const FourierTransformer & | fTransform | ) |
FourierTransformer::FourierTransformer | ( | int | _normSign | ) |
Constructor setting the sign of normalization application
Definition at line 49 of file xmipp_fftw.cpp.
FourierTransformer::~FourierTransformer | ( | ) |
|
inline |
Change Number of threads.
The nthreads argument indicates the number of threads you want FFTW to use (or actually, the maximum number). All plans subsequently created with any planner routine will use that many threads. You can call fftw_plan_with_nthreads, create some plans, call fftw_plan_with_nthreads again with a different argument, and create some more plans for a new number of threads. Plans already created before a call to fftw_plan_with_nthreads are unaffected. If you pass an nthreads argument of 1 (the default), threads are disabled for subsequent plans.
Definition at line 142 of file xmipp_fftw.h.
|
inline |
FFTW's planner saves some other persistent data, such as the accumulated wisdom and a list of algorithms available in the current configuration. If you want to deallocate all of that and reset FFTW to the pristine state it was in when you started your program, you can call:
Definition at line 370 of file xmipp_fftw.h.
void FourierTransformer::clear | ( | ) |
Clear object
Definition at line 79 of file xmipp_fftw.cpp.
|
inline |
Compute the Fourier transform of a MultidimArray, 2D and 3D and returns a complete copy.
Definition at line 315 of file xmipp_fftw.h.
|
inline |
Destroy Threads. Do not execute any previously created plans after calling this function
Definition at line 150 of file xmipp_fftw.h.
void FourierTransformer::enforceHermitianSymmetry | ( | ) |
Inforce Hermitian symmetry. If the Fourier transform risks of losing Hermitian symmetry, use this function to renforce it.
Definition at line 335 of file xmipp_fftw.cpp.
|
inline |
Compute the Fourier transform of a MultidimArray, 2D and 3D. If getCopy is false, an alias to the transformed data is returned. This is a faster option since a copy of all the data is avoided, but you need to be careful that an inverse Fourier transform may change the data.
Definition at line 166 of file xmipp_fftw.h.
void FourierTransformer::FourierTransform | ( | ) |
Compute the Fourier transform. The data is taken from the matrix with which the object was created.
Definition at line 324 of file xmipp_fftw.cpp.
|
inline |
Return a complete Fourier transform (two halves).
Definition at line 234 of file xmipp_fftw.h.
const MultidimArray< std::complex< double > > & FourierTransformer::getComplex | ( | ) | const |
Definition at line 123 of file xmipp_fftw.cpp.
|
inline |
Get Fourier coefficients.
Definition at line 207 of file xmipp_fftw.h.
|
inline |
Get Fourier coefficients.
Definition at line 223 of file xmipp_fftw.h.
const MultidimArray< double > & FourierTransformer::getReal | ( | ) | const |
void FourierTransformer::init | ( | void | ) |
Definition at line 69 of file xmipp_fftw.cpp.
void FourierTransformer::inverseFourierTransform | ( | ) |
Compute the inverse Fourier transform. The result is stored in the same real data that was passed for the forward transform. The Fourier coefficients are taken from the internal Fourier coefficients
Definition at line 329 of file xmipp_fftw.cpp.
|
inline |
Compute the inverse Fourier transform. New data is provided for the Fourier coefficients and the output can be any matrix1D, 2D or 3D. It is important that the output matrix is already resized to the right size before entering in this function.
Definition at line 198 of file xmipp_fftw.h.
FourierTransformer & FourierTransformer::operator= | ( | const FourierTransformer & | other | ) |
void FourierTransformer::recomputePlanR2C | ( | ) |
Recompute transformation plan. Call this method after setting real/fourier alias and before calling Transform() to correctly update this object.
Definition at line 147 of file xmipp_fftw.cpp.
void FourierTransformer::setFourier | ( | const MultidimArray< std::complex< double > > & | imgFourier | ) |
Set a Multidimarray for the Fourier transform. The values of the input array are copied in the internal array. It is assumed that the container for the real image as well as the one for the Fourier array are already resized. No plan is updated.
Definition at line 249 of file xmipp_fftw.cpp.
|
inline |
Use input as a reference to Fourier data.
Definition at line 215 of file xmipp_fftw.h.
|
inline |
Set one half of the FT in fFourier from the input complete Fourier transform (two halves). The fReal and fFourier already should have the right sizes
Definition at line 326 of file xmipp_fftw.h.
|
inline |
Definition at line 416 of file xmipp_fftw.h.
void FourierTransformer::setReal | ( | MultidimArray< double > & | img | ) |
Set a Multidimarray for input. The data of img will be the one of fReal. In forward transforms it is not modified, but in backward transforms, the result will be stored in img. This means that the size of img cannot change between calls.
Definition at line 129 of file xmipp_fftw.cpp.
void FourierTransformer::setReal | ( | MultidimArray< std::complex< double > > & | img | ) |
Set a Multidimarray for input. The data of img will be the one of fComplex. In forward transforms it is not modified, but in backward transforms, the result will be stored in img. This means that the size of img cannot change between calls.
Definition at line 192 of file xmipp_fftw.cpp.
|
inline |
Set Number of threads This function, which should be called once, performs any one-time initialization required to use threads on your system.
The nthreads argument indicates the number of threads you want FFTW to use (or actually, the maximum number). All plans subsequently created with any planner routine will use that many threads. You can call fftw_plan_with_nthreads, create some plans, call fftw_plan_with_nthreads again with a different argument, and create some more plans for a new number of threads. Plans already created before a call to fftw_plan_with_nthreads are unaffected. If you pass an nthreads argument of 1 (the default), threads are disabled for subsequent plans.
Definition at line 119 of file xmipp_fftw.h.
void FourierTransformer::Transform | ( | int | sign | ) |
Computes the transform, specified in Init() function If normalization=true the forward transform is normalized (no normalization is made in the inverse transform) If normalize=false no normalization is performed and therefore the image is scaled by the number of pixels.
Definition at line 256 of file xmipp_fftw.cpp.
std::complex<double>* FourierTransformer::complexDataPtr |
Definition at line 358 of file xmipp_fftw.h.
double* FourierTransformer::dataPtr |
Definition at line 355 of file xmipp_fftw.h.
MultidimArray<std::complex<double> >* FourierTransformer::fComplex |
Complex array, in fact a pointer to the user array is stored.
Definition at line 67 of file xmipp_fftw.h.
MultidimArray< std::complex<double> > FourierTransformer::fFourier |
Fourier array
Definition at line 70 of file xmipp_fftw.h.
fftw_plan FourierTransformer::fPlanBackward |
Definition at line 76 of file xmipp_fftw.h.
fftw_plan FourierTransformer::fPlanForward |
Definition at line 73 of file xmipp_fftw.h.
MultidimArray<double>* FourierTransformer::fReal |
Real array, in fact a pointer to the user array is stored.
Definition at line 64 of file xmipp_fftw.h.
int FourierTransformer::normSign |
Definition at line 85 of file xmipp_fftw.h.
int FourierTransformer::nthreads |
Definition at line 79 of file xmipp_fftw.h.
bool FourierTransformer::threadsSetOn |
Definition at line 82 of file xmipp_fftw.h.