Filter Library Camera Interface Physics

ScanFilterNCCFFTOld.h

00001 /*
00002  * ScanFilterNCCFFTOld.h - fast normalized cross-correlation filter.
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: Martin J. Moene
00011  *
00012  * $Id: ScanFilterNCCFFTOld.h 458 2007-01-04 15:20:34Z moene $
00013  */
00014 
00015 #ifndef CFL_SCANFILTERNCCFFT_H
00016 #define CFL_SCANFILTERNCCFFT_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 
00025 /**
00026  * \addtogroup cfl_filtermean Boxcar Filter
00027  * \brief mean filter.
00028  *
00029 
00030 <h3>Purpose</h3>
00031 
00032 <h3>Description</h3>
00033 
00034 <h3>Algorithm</h3>
00035 
00036 
00037 \f[
00038    \textrm{B} = \textrm{A}
00039 \f]
00040 
00041 <h3>Examples</h3>
00042 Try to find some interesting pictures for most filters.
00043 
00044 <h3>Contact</h3>
00045 Dipl.phys. M.J. Rost<br>
00046 Huygens Laboratorium<br>
00047 Universiteit Leiden<br>
00048 Niels Bohrweg 2<br>
00049 2333 CA Leiden, The Netherlands<br>
00050 <br>
00051 Tel: +31 71 5275600<br>
00052 Fax: +31 71 5275404<br>
00053 <br>
00054 E-mail: rost@physics.LeidenUniv.nl<br>
00055 Web: http://www.geocities.com/marcel_rost/<br>
00056 
00057  *
00058  * @{
00059  */
00060 
00061 DECLARE_CLASS( CScanFilterNCCFFTOld );         // create various types
00062 
00063 /**
00064  * \brief mean filter.
00065  *
00066  */
00067 class CScanFilterNCCFFTOld : public CScanFilter
00068 {
00069    /**
00070     * its dialog class.
00071     */
00072    friend class CFilterDlg_NCCFFTOld;
00073 
00074 public:
00075    /**
00076     * the value type.
00077     */
00078    typedef CScanBaseBuffer::ValueType ValueType;
00079 
00080    /**
00081     * the input pixel type.
00082     */
00083    typedef ValueType InputPixelType;
00084 
00085    /**
00086     * the output pixel type.
00087     */
00088    typedef ValueType OutputPixelType;
00089 
00090    /**
00091     * normalization type.
00092     */
00093    enum NormalizationType
00094    {
00095       nmNone,                   ///< none
00096       nmNormal,                 ///< normal
00097       nmPhase,                  ///< phase
00098       nmDimension_,             ///< the number of entries
00099    };
00100 
00101    /**
00102     * normalization sub-type.
00103     */
00104    enum NormalizationSubType
00105    {
00106       nsZeroMean,               ///< zero-mean
00107       nsEnergy,                 ///< energy
00108       nsPlanar,                 ///< planer bg subtr for image-under-template
00109    };
00110 
00111    /**
00112     * the scale type.
00113     */
00114    typedef double ScaleType;
00115 
00116    ///
00117    /// \name Construction
00118    /// @{
00119 
00120    /**
00121     * default constructor: setup filter to run without dialog;
00122     * see also CScanFilterNull::CScanFilterNull().
00123     */
00124    CScanFilterNCCFFTOld();
00125 
00126    /**
00127     * destructor.
00128     */
00129    virtual ~CScanFilterNCCFFTOld();
00130 
00131    /// @}
00132    /// \name Camera--Filter Interface
00133    /// @{
00134 
00135 //    /**
00136 //     * no partial data.
00137 //     */
00138 //   virtual BOOL CanDoPartialData() const;
00139 //
00140 //    /**
00141 //     * has dialog (default true).
00142 //     */
00143 //    virtual BOOL CanDoDialogEntry() const;
00144 
00145    /**
00146     * \brief configure filter with settings as provided by the application on the
00147     * filterlist window (e.g. via registry); see also CScanFilterNull::ReadFilterSettings().
00148     */
00149    virtual void ReadFilterSettings( );
00150 
00151    /**
00152     * \brief save filter settings e.g. for use with the filterlist window (e.g. via registry);
00153     * see also ReadFilterSettings().
00154     */
00155    virtual void WriteFilterSettings( ) const;
00156 
00157    /**
00158     * provide current filter parameter(s) for filter-scripting capture
00159     * in the main application;
00160     * see also CScanFilterNull::GetParameters().
00161     */
00162    virtual LPCTSTR GetParameters() const;
00163 
00164    /**
00165     * set parameters for filter-script execution of filter;
00166     * see also CScanFilterNull::SetParameters().
00167     */
00168    virtual BOOL SetParameters( LPCTSTR lpParameters );
00169 
00170 //    /**
00171 //     * the supported dragmethod(s).
00172 //     */
00173 //    virtual DragSupportType SupportDragInput() const;
00174 //
00175 //    /**
00176 //     * apply the filter to the selected area.
00177 //     */
00178 //    virtual void SetDragInput( BOOL bL2R, CRect rcIn );
00179 //
00180 //    /**
00181 //     * start filter dialog to edit parameters; no filter operations;
00182 //     * see also CScanFilterNull::EditModeless().
00183 //     */
00184 //    virtual BOOL EditModeless( CWnd *pParentWnd );
00185 
00186    /**
00187     * create filter dialog and pre Apply() filter to view result;
00188     * see also CScanFilterNull::RunModeless().
00189     */
00190    virtual BOOL RunModeless( CWnd *pParentWnd, CDocument *pDoc );
00191 
00192    /**
00193     * check parameters, take care of a properly sized output buffer,
00194     * set its name and copy filter parameters and process;
00195     * see also CScanFilterNull::Apply().
00196     */
00197    virtual BOOL Apply();
00198 
00199    /**
00200     * the number of input buffers is 2.
00201     */
00202    virtual DWORD GetNrOfInBuffers() const;
00203 
00204    /**
00205     * the requested input buffer.
00206     */
00207    virtual CScanBaseBuffer* GetInputBuffer( UINT nNr );
00208 
00209    /**
00210     * set the given input buffer.
00211     */
00212    virtual void SetInputBuffer( UINT nNr, CScanBaseBuffer *lpsbIn );
00213 
00214    /// @}
00215    /// \name Predicates
00216    /// @{
00217 
00218    /**
00219     * true if the FFT size has been relaxed (allow overlap).
00220     */
00221    bool DoRelaxFFTSize() const
00222    {
00223       return m_relax_fft_size;
00224    }
00225 
00226    /// @}
00227    /// \name Accessors
00228    /// @{
00229 
00230    /**
00231     * the normalization type.
00232     */
00233    NormalizationType GetNormalizationType() const
00234    {
00235       return m_norm;
00236    }
00237 
00238    /**
00239     * the normalization sub-type.
00240     */
00241    NormalizationSubType GetNormalizationSubType() const
00242    {
00243       return m_normsub;
00244    }
00245 
00246    /**
00247     * the scale factor.
00248     */
00249    ScaleType GetScale( NormalizationType type ) const
00250    {
00251 //       return m_scale;
00252       return m_scale[ type ];
00253    }
00254 
00255    /// @}
00256    /// \name Mutators
00257    /// @{
00258 
00259    /**
00260     * set the normalization type.
00261     */
00262    void SetNormalizationType( NormalizationType norm )
00263    {
00264       m_norm = norm;
00265    }
00266 
00267    /**
00268     * set the normalization sub-type.
00269     */
00270    void SetNormalizationSubType( NormalizationSubType normsub )
00271    {
00272       m_normsub = normsub;
00273    }
00274 
00275    /**
00276     * relax the FFT image size and allow overlap in the transformation.
00277     */
00278    void SetRelaxFFTSize( bool relax_fft_size )
00279    {
00280       m_relax_fft_size = relax_fft_size;
00281    }
00282 
00283    /**
00284     * set the scale factor.
00285     */
00286    void SetScale( NormalizationType type, ScaleType scale )
00287    {
00288       m_scale[ type ] = scale;
00289    }
00290 
00291     /// @}
00292 
00293 protected:
00294    /**
00295     * store or retrieve the object's settings; see also CScanFilterNull::Serialize().
00296     */
00297    virtual void Serialize(CArchive& ar);
00298    DECLARE_SERIAL(CScanFilterNCCFFTOld)
00299 
00300 public:
00301    /**
00302     * the filter name.
00303     */
00304    static LPCTSTR m_lpcsFilterName;
00305 
00306    /**
00307     * the class short filtername.
00308     */
00309    static LPCTSTR m_lpcsShortFilterName;
00310 
00311    /**
00312     * the default scale factor.
00313     */
00314    static const ScaleType m_defScale;
00315 
00316 protected:
00317    /**
00318     * the second input buffer.
00319     */
00320    CScanBaseBuffer *m_lpsbIn2;
00321 
00322    /**
00323     * the normalization type.
00324     */
00325    NormalizationType m_norm;
00326 
00327    /**
00328     * the normalization sub-type.
00329     */
00330    NormalizationSubType m_normsub;
00331 
00332    /**
00333     * use minimal FFT size.
00334     */
00335    bool m_relax_fft_size;
00336 
00337    /**
00338     * the scale factors (one for each normalization type).
00339     */
00340    ScaleType m_scale[ nmDimension_ ];
00341 };
00342 
00343 /// @} cfl_filtermean
00344 
00345 #endif // CFL_SCANFILTERNCCFFT_H
00346 
00347 /*
00348  * end of file
00349  */
00350 

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