Commit c20701df authored by Edlira Nano's avatar Edlira Nano
Browse files

filterBackgroundWidget added, not finished

git-svn-id: https://subversion.renater.fr/masschroq/trunk@2253 e4b6dbb4-9209-464b-83f7-6257456c460c
parent 7070c406
......@@ -58,8 +58,8 @@ if (NOT CMAKE_INSTALL_PREFIX)
SET (CMAKE_INSTALL_PREFIX /usr/local)
endif (NOT CMAKE_INSTALL_PREFIX)
SET(CMAKE_BUILD_TYPE "Release")
#SET(CMAKE_BUILD_TYPE "RelWithDebInfo")
#SET(CMAKE_BUILD_TYPE "Release")
SET(CMAKE_BUILD_TYPE "RelWithDebInfo")
#SET( CMAKE_BUILD_TYPE "Debug")
IF(CMAKE_BUILD_TYPE MATCHES "Release")
......
......@@ -131,6 +131,7 @@ SET(GUI_SRCS
./gui/mainwindow.cpp
./gui/masschroq_gui.cpp
./gui/xicSelectionWidget.cpp
./gui/filterBackgroundWidget.cpp
./gui/plotStyle.cpp
./gui/xicProfile.cpp
./gui/xicPlot.cpp
......@@ -144,6 +145,7 @@ SET(GUI_SRCS
SET(GUI_MOC_HDRS
./gui/mainwindow.h
./gui/xicSelectionWidget.h
./gui/filterBackgroundWidget.h
./gui/xicProfile.h
./gui/plot.h
./gui/mcqThread.h
......
......@@ -7,12 +7,14 @@
#include "filterBackgroundWidget.h"
#include <QtGui>
FilterBackgroundWidget::FilterBackgroundWidget(QWidget * parent) : QWidget(parent) {
FilterBackgroundWidget::FilterBackgroundWidget(QWidget * parent)
:
QWidget(parent)
{
create_parameters();
QPushButton * filterButton = new QPushButton(tr("&Filter"));
extractButton->setDefault(true);
filterButton->setDefault(true);
_button_box = new QDialogButtonBox(Qt::Vertical);
_button_box->addButton(filterButton, QDialogButtonBox::AcceptRole);
_button_box->addButton(QDialogButtonBox::Cancel);
......@@ -22,7 +24,11 @@ FilterBackgroundWidget::FilterBackgroundWidget(QWidget * parent) : QWidget(paren
connect(_button_box, SIGNAL(rejected()), this, SLOT(cancel()));
QVBoxLayout * mainLayout = new QVBoxLayout;
setWindowTitle(tr("Filter background XIC noise"));
mainLayout->addWidget(_median_group);
mainLayout->addWidget(_minmax_group);
mainLayout->addWidget(_button_box);
setLayout(mainLayout);
setWindowTitle(tr("Background noise filter"));
}
FilterBackgroundWidget::~FilterBackgroundWidget() {
......@@ -31,47 +37,60 @@ FilterBackgroundWidget::~FilterBackgroundWidget() {
void
FilterBackgroundWidget::create_parameters() {
QGridLayout *layout = new QGridLayout;
_median_group = new QGroupBox;
QGridLayout *layout1 = new QGridLayout;
QLabel * median_label = new QLabel("Median filtering half window");
QSpinBox * median_box = new QSpinBox;
median_box->setMaximum(20);
median_box->setWrapping(true);
median_box->setSingleStep(1);
connect(median_box, SIGNAL(valueChanged(unsigned int)),
this, SLOT(setMedianHalfWindow(unsigned int)));
connect(median_box, SIGNAL(valueChanged(int)),
this, SLOT(setMedianHalfWindow(int)));
median_box->setValue(5);
// setMedianHalfWindow(5);
layout->addWidget(median_label, 0, 0);
layout->addWidget(median_box, 0, 1);
layout1->addWidget(median_label, 0, 0);
layout1->addWidget(median_box, 0, 1);
_median_group->setLayout(layout1);
_minmax_group = new QGroupBox;
QGridLayout *layout2 = new QGridLayout;
QLabel * minmax_label = new QLabel("MinMax filtering half window");
QSpinBox * minmax_box = new QSpinBox;
minmax_box->setMaximum(20);
minmax_box->setWrapping(true);
minmax_box->setSingleStep(1);
connect(minmax_box, SIGNAL(valueChanged(unsigned int)),
this, SLOT(setMinMaxHalfWindow(unsigned int)));
connect(minmax_box, SIGNAL(valueChanged(int)),
this, SLOT(setMinMaxHalfWindow(int)));
median_box->setValue(5);
// setMinMaxHalfWindow(5);
layout->addWidget(median_label, 1, 0);
layout->addWidget(median_box, 1, 1);
layout2->addWidget(minmax_label, 1, 0);
layout2->addWidget(minmax_box, 1, 1);
_minmax_group->setLayout(layout2);
}
void
FilterBackgroundWidget:setMedianHalfWindow(unsigned int i) {
FilterBackgroundWidget::setMedianHalfWindow(int i) {
_median_half_window = i;
}
void
FilterBackgroundWidget:setMinMaxHalfWindow(unsigned int i) {
FilterBackgroundWidget::setMinMaxHalfWindow(int i) {
_min_max_half_window = i;
}
const int
FilterBackgroundWidget::getMedianHalfWindow() const {
return _median_half_window;
}
const int
FilterBackgroundWidget::getMinMaxHalfWindow() const {
return _min_max_half_window;
}
void
FilterBackgroundWidget::filterXic() {
emit filter(this);
}
void
......
......@@ -27,7 +27,8 @@
#ifndef FILTER_BACKGROUND_WIDGET_H_
#define FILTER_BACKGROUND_WIDGET_H_ 1
//#include "../mcq_types.h"
#include <QWidget>
#include "../mcq_types.h"
class QButtonGroup;
class QGroupBox;
......@@ -38,10 +39,10 @@ class XicExtractionMethodBase;
/**
* \class FilterBackgroundWidget
* \brief Xic Filter Background Widget
* \brief Background noise removal XIC filter Widget
*
*
*/
**/
class FilterBackgroundWidget : public QWidget {
......@@ -53,30 +54,26 @@ class FilterBackgroundWidget : public QWidget {
virtual ~FilterBackgroundWidget();
XicExtractionMethodBase * getXicExtractionMethod() const;
const mcq_xic_type getXicType() const;
const mcq_double getMzToExtract() const;
const int getMedianHalfWindow() const;
const mcq_double getRtToExtract() const;
const int getMinMaxHalfWindow() const;
private slots :
void setMedianHalfWindow(const unsigned int i);
void setMinMaxHalfWindow(const unsigned int i);
void setMedianHalfWindow(int i);
void setMinMaxHalfWindow(int i);
void filterXic();
void cancel();
signals :
// void extract(XicSelectionWidget *);
void filter(FilterBackgroundWidget *);
protected :
unsigned int _median_half_window;
unsigned int _min_max_half_window;
int _median_half_window;
int _min_max_half_window;
private :
......@@ -85,11 +82,11 @@ class FilterBackgroundWidget : public QWidget {
// void create_xic_range_group();
// void create_mz_group();
// QGroupBox * _xic_type_group;
// QGroupBox * _xic_range_group;
// QGroupBox * _mz_group;
QGroupBox * _median_group;
QGroupBox * _minmax_group;
QDialogButtonBox * _button_box;
void create_parameters();
};
......
......@@ -12,7 +12,7 @@
#include "xicSelectionWidget.h"
#include "xicProfile.h"
#include "xicPlot.h"
#include "../lib/filters/filter_background.h"
MainWindow::MainWindow(QWidget *parent)
:
......@@ -26,14 +26,17 @@ MainWindow::MainWindow(QWidget *parent)
_plot_area = new Plot(this);
setCentralWidget(_plot_area);
setWindowTitle(tr("MassChroQ GUI"));
createActions();
createMenus();
//createToolBars();
createStatusBar();
setWindowTitle(tr("MassChroQ GUI"));
// cannot resize the main window to less than 200x200
setMinimumSize(200, 200);
// size at creation is 480x320
resize(480, 320);
_msrun_loader_thread.setMaxProgress(4);
connect(&_msrun_loader_thread, SIGNAL(loadedMsrun(Msrun *)),
this, SLOT(doneLoading(Msrun *)));
......@@ -54,9 +57,11 @@ MainWindow::createMenus() {
_toolsMenu = menuBar()->addMenu(tr("&Tools"));
_toolsMenu->addAction(_extractXicAct);
_toolsMenu->addAction(_applyFilterAct);
menuBar()->addSeparator();
_fileMenu->addSeparator();
_filtersMenu = _toolsMenu->addMenu(tr("&Filter XIC"));
_filtersMenu->addAction(_filterBackgroundAct);
_filtersMenu->addAction(_filterSpikeAct);
_helpMenu = menuBar()->addMenu(tr("&Help"));
_helpMenu->addAction(_aboutAct);
......@@ -67,7 +72,7 @@ void
MainWindow::createActions() {
_loadMsrunAct = new QAction(tr("&Load MS-run"), this);
_loadMsrunAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
_loadMsrunAct->setShortcut(tr("Ctrl+L"));
_loadMsrunAct->setStatusTip(tr("Load an MS-run file"));
connect(_loadMsrunAct, SIGNAL(triggered()), this, SLOT(loadMsrun()));
......@@ -75,17 +80,23 @@ MainWindow::createActions() {
_quitAct->setShortcuts(QKeySequence::Quit);
_quitAct->setStatusTip(tr("Quit MassChroQ GUI"));
connect(_quitAct, SIGNAL(triggered()), this, SLOT(close()));
_extractXicAct = new QAction(tr("&extract XIC"), this);
_extractXicAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
_extractXicAct->setShortcut(tr("Ctrl+X"));
_extractXicAct->setStatusTip(tr("Select values vor XIC extraction"));
connect(_extractXicAct, SIGNAL(triggered()), this, SLOT(extractXicWidget()));
_applyFilterAct = new QAction(tr("&filter XIC"), this);
_applyFilterAct->setShortcut(QKeySequence(tr("Ctrl+F")));
_applyFilterAct->setStatusTip(tr("Select filter to apply on XIC"));
connect(_applyFilterAct, SIGNAL(triggered()), this, SLOT(filterXic()));
_filterBackgroundAct = new QAction(tr("&Background filter"), this);
_filterBackgroundAct->setShortcut(tr("Ctrl+B"));
_filterBackgroundAct->setStatusTip(tr("Apply a backround noise removal filter to the XIC"));
connect(_filterBackgroundAct, SIGNAL(triggered()), this, SLOT(filterBackgroundWidget()));
_filterSpikeAct = new QAction(tr("&Spike filter"), this);
_filterSpikeAct->setShortcut(tr("Ctrl+S"));
_filterSpikeAct->setStatusTip(tr("Apply a spike removal filter to the XIC"));
connect(_filterSpikeAct, SIGNAL(triggered()), this, SLOT(filterSpikeWidget()));
_aboutAct = new QAction(tr("&About"), this);
_aboutAct->setStatusTip(tr("About MassChroQ GUI"));
connect(_aboutAct, SIGNAL(triggered()), this, SLOT(about()));
......@@ -153,42 +164,70 @@ void
MainWindow::doneLoading(Msrun * msrun) {
QString filename = (msrun->getXmlFileInfo()).filePath();
_masschroq_gui->addMsrun(filename, msrun);
this->statusBar()->showMessage(QObject::tr("MS run '%1' loaded").arg(filename), 4000);
QString sfilename = strippedFilename(filename);
this->statusBar()->showMessage(QObject::tr("MS run '%1' loaded").arg(sfilename), 4000);
this->setPlotAreaTitle(filename);
delete _runningBarr;
this->statusBar()->showMessage(QObject::tr("Current working MS run is '%1'").arg(sfilename));
}
void
MainWindow::extractXicWidget() {
QDockWidget * dock = new QDockWidget(tr("XIC extraction"), this);
XicSelectionWidget * xic = new XicSelectionWidget(dock);
dock->setWidget(xic);
addDockWidget(Qt::LeftDockWidgetArea, dock);
connect(xic, SIGNAL(extract(XicSelectionWidget *)), this, SLOT(extractXic(XicSelectionWidget *)));
QDockWidget * dock = new QDockWidget(tr("XIC extraction"), this);
addDockWidget(Qt::LeftDockWidgetArea, dock);
XicSelectionWidget * xic = new XicSelectionWidget(dock);
connect(xic, SIGNAL(extract(XicSelectionWidget *)), this, SLOT(extractXic(XicSelectionWidget *)));
dock->setWidget(xic);
}
void
MainWindow::extractXic(XicSelectionWidget * xic_widget) {
XicProfile * xic_profile = new XicProfile();
connect(xic_profile, SIGNAL(created(XicProfile *)), this, SLOT(plotNewXic(XicProfile *)));
_xic_profiles.push_back(xic_profile);
// _xic_profiles.push_back(xic_profile);
_current_xic_profile = xic_profile;
_masschroq_gui->extractXicProfile(xic_profile, _current_msrun_file, xic_widget);
}
void
MainWindow::filterBackgroundWidget() {
QDockWidget * dock = new QDockWidget(tr("Background noise filter"), this);
addDockWidget(Qt::LeftDockWidgetArea, dock);
FilterBackgroundWidget * backgroundFilter = new FilterBackgroundWidget(dock);
connect(backgroundFilter, SIGNAL(filter(FilterBackgroundWidget *)),
this, SLOT(filterBackgroundXic(FilterBackgroundWidget *)));
dock->setWidget(backgroundFilter);
}
void
MainWindow::plotNewXic(XicProfile * xic_profile) {
_plot_area->clear();
_plot_area->addPlot(xic_profile);
MainWindow::filterBackgroundXic(FilterBackgroundWidget * fback_widget) {
filterBackground * f_back = new filterBackground();
f_back->set_half_median_window_length(fback_widget->getMedianHalfWindow());
f_back->set_half_min_max_window_length(fback_widget->getMinMaxHalfWindow());
// _masschroq_gui->applyFilterToXicProfile(_current_xic_profile, f_back);
}
void
MainWindow::filterXic() {
MainWindow::filterSpikeWidget() {
}
void
MainWindow::filterSpikeXic(/*FilterSpikeWidget * fspike_widget*/) {
}
void
MainWindow::plotNewXic(XicProfile * xic_profile) {
_plot_area->clear();
_plot_area->addPlot(xic_profile);
}
void MainWindow::about() {
QMessageBox::about(this, tr("About MassChroQ"),
tr("This is <b>MassChroQ GUI</b> version beta."));
......
......@@ -36,6 +36,7 @@
#include "plot.h"
#include "runningBarr.h"
#include "msrunLoaderThread.h"
#include "filterBackgroundWidget.h"
class MainWindow : public QMainWindow
{
......@@ -53,7 +54,10 @@ public:
void extractXicWidget();
void extractXic(XicSelectionWidget * xic);
void plotNewXic(XicProfile * xic_profile);
void filterXic();
void filterBackgroundWidget();
void filterBackgroundXic(FilterBackgroundWidget * fb);
void filterSpikeWidget();
void filterSpikeXic(/* FilterSpikeWidget *fs*/);
void about();
void doneLoading(Msrun * msrun);
......@@ -81,28 +85,30 @@ private:
//QListWidget * filtersList;
//QListWidget * quantiItemsList;
MasschroqGui * _masschroq_gui;
Plot * _plot_area;
/// Menus
QMenu * _fileMenu;
QMenu * _toolsMenu;
QMenu * _filtersMenu;
QMenu * _helpMenu;
//QToolBar * fileToolbar;
//QToolBar * toolsToolbar;
/// Menu actions
QAction * _loadMsrunAct;
QAction * _extractXicAct;
QAction * _applyFilterAct;
QAction * _filterBackgroundAct;
QAction * _filterSpikeAct;
QAction * _aboutAct;
QAction * _quitAct;
MasschroqGui * _masschroq_gui;
RunningBarr * _runningBarr;
MsrunLoaderThread _msrun_loader_thread;
QString _current_msrun_file;
std::vector<XicProfile *> _xic_profiles;
// std::vector<XicProfile *> _xic_profiles;
XicProfile * _current_xic_profile;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment