/usr/include/mia-2.0/mia/core/fft1d_r2c.hh is in libmia-2.0-dev 2.0.13-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | /* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
* Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef mia_core_fft1d_r2c_hh
#define mia_core_fft1d_r2c_hh
#include <mia/core/defines.hh>
#include <vector>
#include <complex>
#include <fftw3.h>
NS_MIA_BEGIN
/**
\ingroup basic
\brief a class to real-to-complex 1D FFTs
Class to run a 1D real-to-complex FFT and its inverse. This class makes use of fftw.
The result of a forward transform followed directly by a backward transform is the input
scaled by the size of the input.
*/
class EXPORT_CORE CFFT1D_R2C {
public:
struct Complex : public std::complex<float> {
Complex():std::complex<float>(0.0, 0.0){}
Complex(const std::complex<float>& other):std::complex<float>(other){}
#if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
Complex(fftwf_complex& v):
std::complex<float>(v)
{
}
#else
Complex(fftwf_complex& v):
std::complex<float>(v[0], v[1])
{
}
#endif
};
/// A typedef that makes switching between single precicion and double precicion easier
typedef float Real;
/**
Construtor to create the needed fftw structures for the FFT of a real input vector of
size \a n
*/
CFFT1D_R2C(size_t n);
~CFFT1D_R2C();
/**
Execute forward transformation. input data must be of size \a n that was given at construction time
\returns the transformed in halfcomplex format (i.e. only the non-negative coefficints, since the
fft is sysetric
*/
std::vector<Complex> forward(const std::vector<Real>& data) const;
/**
Execute backward transformation. input data must be of size \f$\frac{n}{2} + 1\f$ with n as
given at construction time
\returns the backward transformed series
*/
std::vector<Real> backward(const std::vector<Complex>& data) const;
/**
Execute forward transformation. distance(in_begin, in_end) must be equal to \a n as given at construction time
\param in_begin
\param in_end
\param out_begin output iterator pointing at the output range that must be at least
of size \f$\frac{n}{2} + 1\f$ with n as given at construction time
\sa out_size
*/
void forward(std::vector<Real>::const_iterator in_begin,
std::vector<Real>::const_iterator in_end,
std::vector<Complex>::iterator out_begin) const;
/**
Execute forward transformation. distance(in_begin, in_end) must be equal to \f$\frac{n}{2} + 1\f$ with n as
given at construction time
\param in_begin
\param in_end
\param out_begin output iterator pointing at the output range that must be at least
of size \a n as given at construction time
\sa out_size
*/
void backward(std::vector<Complex>::const_iterator in_begin,
std::vector<Complex>::const_iterator in_end,
std::vector<Real>::iterator out_begin) const;
/// \returns the size of the forward transform result (i.e. \f$\frac{n}{2} + 1\f$) complex numbers.
size_t out_size() const;
private:
struct CFFT1D_R2CImpl *impl;
};
NS_MIA_END
#endif
|