iRoCS Toolbox  1.1.0
LabellingMainWidget.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * This file belongs to the iRoCS Toolbox.
4  *
5  * Copyright (C) 2015 Thorsten Falk
6  *
7  * Image Analysis Lab, University of Freiburg, Germany
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  **************************************************************************/
24 
25 #ifndef LABELLINGMAINWIDGET_HH
26 #define LABELLINGMAINWIDGET_HH
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.hh>
30 #endif
31 
32 #include <QtGui/QMainWindow>
33 #include <QtCore/QMap>
34 
35 #include "StreamBufTextEditQt4.hh"
37 
38 class QDockWidget;
39 class QTextEdit;
40 
41 class MultiChannelModel;
42 class OrthoViewWidget;
44 class PluginInterface;
45 
46 #include "Marker.hh"
47 
48 #ifdef _WIN32
49  #if defined(Labelling_qt4_EXPORTS)
50  #define LABELLING_QT4_API __declspec(dllexport)
51  #elif defined(Labelling_qt4_USE_DLL)
52  #define LABELLING_QT4_API __declspec(dllimport)
53  #else
54  #define LABELLING_QT4_API
55  #endif
56 #else
57  #define LABELLING_QT4_API
58 #endif
59 
60 class LABELLING_QT4_API LabellingMainWidget : public QMainWindow
61 {
62 
63  Q_OBJECT
64 
65 public:
66 
67  static std::string const __labellingVersionString;
68 
70  size_t memoryLimit, std::string const &fileName = "",
71  bool forceImport = false, QWidget* parent = 0);
73 
74  MultiChannelModel* multiChannelModel();
75  OrthoViewWidget* orthoView();
76  OpenGlRenderingViewWidget* openGlRenderingView();
77 
78  const std::string& fileName() const;
79 
80  void runPlugin(
81  QString const &name, std::map<std::string,std::string> const &parameters);
82 
83  bool closeProjectInteractive();
84 
85  iRoCS::ProgressReporterQt4 *progressReporter();
86 
87 public slots:
88 
89  void open();
90  void save();
91  void saveAs();
92  void exportToSVG();
93  void exportToAnalyzeAndSTL();
94  void closeProject();
95  void createAnnotationChannel();
96  void createAnnotationChannel(Marker::MarkerType mtype);
97  void importChannels();
98  void importCSVMarkers();
99  void exportCSVMarkers();
100  void showChannelControlWidget(bool show);
101  void showInfoWidget(bool show);
102  void showOpenGlWidget(bool show);
103  void showLogWidget(bool show);
104  void showDebugWidget(bool show);
105  void setInterpolation(bool interpolation);
106  void snapToVoxelGrid(bool snap);
107  void showHelperLines(bool show);
108  void setPluginFolder();
109  void runPlugin(QAction* action);
110 
111  void about();
112 
113  void setUserInteractionEnabled(bool enable);
114 
115  void showError(const QString& message);
116 
117  size_t memoryLimit() const;
118 
119 private:
120 
121  void searchPlugins();
122 
123  std::string getOpenFileName();
124  std::string getSaveFileName();
125 
126  void closeEvent(QCloseEvent*);
127  void resizeEvent(QResizeEvent*);
128 
129  std::string _initialFileName;
130 
131  size_t _memoryLimit;
132  std::string _fileName;
133 
134  QMenu* p_fileMenu;
135  QMenu* p_channelMenu;
136  QMenu* p_viewMenu;
137  QMenu* p_pluginMenu;
138  QMenu* p_helpMenu;
139 
140  MultiChannelModel *p_multiChannelModel;
141  OrthoViewWidget *p_orthoView;
142  OpenGlRenderingViewWidget *p_openGlView;
143 
144  QDockWidget* p_channelControlDockWidget;
145  QDockWidget* p_infoDockWidget;
146 
147  StreamBufTextEditQt4* p_logBuffer;
148  std::streambuf *p_origCoutBuffer;
149  QDockWidget* p_logWidget;
150  QTextEdit* p_logTextEdit;
151 
152  StreamBufTextEditQt4* p_debugBuffer;
153  std::streambuf *p_origCerrBuffer;
154  QDockWidget* p_debugWidget;
155  QTextEdit* p_debugTextEdit;
156 
157  QList<QAction*> _plugins;
158  std::list<PluginInterface*> _pluginsRunning;
159 
160  QProgressBar *p_progressBar;
161  iRoCS::ProgressReporterQt4 *p_progressReporter;
162 
163 };
164 
165 #endif
static std::string const __labellingVersionString
void open(blitz::Array< DataT, Dim > const &data, blitz::Array< DataT, Dim > &result, std::vector< blitz::TinyVector< BlitzIndexT, Dim > > const &strel, iRoCS::ProgressReporter *progress=NULL)
Morphological opening.
MarkerType
Marker.hh "liblabelling_qt4/Marker.hh".
Definition: Marker.hh:73
#define LABELLING_QT4_API
The abstract plugin interface all plugins must inherit from.