GeopsyCore/SignalProcess.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 : 2009-03-26
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef SIGNALPROCESS_H
00029 #define SIGNALPROCESS_H
00030 
00031 #include "GeopsyCoreDLLExport.h"
00032 #include "RotateParameters.h"
00033 #include "MorletParameters.h"
00034 #include "SubSignalPool.h"
00035 
00036 namespace GeopsyCore {
00037 
00038 class GEOPSYCORE_EXPORT SignalProcess : public QObject
00039 {
00040   Q_OBJECT
00041 public:
00042   SignalProcess(QObject * parent=0) : QObject(parent) {}
00043 
00044   void setCurrentSubPool(SubSignalPool * subPool);
00045 
00046   const QString& history() const {return _history;}
00047   int stepCount() const {return _steps.count();}
00048   QStringList steps() const;
00049   void clear();
00050 
00051   int indexOfStep(const QString& tag) const;
00052 
00053   void saveStep(const QString& tag);
00054   void restoreStep(int index);
00055 
00056   void fastFourierTransform(DoubleSignal::SignalType st);
00057   bool exportFile(const QString& filePath, bool useOriginalBaseName=false,
00058                    const SignalFileFormat& format=SignalFileFormat::Unknown, int pickNumber=0);
00059   void setHeader(int signalIndex, const MetaDataIndex& dataIndex, const QVariant& value);
00060 
00061   void subtractValue(double val);
00062   void subtractSignal(int index);
00063   void subtractSignals(const QString& groupName);
00064   void multiply(double val);
00065   void filter(const FilterParameters& param);
00066   void whiten();
00067   void agc(double width);
00068   void stddevClip(double factor);
00069   void shift(double dt);
00070   void overSample(double factor);
00071   void taper(TimeRangeParameters& range, const TaperParameters& param);
00072   void cut(TimeRangeParameters& param);
00073   bool merge();
00074   bool mergeStations();
00075   void decimateAmplitude(int maxCount, double maxRef);
00076   void decimateTime(int factor);
00077   void waveletTransform(const MorletParameters& param);
00078   void stalta(double tsta, double tlta);
00079   void discreteFourierTransform();
00080   void rotateComponents(const RotateParameters& param);
00081   void correlations(double maxDelay, int referenceIndex=-1);
00082   void normalizedCorrelations(double maxDelay, int referenceIndex=-1);
00083   void convolution(int referenceIndex);
00084 protected:
00085   void init();
00086 
00087   void saveStepCore(const QString& tag);
00088   void restoreStepCore(int index);
00089 
00090   void fastFourierTransformCore(DoubleSignal::SignalType st);
00091   bool exportFileCore(const QString& filePath, bool useOriginalBaseName,
00092                       const SignalFileFormat& format, int pickNumber);
00093   QVariant headerCore(int signalIndex, const MetaDataIndex& dataIndex);
00094   void setHeaderCore(int signalIndex, const MetaDataIndex& dataIndex, const QVariant& value);
00095   int signalCountCore();
00096 
00097   void subtractValueCore(double val);
00098   void subtractSignalCore(int index);
00099   void subtractSignalsCore(const QString& groupName);
00100   void multiplyCore(double val);
00101   void filterCore(const FilterParameters& param);
00102   void whitenCore();
00103   void agcCore(double width);
00104   void stddevClipCore(double factor);
00105   void shiftCore(double dt);
00106   void overSampleCore(double factor);
00107   void taperCore(TimeRangeParameters& range, const TaperParameters& param);
00108   void cutCore(TimeRangeParameters& param);
00109   bool mergeCore();
00110   bool mergeStationsCore();
00111   void decimateAmplitudeCore(int maxCount, double maxRef);
00112   void decimateTimeCore(int factor);
00113   void waveletTransformCore(const MorletParameters& param);
00114   void staltaCore(double tsta, double tlta);
00115   void discreteFourierTransformCore();
00116   void rotateComponentsCore(const RotateParameters& param);
00117   void correlationsCore(double maxDelay, int referenceIndex);
00118   void normalizedCorrelationsCore(double maxDelay, int referenceIndex);
00119   void convolutionCore(int referenceIndex);
00120 protected:
00121   void addToHistory(const QString& s) {_history += s;}
00122 private:
00123   void setPicks(TimeRangeParameters& param);
00124   static QString timeRangeToArguments(const TimeRangeParameters& param);
00125 
00126   SubSignalPool * _current;
00127   QVector<SubSignalPool> _steps;
00128   QString _history;
00129 };
00130 
00131 } // namespace GeopsyCore
00132 
00133 #endif // SIGNALPROCESS_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines