Image Component Library (ICL)
|
00001 /******************************************************************** 00002 ** Image Component Library (ICL) ** 00003 ** ** 00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld ** 00005 ** Neuroinformatics Group ** 00006 ** Website: www.iclcv.org and ** 00007 ** http://opensource.cit-ec.de/projects/icl ** 00008 ** ** 00009 ** File : ICLFilter/src/ICLFilter/IFFTOp.h ** 00010 ** Module : ICLFilter ** 00011 ** Authors: Christian Groszewski, Christof Elbrechter ** 00012 ** ** 00013 ** ** 00014 ** GNU LESSER GENERAL PUBLIC LICENSE ** 00015 ** This file may be used under the terms of the GNU Lesser General ** 00016 ** Public License version 3.0 as published by the ** 00017 ** ** 00018 ** Free Software Foundation and appearing in the file LICENSE.GPL ** 00019 ** included in the packaging of this file. Please review the ** 00020 ** following information to ensure the license requirements will ** 00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt ** 00022 ** ** 00023 ** The development of this software was supported by the ** 00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. ** 00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche ** 00026 ** Forschungsgemeinschaft (DFG) in the context of the German ** 00027 ** Excellence Initiative. ** 00028 ** ** 00029 ********************************************************************/ 00030 00031 #pragma once 00032 #include <ICLCore/Img.h> 00033 #include <ICLFilter/UnaryOp.h> 00034 #include <ICLMath/FFTUtils.h> 00035 #include <cmath> 00036 #include <complex> 00037 #include <ICLUtils/BasicTypes.h> 00038 #include <ICLMath/DynMatrix.h> 00039 namespace icl{ 00040 namespace filter{ 00042 00046 class IFFTOp : public UnaryOp{ 00047 00048 private: 00050 class Data; 00051 00053 Data *m_data; 00054 00055 //Applies ifft/idft on all channel of sourceimage. 00060 template<class SrcT, class DstT> 00061 void apply_internal(const core::Img<SrcT> &src, core::Img<DstT> &dst, 00062 math::DynMatrix<std::complex<DstT> > &buf, 00063 math::DynMatrix<std::complex<DstT> > &dstBuf); 00064 00065 //Adapts sourceimage before ifft/idft computation. 00069 template<class T> 00070 const core::Img<T> *adapt_source(const core::Img<T> *src); 00071 00072 //Applies an inplace ifftshift after computation of the ifft. 00075 template<typename T> 00076 void apply_inplace_ifftshift(math::DynMatrix<T> &m); 00077 00078 public: 00079 00081 00082 enum SizeAdaptionMode{ 00083 NO_SCALE, 00084 PAD_REMOVE, 00085 SCALE_UP, 00086 SCALE_DOWN 00087 }; 00088 00089 00090 //Modes how the destinationimage will be created. 00092 enum ResultMode{ 00093 REAL_ONLY, 00094 IMAG_ONLY, 00095 TWO_CHANNEL_COMPLEX 00096 }; 00097 00099 00106 IFFTOp(ResultMode rm=REAL_ONLY, SizeAdaptionMode sam=NO_SCALE, 00107 utils::Rect roi=Rect(0,0,0,0),bool join=true, 00108 bool ifftshift=true, bool forceIDFT=false); 00109 00111 ~IFFTOp(); 00112 00114 00115 void setJoinMatrix(bool pJoin); 00116 00118 00119 bool getJoinMatrix(); 00120 00122 00123 void setROI(utils::Rect roi); 00124 00126 00127 Rect getRoi(); 00128 00130 /*@param rm the resultmode to be set*/ 00131 void setResultMode(ResultMode rm); 00132 00134 00135 int getResultMode(); 00136 00138 00139 void setSizeAdaptionMode(SizeAdaptionMode sam); 00140 00142 00143 int getSizeAdaptionMode(); 00144 00146 00147 bool getForceIDFT(); 00148 00150 00151 void setForceIDFT(bool pForceDFT); 00152 00154 00157 virtual void apply(const core::ImgBase *src, core::ImgBase **dst); 00158 00160 using UnaryOp::apply; 00161 }; 00162 } // namespace filter 00163 } 00164