Filter Library Camera Interface Physics

ScanFilterHighPass.h

00001 /*
00002  * ScanFilterHighPass.h - highpass 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: ScanFilterHighPass.h 242 2005-06-29 07:57:25Z moene $
00013  */
00014 
00015 #ifndef CFL_SCANFILTERHIGHPASS_H
00016 #define CFL_SCANFILTERHIGHPASS_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_filterffthighpass FFT highpass filter.
00029  * \brief fft highpass filter.
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( CScanFilterHighPass );         // create various types
00064 
00065 /**
00066  * \brief FFT highpass filter.
00067  *
00068  */
00069 class CScanFilterHighPass : public CScanFilterFourierBase
00070 {
00071    friend class CFilterDlg_HighPass;
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    CScanFilterHighPass();
00102 
00103    /**
00104     * destructor.
00105     */
00106    virtual ~CScanFilterHighPass();
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( CScanFilterHighPass )
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     * the cut-off.
00236     */
00237    RealType m_dCutOff;
00238 
00239    /**
00240     * the soft edge.
00241     */
00242    RealType m_dSoftEdge;
00243 
00244    /**
00245     * the computation thread arguments type.
00246     */
00247    class ThreadArgs
00248    {
00249    public:
00250       /**
00251        * constructor
00252        */
00253       ThreadArgs( CProgressDlg* Dlg, CScanFilterHighPass* This ) :
00254          pDlg( Dlg ), pThis( This ), bReturn( 0 )
00255       {
00256          ; // do nothing
00257       }
00258 
00259       BOOL bReturn;                     ///< the thread return value
00260       CProgressDlg *pDlg;               ///< the progress dialog
00261       CScanFilterHighPass *pThis;       ///< the filter
00262    };
00263 };
00264 
00265 /// @} cfl_filterffthighpass
00266 
00267 /**
00268  * the cut off.
00269  */
00270 
00271 inline CScanFilterHighPass::RealType CScanFilterHighPass::GetCutOff() const
00272 {
00273    return m_dCutOff;
00274 }
00275 
00276 /**
00277  * the soft edge.
00278  */
00279 inline CScanFilterHighPass::RealType CScanFilterHighPass::GetSoftEdge() const
00280 {
00281    return m_dSoftEdge;
00282 }
00283 
00284 /**
00285  * set the cut off.
00286  */
00287 inline void CScanFilterHighPass::SetCutOff( RealType cutOff )
00288 {
00289    m_dCutOff = cutOff;
00290 }
00291 
00292 /**
00293  * set the soft edge.
00294  */
00295 inline void CScanFilterHighPass::SetSoftEdge( RealType softEdge )
00296 {
00297    m_dSoftEdge = softEdge;
00298 }
00299 
00300 #endif // CFL_SCANFILTERHIGHPASS_H
00301 
00302 /*
00303  * end of file
00304  */
00305 

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