Filter Library | Camera | Interface Physics |
00001 /* 00002 * ScanFilterDifferential.h - frame by frame differentiation. 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: ScanFilterDifferential.h 202 2005-05-12 11:00:48Z moene $ 00013 */ 00014 00015 #ifndef CFL_SCANFILTERDIFFERENTIAL_H 00016 #define CFL_SCANFILTERDIFFERENTIAL_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_filterdifferential Frame by Frame Differential Filter 00027 * \brief frame by frame differential filter. 00028 * 00029 00030 <h3>Purpose</h3> 00031 00032 Differentiate one frame at a time. 00033 00034 <h3>Description</h3> 00035 00036 This filter differentiates one frame at a time. It uses two neihgbor 00037 pixels in the x-direction and two neihgbor pixels in the y-direction to 00038 calculate the delta at each position. 00039 00040 In addition to this an angle \f$alpha\f$ is used to weigh the direction of 00041 differentiation in the x- and y-direction. This makes the "light source" to 00042 appear fom a certain direction. 00043 00044 <h3>Algorithm</h3> 00045 00046 \f{eqnarray*} 00047 \textrm{B}{ij} & = & \textrm{cos}\ \alpha\ ( \textrm{A}{ij_{+1}} - \textrm{A}{ij_{-1}} )\ /\ 2 \\ 00048 & + & \textrm{sin}\ \alpha\ ( \textrm{A}{i_{+1}j} - \textrm{A}{i_{-1}j} )\ /\ 2 00049 \f} 00050 00051 <h3>Examples</h3> 00052 Try to find some interesting pictures for most filters. 00053 00054 <h3>Contact</h3> 00055 Dipl.phys. M.J. Rost<br> 00056 Huygens Laboratorium<br> 00057 Universiteit Leiden<br> 00058 Niels Bohrweg 2<br> 00059 2333 CA Leiden, The Netherlands<br> 00060 <br> 00061 Tel: +31 71 5275600<br> 00062 Fax: +31 71 5275404<br> 00063 <br> 00064 E-mail: rost@physics.LeidenUniv.nl<br> 00065 Web: http://www.geocities.com/marcel_rost/<br> 00066 00067 * 00068 * @{ 00069 */ 00070 00071 DECLARE_CLASS( CScanFilterDifferential ); // create various types 00072 00073 /** 00074 * \brief frame-by-frame differential filter. 00075 * 00076 */ 00077 class CScanFilterDifferential : public CScanFilter 00078 { 00079 friend class CFilterDlg_Differential; 00080 00081 public: 00082 /** 00083 * the value type. 00084 */ 00085 typedef CScanBaseBuffer::ValueType ValueType; 00086 00087 /** 00088 * the parent class. 00089 */ 00090 typedef CScanFilter Super; 00091 00092 /// 00093 /// \name Construction 00094 /// @{ 00095 00096 /** 00097 * default constructor. 00098 */ 00099 CScanFilterDifferential(); 00100 00101 /** 00102 * destructor. 00103 */ 00104 virtual ~CScanFilterDifferential(); 00105 00106 /// @} 00107 /// \name Camera--Filter Interface 00108 /// @{ 00109 00110 /** 00111 * \brief configure filter with settings as provided by the application on the 00112 * filterlist window (e.g. via registry); see also CScanFilterNull::ReadFilterSettings(). 00113 */ 00114 virtual void ReadFilterSettings( ); 00115 00116 /** 00117 * \brief save filter settings e.g. for use with the filterlist window (e.g. via registry); 00118 * see also ReadFilterSettings(). 00119 */ 00120 virtual void WriteFilterSettings( ) const; 00121 00122 /** 00123 * provide current filter parameter(s) for filter-scripting capture 00124 * in the main application; 00125 * see also CScanFilterNull::GetParameters(). 00126 */ 00127 virtual LPCTSTR GetParameters() const; 00128 00129 /** 00130 * set parameters for filter-script execution of filter; 00131 * see also CScanFilterNull::SetParameters(). 00132 */ 00133 virtual BOOL SetParameters( LPCTSTR lpParameters ); 00134 00135 /** 00136 * start filter dialog to edit parameters; no filter operations; 00137 * see also CScanFilterNull::EditModeless(). 00138 */ 00139 virtual BOOL EditModeless( CWnd *pParentWnd ); 00140 00141 /** 00142 * create filter dialog and pre Apply() filter to view result; 00143 * see also CScanFilterNull::RunModeless(). 00144 */ 00145 virtual BOOL RunModeless( CWnd *pParentWnd, CDocument *pDoc ); 00146 00147 /** 00148 * check parameters, take care of a properly sized output buffer, 00149 * set its name and copy filter parameters and process; 00150 * see also CScanFilterNull::ApplyCore(). 00151 */ 00152 virtual BOOL Apply(); 00153 00154 /// @} 00155 /// \name Predicates 00156 /// @{ 00157 00158 /// @} 00159 /// \name Accessors 00160 /// @{ 00161 00162 /// @} 00163 /// \name Mutators 00164 /// @{ 00165 00166 /// @} 00167 00168 public: 00169 /** 00170 * the filter name. 00171 */ 00172 static LPCTSTR m_lpcsFilterName; 00173 00174 /** 00175 * the class short filtername. 00176 */ 00177 static LPCTSTR m_lpcsShortFilterName; 00178 00179 /** 00180 * the default angle for differentiation. 00181 */ 00182 static const int def_nAngle; 00183 00184 protected: 00185 /** 00186 * store or retrieve the object's settings. 00187 */ 00188 virtual void Serialize( CArchive& ar ); 00189 DECLARE_SERIAL( CScanFilterDifferential ) 00190 00191 /** 00192 * differentiate the frame part at the given offset (L2R, R2L frame part). 00193 */ 00194 void Differentiate( DWORD dwOffset ); 00195 00196 protected: 00197 /** 00198 * the current angle for differentiation. 00199 */ 00200 int m_nAngle; 00201 }; 00202 00203 /// @} cfl_filterdifferential 00204 00205 #endif // CFL_SCANFILTERDIFFERENTIAL_H 00206 00207 /* 00208 * end of file 00209 */ 00210