File: tutorial_visual.html

package info (click to toggle)
openms 1.11.1-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 436,688 kB
  • ctags: 150,907
  • sloc: cpp: 387,126; xml: 71,547; python: 7,764; ansic: 2,626; php: 2,499; sql: 737; ruby: 342; sh: 325; makefile: 128
file content (87 lines) | stat: -rw-r--r-- 6,063 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<HTML>
<HEAD>
<TITLE>Visualization</TITLE>
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
<LINK HREF="style_ini.css" REL="stylesheet" TYPE="text/css">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<A href="index.html">Home</A> &nbsp;&middot;
<A href="classes.html">Classes</A> &nbsp;&middot;
<A href="annotated.html">Annotated Classes</A> &nbsp;&middot;
<A href="modules.html">Modules</A> &nbsp;&middot;
<A href="functions_func.html">Members</A> &nbsp;&middot;
<A href="namespaces.html">Namespaces</A> &nbsp;&middot;
<A href="pages.html">Related Pages</A>
<HR style="height:1px; border:none; border-top:1px solid #c0c0c0;">
<!-- Generated by Doxygen 1.8.5 -->
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Visualization </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>Visualization in OpenMS is based on Qt.</p>
<h1><a class="anchor" id="visualization_1D"></a>
1D view</h1>
<p>All types of peak or feature visualization share a common interface. So here only an example how to visualize a single spectrum is given (Tutorial_GUI_Spectrum1D.C).</p>
<p>First we need to create a <em><a class="el" href="classQApplication.html">QApplication</a></em> in order to be able to use Qt widgets in out application.  <div class="fragment"><div class="line"><a class="code" href="classInt.html">Int</a> <a class="code" href="RNPxl_8C.html#a217dbf8b442f20279ea00b898af96f52">main</a>(<span class="keywordtype">int</span> argc, <span class="keyword">const</span> <span class="keywordtype">char</span> ** argv)</div>
<div class="line">{</div>
<div class="line">  <span class="keywordflow">if</span> (argc &lt; 2) <span class="keywordflow">return</span> 1;</div>
<div class="line">  <span class="comment">// the path to the data should be given on the command line</span></div>
<div class="line">  String tutorial_data_path(argv[1]);</div>
<div class="line">  </div>
<div class="line">  <a class="code" href="classQApplication.html">QApplication</a> app(argc, const_cast&lt;char **&gt;(argv));</div>
</div><!-- fragment --></p>
<p>Then we load a DTA file (the first command line argument of our application). <div class="fragment"><div class="line"></div>
<div class="line">  PeakMap exp;</div>
<div class="line">  exp.resize(1);</div>
<div class="line">  DTAFile().load(tutorial_data_path + <span class="stringliteral">&quot;/data/Tutorial_Spectrum1D.dta&quot;</span>, exp[0]);</div>
</div><!-- fragment --></p>
<p>Then we create a widget for 1D visualization and hand over the data. <div class="fragment"><div class="line">  LayerData::ExperimentSharedPtrType exp_sptr(<span class="keyword">new</span> <a class="code" href="group__Kernel.html#gac459ab9d68b68f31561c7763c7da61ef">PeakMap</a>(exp));</div>
<div class="line">  Spectrum1DWidget * widget = <span class="keyword">new</span> Spectrum1DWidget(Param(), 0);</div>
<div class="line">  widget-&gt;canvas()-&gt;addLayer(exp_sptr);</div>
<div class="line">  widget-&gt;show();</div>
</div><!-- fragment --></p>
<p>Finally we start the application. <div class="fragment"><div class="line"></div>
<div class="line">  <span class="keywordflow">return</span> app.exec();</div>
<div class="line">} <span class="comment">//end of main</span></div>
</div><!-- fragment --></p>
<h1><a class="anchor" id="visualization_param"></a>
Visual editing of parameters</h1>
<p><em>Param</em> objects are used to set algorithm parameters in OpenMS. In order to be able to visually edit them, the <em>ParamEditor</em> class can be used. The following example (Tutorial_GUI_ParamEditor.C) show how to use it.</p>
<p>We need to create a <a class="el" href="classQApplication.html">QApplication</a>, load the data from a file (e.g. the parameters file of any TOPP tool), create the <em>ParamEditor</em> and execute the application:  <div class="fragment"><div class="line"><a class="code" href="classInt.html">Int</a> <a class="code" href="RNPxl_8C.html#a217dbf8b442f20279ea00b898af96f52">main</a>(<span class="keywordtype">int</span> argc, <span class="keyword">const</span> <span class="keywordtype">char</span>** argv)</div>
<div class="line">{</div>
<div class="line">  <span class="keywordflow">if</span> (argc &lt; 2) <span class="keywordflow">return</span> 1;</div>
<div class="line">  <span class="comment">// the path to the data should be given on the command line</span></div>
<div class="line">  String tutorial_data_path(argv[1]);</div>
<div class="line">  </div>
<div class="line">  <a class="code" href="classQApplication.html">QApplication</a> app(argc, const_cast&lt;char**&gt;(argv));</div>
<div class="line"></div>
<div class="line">  Param param;</div>
<div class="line">  ParamXMLFile paramFile;</div>
<div class="line"></div>
<div class="line">  paramFile.load(tutorial_data_path + <span class="stringliteral">&quot;/data/Tutorial_ParamEditor.ini&quot;</span>, param);</div>
<div class="line"></div>
<div class="line">  ParamEditor* editor = <span class="keyword">new</span> ParamEditor(0);</div>
<div class="line">  editor-&gt;load(param);</div>
<div class="line">  editor-&gt;show();</div>
<div class="line"></div>
<div class="line">  app.exec();</div>
</div><!-- fragment --></p>
<p>When it is closed, we store the result back to the <em>Param</em> object and then to the file. <div class="fragment"><div class="line"></div>
<div class="line">  editor-&gt;store();</div>
<div class="line">  paramFile.store(<span class="stringliteral">&quot;Tutorial_ParamEditor_out.ini&quot;</span>, param);</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">return</span> 0;</div>
<div class="line">} <span class="comment">//end of main</span></div>
</div><!-- fragment --> </p>
</div></div><!-- contents -->
<HR style="height:1px; border:none; border-top:1px solid #c0c0c0;">
<TABLE width="100%" border="0">
<TR>
<TD><font color="#c0c0c0">OpenMS / TOPP release 1.11.1</font></TD>
<TD align="right"><font color="#c0c0c0">Documentation generated on Thu Nov 14 2013 11:19:24 using doxygen 1.8.5</font></TD>
</TR>
</TABLE>
</BODY>
</HTML>