GeopsyCore/WindowingParameters.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of GeopsyCore.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2003-12-19
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (ULg, Liège, Belgium)
00025 **    Marc Wathelet (LGIT, Grenoble, France)
00026 **
00027 ***************************************************************************/
00028 
00029 #ifndef WINDOWINGPARAMETERS_H
00030 #define WINDOWINGPARAMETERS_H
00031 
00032 #include <QGpCoreTools.h>
00033 
00034 #include "GeopsyCoreDLLExport.h"
00035 #include "FilterParameters.h"
00036 
00037 namespace GeopsyCore {
00038 
00039 class GEOPSYCORE_EXPORT WindowingParameters: public AbstractParameters
00040 {
00041 public:
00042   WindowingParameters();
00043   ~WindowingParameters();
00044 
00045   void operator=(const WindowingParameters& o);
00046 
00047   struct ShortLongTermAverage
00048   {
00049     bool enabled;
00050     double shortLength;
00051     double longLength;
00052     double minimumThreshold;
00053     double maximumThreshold;
00054   };
00055 
00056   void setComponentCount(int n);
00057   int componentCount() const {return _componentCount;}
00058 
00059   void setStationCount(int n);
00060   int stationCount() const {return _stationCount;}
00061 
00062   void setRawComponent(int comp, bool b) {ASSERT(comp<_componentCount); _rawComponent[comp]=b;}
00063   void setFilterComponent(int comp, bool b) {ASSERT(comp<_componentCount); _filterComponent[comp]=b;}
00064   void setRawStation(int stat, bool b) {ASSERT(stat<_stationCount); _rawStation[stat]=b;}
00065   void setFilterStation(int stat, bool b) {ASSERT(stat<_stationCount); _filterStation[stat]=b;}
00066 
00067   bool rawComponent(int comp) const {return comp<_componentCount ? _rawComponent[comp] : true;}
00068   bool filterComponent(int comp) const {return comp<_componentCount ? _filterComponent[comp] : true;}
00069   bool rawStation(int stat) const {return stat<_stationCount ? _rawStation[stat] : true;}
00070   bool filterStation(int stat) const {return stat<_stationCount ? _filterStation[stat] : true;}
00071 
00072   enum LengthType {Exactly, AtLeast, FrequencyDependent};
00073   void setLength(double tmin, double tmax);
00074   void setLength(double t);
00075   void setPeriodCount(double n);
00076   void setLengthType(const QString& l);
00077   LengthType lengthType() const {return _lengthType;}
00078   QString lengthTypeString() const;
00079 
00080   double minimumLength(double frequency) const;
00081   double maximumLength(double frequency) const;
00082   double periodCount() const {return _periodCount;}
00083 
00084   const double& overlap() const {return _overlap;}
00085   void setOverlap(const double& o) {_overlap=o;}
00086 
00087   enum SampleThreshold {NoSampleThreshold, RelativeSampleThreshold, AbsoluteSampleThreshold};
00088 
00089   void setBadSampleThresholdType(SampleThreshold t) {_badSampleThresholdType=t;}
00090   void setBadSampleThresholdType(const QString& t);
00091   SampleThreshold badSampleThresholdType() const {return _badSampleThresholdType;}
00092   QString badSampleThresholdTypeString() const;
00093 
00094   const double& badSampleThreshold() const {return _badSampleThresholdValue;}
00095   void setBadSampleThreshold(const double& b) {_badSampleThresholdValue=b;}
00096 
00097   const double& badSampleTolerance() const {return _badSampleTolerance;}
00098   void setBadSampleTolerance(const double& b) {_badSampleTolerance=b;}
00099 
00100   const ShortLongTermAverage& rawSignalAntiTrigger() const {return _rawSignalAntiTrigger;}
00101   void setRawSignalAntiTrigger(const ShortLongTermAverage& r) {_rawSignalAntiTrigger=r;}
00102 
00103   const ShortLongTermAverage& filterSignalAntiTrigger() const {return _filterSignalAntiTrigger;}
00104   void setFilterSignalAntiTrigger(const ShortLongTermAverage& f) {_filterSignalAntiTrigger=f;}
00105 
00106   const FilterParameters& filter() const {return _filter;}
00107   void setFilter(const FilterParameters& f) {_filter=f;}
00108 
00109   bool isValid();
00110   void printDebug();
00111 
00112   virtual void collectKeywords(PARAMETERS_COLLECTKEYWORDS_ARGS);
00113   virtual int keywordCount(PARAMETERS_KEYWORDCOUNT_ARGS);
00114   virtual bool setValue(PARAMETERS_SETVALUE_ARGS);
00115   virtual QString toString(PARAMETERS_TOSTRING_ARGS_DECL) const;
00116 private:
00117   int _componentCount, _stationCount;
00118   bool * _rawComponent;
00119   bool * _filterComponent;
00120   bool * _rawStation;
00121   bool * _filterStation;
00122 
00123   LengthType _lengthType;
00124   double _minimumLength;
00125   double _maximumLength;
00126   double _periodCount;
00127 
00128   double _overlap;
00129   SampleThreshold _badSampleThresholdType;
00130   double _badSampleThresholdValue;
00131   double _badSampleTolerance;
00132   ShortLongTermAverage _rawSignalAntiTrigger;
00133   ShortLongTermAverage _filterSignalAntiTrigger;
00134   FilterParameters _filter;
00135 
00136 };
00137 
00138 } // namespace GeopsyCore
00139 
00140 #endif // WINDOWINGPARAMETERS_H
00141 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines