Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
IFFTOp.h
Go to the documentation of this file.
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.LGPL **
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 
00033 #include <ICLUtils/CompatMacros.h>
00034 #include <ICLUtils/BasicTypes.h>
00035 #include <ICLMath/DynMatrix.h>
00036 #include <ICLMath/FFTUtils.h>
00037 #include <ICLCore/Img.h>
00038 #include <ICLFilter/UnaryOp.h>
00039 #include <cmath>
00040 #include <complex>
00041 
00042 namespace icl{
00043   namespace filter{
00045 
00049     class ICLFilter_API IFFTOp : public UnaryOp{
00050       
00051       private:
00053       class Data;
00054       
00056       Data *m_data;
00057       
00058       //Applies ifft/idft on all channel of sourceimage.
00063       template<class SrcT, class DstT>
00064       void apply_internal(const core::Img<SrcT> &src, core::Img<DstT> &dst,
00065                           math::DynMatrix<std::complex<DstT> > &buf, 
00066                           math::DynMatrix<std::complex<DstT> > &dstBuf);
00067       
00068       //Adapts sourceimage before ifft/idft computation.
00072       template<class T>
00073       const core::Img<T> *adapt_source(const core::Img<T> *src);
00074       
00075       //Applies an inplace ifftshift  after computation of the ifft.
00078       template<typename T>
00079       void apply_inplace_ifftshift(math::DynMatrix<T> &m);
00080       
00081       public:
00082       
00084 
00085       enum SizeAdaptionMode{
00086         NO_SCALE,
00087         PAD_REMOVE,
00088         SCALE_UP,
00089         SCALE_DOWN
00090       };
00091       
00092       
00093       //Modes how the destinationimage will be created.
00095       enum ResultMode{
00096         REAL_ONLY,
00097         IMAG_ONLY,
00098         TWO_CHANNEL_COMPLEX
00099       };
00100   
00102 
00109       IFFTOp(ResultMode rm=REAL_ONLY, SizeAdaptionMode sam=NO_SCALE,
00110              utils::Rect roi=Rect(0,0,0,0),bool join=true, 
00111              bool ifftshift=true, bool forceIDFT=false);
00112   
00114       ~IFFTOp();
00115   
00117 
00118       void setJoinMatrix(bool pJoin);
00119   
00121 
00122       bool getJoinMatrix();
00123   
00125 
00126       void setROI(utils::Rect roi);
00127   
00129 
00130       Rect getRoi();
00131   
00133       /*@param rm the resultmode to be set*/
00134       void setResultMode(ResultMode rm);
00135   
00137 
00138       int getResultMode();
00139   
00141 
00142       void setSizeAdaptionMode(SizeAdaptionMode sam);
00143   
00145 
00146       int getSizeAdaptionMode();
00147   
00149 
00150       bool getForceIDFT();
00151   
00153 
00154       void setForceIDFT(bool pForceDFT);
00155   
00157 
00160       virtual void apply(const core::ImgBase *src, core::ImgBase **dst);
00161   
00163       using UnaryOp::apply;
00164     };
00165   } // namespace filter
00166 }
00167 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines