Image Component Library (ICL)
FFTOp.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLFilter/src/ICLFilter/FFTOp.h **
10 ** Module : ICLFilter **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLMath/FFTUtils.h>
35 #include <ICLCore/Img.h>
36 #include <ICLFilter/UnaryOp.h>
37 #include <cmath>
38 
39 namespace icl{
40  namespace filter{
41 
42 
117  class ICLFilter_API FFTOp : public UnaryOp{
118 
119  private:
121  class Data;
122 
124  Data *m_data;
125 
126  //Applies fft/dft on all channel of sourceimage.
131  template<class SrcT, class DstT>
132  void apply_internal(const core::Img<SrcT> &src, core::Img<DstT> &dst,
133  math::DynMatrix<std::complex<DstT> > &buf,
134  math::DynMatrix<std::complex<DstT> > &dstBuf);
135 
136  //Adapts sourceimage before fft/dft computation.
140  template<class T>
141  const core::Img<T> *adapt_source(const core::Img<T> *src);
142 
143  //Applies an inplace fftshift after computation of the fft (if possible).
146  template<typename T>
147  void apply_inplace_fftshift(math::DynMatrix<T> &m);
148 
149  public:
151 
158  SCALE_DOWN
159  };
160 
162 
171  TWO_CHANNEL_MAGNITUDE_PHASE
172  };
173 
175 
180  FFTOp(ResultMode rm=LOG_POWER_SPECTRUM, SizeAdaptionMode sam=NO_SCALE,
181  bool fftshift=true,bool forceDFT=false);
182 
184  ~FFTOp();
185 
187 
188  void setResultMode(ResultMode rm);
189 
191 
192  int getResultMode();
193 
195 
196  void setSizeAdaptionMode(SizeAdaptionMode sam);
197 
199 
200  int getSizeAdaptionMode();
201 
203 
204  bool getForceDFT();
205 
207 
208  void setForceDFT(bool pForceDFT);
209 
211 
212  void setFFTShift(bool pFFTShift);
213 
215 
216  bool getFFTShift();
217 
219 
222  virtual void apply(const core::ImgBase *src, core::ImgBase **dst);
223 
225  using UnaryOp::apply;
226  };
227  } // namespace filter
228 }
229 
sourceimage stays as is
Definition: FFTOp.h:153
undocument this line if you encounter any issues!
Definition: Any.h:37
ResultMode
Modes how the destinationimage will be created.
Definition: FFTOp.h:163
Data * m_data
Class for internal params and buffers.
Definition: FFTOp.h:121
magnitude of fftcomputation
Definition: FFTOp.h:169
mirrors the image on the edges of the sourceimage(new size is next power of 2 after originsize,...
Definition: FFTOp.h:156
alternates real- and imaginarypart of fftcomputation
Definition: FFTOp.h:164
Highly flexible and optimized matrix class implementation.
Definition: DynMatrix.h:81
creates a border with zeros around the sourceimage(new size is next power of 2 after originsize,...
Definition: FFTOp.h:154
powerspectrum of fftcomputation
Definition: FFTOp.h:167
phase of fftcomputation
Definition: FFTOp.h:170
continues the image with copies the sourceimage(new size is next power of 2 after originsize,...
Definition: FFTOp.h:155
Abstract Base class for Unary Operators.
Definition: UnaryOp.h:51
realpart of fftcomputation
Definition: FFTOp.h:166
ICLQt_API core::Img< T > filter(const core::Img< T > &image, const std::string &filter)
applies a filter operation on the source image (affinity for float)
imaginarypart of fftcomputation
Definition: FFTOp.h:165
zooms to next higher power of 2 of originsize, or origanalsize if it is power of 2
Definition: FFTOp.h:157
logpowerspectrum of fftcomputation
Definition: FFTOp.h:168
SizeAdaptionMode
Modes how the sourceimage is to adapt before fftcomputation.
Definition: FFTOp.h:152
#define ICLFilter_API
Definition: CompatMacros.h:175
ICLMath_IMP DynMatrix< T > & fftshift(DynMatrix< T > &src, DynMatrix< T > &dst)
shifts upper left corner to center.
virtual void apply(const core::ImgBase *operand1, core::ImgBase **dst)=0
pure virtual apply function, that must be implemented in all derived classes
Definition: FFTOp.h:117
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131
The Img class implements the ImgBase Image interface with type specific functionalities .
Definition: Img.h:49