STIR  6.2.0
fourier.h
Go to the documentation of this file.
1 //
2 //
3 
12 /*
13  Copyright (C) 2003- 2011, Hammersmith Imanet Ltd
14  This file is part of STIR.
15 
16  SPDX-License-Identifier: Apache-2.0
17 
18  See STIR/LICENSE.txt for details
19 */
20 #ifndef __stir_numerics_stir_fourier_h__
21 #define __stir_numerics_stir_fourier_h__
22 #include "stir/VectorWithOffset.h"
24 START_NAMESPACE_STIR
25 
39 template <typename T>
40 void fourier(T& c, const int sign = 1);
41 // fourier(VectorWithOffset<elemT>& c, const int sign = 1);
42 
50 template <typename T>
51 inline void
52 inverse_fourier(T& c, const int sign = 1)
53 {
54  fourier(c, -sign);
55 #ifdef _MSC_VER
56 // disable warning about conversion
57 # pragma warning(disable : 4244)
58 #endif
59  c /= c.size_all();
60 #ifdef _MSC_VER
61 // disable warning about conversion
62 # pragma warning(default : 4244)
63 #endif
64 }
65 
95 template <typename T>
96 void fourier_1d(T& c, const int sign);
97 
105 template <typename T>
106 inline void
107 inverse_fourier_1d(T& c, const int sign = 1)
108 {
109  fourier_1d(c, -sign);
110 #ifdef _MSC_VER
111 // disable warning about conversion
112 # pragma warning(disable : 4244)
113 #endif
114  c /= c.size();
115 #ifdef _MSC_VER
116 # pragma warning(default : 4244)
117 #endif
118 }
119 
153 template <typename T>
154 Array<1, std::complex<T>> fourier_1d_for_real_data(const Array<1, T>& c, const int sign = 1);
155 
163 template <typename T>
164 Array<1, T> inverse_fourier_1d_for_real_data(const Array<1, std::complex<T>>& c, const int sign = 1);
165 
173 template <typename T>
174 Array<1, T> inverse_fourier_1d_for_real_data_corrupting_input(Array<1, std::complex<T>>& c, const int sign);
175 
200 template <int num_dimensions, typename T>
202 
210 template <int num_dimensions, typename T>
211 Array<num_dimensions, T> inverse_fourier_for_real_data(const Array<num_dimensions, std::complex<T>>& c, const int sign = 1);
212 
220 template <int num_dimensions, typename T>
222  const int sign = 1);
223 
229 template <int num_dimensions, typename T>
230 Array<num_dimensions, std::complex<T>> pos_frequencies_to_all(const Array<num_dimensions, std::complex<T>>& c);
231 
232 END_NAMESPACE_STIR
233 
234 #endif
Array< num_dimensions, std::complex< T > > pos_frequencies_to_all(const Array< num_dimensions, std::complex< T >> &c)
Adds negative frequencies to the last dimension of a complex array by complex conjugation.
Definition: fourier.cxx:352
void fourier(T &c, const int sign=1)
Compute multi-dimensional discrete fourier transform.
Definition: fourier.cxx:143
void inverse_fourier_1d(T &c, const int sign=1)
Compute the inverse of the one-dimensional discrete fourier transform.
Definition: fourier.h:107
void inverse_fourier(T &c, const int sign=1)
Compute the inverse of the multi-dimensional discrete fourier transform.
Definition: fourier.h:52
Array< 1, std::complex< T > > fourier_1d_for_real_data(const Array< 1, T > &c, const int sign=1)
Compute one-dimensional discrete fourier transform of a real array (of even size).
Definition: fourier.cxx:156
Array< 1, T > inverse_fourier_1d_for_real_data_corrupting_input(Array< 1, std::complex< T >> &c, const int sign)
As inverse_fourier_1d_for_real_data(), but avoiding the copy of the input array.
Definition: fourier.cxx:206
Array< 1, T > inverse_fourier_1d_for_real_data(const Array< 1, std::complex< T >> &c, const int sign=1)
Compute the inverse of the one-dimensional discrete fourier transform of a real array (of even size)...
Definition: fourier.cxx:257
defines the stir::VectorWithOffset class
void fourier_1d(T &c, const int sign)
Compute one-dimensional discrete fourier transform of an array.
Definition: fourier.cxx:65
defines additional numerical operations for arrays of complex numbers
Array< num_dimensions, T > inverse_fourier_for_real_data_corrupting_input(Array< num_dimensions, std::complex< T >> &c, const int sign=1)
As inverse_fourier_for_real_data(), but avoiding the copy of the input array.
Definition: fourier.cxx:337
Array< num_dimensions, T > inverse_fourier_for_real_data(const Array< num_dimensions, std::complex< T >> &c, const int sign=1)
Compute the inverse of the discrete fourier transform of a real array (with the last dimension of eve...
Definition: fourier.cxx:344
This class defines multi-dimensional (numeric) arrays.
Definition: Array.h:73
Array< num_dimensions, std::complex< T > > fourier_for_real_data(const Array< num_dimensions, T > &c, const int sign=1)
Compute discrete fourier transform of a real array (with the last dimensions of even size)...
Definition: fourier.cxx:330