Vespucci  1.0.0
booleanizedialog.cpp
Go to the documentation of this file.
2 #include "ui_booleanizedialog.h"
3 
4 BooleanizeDialog::BooleanizeDialog(QWidget *parent, QSharedPointer<VespucciWorkspace> ws, const QString &dataset_key) :
5  QDialog(parent),
6  ui(new Ui::BooleanizeDialog)
7 {
8  ui->setupUi(this);
9 
10  workspace_ = ws;
11  dataset_ = workspace_->GetDataset(dataset_key);
12  //not encapsulated, but this is basically research code anyway...
13  ui->minDoubleSpinBox->setValue(dataset_->spectra_ptr()->min());
14  ui->maxDoubleSpinBox->setValue(dataset_->spectra_ptr()->max());
15 
16 
17 }
18 
20 {
21  delete ui;
22 }
23 
24 void BooleanizeDialog::on_behaviorComboBox_currentIndexChanged(const QString &arg1)
25 {
26  if (arg1 == "Set Values out of Range to Maximum (clamp)")
27  ui->oneifyCheckBox->setEnabled(false);
28  else
29  ui->oneifyCheckBox->setEnabled(true);
30 
31 
32 }
33 
34 void BooleanizeDialog::on_buttonBox_accepted()
35 {
36  double min = std::min(ui->minDoubleSpinBox->value(), ui->maxDoubleSpinBox->value());
37  double max = std::max(ui->minDoubleSpinBox->value(), ui->maxDoubleSpinBox->value());
38  bool oneify = ui->oneifyCheckBox->isChecked();
39 
40  if (ui->behaviorComboBox->currentText() == "Set Values out of Range to Maximum (clamp)")
41  dataset_->Clamp(min, max);
42  else if (ui->behaviorComboBox->currentText() == "Set Values out of Range to Zero")
43  dataset_->Booleanize(min, max, true, oneify);
44  else
45  dataset_->Booleanize(min, max, false, oneify);
46 
47 }
48 
49 void BooleanizeDialog::on_buttonBox_rejected()
50 {
51  dataset_.clear();
52  close();
53 }
Definition: ahcadialog.h:26
VESPUCCI_EXPORT arma::uword max(arma::uword a, arma::uword b)
Vespucci::Math::max.
Definition: accessory.cpp:237
VESPUCCI_EXPORT arma::uword min(arma::uword a, arma::uword b)
Vespucci::Math::min.
Definition: accessory.cpp:249
BooleanizeDialog(QWidget *parent, QSharedPointer< VespucciWorkspace > ws, const QString &dataset_key)