Relacs Numerics Library  0.9.8
Public Member Functions | List of all members
Detector< DataIter, TimeIter > Class Template Reference

#include <detector.h>

Public Member Functions

 Detector (void)
 
 Detector (int n)
 
 ~Detector (void)
 
void init (DataIter first, DataIter last, TimeIter firsttime)
 
template<class Check >
void peakTrough (DataIter first, DataIter last, EventList &outevents, double &threshold, double minthresh, double maxthresh, Check &check)
 
template<class Check >
void peakTroughHist (DataIter first, DataIter last, EventList &outevents, double &threshold, double minthresh, double maxthresh, Check &check)
 
template<class Check >
void peak (DataIter first, DataIter last, EventData &outevents, double &threshold, double minthresh, double maxthresh, Check &check)
 
template<class Check >
void peakHist (DataIter first, DataIter last, EventData &outevents, double &threshold, double minthresh, double maxthresh, Check &check)
 
template<class Check >
void trough (DataIter first, DataIter last, EventData &outevents, double &threshold, double minthresh, double maxthresh, Check &check)
 
template<class Check >
void troughHist (DataIter first, DataIter last, EventData &outevents, double &threshold, double minthresh, double maxthresh, Check &check)
 
template<class Check >
void dynamicPeakTrough (DataIter first, DataIter last, EventList &outevents, double &threshold, double minthresh, double maxthresh, double delay, double decay, Check &check)
 
template<class Check >
void dynamicPeakTroughHist (DataIter first, DataIter last, EventList &outevents, double &threshold, double minthresh, double maxthresh, double delay, double decay, Check &check)
 
template<class Check >
void dynamicPeak (DataIter first, DataIter last, EventData &outevents, double &threshold, double minthresh, double maxthresh, double delay, double decay, Check &check)
 
template<class Check >
void dynamicPeakHist (DataIter first, DataIter last, EventData &outevents, double &threshold, double minthresh, double maxthresh, double delay, double decay, Check &check)
 
template<class Check >
void dynamicTrough (DataIter first, DataIter last, EventData &outevents, double &threshold, double minthresh, double maxthresh, double delay, double decay, Check &check)
 
template<class Check >
void dynamicTroughHist (DataIter first, DataIter last, EventData &outevents, double &threshold, double minthresh, double maxthresh, double delay, double decay, Check &check)
 
template<class Check >
void rising (DataIter first, DataIter last, EventData &outevents, double &threshold, double minthresh, double maxthresh, Check &check)
 
template<class Check >
void falling (DataIter first, DataIter last, EventData &outevents, double &threshold, double minthresh, double maxthresh, Check &check)
 
template<class Check >
void dynamicRising (DataIter first, DataIter last, EventData &outevents, double &threshold, double minthresh, double maxthresh, double delay, double decay, Check &check)
 
template<class Check >
void dynamicFalling (DataIter first, DataIter last, EventData &outevents, double &threshold, double minthresh, double maxthresh, double delay, double decay, Check &check)
 
template<class Check >
void thresholdPeakHist (DataIter first, DataIter last, EventData &outevents, double &threshold, double minthresh, double maxthresh, Check &check)
 
template<class Check >
void thresholdTroughHist (DataIter first, DataIter last, EventData &outevents, double &threshold, double minthresh, double maxthresh, Check &check)
 
const EventDatagoodEvents (void) const
 
const EventDatabadEvents (void) const
 
void setHistorySize (int n)
 
int historySize (void) const
 
void clearHistory (void)
 

Detailed Description

template<typename DataIter, typename TimeIter>
class relacs::Detector< DataIter, TimeIter >

Some basic event detector algorithms.

Author
Jan Benda
Version
1.0 The Detector class provides several algorithms for incremental detection of events (e.g. peaks, troughs, zero crossings, etc.) on a range of input data. The input data are traversed by two iterators. One of type DataIter returning the data values on which the events are to be detected, the other of TimeIter returning the corresponding times. Usually, you should provide const types for both DataIter and TimeIter.

Constructor & Destructor Documentation

Detector ( void  )

Constructor.

References EventData::setCyclic(), and EventData::setIdent().

Detector ( int  n)

Constructs Detector with history size n.

References EventData::setCyclic().

~Detector ( void  )

Destructor.

Member Function Documentation

void init ( DataIter  first,
DataIter  last,
TimeIter  firsttime 
)

Init the detector.

Parameters
[in]firstiterator pointing to the first data element.
[in]lastiterator pointing behind the last data element, if there aren't any data yet, then last should equal first.
[in]firsttimeiterator pointing to the time of the first data element.

Referenced by relacs::falling(), relacs::peaks(), relacs::peaksTroughs(), relacs::rising(), and relacs::troughs().

