Filter Library Camera Interface Physics

ScanFilterFFTInverse.h

00001 /*
00002  * ScanFilterFFTInverse.h - inverse FFT.
00003  *
00004  * This file is part of the Camera Filter Library.
00005  * Computer Aided Measurement Environment for Realtime Atomic imaging (Camera)
00006  *
00007  * Copyright (C) 2004-2005, Leiden Probe Microscopy.
00008  * Copyright (C) 2004-2005, Universiteit Leiden.
00009  *
00010  * Authors: M. Seynen (original), Martin J. Moene
00011  *
00012  * $Id: ScanFilterFFTInverse.h 346 2006-03-01 13:55:57Z moene $
00013  */
00014 
00015 #ifndef CFL_ScanFilterFFTInverse_H
00016 #define CFL_ScanFilterFFTInverse_H
00017 
00018 #if _MSC_VER > 1000
00019 #pragma once
00020 #endif // _MSC_VER > 1000
00021 
00022 #include <cfl/ScanFilter.h>             // for base class
00023 #include <cfl/ScanBaseBuffer.h>         // for ValueType
00024 #include <cfl/ProgressDlg.h>            // for class CProgressDlg
00025 #include <cfl/ToolCilImage.h>           // for class Image
00026 
00027 /**
00028  * \addtogroup cfl_filterinversefft Inverse FFT Filter.
00029  * \brief inverse FFT filter; 
00030  * \todo can get at original image size and restore image size?.
00031  *
00032 
00033 <h3>Purpose</h3>
00034 
00035 <h3>Description</h3>
00036 
00037 <h3>Algorithm</h3>
00038 
00039 
00040 \f[
00041    \textrm{B} = \textrm{A}
00042 \f]
00043 
00044 <h3>Examples</h3>
00045 Try to find some interesting pictures for most filters.
00046 
00047 <h3>Contact</h3>
00048 Dipl.phys. M.J. Rost<br>
00049 Huygens Laboratorium<br>
00050 Universiteit Leiden<br>
00051 Niels Bohrweg 2<br>
00052 2333 CA Leiden, The Netherlands<br>
00053 <br>
00054 Tel: +31 71 5275600<br>
00055 Fax: +31 71 5275404<br>
00056 <br>
00057 E-mail: rost@physics.LeidenUniv.nl<br>
00058 Web: http://www.geocities.com/marcel_rost/<br>
00059 
00060  *
00061  * @{
00062  */
00063 
00064 DECLARE_CLASS( CScanFilterFFTInverse );         // create various types
00065 
00066 /**
00067  * \brief inverse FFT.
00068  *
00069  */
00070 class CScanFilterFFTInverse : public CScanFilter
00071 {
00072    /**
00073     * declare class serializable.
00074     */
00075    DECLARE_SERIAL( CScanFilterFFTInverse );
00076 
00077 public:
00078    /**
00079     * the parent class.
00080     */
00081    typedef CScanFilter Super;
00082 
00083    /**
00084     * the size type.
00085     */
00086    typedef CScanBaseBuffer::SizeType SizeType;
00087 
00088    /**
00089     * the value type.
00090     */
00091    typedef CScanBaseBuffer::ValueType ValueType;
00092 
00093    /**
00094     * the pointer type.
00095     */
00096    typedef ValueType* Pointer;
00097 
00098    /**
00099     * the Fourier element type.
00100     */
00101    typedef CScanBaseBuffer::FourierElementType FourierElementType;
00102 
00103    ///
00104    /// \name Construction
00105    /// @{
00106 
00107    /**
00108     * default constructor.
00109     */
00110    CScanFilterFFTInverse();
00111 
00112    /**
00113     * destructor.
00114     */
00115    virtual ~CScanFilterFFTInverse();
00116 
00117    /// @}
00118    /// \name Camera--Filter Interface
00119    /// @{
00120 
00121    /**
00122     * no dialog.
00123     */
00124    virtual BOOL CanDoDialogEntry() const;
00125 
00126 //    /**
00127 //     * \brief configure filter with settings as provided by the application on the
00128 //     * filterlist window (e.g. via registry); see also CScanFilterNull::ReadFilterSettings().
00129 //     */
00130 //    virtual void ReadFilterSettings( );
00131 // 
00132 //    /**
00133 //     * \brief save filter settings e.g. for use with the filterlist window (e.g. via registry);
00134 //     * see also ReadFilterSettings().
00135 //     */
00136 //    virtual void WriteFilterSettings( ) const;
00137 //
00138    /**
00139     * no parameters; see also CScanFilterNull::GetParameters().
00140     */
00141    virtual LPCTSTR GetParameters() const;
00142 
00143    /**
00144     * no parameters; see also CScanFilterNull::SetParameters().
00145     */
00146    virtual BOOL SetParameters( LPCTSTR lpParameters );
00147 
00148 //    /**
00149 //     * start filter dialog to edit parameters; no filter operations;
00150 //     * see also CScanFilterNull::EditModeless().
00151 //     */
00152 //    virtual BOOL EditModeless( CWnd *pParentWnd );
00153 //
00154 //    /**
00155 //     * create filter dialog and prepare filter for Apply();
00156 //     * see also CScanFilterNull::RunModeless().
00157 //     */
00158 //    virtual BOOL RunModeless( CWnd *pParentWnd, CDocument *pDoc );
00159 
00160    /**
00161     * check parameters, take care of a properly sized output buffer,
00162     * set its name and copy filter parameters and process;
00163     * see also CScanFilterNull::ApplyCore().
00164     */
00165    virtual BOOL Apply();
00166 
00167    /// @}
00168    /// \name Predicates
00169    /// @{
00170 
00171    /// @}
00172    /// \name Accessors
00173    /// @{
00174 
00175    /// @}
00176    /// \name Mutators
00177    /// @{
00178 
00179    /// @}
00180 
00181 public:
00182    /**
00183     * the filter name.
00184     */
00185    static LPCTSTR m_lpcsFilterName;
00186 
00187    /**
00188     * the class short filtername.
00189     */
00190    static LPCTSTR m_lpcsShortFilterName;
00191 
00192 protected:
00193    /**
00194     * store or retrieve the object's settings.
00195     */
00196    virtual void Serialize(CArchive& ar);
00197 
00198    /**
00199     * create a thread that computes the result.
00200     */
00201    static UINT ComputationThreadFunction( LPVOID lpContext );
00202 
00203    /**
00204     * called by working thread
00205     */
00206    BOOL Compute( CProgressDlg *pDlg );
00207 
00208    /**
00209     * compute a frame.
00210     */
00211    void ComputePart( FourierElementType** pFFT, Image& dst );
00212 //   void ComputePart( FourierElementType** a, Pointer pFrame );
00213 
00214    /**
00215     * crop image to original size.
00216     */
00217    BOOL CropImage();
00218 
00219    /**
00220     * true if any edge contains non-zero data.
00221     */
00222    bool HasNonzeroEdge() const;
00223 
00224    /**
00225     * the rectangle that contains non-zero data.
00226     */
00227    CRect GetUsedRectangle() const;
00228 
00229    /**
00230     * the computation thread arguments type.
00231     */
00232    class ThreadArgs
00233    {
00234    public:
00235       /**
00236        * constructor
00237        */
00238       ThreadArgs( CProgressDlg* Dlg, CScanFilterFFTInverse* This ) :
00239          pDlg( Dlg ), pThis( This ), bReturn( 0 )
00240       {
00241          ; // do nothing
00242       }
00243 
00244       BOOL bReturn;                     ///< the thread return value
00245       CProgressDlg *pDlg;               ///< the progress dialog
00246       CScanFilterFFTInverse *pThis;     ///< the filter
00247    };
00248 
00249    /**
00250     * the intermediate result buffer for cropping.
00251     */
00252    CScanBaseBufferPtr m_lpsbTmp;
00253 };
00254 
00255 /// @} cfl_filterinversefft
00256 
00257 #endif // CFL_ScanFilterFFTInverse_H
00258 
00259 /*
00260  * end of file
00261  */
00262 

Camera Filter Library documentation © 2004-2007 by Leiden Probe Microscopy