gVirtualXRay  2.0.10
VirtualX-RayImagingLibraryonGPU
FFT.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (c) 2017, Dr Franck P. Vidal (franck.p.vidal@fpvidal.net),
4 http://www.fpvidal.net/
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14 this list of conditions and the following disclaimer in the documentation and/or
15 other materials provided with the distribution.
16 
17 3. Neither the name of the Bangor University nor the names of its contributors
18 may be used to endorse or promote products derived from this software without
19 specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 
32 */
33 
34 
35 #ifndef __FFT_h
36 #define __FFT_h
37 
38 
56 //******************************************************************************
57 // Include
58 //******************************************************************************
59 #include <string>
60 
61 #ifndef __Image_h
62 #include "gVirtualXRay/Image.h"
63 #endif
64 
65 
66 //******************************************************************************
67 // namespace
68 //******************************************************************************
69 namespace gVirtualXRay {
70 
71 
72 //==============================================================================
77 //==============================================================================
78 template<typename T> class FFT
79 //------------------------------------------------------------------------------
80 {
81 //******************************************************************************
82 public:
83  //--------------------------------------------------------------------------
85  //--------------------------------------------------------------------------
86  FFT();
87 
88 
89  //--------------------------------------------------------------------------
91 
94  //--------------------------------------------------------------------------
95  FFT(const FFT<T>& aFFT);
96 
97 
98  //--------------------------------------------------------------------------
100 
104  //--------------------------------------------------------------------------
105  FFT(unsigned int aWidth,
106  unsigned int aHeight);
107 
108 
109  //--------------------------------------------------------------------------
111 
115  //--------------------------------------------------------------------------
116  FFT<T>& operator=(const FFT<T>& aFFT);
117 
118 
119  static FFT<T> computeFFT(const Image<T>& anImage);
120 
121 
122  Image<T> getInverseFFT() const;
123 
124 
125  FFT<T> filterRamp() const;
126 
127 
128  FFT<T> rhoFilter(const std::string& aFilterType, float aScalingFactor);
129 
130 
131  FFT<T> rhoFilter(const char* aFilterType, float aScalingFactor);
132 
133 
134  Image<T> getMagnitude() const;
135 
136 
137  //Image& getMagnitude();
138 
139 
140  Image<T> getPhase() const;
141 
142 
143  // Image& getPhase();
144 
145 
146 //******************************************************************************
147 private:
148  static unsigned int powerOfTwo(unsigned int i);
149 
150 
151  static Image<T> swapQuadrants(const Image<T>& anImage);
152 
153  Image<T> m_real;
154  Image<T> m_img;
155 
156  unsigned int m_origin_image_width;
157  unsigned int m_origin_image_height;
158 };
159 
160 
161 } // namespace gVirtualXRay
162 
163 
164 //******************************************************************************
165 #include "FFT.inl"
166 
167 
168 #endif // __FFT_h
FFT()
Default constructor.
Definition: FFT.inl:88
static FFT< T > computeFFT(const Image< T > &anImage)
Definition: FFT.inl:121
FFT< T > rhoFilter(const std::string &aFilterType, float aScalingFactor)
Definition: FFT.inl:352
Image is a class to manage a greyscale image.
Definition: Image.h:92
Image< T > getPhase() const
Definition: FFT.inl:466
Class to handle a greyscale image.
Class to handle a greyscale image.
Image< T > getInverseFFT() const
Definition: FFT.inl:251
FFT is a class to compute the FFT of a greyscale image.
Definition: FFT.h:78
Image< T > getMagnitude() const
Definition: FFT.inl:441
FFT< T > & operator=(const FFT< T > &aFFT)
Assignment operator (also called copy operator).
Definition: FFT.inl:108
FFT< T > filterRamp() const
Definition: FFT.inl:312