Filter Library Camera Interface Physics

ScanFilterLowPass.h

00001 /*
00002  * ScanFilterLowPass.h - low-pass filter (frequency domain).
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: ScanFilterLowPass.h 242 2005-06-29 07:57:25Z moene $
00013  */
00014 
00015 #ifndef CFL_SCANFILTERLOWPASS_H
00016 #define CFL_SCANFILTERLOWPASS_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/ScanFilterFourierBase.h>  // for base class
00025 #include <cfl/ProgressDlg.h>            // for class CProgressDlg
00026 
00027 /**
00028  * \addtogroup cfl_filterlowpass Low-pass Filter (Frequency Domain)
00029  * \brief low-pass filter (frequency domain).
00030  *
00031 
00032 <h3>Purpose</h3>
00033 
00034 <h3>Description</h3>
00035 
00036 <h3>Algorithm</h3>
00037 
00038 
00039 \f[
00040    \textrm{B} = \textrm{A}
00041 \f]
00042 
00043 <h3>Examples</h3>
00044 Try to find some interesting pictures for most filters.
00045 
00046 <h3>Contact</h3>
00047 Dipl.phys. M.J. Rost<br>
00048 Huygens Laboratorium<br>
00049 Universiteit Leiden<br>
00050 Niels Bohrweg 2<br>
00051 2333 CA Leiden, The Netherlands<br>
00052 <br>
00053 Tel: +31 71 5275600<br>
00054 Fax: +31 71 5275404<br>
00055 <br>
00056 E-mail: rost@physics.LeidenUniv.nl<br>
00057 Web: http://www.geocities.com/marcel_rost/<br>
00058 
00059  *
00060  * @{
00061  */
00062 
00063 DECLARE_CLASS( CScanFilterLowPass );         // create various types
00064 
00065 /**
00066  * \brief FFT lowpass filter.
00067  *
00068  */
00069 class CScanFilterLowPass : public CScanFilterFourierBase
00070 {
00071    friend class CFilterDlg_LowPass;
00072 
00073 public:
00074    /**
00075     * the parent class.
00076     */
00077    typedef CScanFilterFourierBase Super;
00078 
00079    /**
00080     * the size type.
00081     */
00082    typedef CScanBaseBuffer::SizeType SizeType;
00083 
00084    /**
00085     * the real type.
00086     */
00087    typedef CScanFilterFourierBase::RealType RealType;
00088 
00089    /**
00090     * the Fourier element type.
00091     */
00092    typedef CScanBaseBuffer::FourierElementType FourierElementType;
00093 
00094    ///
00095    /// \name Construction
00096    /// @{
00097 
00098    /**
00099     * default constructor.
00100     */
00101    CScanFilterLowPass();
00102 
00103    /**
00104     * destructor.
00105     */
00106    virtual ~CScanFilterLowPass();
00107 
00108    /// @}
00109    /// \name Camera--Filter Interface
00110    /// @{
00111 
00112    /**
00113     * \brief configure filter with settings as provided by the application on the
00114     * filterlist window (e.g. via registry); see also CScanFilterNull::ReadFilterSettings().
00115     */
00116    virtual void ReadFilterSettings( );
00117 
00118    /**
00119     * \brief save filter settings e.g. for use with the filterlist window (e.g. via registry);
00120     * see also ReadFilterSettings().
00121     */
00122    virtual void WriteFilterSettings( ) const;
00123 
00124    /**
00125     * provide current filter parameter(s) for filter-scripting capture
00126     * in the main application;
00127     * see also CScanFilterNull::GetParameters().
00128     */
00129    virtual LPCTSTR GetParameters() const;
00130 
00131    /**
00132     * set parameters for filter-script execution of filter;
00133     * see also CScanFilterNull::SetParameters().
00134     */
00135    virtual BOOL SetParameters( LPCTSTR lpParameters );
00136 
00137    /**
00138     * start filter dialog to edit parameters; no filter operations;
00139     * see also CScanFilterNull::EditModeless().
00140     */
00141 //   virtual BOOL EditModeless( CWnd *pParentWnd );
00142 
00143    /**
00144     * create filter dialog and prepare filter for Apply();
00145     * see also CScanFilterNull::RunModeless().
00146     */
00147    virtual BOOL RunModeless( CWnd *pParentWnd, CDocument *pDoc );
00148 
00149    /**
00150     * check parameters, take care of a properly sized output buffer,
00151     * set its name and copy filter parameters and process;
00152     * see also CScanFilterNull::ApplyCore().
00153     */
00154    virtual BOOL Apply();
00155 
00156    /// @}
00157    /// \name Predicates
00158    /// @{
00159 
00160    /// @}
00161    /// \name Accessors
00162    /// @{
00163 
00164    /**
00165     * the cut off.
00166     */
00167    double GetCutOff() const;
00168 
00169    /**
00170     * the soft edge.
00171     */
00172    double GetSoftEdge() const;
00173 
00174    /// @}
00175    /// \name Mutators
00176    /// @{
00177 
00178    /**
00179     * set the cut off.
00180     */
00181    void SetCutOff( double cutOff );
00182 
00183    /**
00184     * set the soft edge.
00185     */
00186    void SetSoftEdge( double softEdge );
00187 
00188    /// @}
00189 
00190 protected:
00191    /**
00192     * store or retrieve the object's settings.
00193     */
00194    virtual void Serialize( CArchive& ar );
00195    DECLARE_SERIAL( CScanFilterLowPass )
00196 
00197    /**
00198     * create a thread that computes the result.
00199     */
00200    static UINT ComputationThreadFunction( LPVOID lpContext );
00201 
00202    /**
00203     * called by working thread.
00204     */
00205    BOOL Compute( CProgressDlg *pDlg );
00206 
00207    /**
00208     * compute a frame.
00209     */
00210    void ComputePart( FourierElementType** in, FourierElementType** out );
00211 
00212 public:
00213    /**
00214     * the filter name.
00215     */
00216    static LPCTSTR m_lpcsFilterName;
00217 
00218    /**
00219     * the class short filtername.
00220     */
00221    static LPCTSTR m_lpcsShortFilterName;
00222 
00223    /**
00224     * the default cut-off value.
00225     */
00226    static const RealType def_dCutOff;
00227 
00228    /**
00229     * the default new Y-size.
00230     */
00231    static const RealType def_dSoftEdge;
00232 
00233 private:
00234 
00235    /**
00236     * the cut-off.
00237     */
00238    RealType m_dCutOff;
00239 
00240    /**
00241     * the soft edge.
00242     */
00243    RealType m_dSoftEdge;
00244 
00245    /**
00246     * the computation thread arguments type.
00247     */
00248    class ThreadArgs
00249    {
00250    public:
00251       /**
00252        * constructor
00253        */
00254       ThreadArgs( CProgressDlg* Dlg, CScanFilterLowPass* This ) :
00255          pDlg( Dlg ), pThis( This ), bReturn( 0 )
00256       {
00257          ; // do nothing
00258       }
00259 
00260       BOOL bReturn;                     ///< the thread return value
00261       CProgressDlg *pDlg;               ///< the progress dialog
00262       CScanFilterLowPass *pThis;        ///< the filter
00263    };
00264 };
00265 
00266 ///@} cfl_filterlowpass
00267 
00268 /**
00269  * the cut off.
00270  */
00271 
00272 inline CScanFilterLowPass::RealType CScanFilterLowPass::GetCutOff() const
00273 {
00274    return m_dCutOff;
00275 }
00276 
00277 /**
00278  * the soft edge.
00279  */
00280 inline CScanFilterLowPass::RealType CScanFilterLowPass::GetSoftEdge() const
00281 {
00282    return m_dSoftEdge;
00283 }
00284 
00285 /**
00286  * set the cut off.
00287  */
00288 inline void CScanFilterLowPass::SetCutOff( RealType cutOff )
00289 {
00290    m_dCutOff = cutOff;
00291 }
00292 
00293 /**
00294  * set the soft edge.
00295  */
00296 inline void CScanFilterLowPass::SetSoftEdge( RealType softEdge )
00297 {
00298    m_dSoftEdge = softEdge;
00299 }
00300 
00301 #endif // CFL_SCANFILTERLOWPASS_H
00302 
00303 /*
00304  * end of file
00305  */
00306 

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