void peakTrough ( DataIter  first,
DataIter  last,
EventList outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
Check &  check 
)

The peak and trough finding algorithm from B. Todd and D. Andrews ("The identification of peaks in physiological signals.", Computers and Biomedical Research, 32, 322-335, 1999). The peaks are stored in outevents[0], the troughs in outevents[1]. A peak is detected if it is higher than threshold relative to the following minimum. A trough is detected if it is lower than threshold relative to the following maximum. All thresholds (threshold minthresh, maxthresh) have to be positive numbers!

Parameters
[in]firstiterator pointing to the first accessible data element.
[in]lastiterator pointing behind the last data element.
[out]outeventsoutevents[0] gets the peak times and outevents[1] the troughs.
thresholdthe current value of the threshold
[in]minthreshthe minimum value for the threshold
[in]maxthreshthe maximum value for the threshold
checka clas that implements a checkPeak() and a checkTrough() function. For details see the AcceptEvent implementation.

References EventList::push().

Referenced by relacs::peaksTroughs().

void peakTroughHist ( DataIter  first,
DataIter  last,
EventList outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
Check &  check 
)

References EventList::push().

void peak ( DataIter  first,
DataIter  last,
EventData outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
Check &  check 
)
void peakHist ( DataIter  first,
DataIter  last,
EventData outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
Check &  check 
)
void trough ( DataIter  first,
DataIter  last,
EventData outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
Check &  check 
)
void troughHist ( DataIter  first,
DataIter  last,
EventData outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
Check &  check 
)
void dynamicPeakTrough ( DataIter  first,
DataIter  last,
EventList outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
double  delay,
double  decay,
Check &  check 
)
void dynamicPeakTroughHist ( DataIter  first,
DataIter  last,
EventList outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
double  delay,
double  decay,
Check &  check 
)
void dynamicPeak ( DataIter  first,
DataIter  last,
EventData outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
double  delay,
double  decay,
Check &  check 
)
void dynamicPeakHist ( DataIter  first,
DataIter  last,
EventData outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
double  delay,
double  decay,
Check &  check 
)
void dynamicTrough ( DataIter  first,
DataIter  last,
EventData outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
double  delay,
double  decay,
Check &  check 
)
void dynamicTroughHist ( DataIter  first,
DataIter  last,
EventData outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
double  delay,
double  decay,
Check &  check 
)
void rising ( DataIter  first,
DataIter  last,
EventData outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
Check &  check 
)

Detect events crossing the threshold with a positive slope in a single trace of the analog data refered to by events.

References EventData::push(), and EventData::updateMeanQuality().

Referenced by relacs::rising().

void falling ( DataIter  first,
DataIter  last,
EventData outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
Check &  check 
)

Detect events crossing the threshold with a negative slope in a single trace of the analog data refered to by events.

References EventData::push(), and EventData::updateMeanQuality().

Referenced by relacs::falling().

void dynamicRising ( DataIter  first,
DataIter  last,
EventData outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
double  delay,
double  decay,
Check &  check 
)

Detect events crossing the threshold with a positive slope in a single trace of the analog data refered to by events. The threshold is dynamic. If there are no events detected after a delay of delay seconds the threshold decays to minthresh with a decay time constant of decay seconds. minthresh can be greater than maxthresh.

References relacs::ceil(), EventData::push(), and EventData::updateMeanQuality().

void dynamicFalling ( DataIter  first,
DataIter  last,
EventData outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
double  delay,
double  decay,
Check &  check 
)

Detect events crossing the threshold with a negative slope in a single trace of the analog data refered to by events. The threshold is dynamic. If there are no events detected after a delay of delay seconds the threshold decays to minthresh with a decay time constant of decay seconds. minthresh can be greater than maxthresh.

References relacs::ceil(), EventData::push(), and EventData::updateMeanQuality().

void thresholdPeakHist ( DataIter  first,
DataIter  last,
EventData outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
Check &  check 
)

Detect the largest local maxima above succeding threshold crossings. All local maxima are stored in BadEvents.

References EventData::push(), and EventData::updateMeanQuality().

void thresholdTroughHist ( DataIter  first,
DataIter  last,
EventData outevents,
double &  threshold,
double  minthresh,
double  maxthresh,
Check &  check 
)

Detect smallest local minima below succeding threshold crossings. All local minima are stored in BadEvents.

References EventData::push(), and EventData::updateMeanQuality().

const EventData& goodEvents ( void  ) const
inline
const EventData& badEvents ( void  ) const
inline
void setHistorySize ( int  n)
inline

References EventData::reserve().

int historySize ( void  ) const
inline

References EventData::capacity().

void clearHistory ( void  )
inline

References EventData::clear().


The documentation for this class was generated from the following file: