MorphoGraphX
TransferFunctionDlg.hpp
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2015 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 #ifndef TRANSFERFUNCTIONDLG_HPP
12 #define TRANSFERFUNCTIONDLG_HPP
13 
14 #include <Config.hpp>
15 
16 #include <QStringList>
17 #include <QList>
18 
19 #include <ui_TransferFunctionDlg.h>
20 
21 class QAbstractButton;
22 
23 namespace mgx {
24 namespace gui {
25 class mgx_EXPORT TransferFunctionDlg : public QDialog {
26  Q_OBJECT
27 public:
28  TransferFunctionDlg(QWidget* parent = 0, Qt::WindowFlags f = 0);
29  virtual ~TransferFunctionDlg();
30 
31  const TransferFunction& transferFunction() const;
32 
33 public slots:
34  void loadSettings(bool changeFunction = true);
35  void saveSettings();
36  void setTransferFunction(const TransferFunction& fct);
37  void setDefaultTransferFunction(const TransferFunction& fct);
38  void setStickers(const std::vector<double>& pos);
39  void changeHistogram(const std::vector<double>& h);
40  void changeBounds(const std::pair<double, double>& bounds);
41  void apply();
42  void reset();
43  void accept();
44  void reject();
45  int exec();
46 
47 signals:
48  void changedTransferFunction(const TransferFunction& fct);
49  void appliedTransferFunction(const TransferFunction& fct);
50 
51 protected slots:
52  void changeTransferFunction(const QString& name);
53  void changeTransferFunction(const TransferFunction& fct);
54  void on_useChecks_toggled(bool on);
55  void on_useWhite_toggled(bool on);
56  void on_useBlack_toggled(bool on);
57  void on_useRGB_toggled(bool on);
58  void on_useHSV_toggled(bool on);
59  void on_useCyclicHSV_toggled(bool on);
60  void on_selectSelectionColor_clicked();
61  void on_functionList_currentIndexChanged(const QString& name);
62  void on_exportFunction_clicked();
63  void on_importFunction_clicked();
64  void on_saveFunction_clicked();
65  void on_renameFunction_clicked();
66  void on_deleteFunction_clicked();
67  void resetFunctionList();
68  void on_buttonBox_clicked(QAbstractButton* btn);
69 
70 protected:
71  QColor getColor(QWidget* w);
72  void setColor(QWidget* w, const QColor& col);
73  bool changeColor(QWidget* w);
74 
75  TransferFunction current, default_fct;
76  Ui::TransferFunctionDlg ui;
77  QStringList fct_names;
79 };
80 } // namespace gui
81 } // namespace mgx
82 #endif // TRANSFERFUNCTIONDLG_HPP
Definition: TransferFunctionDlg.hpp:25
This namespace contains all the API of MorphoGraphX.
Definition: Assert.hpp:26
Class defining a transfer function as linear interpolation between set values.
Definition: TransferFunction.hpp:33