File: vnl_fft_3d.h

package info (click to toggle)
insighttoolkit 3.6.0-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 94,956 kB
  • ctags: 74,981
  • sloc: cpp: 355,621; ansic: 195,070; fortran: 28,713; python: 3,802; tcl: 1,996; sh: 1,175; java: 583; makefile: 415; csh: 184; perl: 175
file content (46 lines) | stat: -rw-r--r-- 1,174 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// This is vxl/vnl/algo/vnl_fft_3d.h
#ifndef vnl_fft_3d_h_
#define vnl_fft_3d_h_
#ifdef VCL_NEEDS_PRAGMA_INTERFACE
#pragma interface
#endif
//:
// \file
// \brief In-place 3D fast fourier transform
// \author fsm

#include <vnl/vnl_matrix.h>
#include <vnl/algo/vnl_fft_base.h>

//: In-place 3D fast fourier transform

template <class T>
struct vnl_fft_3d : public vnl_fft_base<3, T>
{
  typedef vnl_fft_base<3, T> base;

  //: constructor takes size of signal.
  vnl_fft_3d(int M, int N,int Q) {
    base::factors_[0].resize(M);
    base::factors_[1].resize(N);
    base::factors_[2].resize(Q);
  }

  //: dir = +1/-1 according to direction of transform.
  void transform(vnl_matrix<vcl_complex<T> > &signal, int dir)
  { base::transform(signal.data_block(), dir); }

  //: forward FFT
  void fwd_transform(vnl_matrix<vcl_complex<T> > &signal)
  { transform(signal, +1); }

  //: backward (inverse) FFT
  void bwd_transform(vnl_matrix<vcl_complex<T> > &signal)
  { transform(signal, -1); }

  //: return size of signal.
  unsigned rows() const { return base::factors_[0].number(); }
  unsigned cols() const { return base::factors_[1].number(); }
};

#endif // vnl_fft_3d_h_