Image Component Library (ICL)
IFFTOp.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/IFFTOp.h **
10 ** Module : ICLFilter **
11 ** Authors: Christian Groszewski, 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 <ICLUtils/BasicTypes.h>
35 #include <ICLMath/DynMatrix.h>
36 #include <ICLMath/FFTUtils.h>
37 #include <ICLCore/Img.h>
38 #include <ICLFilter/UnaryOp.h>
39 #include <cmath>
40 #include <complex>
41 
42 namespace icl{
43  namespace filter{
45 
49  class ICLFilter_API IFFTOp : public UnaryOp{
50 
51  private:
53  class Data;
54 
56  Data *m_data;
57 
58  //Applies ifft/idft on all channel of sourceimage.
63  template<class SrcT, class DstT>
64  void apply_internal(const core::Img<SrcT> &src, core::Img<DstT> &dst,
65  math::DynMatrix<std::complex<DstT> > &buf,
66  math::DynMatrix<std::complex<DstT> > &dstBuf);
67 
68  //Adapts sourceimage before ifft/idft computation.
72  template<class T>
73  const core::Img<T> *adapt_source(const core::Img<T> *src);
74 
75  //Applies an inplace ifftshift after computation of the ifft.
78  template<typename T>
79  void apply_inplace_ifftshift(math::DynMatrix<T> &m);
80 
81  public:
82 
84 
89  SCALE_DOWN
90  };
91 
92 
93  //Modes how the destinationimage will be created.
95  enum ResultMode{
98  TWO_CHANNEL_COMPLEX
99  };
100 
102 
109  IFFTOp(ResultMode rm=REAL_ONLY, SizeAdaptionMode sam=NO_SCALE,
110  utils::Rect roi=Rect(0,0,0,0),bool join=true,
111  bool ifftshift=true, bool forceIDFT=false);
112 
114  ~IFFTOp();
115 
117 
118  void setJoinMatrix(bool pJoin);
119 
121 
122  bool getJoinMatrix();
123 
125 
126  void setROI(utils::Rect roi);
127 
129 
130  Rect getRoi();
131 
133  /*@param rm the resultmode to be set*/
134  void setResultMode(ResultMode rm);
135 
137 
138  int getResultMode();
139 
141 
142  void setSizeAdaptionMode(SizeAdaptionMode sam);
143 
145 
146  int getSizeAdaptionMode();
147 
149 
150  bool getForceIDFT();
151 
153 
154  void setForceIDFT(bool pForceDFT);
155 
157 
160  virtual void apply(const core::ImgBase *src, core::ImgBase **dst);
161 
163  using UnaryOp::apply;
164  };
165  } // namespace filter
166 }
167 
removes PAD_MIRROR,PAD_ZERO and PAD_COPY from the sourceimage(new size is given from contructorparame...
Definition: IFFTOp.h:87
undocument this line if you encounter any issues!
Definition: Any.h:37
This class implements the unary operator for the inverse fast and discrete 2D fourier transformation.
Definition: IFFTOp.h:49
Highly flexible and optimized matrix class implementation.
Definition: DynMatrix.h:81
ICLQt_API ImgROI roi(ImgQ &r)
creates a ROI-struct from an image
ResultMode
Definition: IFFTOp.h:95
imaginarypart of ifftcomputation
Definition: IFFTOp.h:97
SizeAdaptionMode
Modes how the sourceimage is to adapt before fftcomputation.
Definition: IFFTOp.h:85
Abstract Base class for Unary Operators.
Definition: UnaryOp.h:51
Data * m_data
Class for internal params and buffers.
Definition: IFFTOp.h:53
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)
ICLMath_IMP DynMatrix< T > & ifftshift(DynMatrix< T > &src, DynMatrix< T > &dst)
invers function to fftshift.
alternates real- and imaginarypart of ifftcomputation
Definition: IFFTOp.h:96
zooms to next higher power of 2 of originsize, or origanalsize if it is power of 2
Definition: IFFTOp.h:88
#define ICLFilter_API
Definition: CompatMacros.h:175
virtual void apply(const core::ImgBase *operand1, core::ImgBase **dst)=0
pure virtual apply function, that must be implemented in all derived classes
Rectangle class of the ICL used e.g. for the Images ROI-rect.
Definition: Rect.h:95
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131
sourceimage stays as is
Definition: IFFTOp.h:86
The Img class implements the ImgBase Image interface with type specific functionalities .
Definition: Img.h:49