24 #include "..\..\persistence1d\persistence1d.hpp" 38 char * filename =
"data.txt";
41 vector<TPairedExtrema> pairs;
48 datafile.open(filename);
51 cout <<
"Cannot open data file for reading: " << filename << endl;
56 while(datafile >> currdata)
58 data.push_back(currdata);
80 float filterThreshold = (pairs.front().Persistence + pairs.back().Persistence)/2;
87 cout <<
"Filtered results with persistence > " << filterThreshold << endl;
93 cout <<
"Global minimum value: " << globalMinValue
94 <<
" index: " << globalMinIndex << endl << endl;
97 cout <<
"PrintResults(filterThreshold) results:" << endl;
102 filterThreshold = pairs.back().Persistence + 1;
106 cout <<
"Filtered results with persistence > " << filterThreshold << endl;
107 cout <<
"Number of found paired extrema: " << pairs.size() << endl;
110 cout <<
"PrintPairs(pairs) start" << endl;
112 cout <<
"PrintPairs(pairs) end" << endl << endl;
int GetGlobalMinimumIndex(const bool matlabIndexing=false) const
Returns the index of the global minimum.
bool GetExtremaIndices(std::vector< int > &min, std::vector< int > &max, const float threshold=0, const bool matlabIndexing=false) const
Use this method to get two vectors with all indices of PairedExterma.
bool RunPersistence(const std::vector< float > &InputData)
Call this function with a vector of one dimensional data to find extrema features in the data.
void PrintPairs(const std::vector< TPairedExtrema > &pairs) const
Prints the contents of the TPairedExtrema vector.
Finds extrema and their persistence in one-dimensional data.
bool GetPairedExtrema(std::vector< TPairedExtrema > &pairs, const float threshold=0, const bool matlabIndexing=false) const
Use this method to get the results of RunPersistence.
void PrintResults(const float threshold=0.0, const bool matlabIndexing=false) const
Prints the global minimum and all paired extrema whose persistence is greater or equal to threshold.
float GetGlobalMinimumValue() const
Returns the value of the global minimum.