Persistence 1D inc. Reconstruct1D  1.1
Finding extrema in one dimensional data, filtering them by persistence and reconstructing smooth functions
 All Classes Namespaces Files Functions Variables Macros Pages
Interface to Matlab

Folder Contents

The Matlab folder cotains:

See also the examples persistence1d_example.m and persistence1d_example_sine.m as well as the documentation for run_persistence1d.cpp.

Compiling with Mex

To compile with Mex, change the working directory to [persistence_base_directory]\matlab and run: mex run_persistence1d.cpp

Configuring Mex

  1. If this is the first time you're using Mex run: mex -setup to setup the compiler.
  2. Answer yes when mex would like to locate installed compilers.
  3. Choose Microsoft Visual C++ from the compiler list. Persistence1D does not support the Lcc-win23 supplied with Matlab. (Note: Matlab auto-detects Microsoft Visual Studio compilers up to the Matlab's release year)
  4. Answer yes again to set the compiler.

Usage

[MinIndices MaxIndices Persistence GlobalMinIdx GlobalMinVal] = run_persistence1d(single(data))

Input and output format must adhere to this specified format.

Parameters
[in]dataA vector of data, sorted according to coordinates. This should contain only data values to be sorted. Assumes the data is one dimensional. Data format MUST be single.
[out]MinIndicesVector of (Matlab compatible) indices of local maxima.
[out]MaxIndicesVector of (Matlab compatible) indices of local minima.
[out]PersistenceVector of persistence of the paired extrema whose indices live in MinIndices and MaxIndices
[out]GlobalMinIdxIndex (Matlab compatible) of global minimum.
[out]GlobalMinValValue of global minimum.

Supplementary Scripts

visualize_features(datafilename, resfilename)

This script is used to display results of Persistence1D runs which were saved to text files.

Parameters
[in]data_fileName of the file which contains the raw data Persistence1D was run on, one value per row.
[in]res_fileA file with all indices of extrema to display. Assumes Matlab-compatible indexing.

plot_data_with_features(data, indices)

Creates a plot with markers at extrema specified by indices

Parameters
[in]dataOne dimensional data vector.
[in]indicesOne dimensional vector of indices (integer) values, all must be greater than 0 and less than or equal to the number of elemenets in data

filter_features_by_persistence(min, max, persistence, threshold)

Returns a 3-column matrix [minIndex maxIndex persistence] of paired extrema whose persistence is greater than threshold

Parameters
[in]minVector of indices of minima.
[in]maxVector of indices of maxima
[in]persistenceVector of persistence of paired extrema.
[in]thresholdPersistence threshold for filtering
[out]filtered_pairsReturns a matrix with all pairs whose persistence > threshold.

get_max_indices(pairs)

Returns a vector with the indices of paired minima in a pairs matrix.

Parameters
[in]pairsPaired extrema matrix, as per filter_features_by_persistence output.
[out]idxVector with minima indices.

get_max_indices(pairs)

Returns a vector with the indices of paired maxima in a pairs matrix.

Parameters
[in]pairsPaired extrema matrix, , as per filter_features_by_persistence output.
[out]idxVector with maxima indices.