Skip to content

Commit

Permalink
New doc
Browse files Browse the repository at this point in the history
  • Loading branch information
weinkauf committed Apr 20, 2020
1 parent f28fdd6 commit 4ac20d1
Show file tree
Hide file tree
Showing 76 changed files with 106 additions and 97 deletions.
2 changes: 1 addition & 1 deletion doc/html/_files_and_filters_8cpp-example.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ <h1>Expected Output</h1>
<div class="fragment"><div class="line"><span class="comment">/*! \file FilesAndFilters.cpp</span></div><div class="line"><span class="comment"> Example of working with data in files and using filters.</span></div><div class="line"><span class="comment">*/</span><span class="comment"></span></div><div class="line"><span class="comment">/*! \example FilesAndFilters.cpp</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment"> Example of working with data in files and using filters.</span></div><div class="line"><span class="comment"> </span></div><div class="line"><span class="comment"> # Contents </span></div><div class="line"><span class="comment"> This example demonstrates:</span></div><div class="line"><span class="comment"> -# Reading data into a vector from a text file</span></div><div class="line"><span class="comment"> -# Using Persistence1D class to extract features</span></div><div class="line"><span class="comment"> -# Filtering features according to their persistence.</span></div><div class="line"><span class="comment"> -# Automatic reset of output variables - reused output variables are reset. </span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment"> # Expected Output</span></div><div class="line"><span class="comment"> Output reference file: [persistence_base_dir]\\src\\examples\\FilesAndFilters\\FilesAndFiltersRes.ref</span></div><div class="line"><span class="comment"> with contents:</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment"> \include FilesAndFiltersRes.ref</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment"> # Code Documentation</span></div><div class="line"><span class="comment">*/</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &quot;..\..\persistence1d\persistence1d.hpp&quot;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &lt;fstream&gt;</span></div><div class="line"></div><div class="line"><span class="keyword">using namespace </span>std;</div><div class="line"><span class="keyword">using namespace </span><a class="code" href="namespacep1d.html">p1d</a>;</div><div class="line"></div><div class="line"><span class="keywordtype">int</span> <a name="a0"></a><a class="code" href="_files_and_filters_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>()</div><div class="line">{</div><div class="line"> <span class="comment">//Declare class and input variables</span></div><div class="line"> <a name="_a1"></a><a class="code" href="classp1d_1_1_persistence1_d.html">Persistence1D</a> p;</div><div class="line"> vector&lt;float&gt; <a name="a2"></a><a class="code" href="namespacevisualize.html#a158cecaf86cdc5969d2946bfe590d959">data</a>;</div><div class="line"> <span class="keywordtype">float</span> currdata; </div><div class="line"> ifstream datafile;</div><div class="line"> <span class="keywordtype">char</span> * filename = <span class="stringliteral">&quot;data.txt&quot;</span>;</div><div class="line"> </div><div class="line"> <span class="comment">//Declare variables for results</span></div><div class="line"> vector&lt;TPairedExtrema&gt; pairs; </div><div class="line"> vector&lt;int&gt; min, max; </div><div class="line"> <span class="keywordtype">int</span> globalMinIndex;</div><div class="line"> <span class="keywordtype">float</span> globalMinValue;</div><div class="line"> </div><div class="line"></div><div class="line"> <span class="comment">//Open the data file for reading</span></div><div class="line"> datafile.open(filename);</div><div class="line"> <span class="keywordflow">if</span> (!datafile)</div><div class="line"> {</div><div class="line"> cout &lt;&lt; <span class="stringliteral">&quot;Cannot open data file for reading: &quot;</span> &lt;&lt; filename &lt;&lt; endl;</div><div class="line"> <span class="keywordflow">return</span> -1;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">//Read the values from data file</span></div><div class="line"> <span class="keywordflow">while</span>(datafile &gt;&gt; currdata)</div><div class="line"> {</div><div class="line"> <a class="code" href="namespacevisualize.html#a158cecaf86cdc5969d2946bfe590d959">data</a>.push_back(currdata);</div><div class="line"> }</div><div class="line"> </div><div class="line"> datafile.close();</div><div class="line"> </div><div class="line"> <span class="comment">//Find extrema and compute their persistence.</span></div><div class="line"> p.<a name="a3"></a><a class="code" href="classp1d_1_1_persistence1_d.html#afa9e076d614ac0f0e8dd7e63b1c81868">RunPersistence</a>(<a class="code" href="namespacevisualize.html#a158cecaf86cdc5969d2946bfe590d959">data</a>);</div><div class="line"></div><div class="line"> <span class="comment">//Use the Get functions to get a copy of the results. </span></div><div class="line"> <span class="comment">//You can use this function multiple times with multiple threshold values without re-running the </span></div><div class="line"> <span class="comment">//main algorithm. </span></div><div class="line"> p.<a name="a4"></a><a class="code" href="classp1d_1_1_persistence1_d.html#a01514ef0112996211ce44eca987d889f">GetExtremaIndices</a>(min, max);</div><div class="line"> p.<a name="a5"></a><a class="code" href="classp1d_1_1_persistence1_d.html#afa11c91f655e97c9ffbefb70e8c0de8a">GetPairedExtrema</a>(pairs);</div><div class="line"> globalMinValue = p.<a name="a6"></a><a class="code" href="classp1d_1_1_persistence1_d.html#a990ff31bf9bbbd75dd0daed7438b0088">GetGlobalMinimumValue</a>();</div><div class="line"> globalMinIndex = p.<a name="a7"></a><a class="code" href="classp1d_1_1_persistence1_d.html#a8e5c3dd806ea58cfec93b38447a663c4">GetGlobalMinimumIndex</a>();</div><div class="line"> </div><div class="line"> <span class="comment">//To print the results - including all pairs and the global minimum, call PrintResults. </span></div><div class="line"> p.<a name="a8"></a><a class="code" href="classp1d_1_1_persistence1_d.html#aabe6a1637935518b6b6d5e4f80642389">PrintResults</a>();</div><div class="line"> cout &lt;&lt; endl;</div><div class="line"> </div><div class="line"> <span class="comment">//Now set a threshold for features filtering</span></div><div class="line"> <span class="comment">//In this case, we choose a threshold between largest and smallest persistence, to select from of the data.</span></div><div class="line"> <span class="keywordtype">float</span> filterThreshold = (pairs.front().Persistence + pairs.back().Persistence)/2;</div><div class="line"> </div><div class="line"> <span class="comment">//The vector which hold the data for the Get functions are being reset before use.</span></div><div class="line"> <span class="comment">//Use them to retrieve the filtered results:</span></div><div class="line"> p.<a class="code" href="classp1d_1_1_persistence1_d.html#a01514ef0112996211ce44eca987d889f">GetExtremaIndices</a>(min, max, filterThreshold);</div><div class="line"> p.<a class="code" href="classp1d_1_1_persistence1_d.html#afa11c91f655e97c9ffbefb70e8c0de8a">GetPairedExtrema</a>(pairs, filterThreshold);</div><div class="line"> </div><div class="line"> cout &lt;&lt; <span class="stringliteral">&quot;Filtered results with persistence &gt; &quot;</span> &lt;&lt; filterThreshold &lt;&lt; endl;</div><div class="line"></div><div class="line"> <span class="comment">//To print the results, it is also possible to print the contents of the local pairs structure</span></div><div class="line"> p.<a name="a9"></a><a class="code" href="classp1d_1_1_persistence1_d.html#adae134f828302ff68da0ad10c72c9562">PrintPairs</a>(pairs);</div><div class="line"></div><div class="line"> <span class="comment">//In this case, the global minimum needs to be printed manually</span></div><div class="line"> cout &lt;&lt; <span class="stringliteral">&quot;Global minimum value: &quot;</span> &lt;&lt; globalMinValue </div><div class="line"> &lt;&lt; <span class="stringliteral">&quot; index: &quot;</span> &lt;&lt; globalMinIndex &lt;&lt; endl &lt;&lt; endl;</div><div class="line"> </div><div class="line"> <span class="comment">//It is also possible to call PrintResuls with a threshold value to achieve identical results:</span></div><div class="line"> cout &lt;&lt; <span class="stringliteral">&quot;PrintResults(filterThreshold) results:&quot;</span> &lt;&lt; endl;</div><div class="line"> p.<a class="code" href="classp1d_1_1_persistence1_d.html#aabe6a1637935518b6b6d5e4f80642389">PrintResults</a>(filterThreshold);</div><div class="line"> cout &lt;&lt; endl;</div><div class="line"></div><div class="line"> <span class="comment">//Now set a threshold greater than the largest persistence, such that no paired extrema are returned:</span></div><div class="line"> filterThreshold = pairs.back().Persistence + 1; </div><div class="line"> p.<a class="code" href="classp1d_1_1_persistence1_d.html#a01514ef0112996211ce44eca987d889f">GetExtremaIndices</a>(min, max, filterThreshold);</div><div class="line"> p.<a class="code" href="classp1d_1_1_persistence1_d.html#afa11c91f655e97c9ffbefb70e8c0de8a">GetPairedExtrema</a>(pairs, filterThreshold);</div><div class="line"> </div><div class="line"> cout &lt;&lt; <span class="stringliteral">&quot;Filtered results with persistence &gt; &quot;</span> &lt;&lt; filterThreshold &lt;&lt; endl;</div><div class="line"> cout &lt;&lt; <span class="stringliteral">&quot;Number of found paired extrema: &quot;</span> &lt;&lt; pairs.size() &lt;&lt; endl;</div><div class="line"></div><div class="line"> <span class="comment">//Trying to print the results using the local pairs structure via PrintPairs will not print anything</span></div><div class="line"> cout &lt;&lt; <span class="stringliteral">&quot;PrintPairs(pairs) start&quot;</span> &lt;&lt; endl;</div><div class="line"> p.<a class="code" href="classp1d_1_1_persistence1_d.html#adae134f828302ff68da0ad10c72c9562">PrintPairs</a>(pairs);</div><div class="line"> cout &lt;&lt; <span class="stringliteral">&quot;PrintPairs(pairs) end&quot;</span> &lt;&lt; endl &lt;&lt; endl;</div><div class="line"></div><div class="line"> <span class="comment">//But calling the class&#39;s PrintPairs will print the global minimum even when no </span></div><div class="line"> <span class="comment">//pairs pass the persistence threshold.</span></div><div class="line"> p.<a class="code" href="classp1d_1_1_persistence1_d.html#aabe6a1637935518b6b6d5e4f80642389">PrintResults</a>(filterThreshold);</div><div class="line"> </div><div class="line"> <span class="keywordflow">return</span> 0;</div><div class="line">}</div></div><!-- fragment --> </div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Mar 25 2020 19:03:24 for Persistence 1D inc. Reconstruct1D by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Mon Apr 20 2020 12:40:37 for Persistence 1D inc. Reconstruct1D by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/_files_and_filters_8cpp.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a7
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Mar 25 2020 19:03:25 for Persistence 1D inc. Reconstruct1D by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Mon Apr 20 2020 12:40:37 for Persistence 1D inc. Reconstruct1D by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/_files_and_filters_8cpp_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Mar 25 2020 19:03:24 for Persistence 1D inc. Reconstruct1D by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Mon Apr 20 2020 12:40:37 for Persistence 1D inc. Reconstruct1D by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/_matlab_interface.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ <h2><a class="anchor" id="get_min"></a>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Mar 25 2020 19:03:25 for Persistence 1D inc. Reconstruct1D by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Mon Apr 20 2020 12:40:37 for Persistence 1D inc. Reconstruct1D by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
Expand Down
Loading

0 comments on commit 4ac20d1

Please sign in to comment.