GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QGoMainWindow.h
Go to the documentation of this file.
1 /*=========================================================================
2  Authors: The GoFigure Dev. Team.
3  at Megason Lab, Systems biology, Harvard Medical school, 2009-11
4 
5  Copyright (c) 2009-11, President and Fellows of Harvard College.
6  All rights reserved.
7 
8  Redistribution and use in source and binary forms, with or without
9  modification, are permitted provided that the following conditions are met:
10 
11  Redistributions of source code must retain the above copyright notice,
12  this list of conditions and the following disclaimer.
13  Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16  Neither the name of the President and Fellows of Harvard College
17  nor the names of its contributors may be used to endorse or promote
18  products derived from this software without specific prior written
19  permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33 =========================================================================*/
34 
35 #ifndef __QGoMainWindow_h
36 #define __QGoMainWindow_h
37 
38 #include <QMainWindow>
39 #include <QDir>
40 
41 // #include "itkImage.h"
42 // #include "itkImageToVTKImageFilter.h"
43 
44 #include "itkQtProgressBar.h"
45 #include "itkQtAdaptor.h"
46 
49 #include "QGoAboutWidget.h"
51 #include "QGoTabImageView3DwT.h"
52 
53 class vtkImageData;
54 
55 class vtkLSMReader;
56 
57 class QGoWizardDB;
58 class QGoTabManager;
59 class QGoTabImageView3D;
60 class QGoTabImageView2D;
61 class QGoTabElementBase;
63 
64 #include "ui_go.h"
65 
72  private Ui::go_mainwindow
73 {
74  Q_OBJECT
75 public:
76  friend class QGoTabManager;
77 
78 // typedef itk::Image< unsigned char, 3 > ImageType;
79 // typedef itk::ImageToVTKImageFilter< ImageType > VTKConvertImageType;
80 // typedef VTKConvertImageType::Pointer VTKConvertImagePointer;
81 
82 // typedef itk::MultiFileReader::FILETYPE FILETYPE;
83 
84  explicit QGoMainWindow(QWidget *iParent = 0, Qt::WindowFlags iFlags = 0);
86 
87  void SetSingleFileName(const QString & iFileName);
88 
89  void SetMaxNumberOfTraces( unsigned int iN );
90 
91 private slots:
93 
94  void openRecentSingleFile();
95 
96 // void on_actionOpen_Multiple_Files_triggered( );
98 
100 
101  void openRecentDatabaseFile();
102 
103  void openRecentFilesfromDB();
104 
106 
108 
110 
112 
114 
115  void openFilesfromDB();
116 
121 
123 
125 
127 
129 
131 
132  void SetUpDatabase();
133 
135 
136  void DisplayUpdateResults(QString result, bool noerror);
137 
138  void ApplyImageFilter();
139 
140  void tobedone(std::vector< vtkImageData * > );
141 
146 
151  void AddSetUpDatabaseMenu();
152 
153 private:
154 
155  std::map< GoFigure::TabDimensionType, std::list< QAction * > >
157 
159  void openRecentFile(const bool & IsSerie);
160 
161  void DisplayFilesfromDB(std::string iFirst_Filename);
162 
164  void SetCurrentSingleFile(const QString & fileName);
165 
166  void SetCurrentMultiFile(const QString & fileName);
167 
168  void SetCurrentDatabaseFile(const QString & fileName);
169 
171  enum { MaxRecentFiles = 5 };
175 
176  void UpdateRecentFileActions(QStringList list, QMenu * menu,
177  QAction * recentFileActions[MaxRecentFiles]);
178 
190  const GoFigure::FileType & iFileType,
191  const std::string & iHeader,
192  const int & iTimePoint,
193  const bool & iUseDatabase);
194 
201  vtkLSMReader *iReader, const QString & iFile);
202 
203  QGoTabImageView3D * CreateNewTabFor3DImage(vtkImageData *, const QString &);
204 
205  QGoTabImageView2D * CreateNewTabFor2DImage(vtkImageData *, const QString &);
206 
207  /* \brief Open Image with given iFileName
208  \param[in] iFileName */
209 // void OpenImageWithITK( const QString& iFileName );
210 
215  void OpenLSMImage(const QString & iFile, const int & iTimePoint);
216 
218 
220 
222 
231  std::string & ioHeader_Filename,
232  std::string iFirstFileName);
233 
237  void LoadAllTracesFromDatabaseManager(const int & iT);
238 
242  //void LoadAllTracesFromDatabase(const int & iT, const std::string & iTrace);
243 
244  void LoadContoursFromDatabase(const int & iT );
245  void LoadMeshesFromDatabase(const int & iT);
246  void LoadTracksFromDatabase(const int & iT);
247 
255  bool ComputeFileType(const QString & iFileName, GoFigure::FileType & oFileType);
256 
257  void LoadPlugins();
258 
259  void PopulateMenus(QObject *plugin);
260 
261  void AddToMenu(QObject *, const QStringList &, QMenu *,
262  const char *, QActionGroup *);
263 
272  std::list< vtkLSMReader * > m_LSMReader;
276 
279 
281  void ReadSettings();
282 
284  void WriteSettings();
285 
287 
291 
298 
301 
303  QString strippedName(const QString & fullFileName);
304 
305 private:
306  unsigned int m_MaxNumberOfTraces;
308 };
309 #endif