Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef QMITKLEVELWINDOWPRESETDEFINITIONDIALOG_H_
00019 #define QMITKLEVELWINDOWPRESETDEFINITIONDIALOG_H_
00020
00021 #include "ui_QmitkLevelWindowPresetDefinition.h"
00022
00023 #include <QDialog>
00024 #include <QSortFilterProxyModel>
00025
00026 #include <map>
00027 #include <string>
00028
00029 #include <mitkCommon.h>
00030
00031 class QMITK_EXPORT QmitkLevelWindowPresetDefinitionDialog : public QDialog, public Ui::QmitkLevelWindowPresetDefinition
00032 {
00033 Q_OBJECT
00034
00035 public:
00036
00037 QmitkLevelWindowPresetDefinitionDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
00038 ~QmitkLevelWindowPresetDefinitionDialog();
00039
00040 void setPresets(std::map<std::string, double>& level, std::map<std::string, double>& window, QString initLevel, QString initWindow);
00041
00042 std::map<std::string, double> getLevelPresets();
00043
00044 std::map<std::string, double> getWindowPresets();
00045
00046 protected slots:
00047
00048 void addPreset();
00049 void removePreset();
00050 void changePreset();
00051
00052 void ListViewSelectionChanged(const QItemSelection&, const QItemSelection&);
00053 void sortPresets(int index);
00054
00055
00056 protected:
00057
00058 class PresetTableModel : public QAbstractTableModel
00059 {
00060
00061 public:
00062
00063 struct Entry {
00064 std::string name;
00065 double level;
00066 double window;
00067
00068 Entry(const std::string& n, double l, double w)
00069 : name(n), level(l), window(w) {}
00070 };
00071
00072 PresetTableModel(std::map<std::string, double>& levels,
00073 std::map<std::string, double>& windows,
00074 QObject* parent = 0);
00075
00076 int rowCount(const QModelIndex&) const;
00077 int columnCount(const QModelIndex&) const;
00078 QVariant data(const QModelIndex& index, int) const;
00079
00080 QVariant headerData(int section, Qt::Orientation orientation, int) const;
00081
00082 void addPreset(std::string& name, double level, double window);
00083 void removePreset(const QModelIndex&);
00084 void changePreset(int row, std::string& name, double level, double window);
00085
00086 void getLevels(std::map<std::string, double>& levels);
00087 void getWindows(std::map<std::string, double>& windows);
00088
00089 bool contains(std::string& name);
00090
00091 Entry getPreset(const QModelIndex&) const;
00092
00093 private:
00094
00095 std::vector<Entry> m_Entries;
00096
00097 };
00098
00099 void resizeEvent(QResizeEvent* event);
00100 void showEvent(QShowEvent* event);
00101
00102 void resizeColumns();
00103
00104 PresetTableModel* m_TableModel;
00105 QSortFilterProxyModel m_SortModel;
00106 };
00107
00108 #endif