Filter Library Camera Interface Physics

ScanFilterDZ.h

00001 /*
00002  * ScanFilterDZ.h - scaled add 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: Els van Tol (original), Martin J. Moene
00011  *
00012  * $Id: ScanFilterDZ.h 359 2006-03-06 15:52:00Z moene $
00013  */
00014 
00015 #ifndef CFL_SCANFILTERDZ_H
00016 #define CFL_SCANFILTERDZ_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_filterdz Add Scaled Buffer and Offset
00027  * \brief add scaled buffer and offset.
00028  *
00029 
00030 <h3>Purpose</h3>
00031 
00032 Combine original image with delta-Z information.
00033 
00034 <h3>Description</h3>
00035 
00036 For some (fast) measurements it is useful to construct an image that is a
00037 combination of the original image and the delta-Z signal.
00038 
00039 delta-Z can be derived from the delta-I which is obtained after log-conversion.
00040 To convert from delta-I to delta-Z, a conversion factor must be applied. To 
00041 compensate for a possible constant current, a offset value must be applied.
00042 
00043 Thus the delta-Z values can be obtained from scaled and shifted delta-I values.
00044 
00045 <h3>Algorithm</h3>
00046 
00047 
00048 \f[
00049    \textrm{C} = \textrm{A} + a \times \textrm{B} + b
00050 \f]
00051 
00052 <h3>Examples</h3>
00053 Try to find some interesting pictures for most filters.
00054 
00055 <h3>Contact</h3>
00056 Dipl.phys. M.J. Rost<br>
00057 Huygens Laboratorium<br>
00058 Universiteit Leiden<br>
00059 Niels Bohrweg 2<br>
00060 2333 CA Leiden, The Netherlands<br>
00061 <br>
00062 Tel: +31 71 5275600<br>
00063 Fax: +31 71 5275404<br>
00064 <br>
00065 E-mail: rost@physics.LeidenUniv.nl<br>
00066 Web: http://www.geocities.com/marcel_rost/<br>
00067 
00068  *
00069  * @{
00070  */
00071 
00072 DECLARE_CLASS( CScanFilterDZ );         // create various types
00073 
00074 /**
00075  * \brief frame-by-frame differential filter.
00076  *
00077  */
00078 class CScanFilterDZ : public CScanFilter
00079 {
00080    /**
00081     * its dialog class.
00082     */
00083    friend class CFilterDlg_DZ;
00084 
00085 public:
00086    /**
00087     * the value type.
00088     */
00089    typedef CScanBaseBuffer::ValueType ValueType;
00090 
00091    /**
00092     * the pointer type.
00093     */
00094    typedef ValueType* Pointer;
00095 
00096    /**
00097     * the const pointer type.
00098     */
00099    typedef const ValueType* ConstPointer;
00100 
00101    /**
00102     * the size type.
00103     */
00104    typedef CSize SizeType;
00105 
00106    /**
00107     * the size element type.
00108     */
00109    typedef DWORD SizeElementType;
00110 
00111    ///
00112    /// \name Construction
00113    /// @{
00114 
00115    /**
00116     * default constructor.
00117     */
00118    CScanFilterDZ();
00119 
00120    /**
00121     * destructor.
00122     */
00123    virtual ~CScanFilterDZ();
00124 
00125    /// @}
00126    /// \name Camera--Filter Interface
00127    /// @{
00128 
00129    /**
00130     * \brief configure filter with settings as provided by the application on the
00131     * filterlist window (e.g. via registry); see also CScanFilterNull::ReadFilterSettings().
00132     */
00133    virtual void ReadFilterSettings( );
00134 
00135    /**
00136     * \brief save filter settings e.g. for use with the filterlist window (e.g. via registry);
00137     * see also ReadFilterSettings().
00138     */
00139    virtual void WriteFilterSettings( ) const;
00140 
00141    /**
00142     * provide current filter parameter(s) for filter-scripting capture
00143     * in the main application;
00144     * see also CScanFilterNull::GetParameters().
00145     */
00146    virtual LPCTSTR GetParameters() const;
00147 
00148    /**
00149     * set parameters for filter-script execution of filter;
00150     * see also CScanFilterNull::SetParameters().
00151     */
00152    virtual BOOL SetParameters( LPCTSTR lpParameters );
00153 
00154    /**
00155     * start filter dialog to edit parameters; no filter operations;
00156     * see also CScanFilterNull::EditModeless().
00157     */
00158    virtual BOOL EditModeless( CWnd *pParentWnd );
00159 
00160    /**
00161     * create filter dialog and pre Apply() filter to view result;
00162     * see also CScanFilterNull::RunModeless().
00163     */
00164    virtual BOOL RunModeless( CWnd *pParentWnd, CDocument *pDoc );
00165 
00166    /**
00167     * check parameters, take care of a properly sized output buffer,
00168     * set its name and copy filter parameters and process;
00169     * see also CScanFilterNull::ApplyCore().
00170     */
00171    virtual BOOL Apply();
00172 
00173    /**
00174     * the number of input buffers is 2.
00175     */
00176    virtual DWORD GetNrOfInBuffers() const;
00177 
00178    /**
00179     * the requested input buffer.
00180     */
00181    virtual CScanBaseBuffer* GetInputBuffer( UINT nNr );
00182 
00183    /**
00184     * set the given input buffer.
00185     */
00186    virtual void SetInputBuffer( UINT nNr, CScanBaseBuffer *lpsbIn );
00187 
00188    /// @}
00189    /// \name Predicates
00190    /// @{
00191 
00192    /// @}
00193    /// \name Accessors
00194    /// @{
00195 
00196    /**
00197     * the current factor.
00198     */
00199    double GetFactor() const;
00200 
00201    /**
00202     * the current offset.
00203     */
00204    double GetOffset() const;
00205 
00206    /// @}
00207    /// \name Mutators
00208    /// @{
00209 
00210    /**
00211     * set the factor.
00212     */
00213    void SetFactor( double factor );
00214 
00215    /**
00216     * set the offset.
00217     */
00218    void SetOffset( double offset );
00219 
00220    /// @}
00221 
00222 protected:
00223    /**
00224     * store or retrieve the object's settings.
00225     */
00226    virtual void Serialize( CArchive& ar );
00227    DECLARE_SERIAL( CScanFilterDZ )
00228 
00229    /**
00230     * process the given frame part (L2R, R2L frame part).
00231     */
00232    void Process( ConstPointer in1, ConstPointer end1, ConstPointer in2, Pointer out );
00233 
00234    /**
00235     * process the given frame part (L2R, R2L frame part).
00236     */
00237 //   void Math( BOOL bDoR2L );
00238 
00239 public:
00240    /**
00241     * the filter name.
00242     */
00243    static LPCTSTR m_lpcsFilterName;
00244 
00245    /**
00246     * the class short filtername.
00247     */
00248    static LPCTSTR m_lpcsShortFilterName;
00249 
00250    /**
00251     * the default factor.
00252     */
00253    static const double def_dFactor;
00254 
00255    /**
00256     * the default offset.
00257     */
00258    static const double def_dOffset;
00259 
00260 protected:
00261    /**
00262     * the second input buffer.
00263     */
00264    CScanBaseBuffer *m_lpsbIn2;
00265 
00266    /**
00267     * the filter offset value.
00268     */
00269    double m_dOffset;
00270 
00271    /**
00272     * the filter multiplication value
00273     */
00274    double m_dFactor;
00275 
00276 };
00277 
00278 /// @}  cfl_filterdz
00279 
00280 /**
00281  * the current factor.
00282  */
00283 inline double CScanFilterDZ::GetFactor() const
00284 {
00285    return m_dFactor;
00286 }
00287 
00288 /**
00289  * set the factor.
00290  */
00291 inline void CScanFilterDZ::SetFactor( double factor )
00292 {
00293    m_dFactor = factor;
00294 }
00295 
00296 /**
00297  * the current offset.
00298  */
00299 inline double CScanFilterDZ::GetOffset() const
00300 {
00301    return m_dOffset;
00302 }
00303 
00304 /**
00305  * set the offset.
00306  */
00307 inline void CScanFilterDZ::SetOffset( double offset )
00308 {
00309    m_dOffset = offset;
00310 }
00311 
00312 #endif // CFL_SCANFILTERDZ_H
00313 
00314 /*
00315  * end of file
00316  */
00317 

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