Structural deformable models
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Fourier2D Class Reference

#include <Fourier.h>

Public Member Functions

 Fourier2D ()
 
 ~Fourier2D ()
 
void initTransform (int xsize, int ysize, double *f, double *F)
 
void destroyTransform ()
 
void transform ()
 
void transformInv ()
 
int complexX () const
 
int complexY () const
 
int realX () const
 
int realY () const
 

Static Public Member Functions

static int complexX (int sizex)
 

Protected Member Functions

void loadWisdom ()
 
void saveWisdom ()
 

Protected Attributes

fftw_plan m_Plan2D
 
fftw_plan m_Plan2Dinv
 
bool m_PlansCreated
 
int m_SizeX
 
int m_SizeY
 

Static Protected Attributes

static bool s_WisdomLoaded = false
 
static bool s_WisdomModified = false
 

Detailed Description

Definition at line 6 of file Fourier.h.

Constructor & Destructor Documentation

Fourier2D::Fourier2D ( )

Definition at line 16 of file Fourier.cpp.

References loadWisdom().

16  : m_PlansCreated(false) {
17  loadWisdom();
18 }
bool m_PlansCreated
Definition: Fourier.h:26
void loadWisdom()
Definition: Fourier.cpp:33
Fourier2D::~Fourier2D ( )

Definition at line 19 of file Fourier.cpp.

References destroyTransform(), and saveWisdom().

19  {
21  saveWisdom();
22 }
void destroyTransform()
Definition: Fourier.cpp:73
void saveWisdom()
Definition: Fourier.cpp:43

Member Function Documentation

static int Fourier2D::complexX ( int  sizex)
inlinestatic

Definition at line 14 of file Fourier.h.

14 { return (sizex/2+1)*2; }
int Fourier2D::complexX ( ) const
inline

Definition at line 15 of file Fourier.h.

References complexX(), and m_SizeX.

Referenced by complexX(), SmoothIntensitySensor::performUpdate(), and SmoothIntensitySensor::updateScale().

15 { return complexX(m_SizeX); }
int complexX() const
Definition: Fourier.h:15
int m_SizeX
Definition: Fourier.h:27
int Fourier2D::complexY ( ) const
inline

Definition at line 16 of file Fourier.h.

References m_SizeY.

16 { return m_SizeY; }
int m_SizeY
Definition: Fourier.h:27
void Fourier2D::destroyTransform ( )

Definition at line 73 of file Fourier.cpp.

References m_Plan2D, m_Plan2Dinv, m_PlansCreated, m_SizeX, and m_SizeY.

Referenced by initTransform(), and ~Fourier2D().

73  {
74  if(m_PlansCreated) {
75  fftw_destroy_plan(m_Plan2D);
76  fftw_destroy_plan(m_Plan2Dinv);
77  m_SizeX = m_SizeY = 0;
78  m_PlansCreated = false;
79  }
80 }
bool m_PlansCreated
Definition: Fourier.h:26
fftw_plan m_Plan2D
Definition: Fourier.h:25
int m_SizeY
Definition: Fourier.h:27
fftw_plan m_Plan2Dinv
Definition: Fourier.h:25
int m_SizeX
Definition: Fourier.h:27
void Fourier2D::initTransform ( int  xsize,
int  ysize,
double *  f,
double *  F 
)

Definition at line 53 of file Fourier.cpp.

References destroyTransform(), F2D_PLANQUAL, m_Plan2D, m_Plan2Dinv, m_PlansCreated, m_SizeX, m_SizeY, and s_WisdomModified.

53  {
55 #ifdef F2D_REAL_TRANSFORM
56  m_Plan2D = fftw_plan_dft_r2c_2d(ysize, xsize, f, (fftw_complex*)F,
57  F2D_PLANQUAL);
58  m_Plan2Dinv = fftw_plan_dft_c2r_2d(ysize, xsize, (fftw_complex*)F, f,
59  FFTW_ESTIMATE);
60 #else
61  m_Plan2D = fftw_plan_dft_2d(ysize, xsize,
62  (fftw_complex*)f, (fftw_complex*)F,
63  FFTW_FORWARD, FFTW_ESTIMATE);
64  m_Plan2Dinv = fftw_plan_dft_2d(ysize, xsize,
65  (fftw_complex*)f, (fftw_complex*)F,
66  FFTW_BACKWARD, FFTW_ESTIMATE);
67 #endif
68  m_SizeX = xsize; m_SizeY = ysize;
69  m_PlansCreated = true;
70  s_WisdomModified = true;
71 }
bool m_PlansCreated
Definition: Fourier.h:26
#define F2D_PLANQUAL
Definition: Fourier.cpp:14
void destroyTransform()
Definition: Fourier.cpp:73
fftw_plan m_Plan2D
Definition: Fourier.h:25
static bool s_WisdomModified
Definition: Fourier.h:28
int m_SizeY
Definition: Fourier.h:27
fftw_plan m_Plan2Dinv
Definition: Fourier.h:25
int m_SizeX
Definition: Fourier.h:27
void Fourier2D::loadWisdom ( )
protected

Definition at line 33 of file Fourier.cpp.

References s_WisdomLoaded, and WISDOM.

Referenced by Fourier2D(), and realY().

33  {
34  if(!s_WisdomLoaded) {
35  FILE* wisdom_file = fopen(WISDOM, "a+");
36  rewind(wisdom_file);
37  fftw_import_wisdom_from_file(wisdom_file);
38  fclose(wisdom_file);
39  s_WisdomLoaded = true;
40  }
41 }
#define WISDOM
Definition: Fourier.cpp:7
static bool s_WisdomLoaded
Definition: Fourier.h:28
int Fourier2D::realX ( ) const
inline

Definition at line 17 of file Fourier.h.

References m_SizeX.

17 { return m_SizeX; }
int m_SizeX
Definition: Fourier.h:27
int Fourier2D::realY ( ) const
inline

Definition at line 18 of file Fourier.h.

References loadWisdom(), m_SizeY, and saveWisdom().

18 { return m_SizeY; }
int m_SizeY
Definition: Fourier.h:27
void Fourier2D::saveWisdom ( )
protected

Definition at line 43 of file Fourier.cpp.

References s_WisdomLoaded, s_WisdomModified, and WISDOM.

Referenced by realY(), and ~Fourier2D().

43  {
45  FILE* wisdom_file = fopen(WISDOM, "w");
46  fftw_export_wisdom_to_file(wisdom_file);
47  fclose(wisdom_file);
48  std::cout << "fftw plan written to file " << WISDOM << "."<<std::endl;
49  s_WisdomModified = false;
50  }
51 }
static bool s_WisdomModified
Definition: Fourier.h:28
#define WISDOM
Definition: Fourier.cpp:7
static bool s_WisdomLoaded
Definition: Fourier.h:28
void Fourier2D::transform ( )

Definition at line 23 of file Fourier.cpp.

References m_Plan2D, and m_PlansCreated.

23  {
24  assert(m_PlansCreated);
25  fftw_execute(m_Plan2D);
26 }
bool m_PlansCreated
Definition: Fourier.h:26
fftw_plan m_Plan2D
Definition: Fourier.h:25
void Fourier2D::transformInv ( )

Definition at line 28 of file Fourier.cpp.

References m_Plan2Dinv, and m_PlansCreated.

28  {
29  assert(m_PlansCreated);
30  fftw_execute(m_Plan2Dinv);
31 }
bool m_PlansCreated
Definition: Fourier.h:26
fftw_plan m_Plan2Dinv
Definition: Fourier.h:25

Member Data Documentation

fftw_plan Fourier2D::m_Plan2D
protected

Definition at line 25 of file Fourier.h.

Referenced by destroyTransform(), initTransform(), and transform().

fftw_plan Fourier2D::m_Plan2Dinv
protected

Definition at line 25 of file Fourier.h.

Referenced by destroyTransform(), initTransform(), and transformInv().

bool Fourier2D::m_PlansCreated
protected

Definition at line 26 of file Fourier.h.

Referenced by destroyTransform(), initTransform(), transform(), and transformInv().

int Fourier2D::m_SizeX
protected

Definition at line 27 of file Fourier.h.

Referenced by complexX(), destroyTransform(), initTransform(), and realX().

int Fourier2D::m_SizeY
protected

Definition at line 27 of file Fourier.h.

Referenced by complexY(), destroyTransform(), initTransform(), and realY().

bool Fourier2D::s_WisdomLoaded = false
staticprotected

Definition at line 28 of file Fourier.h.

Referenced by loadWisdom(), and saveWisdom().

bool Fourier2D::s_WisdomModified = false
staticprotected

Definition at line 28 of file Fourier.h.

Referenced by initTransform(), and saveWisdom().


The documentation for this class was generated from the following files: