Vespucci  1.0.0
thresholddialog.cpp
Go to the documentation of this file.
2 #include "ui_thresholddialog.h"
3 
4 ThresholdDialog::ThresholdDialog(QWidget *parent, QSharedPointer<VespucciWorkspace> ws, const QString &dataset_key) :
5  QDialog(parent),
6  ui(new Ui::ThresholdDialog)
7 {
8  ui->setupUi(this);
9  dataset_ = ws->GetDataset(dataset_key);
10  workspace_ = ws;
11 }
12 
14 {
15  delete ui;
16 }
17 
18 void ThresholdDialog::on_buttonBox_accepted()
19 {
20  QString method = ui->methodComboBox->currentText();
21  QString behavior = ui->behaviorComboBox->currentText();
22  double threshold = ui->thresholdDoubleSpinBox->value();
23  try{
24  if (method == "Reject Maximum Above Threshold"){
25  if (behavior == "Delete")
26  dataset_->RemoveClippedSpectra(threshold);
27  if (behavior == "Zero")
28  dataset_->ZeroClippedSpectra(threshold);
29  }
30  if (method == "Reject Minimum Below Threshold"){
31  if (behavior == "Delete")
32  dataset_->RemoveFlatSpectra(threshold);
33  if (behavior == "Zero")
34  dataset_->ZeroFlatSpectra(threshold);
35  }
36  }
37  catch(exception e){
38  workspace_->main_window()->DisplayExceptionWarning(e);
39  }
40 }
41 
42 void ThresholdDialog::on_comboBox_currentTextChanged(const QString &arg1)
43 {
44  if (arg1 == "Reject Maximum Above Threshold"){
45  ui->thresholdDoubleSpinBox->setValue(100);
46  }
47  else{
48  ui->thresholdDoubleSpinBox->setValue(64000);
49  }
50 }
ThresholdDialog(QWidget *parent, QSharedPointer< VespucciWorkspace > ws, const QString &dataset_key)
Definition: ahcadialog.h:26