![]() |
Persistence 1D inc. Reconstruct1D
1.1
Finding extrema in one dimensional data, filtering them by persistence and reconstructing smooth functions
|
Use this program to run Persistence1D on data in text files. More...
Go to the source code of this file.
Macros | |
#define | MATLAB "-MATLAB" |
Functions | |
bool | ReadFileToVector (char *filename, vector< float > &data) |
Tries to open the input file and read its contents to a float vector. More... | |
void | WriteMinMaxPairsToFile (char *filename, vector< TPairedExtrema > pairs) |
Writes indices of extrema features to file, sorted according to their persistence. More... | |
bool | ParseCmdLine (int argc, char *argv[], float &threshold, bool &matlabIndexing) |
Parses user command line. More... | |
int | main (int argc, char *argv[]) |
Main function - reads a file specified as a command line argument. More... | |
Use this program to run Persistence1D on data in text files.
This file contains a sample code for using Persistence1D on data in text files, and can be used to directly run Persistence1D on data in a single text file.
Command line: persistence1d_driver.exe <filename> [threshold] [-MATLAB]
Definition in file persistence1d_driver.cpp.
#define MATLAB "-MATLAB" |
Definition at line 28 of file persistence1d_driver.cpp.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Main function - reads a file specified as a command line argument.
runs persistence, writes the indices of extrema to a file called inputfilename_res.txt.
Overwrites files with the same name.
Input file name is assumed to end with a three letter extension.
Definition at line 73 of file persistence1d_driver.cpp.
bool ParseCmdLine | ( | int | argc, |
char * | argv[], | ||
float & | threshold, | ||
bool & | matlabIndexing | ||
) |
Parses user command line.
Checks if the user set a threshold value or wants MATLAB indexing.
Definition at line 161 of file persistence1d_driver.cpp.
bool ReadFileToVector | ( | char * | filename, |
vector< float > & | data | ||
) |
Tries to open the input file and read its contents to a float vector.
Input is assumed to be formatted as one number per line, in float compatible notation.
Ignores any lines which do not conform to this assumption.
Number of data entries is assumed to be smaller than vector's class maximum size - this is not checked!
[in] | filename | Name of input file with float data. |
[out] | data | Data is written to this vector. |
Definition at line 118 of file persistence1d_driver.cpp.
void WriteMinMaxPairsToFile | ( | char * | filename, |
vector< TPairedExtrema > | pairs | ||
) |
Writes indices of extrema features to file, sorted according to their persistence.
If no features were found, writes an empty file.
Overwrites any existing file with the same name.
[in] | filename | Name of output file. |
[out] | pairs | Data to write. |
Definition at line 142 of file persistence1d_driver.cpp.