Filter Library Camera Interface Physics

ScanFilterThreshold.h

00001 /*
00002  * ScanFilterThreshold.h - threshold 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: ScanFilterThreshold.h 356 2006-03-06 10:46:16Z moene $
00013  */
00014 
00015 #ifndef CFL_SCANFILTERTHRESHOLD_H
00016 #define CFL_SCANFILTERTHRESHOLD_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( CScanFilterThreshold );         // create various types
00062 
00063 /**
00064  * \brief mean filter.
00065  *
00066  */
00067 class CScanFilterThreshold : public CScanFilter
00068 {
00069    /**
00070     * its dialog class.
00071     */
00072    friend class CFilterDlg_Threshold;
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     * threshold mode.
00092     */
00093    enum ThresholdMode
00094    {
00095       tmBelow,                  ///< threshold below
00096       tmAbove,                  ///< threshold above
00097       tmOutside,                ///< threshold outside
00098    };
00099 
00100    ///
00101    /// \name Construction
00102    /// @{
00103 
00104    /**
00105     * default constructor: setup filter to run without dialog;
00106     * see also CScanFilterNull::CScanFilterNull().
00107     */
00108    CScanFilterThreshold();
00109 
00110    /**
00111     * destructor.
00112     */
00113    virtual ~CScanFilterThreshold();
00114 
00115    /// @}
00116    /// \name Camera--Filter Interface
00117    /// @{
00118 
00119 //    /**
00120 //     * no partial data.
00121 //     */
00122 //   virtual BOOL CanDoPartialData() const;
00123 // 
00124 //    /**
00125 //     * has dialog (default true).
00126 //     */
00127 //    virtual BOOL CanDoDialogEntry() const;
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 //     * the supported dragmethod(s).
00156 //     */
00157 //    virtual DragSupportType SupportDragInput() const;
00158 //
00159 //    /**
00160 //     * apply the filter to the selected area.
00161 //     */
00162 //    virtual void SetDragInput( BOOL bL2R, CRect rcIn );
00163 //
00164 //    /**
00165 //     * start filter dialog to edit parameters; no filter operations;
00166 //     * see also CScanFilterNull::EditModeless().
00167 //     */
00168 //    virtual BOOL EditModeless( CWnd *pParentWnd );
00169 
00170    /**
00171     * create filter dialog and pre Apply() filter to view result;
00172     * see also CScanFilterNull::RunModeless().
00173     */
00174    virtual BOOL RunModeless( CWnd *pParentWnd, CDocument *pDoc );
00175 
00176    /**
00177     * check parameters, take care of a properly sized output buffer,
00178     * set its name and copy filter parameters and process;
00179     * see also CScanFilterNull::Apply().
00180     */
00181    virtual BOOL Apply();
00182 
00183    /// @}
00184    /// \name Predicates
00185    /// @{
00186 
00187    /// @}
00188    /// \name Accessors
00189    /// @{
00190 
00191    /**
00192     * number of columns in image.
00193     */
00194    int Columns() const
00195    {
00196       return m_lpsbIn->Columns();
00197    }
00198 
00199    /*
00200     * number of columns in image.
00201     */
00202    int Rows() const
00203    {
00204       return m_lpsbIn->Rows();
00205    }
00206 
00207    /**
00208     * the threshold mode.
00209     */
00210    ThresholdMode GetThresholdMode() const
00211    {
00212       return m_mode;
00213    }
00214 
00215    /**
00216     * the lower threshold value.
00217     */
00218    InputPixelType GetLowerThreshold() const
00219    {
00220       return m_lower;
00221    }
00222 
00223    /**
00224     * the upper threshold value.
00225     */
00226    InputPixelType GetUpperThreshold() const
00227    {
00228       return m_upper;
00229    }
00230 
00231    /**
00232     * the outside value.
00233     */
00234    OutputPixelType GetOutsideValue() const
00235    {
00236       return m_outside;
00237    }
00238 
00239    /// @}
00240    /// \name Mutators
00241    /// @{
00242 
00243    /**
00244     * the threshold mode.
00245     */
00246    void SetThresholdMode( ThresholdMode mode )
00247    {
00248       m_mode = mode;
00249    }
00250 
00251    /**
00252     * set the lower threshold value.
00253     */
00254    void SetLowerThreshold( InputPixelType lower )
00255    {
00256       m_lower = lower;
00257    }
00258 
00259    /**
00260     * set the upper threshold value.
00261     */
00262    void SetUpperThreshold( InputPixelType upper )
00263    {
00264       m_upper = upper;
00265    }
00266 
00267    /**
00268     * set the outside value.
00269     */
00270    void SetOutsideValue( OutputPixelType outside )
00271    {
00272       m_outside = outside;
00273    }
00274 
00275     /// @}
00276 
00277 protected:
00278    /**
00279     * store or retrieve the object's settings; see also CScanFilterNull::Serialize().
00280     */
00281    virtual void Serialize(CArchive& ar);
00282    DECLARE_SERIAL(CScanFilterThreshold)
00283 
00284 public:
00285    /**
00286     * the filter name.
00287     */
00288    static LPCTSTR m_lpcsFilterName;
00289 
00290    /**
00291     * the class short filtername.
00292     */
00293    static LPCTSTR m_lpcsShortFilterName;
00294 
00295 protected:
00296    /**
00297     * the threshold mode.
00298     */
00299    ThresholdMode m_mode;
00300 
00301    /**
00302     * the lower threshold value.
00303     */
00304    InputPixelType m_lower;
00305 
00306    /**
00307     * the upper threshold value.
00308     */
00309    InputPixelType m_upper;
00310 
00311    /**
00312     * the outside output value.
00313     */
00314    OutputPixelType m_outside;
00315 };
00316 
00317 /// @} cfl_filtermean
00318 
00319 #endif // CFL_SCANFILTERTHRESHOLD_H
00320 
00321 /*
00322  * end of file
00323  */
00324 

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