Filter Library Camera Interface Physics

ScanFilterRank.h

00001 /*
00002  * ScanFilterRank.h - rank image 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-2006, Leiden Probe Microscopy.
00008  * Copyright (C) 2004-2006, Universiteit Leiden.
00009  *
00010  * Authors: Martin J. Moene
00011  *
00012  * $Id: ScanFilterRank.h 363 2006-03-09 13:21:27Z moene $
00013  */
00014 
00015 #ifndef CFL_SCANFILTERRANK_H
00016 #define CFL_SCANFILTERRANK_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_filterminimum Rank Filter
00027  * \brief rank base filter.
00028  * @{
00029  */
00030 
00031 DECLARE_CLASS( CScanFilterRank );         // create various types
00032 
00033 /**
00034  * \brief base class for ranking filters (mean, median, minimum, maximum).
00035  *
00036  */
00037 class CScanFilterRank : public CScanFilter
00038 {
00039    /**
00040     * its dialog class.
00041     */
00042    friend class CFilterDlg_Rank;
00043 
00044 public:
00045    /**
00046     * the value type.
00047     */
00048    typedef CScanBaseBuffer::ValueType ValueType;
00049 
00050    /**
00051     * the point type.
00052     */
00053    typedef CPoint DiffType;
00054 
00055    /**
00056     * the point element type.
00057     */
00058    typedef int DiffElementType;
00059 
00060    ///
00061    /// \name Construction
00062    /// @{
00063 
00064    /**
00065     * default constructor: setup filter to run without dialog;
00066     * see also CScanFilterNull::CScanFilterNull().
00067     */
00068    CScanFilterRank();
00069 
00070    /**
00071     * destructor.
00072     */
00073    virtual ~CScanFilterRank();
00074 
00075    /// @}
00076    /// \name Camera--Filter Interface
00077    /// @{
00078 
00079 //    /**
00080 //     * no partial data.
00081 //     */
00082 //   virtual BOOL CanDoPartialData() const;
00083 // 
00084 //    /**
00085 //     * has dialog (default true).
00086 //     */
00087 //    virtual BOOL CanDoDialogEntry() const;
00088 
00089    /**
00090     * \brief configure filter with settings as provided by the application on the
00091     * filterlist window (e.g. via registry); see also CScanFilterNull::ReadFilterSettings().
00092     */
00093    virtual void ReadFilterSettings( );
00094 
00095    /**
00096     * \brief save filter settings e.g. for use with the filterlist window (e.g. via registry);
00097     * see also ReadFilterSettings().
00098     */
00099    virtual void WriteFilterSettings( ) const;
00100 
00101    /**
00102     * provide current filter parameter(s) for filter-scripting capture
00103     * in the main application;
00104     * see also CScanFilterNull::GetParameters().
00105     */
00106    virtual LPCTSTR GetParameters() const;
00107 
00108    /**
00109     * set parameters for filter-script execution of filter;
00110     * see also CScanFilterNull::SetParameters().
00111     */
00112    virtual BOOL SetParameters( LPCTSTR lpParameters );
00113 
00114 //    /**
00115 //     * the supported dragmethod(s).
00116 //     */
00117 //    virtual DragSupportType SupportDragInput() const;
00118 //
00119 //    /**
00120 //     * apply the filter to the selected area.
00121 //     */
00122 //    virtual void SetDragInput( BOOL bL2R, CRect rcIn );
00123 //
00124 //    /**
00125 //     * start filter dialog to edit parameters; no filter operations;
00126 //     * see also CScanFilterNull::EditModeless().
00127 //     */
00128 //    virtual BOOL EditModeless( CWnd *pParentWnd );
00129 
00130    /**
00131     * create filter dialog and pre Apply() filter to view result;
00132     * see also CScanFilterNull::RunModeless().
00133     */
00134    virtual BOOL RunModeless( CWnd *pParentWnd, CDocument *pDoc );
00135 
00136    /**
00137     * check parameters, take care of a properly sized output buffer,
00138     * set its name and copy filter parameters and process;
00139     * see also CScanFilterNull::Apply().
00140     */
00141    virtual BOOL Apply();
00142 
00143    /// @}
00144    /// \name Predicates
00145    /// @{
00146 
00147    /// @}
00148    /// \name Accessors
00149    /// @{
00150 
00151    /**
00152     * number of columns in image.
00153     */
00154    int Columns() const;
00155 
00156    /**
00157     * number of columns in image.
00158     */
00159    int Rows() const;
00160 
00161    /**
00162     * the current size.
00163     */
00164    DiffType GetSize() const;
00165 
00166    /**
00167     * the current x-size.
00168     */
00169    DiffElementType GetSizeX() const;
00170 
00171    /**
00172     * the current y-size.
00173     */
00174    DiffElementType GetSizeY() const;
00175 
00176    /// @}
00177    /// \name Mutators
00178    /// @{
00179 
00180    /**
00181     * set the size.
00182     */
00183    void SetSize( CScanFilterRank::DiffType size );
00184 
00185    /**
00186     * set the x-size.
00187     */
00188    void SetSizeX( DiffElementType x );
00189 
00190    /**
00191     * set the x-size.
00192     */
00193    void SetSizeY( DiffElementType y );
00194 
00195    /// @}
00196 
00197 protected:
00198    /**
00199     * store or retrieve the object's settings; see also CScanFilterNull::Serialize().
00200     */
00201    virtual void Serialize(CArchive& ar);
00202    DECLARE_SERIAL(CScanFilterRank)    // in derived classes
00203    
00204    /**
00205     * the filter name.
00206     */
00207    virtual const char* GetFilterName() const
00208    {
00209       return "Rank";
00210    }
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 new X-size.
00225     */
00226    static const DiffElementType def_nSizeX;
00227 
00228    /**
00229     * the default new Y-size.
00230     */
00231    static const DiffElementType def_nSizeY;
00232 
00233 protected:
00234    /**
00235     * the area size.
00236     */
00237    DiffType m_cpSize;
00238 };
00239 
00240 /// @} cfl_filterminimum
00241 
00242 /*
00243  * number of columns in image.
00244  */
00245 inline int CScanFilterRank::Columns() const
00246 {
00247    return m_lpsbIn->Columns();
00248 }
00249 
00250 /*
00251  * number of columns in image.
00252  */
00253 inline int CScanFilterRank::Rows() const
00254 {
00255    return m_lpsbIn->Rows();
00256 }
00257 
00258 /**
00259  * the current size.
00260  */
00261 inline CScanFilterRank::DiffType CScanFilterRank::GetSize() const
00262 {
00263    return m_cpSize;
00264 }
00265 
00266 /*
00267  * the current x-size.
00268  */
00269 inline CScanFilterRank::DiffElementType CScanFilterRank::GetSizeX() const
00270 {
00271    return m_cpSize.x;
00272 }
00273 
00274 /*
00275  * the current y-size.
00276  */
00277 inline CScanFilterRank::DiffElementType CScanFilterRank::GetSizeY() const
00278 {
00279    return m_cpSize.y;
00280 }
00281 
00282 /*
00283  * set area size.
00284  */
00285 inline void CScanFilterRank::SetSize( CScanFilterRank::DiffType size )
00286 {
00287    m_cpSize = size;
00288 }
00289 
00290 /*
00291  * set the x-size.
00292  */
00293 inline void CScanFilterRank::SetSizeX( DiffElementType x )
00294 {
00295    m_cpSize.x = x;
00296 }
00297 
00298 /*
00299  * set the y-size.
00300  */
00301 inline void CScanFilterRank::SetSizeY( DiffElementType y )
00302 {
00303    m_cpSize.y = y;
00304 }
00305 
00306 #endif // CFL_SCANFILTERRANK_H
00307 
00308 /*
00309  * end of file
00310  */
00311 

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