Filter Library Camera Interface Physics

ScanFilterBinaryThreshold.h

00001 /*
00002  * ScanFilterBinaryThreshold.h - binary 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: ScanFilterBinaryThreshold.h 400 2006-09-28 13:34:02Z moene $
00013  */
00014 
00015 #ifndef CFL_SCANFILTERBINARYTHRESHOLD_H
00016 #define CFL_SCANFILTERBINARYTHRESHOLD_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_filterbinarythreshold Binary Threshold Filter
00027  * \brief binary threshold 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( CScanFilterBinaryThreshold );         // create various types
00062 
00063 /**
00064  * \brief binary threshold filter.
00065  *
00066  */
00067 class CScanFilterBinaryThreshold : public CScanFilter
00068 {
00069    /**
00070     * its dialog class.
00071     */
00072    friend class CFilterDlg_BinaryThreshold;
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    /// \name Construction
00092    /// @{
00093 
00094    /**
00095     * default constructor: setup filter to run without dialog;
00096     * see also CScanFilterNull::CScanFilterNull().
00097     */
00098    CScanFilterBinaryThreshold();
00099 
00100    /**
00101     * destructor.
00102     */
00103    virtual ~CScanFilterBinaryThreshold();
00104 
00105    /// @}
00106    /// \name Camera--Filter Interface
00107    /// @{
00108 
00109 //    /**
00110 //     * no partial data.
00111 //     */
00112 //   virtual BOOL CanDoPartialData() const;
00113 // 
00114 //    /**
00115 //     * has dialog (default true).
00116 //     */
00117 //    virtual BOOL CanDoDialogEntry() const;
00118 
00119    /**
00120     * \brief configure filter with settings as provided by the application on the
00121     * filterlist window (e.g. via registry); see also CScanFilterNull::ReadFilterSettings().
00122     */
00123    virtual void ReadFilterSettings( );
00124 
00125    /**
00126     * \brief save filter settings e.g. for use with the filterlist window (e.g. via registry);
00127     * see also ReadFilterSettings().
00128     */
00129    virtual void WriteFilterSettings( ) const;
00130 
00131    /**
00132     * provide current filter parameter(s) for filter-scripting capture
00133     * in the main application;
00134     * see also CScanFilterNull::GetParameters().
00135     */
00136    virtual LPCTSTR GetParameters() const;
00137 
00138    /**
00139     * set parameters for filter-script execution of filter;
00140     * see also CScanFilterNull::SetParameters().
00141     */
00142    virtual BOOL SetParameters( LPCTSTR lpParameters );
00143 
00144 //    /**
00145 //     * the supported dragmethod(s).
00146 //     */
00147 //    virtual DragSupportType SupportDragInput() const;
00148 //
00149 //    /**
00150 //     * apply the filter to the selected area.
00151 //     */
00152 //    virtual void SetDragInput( BOOL bL2R, CRect rcIn );
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::Apply().
00170     */
00171    virtual BOOL Apply();
00172 
00173    /// @}
00174    /// \name Predicates
00175    /// @{
00176 
00177    /// @}
00178    /// \name Accessors
00179    /// @{
00180 
00181    /**
00182     * number of columns in image.
00183     */
00184    int Columns() const
00185    {
00186       return m_lpsbIn->Columns();
00187    }
00188 
00189    /*
00190     * number of columns in image.
00191     */
00192    int Rows() const
00193    {
00194       return m_lpsbIn->Rows();
00195    }
00196 
00197    /**
00198     * the lower threshold value.
00199     */
00200    InputPixelType GetLowerThreshold() const
00201    {
00202       return m_lower;
00203    }
00204 
00205    /**
00206     * the upper threshold value.
00207     */
00208    InputPixelType GetUpperThreshold() const
00209    {
00210       return m_upper;
00211    }
00212 
00213    /**
00214     * the inside value.
00215     */
00216    OutputPixelType GetInsideValue() const
00217    {
00218       return m_inside;
00219    }
00220 
00221    /**
00222     * the outside value.
00223     */
00224    OutputPixelType GetOutsideValue() const
00225    {
00226       return m_outside;
00227    }
00228 
00229    /// @}
00230    /// \name Mutators
00231    /// @{
00232 
00233    /**
00234     * set the lower threshold value.
00235     */
00236    void SetLowerThreshold( InputPixelType lower )
00237    {
00238       m_lower = lower;
00239    }
00240 
00241    /**
00242     * set the upper threshold value.
00243     */
00244    void SetUpperThreshold( InputPixelType upper )
00245    {
00246       m_upper = upper;
00247    }
00248 
00249    /**
00250     * set the inside value.
00251     */
00252    void SetInsideValue( OutputPixelType inside )
00253    {
00254       m_inside = inside;
00255    }
00256 
00257    /**
00258     * set the outside value.
00259     */
00260    void SetOutsideValue( OutputPixelType outside )
00261    {
00262       m_outside = outside;
00263    }
00264 
00265     /// @}
00266 
00267 protected:
00268    /**
00269     * store or retrieve the object's settings; see also CScanFilterNull::Serialize().
00270     */
00271    virtual void Serialize(CArchive& ar);
00272    DECLARE_SERIAL(CScanFilterBinaryThreshold)
00273 
00274 public:
00275    /**
00276     * the filter name.
00277     */
00278    static LPCTSTR m_lpcsFilterName;
00279 
00280    /**
00281     * the class short filtername.
00282     */
00283    static LPCTSTR m_lpcsShortFilterName;
00284 
00285 protected:
00286    /**
00287     * the lower threshold value.
00288     */
00289    InputPixelType m_lower;
00290 
00291    /**
00292     * the upper threshold value.
00293     */
00294    InputPixelType m_upper;
00295 
00296    /**
00297     * the inside output value.
00298     */
00299    OutputPixelType m_inside;
00300 
00301    /**
00302     * the outside output value.
00303     */
00304    OutputPixelType m_outside;
00305 };
00306 
00307 /// @} cfl_filterbinarythreshold
00308 
00309 #endif // CFL_SCANFILTERBINARYTHRESHOLD_H
00310 
00311 /*
00312  * end of file
00313  */
00314 

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