Filter Library Camera Interface Physics

ScanFilterShift.h

00001 /*
00002  * CScanFilterShift.h - shift 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: M. Seynen (original), Martin J. Moene
00011  *
00012  * $Id: ScanFilterShift.h 350 2006-03-02 08:18:37Z moene $
00013  */
00014 
00015 #ifndef CFL_SCANFILTERSHIFT_H
00016 #define CFL_SCANFILTERSHIFT_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_filtershift Shift Filter
00027  * \brief shift filter.
00028  *
00029 
00030 <h3>Purpose</h3>
00031 
00032 Shift the image within an area.
00033 
00034 <h3>Description</h3>
00035 
00036 The shift filter enables you to shift the image within the its area.
00037 
00038 <h3>Algorithm</h3>
00039 
00040 
00041 \f[
00042    \textrm{B} = \textrm{A}
00043 \f]
00044 
00045 <h3>Examples</h3>
00046 Try to find some interesting pictures for most filters.
00047 
00048 <h3>Contact</h3>
00049 Dipl.phys. M.J. Rost<br>
00050 Huygens Laboratorium<br>
00051 Universiteit Leiden<br>
00052 Niels Bohrweg 2<br>
00053 2333 CA Leiden, The Netherlands<br>
00054 <br>
00055 Tel: +31 71 5275600<br>
00056 Fax: +31 71 5275404<br>
00057 <br>
00058 E-mail: rost@physics.LeidenUniv.nl<br>
00059 Web: http://www.geocities.com/marcel_rost/<br>
00060 
00061  *
00062  * @{
00063  */
00064 
00065 DECLARE_CLASS( CScanFilterShift );   // declare various types for class
00066 
00067 /**
00068  * \brief shift filter.
00069  *
00070  */
00071 class CScanFilterShift : public CScanFilter
00072 {
00073    /**
00074     * its dialog class.
00075     */
00076    friend class CFilterDlg_Shift;
00077 
00078 public:
00079    /**
00080     * the value type.
00081     */
00082    typedef CScanBaseBuffer::ValueType ValueType;
00083 
00084    /**
00085     * the point type.
00086     */
00087    typedef CPoint DiffType;
00088 
00089    /**
00090     * the point element type.
00091     */
00092    typedef int DiffElementType;
00093 
00094    ///
00095    /// \name Construction
00096    /// @{
00097 
00098    /**
00099     * default constructor.
00100     */
00101    CScanFilterShift();
00102 
00103    /**
00104     * destructor.
00105     */
00106    virtual ~CScanFilterShift();
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 pre Apply() filter to view result;
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     * the supported dragmethod(s).
00158     */
00159    virtual DragSupportType SupportDragInput() const;
00160 
00161    /**
00162     * apply the filter to the selected area.
00163     */
00164    void SetDragInput( BOOL bL2R, CRect rcIn );
00165 
00166    /// @}
00167    /// \name Predicates
00168    /// @{
00169 
00170    /// @}
00171    /// \name Accessors
00172    /// @{
00173 
00174    /**
00175     * the current shift.
00176     */
00177    DiffType GetShift() const;
00178 
00179    /**
00180     * the current x-shift.
00181     */
00182    DiffElementType GetShiftX() const;
00183 
00184    /**
00185     * the current y-shift.
00186     */
00187    DiffElementType GetShiftY() const;
00188 
00189    /// @}
00190    /// \name Mutators
00191    /// @{
00192 
00193    /**
00194     * set the x-shift.
00195     */
00196    void SetShiftX( DiffElementType x );
00197 
00198    /**
00199     * set the x-shift.
00200     */
00201    void SetShiftY( DiffElementType y );
00202 
00203    /// @}
00204 
00205 public:
00206    /**
00207     * the filter name.
00208     */
00209    static LPCTSTR m_lpcsFilterName;
00210 
00211    /**
00212     * the class short filtername.
00213     */
00214    static LPCTSTR m_lpcsShortFilterName;
00215 
00216    /**
00217     * the default new X-size.
00218     */
00219    static const DiffElementType def_nShiftX;
00220 
00221    /**
00222     * the default new Y-size.
00223     */
00224    static const DiffElementType def_nShiftY;
00225 
00226 protected:
00227    /**
00228     * store or retrieve the object's settings.
00229     */
00230    virtual void Serialize( CArchive& ar );
00231    DECLARE_SERIAL( CScanFilterShift )
00232 
00233    /**
00234     * process the given frame part (L2R, R2L frame part).
00235     */
00236    void Shift( BOOL bDoR2L );
00237 
00238 protected:
00239    /**
00240     * the shift.
00241     */
00242    DiffType m_cpShift;
00243 };
00244 
00245 /// @} cfl_filtershift
00246 
00247 /**
00248  * the current shift.
00249  */
00250 inline CScanFilterShift::DiffType CScanFilterShift::GetShift() const
00251 {
00252    return m_cpShift;
00253 }
00254 
00255 /*
00256  * the current x-location.
00257  */
00258 inline CScanFilterShift::DiffElementType CScanFilterShift::GetShiftX() const
00259 {
00260    return m_cpShift.x;
00261 }
00262 
00263 /*
00264  * the current y-location.
00265  */
00266 inline CScanFilterShift::DiffElementType CScanFilterShift::GetShiftY() const
00267 {
00268    return m_cpShift.y;
00269 }
00270 
00271 /*
00272  * set the x-location.
00273  */
00274 inline void CScanFilterShift::SetShiftX( DiffElementType dx )
00275 {
00276    m_cpShift.x = dx;
00277 }
00278 
00279 /*
00280  * set the x-location.
00281  */
00282 inline void CScanFilterShift::SetShiftY( DiffElementType dy )
00283 {
00284    m_cpShift.y = dy;
00285 }
00286 
00287 #endif // CFL_SCANFILTERSHIFT_H
00288 
00289 /*
00290  * end of file
00291  */
00292 

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