Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Visualization

Visualization in OpenMS is based on Qt.

1D view

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.cpp).

First we need to create a QApplication in order to be able to use Qt widgets in out application.

Int main(int argc, const char ** argv)
{
if (argc < 2) return 1;
// the path to the data should be given on the command line
String tutorial_data_path(argv[1]);
QApplication app(argc, const_cast<char **>(argv));

Then we load a DTA file (the first command line argument of our application).

PeakMap exp;
exp.resize(1);
DTAFile().load(tutorial_data_path + "/data/Tutorial_Spectrum1D.dta", exp[0]);

Then we create a widget for 1D visualization and hand over the data.

LayerData::ExperimentSharedPtrType exp_sptr(new PeakMap(exp));
Spectrum1DWidget * widget = new Spectrum1DWidget(Param(), 0);
widget->canvas()->addLayer(exp_sptr);
widget->show();

Finally we start the application.

return app.exec();
} //end of main

Visual editing of parameters

Param objects are used to set algorithm parameters in OpenMS. In order to be able to visually edit them, the ParamEditor class can be used. The following example (Tutorial_GUI_ParamEditor.cpp) show how to use it.

We need to create a QApplication, load the data from a file (e.g. the parameters file of any TOPP tool), create the ParamEditor and execute the application:

Int main(int argc, const char** argv)
{
if (argc < 2) return 1;
// the path to the data should be given on the command line
String tutorial_data_path(argv[1]);
QApplication app(argc, const_cast<char**>(argv));
Param param;
ParamXMLFile paramFile;
paramFile.load(tutorial_data_path + "/data/Tutorial_ParamEditor.ini", param);
ParamEditor* editor = new ParamEditor(0);
editor->load(param);
editor->show();
app.exec();

When it is closed, we store the result back to the Param object and then to the file.

editor->store();
paramFile.store("Tutorial_ParamEditor_out.ini", param);
return 0;
} //end of main


OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:05 using doxygen 1.8.13