GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QGoMainWindow.cxx
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 #include "QGoMainWindow.h"
36 #include "QGoTabElementBase.h"
37 #include "QGoTabImageView2D.h"
38 #include "QGoTabImageView3D.h"
39 #include "QGoTabImageView3DwT.h"
40 #include "QGoPrintDatabase.h"
41 #include "QGoNetworkUtilities.h"
42 
43 #include "ContourMeshContainer.h"
44 
45 // Plugin stuff
46 #include "QGoPluginHelper.h"
48 
49 #include <iostream>
50 #include <set>
51 
52 // Qt includes
53 #include <QDir>
54 #include <QDesktopServices>
55 #include <QDesktopWidget>
56 #include <QUrl>
57 #include <QFileDialog>
58 #include <QMessageBox>
59 #include <QDialog>
60 #include <QPluginLoader>
61 #include <QSettings>
62 #include <QFileInfo>
63 #include <QDir>
64 #include <QScrollArea>
65 #include <QTextStream>
66 
67 // Qt Dialog Box
69 
70 // itk includes
71 #include "itkImageFileReader.h"
72 
73 #include "itkMegaCaptureImport.h"
74 
75 // vtk includes
76 #include "vtkLSMReader.h"
77 #include "vtkPLYReader.h"
78 
79 #include "vtkImageData.h"
80 #include "vtkImageReader2Factory.h"
81 #include "vtkImageReader2.h"
82 #include "vtkSmartPointer.h"
83 
84 #include "QGoTabManager.h"
85 #include "QGoWizardDB.h"
86 
87 #include <list>
88 
89 //--------------------------------------------------------------------------
91  QMainWindow(iParent, iFlags), m_ViewToolBar(NULL), m_ModeToolBar(NULL),
92  m_TracesToolBar(NULL), m_TraceSettingsToolBar(NULL),
93  m_MaxNumberOfTraces(5000)
94 {
95  QString title("<*)0|00|0>< ~~ <*)0|00|0>< GoFigure ><0|00|0(*> ~~ ><0|00|0(*>");
96 
97  this->setupUi(this);
98  setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
99  setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
100  setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
101  setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
102 
104  int numberOfScreens = QApplication::desktop()->numScreens();
105  QSize MaximumSize = screen.size() * numberOfScreens;
106  this->setMaximumSize(MaximumSize);
107  // QSize IconSize = this->iconSize();
108  QSize SizeIcon(22, 22);
109  this->setIconSize(SizeIcon);
110  //QSize IconSize = this->iconSize();
111 
112  this->setCentralWidget(this->CentralTabWidget);
113 
114  this->setWindowTitle(title);
115  this->statusbar->showMessage( tr("No data") );
116 
117  this->CentralTabWidget->clear();
118  this->CentralTabWidget->setTabsClosable(true);
119  this->CentralTabWidget->setMovable(true);
120 
121  this->statusbar->addPermanentWidget(&m_Bar);
122 
123  m_TabManager = new QGoTabManager(this, this->CentralTabWidget);
124  /*this->m_ViewToolBar = new QToolBar(tr("View"), this);
125  this->m_ViewToolBar->setObjectName( tr("View") );
126  this->addToolBar(Qt::TopToolBarArea, this->m_ViewToolBar);
127 
128  this->m_ModeToolBar = new QToolBar(tr("Mode"), this);
129  this->m_ModeToolBar->setObjectName( tr("Mode") );
130  this->addToolBar(Qt::TopToolBarArea, this->m_ModeToolBar);
131 
132  this->m_TracesToolBar = new QToolBar(tr("Tools For Traces"), this);
133  this->m_TracesToolBar->setObjectName( tr("Traces") );
134  this->addToolBar(Qt::TopToolBarArea, this->m_TracesToolBar);
135 
136  this->m_TraceSettingsToolBar = new QToolBar(tr("Settings For the Trace"), this);
137  this->m_TraceSettingsToolBar->setObjectName(tr("TraceSettingsToolBar"));
138  this->addToolBar(Qt::TopToolBarArea, this->m_TraceSettingsToolBar);*/
139 
140 // m_LSMReader = vtkLSMReader::New();
141  m_DBWizard = new QGoWizardDB(this);
142  m_DBWizard->hide();
143 
145  this->m_AboutWidget->hide();
146 
147  m_Bar.hide();
148  QString temp;
149  SetCurrentSingleFile(temp);
150  SetCurrentMultiFile(temp);
152  //temp:
153  this->actionExportMesh->setVisible(false);
154  this->actionExportLineage->setVisible(false);
155  this->actionExportTrack->setVisible(false);
156  this->actionImportMesh->setVisible(false);
157  this->actionImportTrack->setVisible(false);
158  this->actionImportLineage->setVisible(false);
159 
161 
163  ReadSettings();
164 
165  // Updates -------------------------------
167  SIGNAL( CheckForUpdatesDone(QString, bool) ),
168  this,
169  SLOT( DisplayUpdateResults(QString, bool) ) );
170 
171  m_ManualUpdate = false;
172 
174  // ---------------------------------------
175  if ( !this->m_DatabaseSetUp )
176  {
177  this->AddSetUpDatabaseMenu();
178  }
179  else
180  {
181  QObject::connect( this->m_DBWizard, SIGNAL ( NoGofigureDatabase () ),
182  this, SLOT( AddSetUpDatabaseMenu() ) );
183  }
184  // LoadPlugins();
185 }
186 
187 //--------------------------------------------------------------------------
189 {
190  // clear will call destructor on all of the element in the list
191  // what is the point of the list?
192  if(this->m_LSMReader.back())
193  {
194  this->m_LSMReader.back()->Delete();
195  }
196  this->WriteSettings();
197  delete m_TabManager;
198  delete m_DBWizard;
199  delete m_AboutWidget;
200 }
201 
202 //--------------------------------------------------------------------------
203 void
205 {
206  if( iN != 0 )
207  {
208  this->m_MaxNumberOfTraces = iN;
209  }
210  else
211  {
212  this->m_MaxNumberOfTraces = std::numeric_limits< unsigned int >::max();
213  }
214 }
215 
216 
217 //--------------------------------------------------------------------------
219 {
220  //QObject::connect( this->actionOpen, SIGNAL( triggered( ) ),
221  //this, SLOT( showprogressloading() ) );
222  QObject::connect( this->CentralTabWidget,
223  SIGNAL( tabCloseRequested(int) ),
224  m_TabManager, SLOT( CloseTab(int) ) );
225 
226  QObject::connect( this->CentralTabWidget,
227  SIGNAL( currentChanged(int) ),
228  m_TabManager, SLOT( ChangeCurrentTab(int) ) );
229 
230  QObject::connect( &m_SignalAdaptor, SIGNAL( Signal() ),
231  &( this->m_Bar ), SLOT( hide() ) );
232 
233  for ( int i = 0; i < MaxRecentFiles; ++i )
234  {
235  recentSingleFileActions[i] = new QAction(this);
237  QObject::connect( this->recentSingleFileActions[i], SIGNAL( triggered() ),
238  this, SLOT( openRecentSingleFile() ) );
239 
240  recentMultipleFileActions[i] = new QAction(this);
242  QObject::connect( this->recentMultipleFileActions[i], SIGNAL( triggered() ),
243  this, SLOT( openRecentMultipleFile() ) );
244 
245  recentDatabaseFileActions[i] = new QAction(this);
247  QObject::connect( recentDatabaseFileActions[i], SIGNAL( triggered() ),
248  this, SLOT( openRecentDatabaseFile() ) );
249  }
250 
251  QObject::connect( m_DBWizard, SIGNAL( accepted() ),
252  this, SLOT( openFilesfromDB() ) );
253 }
254 
255 //--------------------------------------------------------------------------
257 {
259  this,
260  tr("Select Image"), "",
261  tr("Images (*.png *.bmp *.jpg *.jpeg *.tiff *.tif *.mha *.mhd *.img *.lsm)")
262  );
263 
264  if ( !filename.isEmpty() )
265  {
266  this->SetSingleFileName(filename);
267  }
268 }
269 
270 //--------------------------------------------------------------------------
271 
272 //--------------------------------------------------------------------------
274 {
276  this,
277  tr("Select One Image from the Dataset"), "",
278  tr("Images (*.png *.tif *.tiff *.jpg *.jpeg)")
279  );
280 
281  if ( !filename.isEmpty() )
282  {
283  if ( QFile::exists(filename) )
284  {
285  itk::MegaCaptureImport::Pointer importer = itk::MegaCaptureImport::New();
286  importer->SetFileName( filename.toStdString() );
287 
288  try
289  {
290  importer->Update();
291  }
292  catch ( ... )
293  {
294  QMessageBox::critical( NULL, tr("Error"),
295  tr("Error while trying to read this Megacatpure") );
296  return;
297  }
298 
299  GoFigure::FileType filetype;
300 
301  if ( !ComputeFileType(filename, filetype) )
302  {
303  return;
304  }
305  int TimePoint = importer->GetOutput().get< m_TCoord >().begin()->m_TCoord;
306 
307  CreateNewTabFor3DwtImage(importer->GetOutput(), filetype,
308  importer->GetHeaderFilename(), TimePoint,
309  false); // do not use the database
310  }
311  }
312 }
313 
314 //--------------------------------------------------------------------------
316 {
317  if ( !m_DBWizard->isVisible() )
318  {
320  m_DBWizard->show();
321  m_DBWizard->restart();
322  }
323 }
324 
325 //--------------------------------------------------------------------------
326 
327 bool
329 {
330  QString extension = QFileInfo(iFileName).suffix();
331 
332  if ( extension.compare("png", Qt::CaseInsensitive) == 0 )
333  {
334  oFileType = GoFigure::PNG;
335  return true;
336  }
337  else
338  {
339  if ( ( extension.compare("tif", Qt::CaseInsensitive) == 0 )
340  || ( extension.compare("tiff", Qt::CaseInsensitive) == 0 ) )
341  {
342  oFileType = GoFigure::TIFF;
343  return true;
344  }
345  else
346  {
347  if ( ( extension.compare("jpg", Qt::CaseInsensitive) == 0 )
348  || ( extension.compare("jpeg", Qt::CaseInsensitive) == 0 ) )
349  {
350  oFileType = GoFigure::JPEG;
351  return true;
352  }
353  else
354  {
355  std::cerr << "file not supported for megacapture!!!" << std::endl;
356  return false;
357  }
358  }
359  }
360 }
361 
362 //--------------------------------------------------------------------------
363 
364 //--------------------------------------------------------------------------
366 {
367  if ( this->m_DBWizard->GetIsAnOpenRecentFile() )
368  {
369  this->openRecentFilesfromDB();
370  }
371  else
372  {
373  std::string temp = "";
374  this->DisplayFilesfromDB(temp);
377  }
378 }
379 
380 //--------------------------------------------------------------------------
381 
382 //--------------------------------------------------------------------------
383 void QGoMainWindow::DisplayFilesfromDB(std::string iFirst_Filename)
384 {
385  std::string Header_FileName;
388  Header_FileName, iFirst_Filename);
389 
390  if ( file_container.size() == 0 )
391  {
392  std::cout << "GoFigureFileInfoHelperMultiIndexContainer empty ";
393  std::cout << "Debug: In " << __FILE__ << ", line " << __LINE__;
394  std::cout << std::endl;
395  return;
396  }
397  GoFigureFileInfoHelperMultiIndexContainer::iterator
398  temp_it = file_container.begin();
399 
400  QString temp_filename = QString::fromStdString(temp_it->m_Filename);
401 
402  GoFigure::FileType filetype;
403 
404  if ( !ComputeFileType(temp_filename, filetype) )
405  {
406  return;
407  }
408 
409  // note: do not need to call w3t->Update(); since it is internally called
410  // when using CreateNewTabFor3DwtImage
411  int TimePoint = file_container.get< m_TCoord >().begin()->m_TCoord;
412 
413  QGoTabImageView3DwT *w3t =
414  CreateNewTabFor3DwtImage(file_container,
415  filetype, Header_FileName, TimePoint,
416  true); // Use the database
417 
418  QObject::connect( w3t, SIGNAL( UpdateBookmarkOpenActions(std::vector< QAction * > ) ),
419  this->m_TabManager, SLOT( UpdateBookmarkMenu(std::vector< QAction * > ) ) );
420 
421  // Load all traces
423  // Show contour/mesh for given T point
424  w3t->ShowTraces(TimePoint);
425 
426  this->menuBookmarks->setEnabled(true);
427  //this->addToolBar(w3t->GetTraceSettingsToolBar() );
428 }
429 
430 //--------------------------------------------------------------------------
431 
432 //--------------------------------------------------------------------------
433 void
435 {
436  QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
437 
438 #ifdef HAS_OPENMP
439 #pragma omp sections nowait
440 #endif
441  {
442 #ifdef HAS_OPENMP
443 #pragma omp section
444 #endif
445  {
446  // Loads contours
448  }
449 #ifdef HAS_OPENMP
450 #pragma omp section
451 #endif
452  {
453  // Loads meshes
455  }
456 #ifdef HAS_OPENMP
457 #pragma omp section
458 #endif
459  {
460  // Loads tracks
462  }
463  }
464 
466 }
467 
468 //--------------------------------------------------------------------------
469 
470 //--------------------------------------------------------------------------
471 void
473 {
474  QGoTabImageView3DwT *w3t =
475  dynamic_cast< QGoTabImageView3DwT * >( this->CentralTabWidget->currentWidget() );
476 
477  if ( w3t )
478  {
480  }
481 }
482 
483 //--------------------------------------------------------------------------
484 
485 //--------------------------------------------------------------------------
486 void
488 {
489  QGoTabImageView3DwT *w3t =
490  dynamic_cast< QGoTabImageView3DwT * >( this->CentralTabWidget->currentWidget() );
491 
492  if ( w3t )
493  {
495  }
496 }
497 
498 //--------------------------------------------------------------------------
499 
500 //--------------------------------------------------------------------------
501 void
503 {
507  (void)iT;
508 
509  QGoTabImageView3DwT *w3t =
510  dynamic_cast< QGoTabImageView3DwT * >( this->CentralTabWidget->currentWidget() );
511 
512  if ( w3t )
513  {
514  TrackContainer *temp = w3t->GetTrackContainer();
515  temp->setTimeInterval( w3t->GetTimeInterval() );
516 
517  if ( temp )
518  {
519  // let's iterate on the container with increasing TraceID
520  typedef TrackContainer::MultiIndexContainerType::index< TraceID >::type::iterator
521  TrackContainerIterator;
522 
523  TrackContainerIterator track_list_it = temp->m_Container.get< TraceID >().begin();
524  TrackContainerIterator track_list_end = temp->m_Container.get< TraceID >().end();
525 
526  size_t nb_tracks = temp->m_Container.get< TraceID >().size();
527 
528  QProgressDialog progress( "Loading Tracks...", QString(), 0, nb_tracks );
529 
530  size_t i = 0;
531 
532  // we don't need here to save this track in the database,
533  // since they have just been extracted from it!
534  while ( track_list_it != track_list_end )
535  {
536  if ( track_list_it->Nodes )
537  {
538  TrackStructure Track = *track_list_it;
539  GoFigureTrackAttributes attributes = Track.ComputeAttributes();
540  //track_list_it->ComputeAttributes();
542  track_list_it->TraceID);
543  }
544  w3t->AddTrackFromNodes< TraceID >(track_list_it);
545 
546  progress.setValue( i );
547 
548  ++i;
549  ++track_list_it;
550  }
551  progress.setValue( nb_tracks );
552  }
553  }
554 }
555 
556 //--------------------------------------------------------------------------
557 
558 //--------------------------------------------------------------------------
560 QGoMainWindow::GetFileContainerForMultiFiles(std::string & ioHeader_Filename,
561  std::string iFirst_FileName)
562 {
564 
565  if ( iFirst_FileName.empty() )
566  {
567  std::string ImgSessionName =
569  //this->m_DBWizard->setImgSessionName(ImgSessionName);
570  ofile_container = this->m_DBWizard->GetMultiIndexFileContainer();
571  }
572  iFirst_FileName = this->m_DBWizard->GetFirstFileName();
573 
574  // if the size is diiferent than 0, the imagingsession has
575  // just been created and the wizard has already filled the
576  // GoFigureFileInfoHelperMultiIndexContainer using MegcaptureImport
577  if ( ofile_container.size() == 0 || !iFirst_FileName.empty() )
578  {
579  itk::MegaCaptureImport::Pointer importer = itk::MegaCaptureImport::New();
580  importer->SetFileName(iFirst_FileName);
581 
582  try
583  {
584  importer->Update();
585  }
586  catch ( ... )
587  {
588  QMessageBox::critical( NULL, tr("Error"),
589  tr("Error while trying to read this Megacatpure") );
590  return ofile_container;
591  }
592 
593  ofile_container = importer->GetOutput();
594  ioHeader_Filename = importer->GetHeaderFilename();
595  }
596  else
597  {
598  ioHeader_Filename = m_DBWizard->GetMegaCaptureHeaderFilename();
599  }
600  return ofile_container;
601 }
602 
603 //--------------------------------------------------------------------------
604 
605 //--------------------------------------------------------------------------
606 void
608 {
609  //Open the dialog window
611  new QGoLsmToMegaExportDialog(this);
612 
613  dlg->show();
614 }
615 
616 //--------------------------------------------------------------------------
617 
618 //--------------------------------------------------------------------------
620 {
622 }
623 
624 //--------------------------------------------------------------------------
625 
626 //--------------------------------------------------------------------------
628 {
629  int idx = this->CentralTabWidget->currentIndex();
630 
631  m_TabManager->CloseTab(idx);
632 }
633 
634 //--------------------------------------------------------------------------
635 
636 //--------------------------------------------------------------------------
638 {
639  this->close();
640  this->WriteSettings();
641 }
642 
643 //--------------------------------------------------------------------------
644 
645 //--------------------------------------------------------------------------
647 {
648  if ( QFile::exists(iFile) )
649  {
650  this->SetCurrentSingleFile(iFile);
651 
652  // parse extension
653  QString ext = QFileInfo(iFile).suffix();
654  if ( ext.compare("lsm", Qt::CaseInsensitive) == 0 )
655  {
656  this->OpenLSMImage(m_CurrentFile, 0);
657  }
658  else
659  {
660  vtkImageReader2Factory *r_factory = vtkImageReader2Factory::New();
661  vtkImageReader2 * reader = r_factory->CreateImageReader2( iFile.toAscii().data() );
662 
663  reader->SetFileName( iFile.toAscii().data() );
664 
665  try
666  {
667  reader->Update();
668  }
669  catch ( ... )
670  {
671  QMessageBox::critical( NULL, tr("Error"),
672  tr("Error while trying to read this file") );
673  return;
674  }
675 
676  vtkImageData *image = reader->GetOutput();
677 
678  int dim[3];
679  image->GetDimensions(dim);
680 
681  if ( ( dim[0] != 1 ) && ( dim[1] != 1 ) && ( dim[2] != 1 ) )
682  {
683  CreateNewTabFor3DImage(image, iFile);
684  }
685  else
686  {
687  CreateNewTabFor2DImage(image, iFile);
688  }
689  reader->Delete();
690  r_factory->Delete();
691  }
692  }
693 }
694 
695 //--------------------------------------------------------------------------
696 
697 //--------------------------------------------------------------------------
698 void QGoMainWindow::OpenLSMImage(const QString & iFile, const int & iTimePoint)
699 {
700  m_LSMReader.push_back( vtkLSMReader::New() );
701  m_LSMReader.back()->SetFileName( iFile.toAscii().data() );
702  m_LSMReader.back()->SetUpdateTimePoint(iTimePoint);
703 
704  try
705  {
706  m_LSMReader.back()->Update();
707  }
708  catch ( ... )
709  {
710  QMessageBox::critical( NULL, tr("Error"),
711  QString("Error while trying to read %1 at time %2").arg(iFile).arg(iTimePoint) );
712  return;
713  }
714 
715  int dim[5];
716  m_LSMReader.back()->GetDimensions(dim);
717 
718  int ImageDimensionality = 4;
719 // bool Color = ( dim[4] > 1 );
720 
721  if ( dim[3] == 1 ) // only one time point
722  {
723  if ( dim[2] == 1 ) // only one z slice
724  {
725  ImageDimensionality = 2;
726  }
727  else
728  {
729  ImageDimensionality = 4;
730  }
731  }
732  else
733  {
734  ImageDimensionality = 4;
735  }
736 
737  switch ( ImageDimensionality )
738  {
739  case 2:
740  {
741  CreateNewTabFor2DImage(m_LSMReader.back()->GetOutput(), iFile);
742  break;
743  }
744  case 3:
745  {
746  CreateNewTabFor3DImage(m_LSMReader.back()->GetOutput(), iFile);
747  break;
748  }
749  default:
750  case 4:
751  {
752  CreateNewTabFor3DwtImage(m_LSMReader.back(), iFile);
753  break;
754  }
755  }
756 }
757 
758 //--------------------------------------------------------------------------
762  const GoFigure::FileType & iFileType,
763  const std::string & iHeader,
764  const int & iTimePoint,
765  const bool & iUseDatabase)
766 {
767  // note: do not need to call w3t->Update() since it is internally called in
768  // w3t->SetMegaCaptureFile
770 
771  w3t->SetStatusBarPointer( this->statusBar() );
772  w3t->SetMegaCaptureFile(iFileList, iFileType, iHeader, iTimePoint);
773 
774  if ( iUseDatabase )
775  {
776  // **********************
777  // Database information
778  //get the content of the tables fron the database to fill the table widget:
779  std::string ImgSessionName = m_DBWizard->GetImagingSessionName().toStdString();
780  //in case the files are opened from the open recent files, the
781  // imgsessionname
782  //can no more be gotten from the wizard:
783  if ( this->m_DBWizard->GetIsAnOpenRecentFile() )
784  {
785  ImgSessionName = this->m_CurrentFile.toStdString();
786  this->m_DBWizard->SetIsAnOpenRecentFile(false);
787  }
788  w3t->m_DataBaseTables->SetDatabaseVariables("gofiguredatabase",
793  ImgSessionName);
794 
796  w3t->setWindowTitle( QString::fromStdString(ImgSessionName) );
797  // **********************
798  }
799  else
800  {
801  w3t->setWindowTitle( QFileInfo( QString::fromStdString(iHeader) ).fileName() );
802  }
803 
804  //w3t->InitializeToolBarsAndMenus(this->menuTools, this->m_TracesToolBar);
805  //SetupMenusFromTab(w3t);
806  this->SetUpGeneralMenusToolBars(w3t);
809 
810  return w3t;
811 }
812 
813 //--------------------------------------------------------------------------
814 
815 //--------------------------------------------------------------------------
816 void
818 {
819  for ( std::list< QAction * >::iterator
820  list_it = m_TabDimPluginActionMap[iT->GetTabDimensionType()].begin();
821  list_it != m_TabDimPluginActionMap[iT->GetTabDimensionType()].end();
822  ++list_it
823  )
824  {
825  ( *list_it )->setEnabled(true);
826  }
827 
828  //iT->CreateModeToolBar(this->menuMode, this->m_ModeToolBar);
830 
831  std::list< QGoTabElementBase::QGoDockWidgetStatusPair > dock_list = iT->DockWidget();
832 
833  for ( std::list< QGoTabElementBase::QGoDockWidgetStatusPair >::iterator
834  dck_it = dock_list.begin();
835  dck_it != dock_list.end();
836  ++dck_it )
837  {
838  if ( dck_it->first->m_Attached )
839  {
840  this->addDockWidget(dck_it->first->m_Area, dck_it->second);
841  }
842  dck_it->second->setVisible(dck_it->first->m_Visibility);
843  }
844 
845  int idx = this->CentralTabWidget->addTab( iT, iT->windowTitle() );
846  /*this->menuView->setEnabled(true);
847  this->menuFiltering->setEnabled(true);
848  this->menuSegmentation->setEnabled(true);
849  this->menuTools->setEnabled(true);
850  this->menuMode->setEnabled(true);*/
851 
852  this->CentralTabWidget->setCurrentIndex(idx);
853 }
854 
855 //--------------------------------------------------------------------------
856 
857 //--------------------------------------------------------------------------
859 {
860  if (!this->m_ViewToolBar)
861  {
862  this->m_ViewToolBar = new QToolBar(tr("View"), this);
863  this->m_ViewToolBar->setObjectName( tr("View") );
864  this->addToolBar(Qt::TopToolBarArea, this->m_ViewToolBar);
865  }
866 
867  if(!this->m_ModeToolBar)
868  {
869  this->m_ModeToolBar = new QToolBar(tr("Mode"), this);
870  this->m_ModeToolBar->setObjectName( tr("Mode") );
871  this->addToolBar(Qt::TopToolBarArea, this->m_ModeToolBar);
872  }
873 
874  iT->CreateModeToolBar(this->menuMode, this->m_ModeToolBar);
875 
876  this->menuView->setEnabled(true);
877  this->menuFiltering->setEnabled(true);
878  this->menuSegmentation->setEnabled(true);
879  this->menuTools->setEnabled(true);
880  this->menuMode->setEnabled(true);
881 }
882 //--------------------------------------------------------------------------
883 
884 //--------------------------------------------------------------------------
886 {
887  //this->SetupMenusFromTab(iT);
888  if (!this->m_TracesToolBar)
889  {
890  this->m_TracesToolBar = new QToolBar(tr("Tools For Traces"), this);
891  this->m_TracesToolBar->setObjectName( tr("Traces") );
892  this->addToolBar(Qt::TopToolBarArea, this->m_TracesToolBar);
893  this->addToolBarBreak(Qt::TopToolBarArea);
894  }
895  if (!this->m_TraceSettingsToolBar)
896  {
897  this->m_TraceSettingsToolBar = new QToolBar(tr("Settings For the Trace"), this);
898  m_TraceSettingsToolBar->setObjectName(tr("TraceSettingsToolBar"));
899  this->addToolBar(Qt::TopToolBarArea, m_TraceSettingsToolBar);
900  }
901 
902  //iT->InitializeModeToolBar(this->menuMode, this->m_ModeToolBar);
903 
904  iT->InitializeToolsForTracesToolBar(this->menuTools, this->m_TracesToolBar);
906 }
907 //--------------------------------------------------------------------------
908 
909 //--------------------------------------------------------------------------
912 {
914 
915  w3t->setWindowTitle( QFileInfo(iFile).fileName() );
916  w3t->SetLSMReader(iReader, 0);
917 
918  //SetupMenusFromTab(w3t);
919  this->SetUpGeneralMenusToolBars(w3t);
922 
923  // w3t->m_DataBaseTables->hide();
924  w3t->SetStatusBarPointer( this->statusBar() );
925 
926  return w3t;
927 }
928 
929 //--------------------------------------------------------------------------
930 
931 //--------------------------------------------------------------------------
933 QGoMainWindow::CreateNewTabFor3DImage(vtkImageData *iInput, const QString & iFile)
934 {
936 
937  w3->SetImage(iInput);
938  w3->setWindowTitle( QFileInfo(iFile).fileName() );
939  w3->Update();
940 
941  //SetupMenusFromTab(w3);
942  this->SetUpGeneralMenusToolBars(w3);
944 
945  return w3;
946 }
947 
948 //--------------------------------------------------------------------------
949 
950 //--------------------------------------------------------------------------
952 QGoMainWindow::CreateNewTabFor2DImage(vtkImageData *iInput, const QString & iFile)
953 {
955 
956  w2->SetImage(iInput);
957  w2->setWindowTitle( QFileInfo(iFile).fileName() );
958  w2->Update();
959 
960  //SetupMenusFromTab(w2);
961  this->SetUpGeneralMenusToolBars(w2);
963 
964  return w2;
965 }
966 
967 //--------------------------------------------------------------------------
968 
969 //--------------------------------------------------------------------------------
971 {
972  this->m_AboutWidget->show();
973 }
974 
975 //--------------------------------------------------------------------------
976 
977 //--------------------------------------------------------------------------
979 {
980  QMessageBox::aboutQt( this, tr("About Qt") );
981 }
982 
983 //--------------------------------------------------------------------------
984 
985 //--------------------------------------------------------------------------
987 {
988  QDesktopServices::openUrl( QUrl("http://gofigure2.sourceforge.net") );
989 }
990 
991 //--------------------------------------------------------------------------
992 
993 //--------------------------------------------------------------------------
995 {
996  QDesktopServices::openUrl( QUrl("mailto:gofigure2-users@lists.sourceforge.net?subject=About GoFigure2") );
997 }
998 
999 //--------------------------------------------------------------------------
1000 
1001 //--------------------------------------------------------------------------
1003 {
1004  QString url( "mailto:gofigure2-developers@lists.sourceforge.net?subject=Bug Report&body=" );
1005 
1007  QDir temp = QDir(app_dir);
1008 
1009  temp.cdUp();
1010  QString app_up_dir = temp.path();
1011  temp.cdUp();
1012  temp.cdUp();
1013  QString app_up_up_up_dir = temp.path();
1014 
1015  // linux without install
1016  QStringList search_dir(app_dir + "/Resources");
1017  // on windows without install
1018  search_dir << app_up_dir + "/Resources";
1019  // linux with install
1020  search_dir << app_up_dir + "/share/doc/gofigure2/Resources";
1021  // on mac without install
1022  search_dir << app_up_up_up_dir + "/Resources";
1023 
1024  QDir::setSearchPaths("BugEntryPath", search_dir);
1025 
1026  QFile file("BugEntryPath:BugEntry.txt");
1027 
1028  file.open(QIODevice::ReadOnly);
1029 
1030  QTextStream textStream( & file);
1031 
1032  QString text = textStream.readAll();
1033 
1034  url.append( text );
1035 
1036  QDesktopServices::openUrl( QUrl( url ) );
1037 }
1038 
1039 //--------------------------------------------------------------------------
1040 
1041 //--------------------------------------------------------------------------
1043 {
1044  QDesktopServices::openUrl( QUrl("mailto:gofigure2-developers@lists.sourceforge.net?subject=About GoFigure2") );
1045 }
1046 //--------------------------------------------------------------------------
1047 
1048 //--------------------------------------------------------------------------
1050 {
1051  this->m_DBInitializationWizard->show();
1052  this->m_DBInitializationWizard->exec();
1053  if ( !this->m_RecentDatabaseFiles.empty() )
1054  {
1055  this->m_RecentDatabaseFiles.clear();
1057  menuDatabase_Files,
1059  }
1060 }
1061 
1062 //--------------------------------------------------------------------------
1063 
1064 //--------------------------------------------------------------------------
1066 {
1067  m_CurrentFile = fileName;
1068  this->setWindowModified(false);
1069  QString shownName = "Untitled";
1070  if ( !m_CurrentFile.isEmpty() )
1071  {
1072  shownName = strippedName(m_CurrentFile);
1075  UpdateRecentFileActions(m_RecentSingleFiles, menuSingle_Files,
1077  }
1078 }
1079 
1080 //--------------------------------------------------------------------------
1081 
1082 //--------------------------------------------------------------------------
1084 {
1085  foreach( QObject * plugin, QPluginLoader::staticInstances() )
1086  {
1087  this->PopulateMenus(plugin);
1088  }
1089 
1090  m_PluginsDir = FindPluginDirectory("plugins");
1091 
1092  foreach( QString fileName, m_PluginsDir.entryList(QDir::Files) )
1093  {
1094  QPluginLoader loader( m_PluginsDir.absoluteFilePath(fileName) );
1095  QObject * plugin = loader.instance();
1096 
1097  if ( plugin )
1098  {
1099  this->PopulateMenus(plugin);
1100  m_PluginFileNames += fileName;
1101  }
1102  }
1103 }
1104 
1105 //--------------------------------------------------------------------------
1106 
1107 //--------------------------------------------------------------------------
1109 {
1110  QGoImageFilterPluginBase *filter =
1111  qobject_cast< QGoImageFilterPluginBase * >(plugin);
1112 
1113  if ( filter )
1114  {
1115  this->AddToMenu(plugin, QStringList( filter->Name() ),
1116  this->menuFiltering, SLOT( ApplyImageFilter() ), 0);
1117  }
1118  else
1119  {
1120  std::cout << "This is not QGoImageFilterPlugin" << std::endl;
1121  }
1122 }
1123 
1124 //--------------------------------------------------------------------------
1125 
1126 //--------------------------------------------------------------------------
1128  QObject *plugin, const QStringList & texts,
1129  QMenu *menu, const char *member,
1130  QActionGroup *actionGroup)
1131 {
1132  std::list< GoFigure::TabDimensionType > dim_list;
1133 
1134  QGoPlugin *temp = dynamic_cast< QGoPlugin * >( plugin );
1135 
1136  if ( temp )
1137  {
1138  dim_list = temp->TabElementCompatibility();
1139  }
1140 
1141  foreach(QString text, texts)
1142  {
1143  QAction *taction = new QAction(text, plugin);
1144 
1145  taction->setDisabled(true);
1146  QObject::connect(taction, SIGNAL( triggered() ), this, member);
1147 // QObject::connect( plugin, SIGNAL( Done( std::vector< vtkImageData* > ) ),
1148 // this, SLOT( tobedone( std::vector< vtkImageData* > ) ) );
1149 
1150  menu->addAction(taction);
1151 
1152  for ( std::list< GoFigure::TabDimensionType >::iterator it = dim_list.begin();
1153  it != dim_list.end();
1154  ++it )
1155  {
1156  m_TabDimPluginActionMap[*it].push_back(taction);
1157  }
1158 
1159  if ( actionGroup )
1160  {
1161  taction->setCheckable(true);
1162  actionGroup->addAction(taction);
1163  }
1164  }
1165 }
1166 
1167 //--------------------------------------------------------------------------
1168 
1169 void QGoMainWindow::tobedone(std::vector< vtkImageData * > iImages)
1170 {
1171  QWidget *w = this->CentralTabWidget->currentWidget();
1172 
1173  QGoTabImageViewNDBase *WnD = dynamic_cast< QGoTabImageViewNDBase * >( w );
1174 
1175  if ( WnD )
1176  {
1177  WnD->SetImage(iImages[0]);
1178  }
1179 }
1180 
1181 //--------------------------------------------------------------------------
1183 {
1184  QAction * taction = qobject_cast< QAction * >( sender() );
1185  QGoImageFilterPluginBase *filter =
1186  qobject_cast< QGoImageFilterPluginBase * >( taction->parent() );
1187 
1188  QWidget *w = this->CentralTabWidget->currentWidget();
1189 
1190  QGoTabImageViewNDBase *WnD = dynamic_cast< QGoTabImageViewNDBase * >( w );
1191 
1192  if ( WnD )
1193  {
1194  filter->SetInput( WnD->GetImage() );
1195  filter->Update();
1196 // WnD->SetImage( filter->GetOutput()[0] );
1197  }
1198 }
1199 
1200 //--------------------------------------------------------------------------
1201 
1202 //--------------------------------------------------------------------------
1204 {
1205  m_CurrentFile = fileName;
1206  this->setWindowModified(false);
1207  QString shownName = "Untitled";
1208  if ( !m_CurrentFile.isEmpty() )
1209  {
1210  shownName = strippedName(m_CurrentFile);
1214  menuMultiple_Files,
1216  }
1217 }
1218 
1219 //--------------------------------------------------------------------------
1220 
1221 //--------------------------------------------------------------------------
1223 {
1224  m_CurrentFile = fileName;
1225  this->setWindowModified(false);
1226  if ( !m_CurrentFile.isEmpty() )
1227  {
1231  menuDatabase_Files,
1233  }
1234 }
1235 
1236 //--------------------------------------------------------------------------
1237 
1238 //--------------------------------------------------------------------------
1240 {
1241  return QFileInfo(fullFileName).fileName();
1242 }
1243 
1244 //--------------------------------------------------------------------------
1245 
1246 //--------------------------------------------------------------------------
1248  QMenu *menu,
1249  QAction *recentFileActions[MaxRecentFiles])
1250 {
1251  //if the items in the list are imagingsession names,from
1252  // the menuDatabase_Files, they don't corresponds to real
1253  //files, the test bellow will then remove
1254  //them from the list
1255  if ( menu != this->menuDatabase_Files )
1256  {
1257  QMutableStringListIterator i(list);
1258  while ( i.hasNext() )
1259  {
1260  if ( !QFile::exists( i.next() ) )
1261  {
1262  i.remove();
1263  }
1264  }
1265  }
1266 
1267  if ( !list.isEmpty() )
1268  {
1269  menu->setEnabled(true);
1270  }
1271 
1272  for ( int j = 0; j < MaxRecentFiles; ++j )
1273  {
1274  if ( j < list.count() )
1275  {
1276  QString text = tr("&%1 %2 ")
1277  .arg(j + 1)
1278  .arg( strippedName(list[j]) );
1279 
1280  recentFileActions[j]->setText(text);
1281  recentFileActions[j]->setData(list[j]);
1282  recentFileActions[j]->setVisible(true);
1283  menu->addAction(recentFileActions[j]);
1284  }
1285  }
1286 }
1287 
1288 //--------------------------------------------------------------------------
1289 
1290 //--------------------------------------------------------------------------
1292 {
1293  QAction *taction = qobject_cast< QAction * >( sender() );
1294 
1295  if ( action )
1296  {
1297  this->SetSingleFileName( taction->data().toString() );
1298  }
1299 }
1300 
1301 //--------------------------------------------------------------------------------
1302 
1303 //--------------------------------------------------------------------------------
1305 {
1306  QAction *taction = qobject_cast< QAction * >( sender() );
1307 
1308  if ( taction )
1309  {
1310 // this->SetMultiFileName( taction->data().toString() );
1311  }
1312 }
1313 
1314 //--------------------------------------------------------------------------------
1315 
1316 //--------------------------------------------------------------------------------
1318 {
1319  QAction *taction = qobject_cast< QAction * >( sender() );
1320 
1321  if ( taction )
1322  {
1323  std::string ImgSessionName = taction->data().toString().toStdString();
1324  this->SetCurrentDatabaseFile( ImgSessionName.c_str() );
1325  this->m_DBWizard->setImgSessionName(ImgSessionName);
1326  this->m_DBWizard->restart();
1327  this->m_DBWizard->show();
1328  }
1329 }
1330 
1331 //--------------------------------------------------------------------------------
1332 
1333 //--------------------------------------------------------------------------------
1335 {
1336  this->DisplayFilesfromDB( this->m_CurrentFile.toStdString() );
1337 }
1338 
1339 //--------------------------------------------------------------------------------
1340 
1341 //--------------------------------------------------------------------------------
1343 {
1344  this->menuDatabase->removeAction(this->actionSet_Up_Database);
1345  this->m_DatabaseSetUp = true;
1346 }
1347 
1348 //--------------------------------------------------------------------------------
1349 
1350 //--------------------------------------------------------------------------------
1352 {
1353  //enter number of actions in the Database menu here:
1354  unsigned int NumberOfActionsIfSetUpDB = 1;
1355 
1356  unsigned int NumberOfCurrentActions = this->menuDatabase->actions().size();
1357 
1358  if ( NumberOfCurrentActions != NumberOfActionsIfSetUpDB )
1359  {
1361  tr("Set Up Database"), this->menuDatabase);
1362  this->m_DatabaseSetUp = false;
1363  this->menuDatabase->addAction(actionSet_Up_Database);
1364  this->actionSet_Up_Database->setEnabled(true);
1366  this->m_DBInitializationWizard->hide();
1367  QObject::connect( this->actionSet_Up_Database, SIGNAL( triggered() ),
1368  SLOT( SetUpDatabase() ) );
1369  QObject::connect( this->m_DBInitializationWizard, SIGNAL( DatabaseAndUserCreated() ),
1370  this, SLOT( RemoveSetUpDatabaseMenu() ) );
1371  QObject::connect( this->m_DBWizard, SIGNAL( GofigureDatabaseExists() ),
1372  this, SLOT( RemoveSetUpDatabaseMenu() ) );
1373  }
1374 }
1375 
1376 //--------------------------------------------------------------------------------
1377 
1378 //--------------------------------------------------------------------------------
1380 {
1381  QSettings settings;
1382 
1384  settings.value("RecentSingleFiles").toStringList();
1386  settings.value("RecentMultipleFiles").toStringList();
1388  settings.value("RecentDatabaseFiles").toStringList();
1389  m_DatabaseSetUp =
1390  settings.value("DatabaseSetUp").toBool();
1391 
1393  this->menuSingle_Files, this->recentSingleFileActions);
1395  this->menuMultiple_Files, this->recentMultipleFileActions);
1397  this->menuDatabase_Files, this->recentDatabaseFileActions);
1398 
1399  settings.beginGroup("MainWindow");
1400  QSize tsize = settings.value("size").toSize();
1401 
1402  if ( tsize.isValid() )
1403  {
1404  this->resize(tsize);
1405  this->move( settings.value("pos").toPoint() );
1406  }
1407  else
1408  {
1409  this->resize(1450, 750);
1410  }
1411 
1412  //QByteArray state = settings.value("state", QByteArray()).toByteArray();
1413  //this->restoreState(state);
1414 
1415  // settings.setValue("vsplitterSizes", vSplitter->saveState());
1416  settings.endGroup();
1417 
1418  settings.beginGroup("MemoryManagement");
1419  unsigned int maxNumberOfTraces =
1420  settings.value("MaxNumberOfTraces").toUInt();
1421  if(maxNumberOfTraces)
1422  {
1423  this->m_MaxNumberOfTraces = maxNumberOfTraces;
1424  }
1425  settings.endGroup();
1426 }
1427 
1428 //--------------------------------------------------------------------------------
1429 
1430 //--------------------------------------------------------------------------------
1432 {
1433  QSettings settings;
1434 
1435  settings.setValue("RecentSingleFiles", m_RecentSingleFiles);
1436  settings.setValue("RecentMultipleFiles", m_RecentMultipleFiles);
1437  settings.setValue("RecentDatabaseFiles", m_RecentDatabaseFiles);
1438  settings.beginGroup("MainWindow");
1439  settings.setValue( "size", size() );
1440  settings.setValue( "pos", pos() );
1441  settings.setValue( "state", saveState() );
1442  settings.endGroup();
1443  settings.setValue("DatabaseSetUp", this->m_DatabaseSetUp);
1444  settings.beginGroup("MemoryManagement");
1445  settings.setValue("MaxNumberOfTraces", this->m_MaxNumberOfTraces);
1446  settings.endGroup();
1447 }
1448 
1449 //-------------------------------------------------------------------------
1450 
1451 void
1453 {
1454  m_ManualUpdate = true;
1456 }
1457 
1458 //-------------------------------------------------------------------------
1459 void
1461 {
1462  if ( !noerror ) // error during the connection to the server
1463  {
1464  if ( m_ManualUpdate )
1465  {
1466  QMessageBox::warning( this, tr("GoFigure2 Updates"),
1467  tr("There was an error while trying to GoFigure2's update website!\n " \
1468  "Check your internet connection and try again later!") );
1469  }
1470  }
1471  else
1472  {
1473  // no new version!
1474  if ( result.compare(tr("no-update\n"), Qt::CaseInsensitive) == 0 )
1475  {
1476  if ( m_ManualUpdate )
1477  {
1478  QMessageBox::information( this, tr("GoFigure2 Updates"),
1479  tr("You have the lastest version!") );
1480  }
1481  }
1482  else
1483  {
1484  // there is one new version!
1485  if ( result.compare(tr("update\n"), Qt::CaseInsensitive) == 0 )
1486  {
1487  QMessageBox msgBox( QMessageBox::Information, tr("GoFigure2 Updates"),
1488  tr("There is a new version of GoFigure2 available for download!") );
1489 
1490  QPushButton *goButton =
1491  msgBox.addButton(tr("Go to GoFigure2's website!"),
1492  QMessageBox::ActionRole);
1493 
1494  QPushButton *notnowButton =
1495  msgBox.addButton(tr("Not Now!"),
1496  QMessageBox::ActionRole);
1497 
1498  msgBox.exec();
1499 
1500  if ( msgBox.clickedButton() == goButton )
1501  {
1502  QUrl address("http://sourceforge.net/projects/gofigure2/files/");
1503  QDesktopServices::openUrl(address);
1504  }
1505  else
1506  {
1507  if ( msgBox.clickedButton() == notnowButton )
1508  {
1509  msgBox.close();
1510  }
1511  }
1512  }
1513  }
1514  }
1515 }
QToolBar * m_ViewToolBar
std::string toStdString() const
QString GetImagingSessionName()
void clear()
Abstract class for one tab element in GoFigure2.
void addToolBar(Qt::ToolBarArea area, QToolBar *toolbar)
void LoadAllTracesFromDatabaseManager(const int &iT)
bool close()
bool isValid() const
QString & append(QChar ch)
QSize size() const
void SetLSMReader(vtkLSMReader *iReader, const int &iTimePoint)
void on_actionClose_all_triggered()
void SetIsAnOpenRecentFile(bool iIsAnOpenRecentFile)
void setupUi(QWidget *widget)
void SetStatusBarPointer(QStatusBar *iStatusbar)
QGoTabManager * m_TabManager
QGoNetworkUtilities * m_NetworkUtilities
void setDisabled(bool b)
void RemoveSetUpDatabaseMenu()
remove the action 'Set up Database' from the Database menu.
itk::QtProgressBar m_Bar
void CreateContoursActorsFromVisuContainer(std::list< unsigned int > iTPointToLoad)
Creates actors for the contours which are at the given time points in the container. The actors are not visible by default. (see ShowTraces)
void AddTrackFromNodes(typename TrackContainer::MultiIndexContainerType::index< TIndex >::type::iterator iIt)
void InitializeTraceSettingsToolBar(QToolBar *iToolBar)
void setCorner(Qt::Corner corner, Qt::DockWidgetArea area)
void endGroup()
int numScreens() const
void CheckForUpdates()
Check for updates.
QObject * sender() const
QToolBar * m_TracesToolBar
QVariant data() const
QStatusBar * statusBar() const
QString strippedName(const QString &fullFileName)
Remove path from a given FileName.
GoFigureTrackAttributes ComputeAttributes() const
void SetMegaCaptureFile(const GoFigureFileInfoHelperMultiIndexContainer &iContainer, const GoFigure::FileType &iFileType, const std::string &iHeader, const unsigned int &iTimePoint)
void setVisible(bool)
void addAction(QAction *action)
QString GetServer()
bool isVisible() const
void SetMaxNumberOfTraces(unsigned int iN)
void addToolBarBreak(Qt::ToolBarArea area)
void on_actionReport_a_bug_triggered()
int exec()
QGoWizardDB * m_DBWizard
Element of the QTabWidget to be used to visualized 2D images.
MultiIndexContainerType m_Container
Trace Contaienr.
QAction * addAction(QAction *action)
void on_actionClose_triggered()
void DisplayUpdateResults(QString result, bool noerror)
int GetImagingSessionID()
bool exists() const
friend class QGoTabManager
Definition: QGoMainWindow.h:76
GoFigureFileInfoHelperMultiIndexContainer GetFileContainerForMultiFiles(std::string &ioHeader_Filename, std::string iFirstFileName)
get the file container and the header filename for one file part of a megacapture imaging session ...
QGoPrintDatabase * m_DataBaseTables
void AddToMenu(QObject *, const QStringList &, QMenu *, const char *, QActionGroup *)
QString tr(const char *sourceText, const char *disambiguation, int n)
StandardButton information(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
void FillTableFromDatabase(const unsigned int &iTreshold)
Create the QTableWidgetChild,get the columns names and the values stored in the database, display them in the QTableWidgetChild and fill the info for the contours and meshes.
void setTimeInterval(const int &iTimeInterval)
Abstract class for any kind of plugins used by GoFigure2.
Definition: QGoPlugin.h:54
void setWindowModified(bool)
QAction * recentMultipleFileActions[MaxRecentFiles]
void tobedone(std::vector< vtkImageData * >)
QAbstractButton * clickedButton() const
void LoadMeshesFromDatabase(const int &iT)
QGoMainWindow(QWidget *iParent=0, Qt::WindowFlags iFlags=0)
QToolBar * m_TraceSettingsToolBar
void setValue(const QString &key, const QVariant &value)
QSize size() const
void SetSingleFileName(const QString &iFileName)
void ShowTraces(const unsigned int &iTimePoint)
Show traces from container which are at the given time point. Only updates contours and meshes since ...
void InitializeToolsForTracesToolBar(QMenu *iMenu, QToolBar *iToolBar)
void setValue(int progress)
QAction * recentDatabaseFileActions[MaxRecentFiles]
void setEnabled(bool)
int count(const T &value) const
QString fromStdString(const std::string &str)
void on_actionUser_mailing_list_triggered()
void setImgSessionName(std::string iImgSessionName)
QGoDBInitializationWizard * m_DBInitializationWizard
void SetCurrentMultiFile(const QString &fileName)
uint toUInt(bool *ok) const
bool empty() const
void restart()
QString path() const
virtual void SetImage(vtkImageData *iImage)
Set the image to be displaid.
void AddSetUpDatabaseMenu()
add the action 'Set up Database' to the Database menu if it doesn't have been already added...
QString m_CurrentFile
current file name
QString fileName() const
void SetUpMenusToolBarsFor3dwtImage(QGoTabImageView3DwT *iT)
std::map< GoFigure::TabDimensionType, std::list< QAction * > > m_TabDimPluginActionMap
QObjectList staticInstances()
virtual std::list< QGoDockWidgetStatusPair > & DockWidget()
Get all actions belonging to Mode Menu and Toolbar.
void on_actionGoFigure2_Website_triggered()
virtual void CreateModeToolBar(QMenu *iMenu, QToolBar *iToolBar)
virtual GoFigure::TabDimensionType GetTabDimensionType() const =0
Get the dimension type of the underlying data set.
virtual void SetPluginActions(std::list< QAction * > iList)
void OpenLSMImage(const QString &iFile, const int &iTimePoint)
Open LSM image.
bool isEmpty() const
void setObjectName(const QString &name)
Structure which represent a track, and used for interaction between Visualization and TableWidget...
std::string GetFirstFileName()
bool isEmpty() const
bool GetIsAnOpenRecentFile()
void SetCurrentDatabaseFile(const QString &fileName)
int removeAll(const T &value)
std::string GetMegaCaptureHeaderFilename()
void SetupPluginsAndDockWidgetFromTab(QGoTabElementBase *iT)
QStringList m_RecentSingleFiles
list of recent files
void setOverrideCursor(const QCursor &cursor)
void move(int x, int y)
itk::QtSignalAdaptor m_SignalAdaptor
void CreateSignalSlotsConnection()
void restoreOverrideCursor()
void openRecentFilesfromDB()
void CloseTab(int idx)
void setCentralWidget(QWidget *widget)
void CreateMeshesActorsFromVisuContainer(std::list< unsigned int > iTPointToLoad)
Creates actors for the meshes which are at the given time points in the container. The actors are not visible by default. (see ShowTraces)
QGoTabImageView2D * CreateNewTabFor2DImage(vtkImageData *, const QString &)
void hide()
QAction * actionSet_Up_Database
void openRecentSingleFile()
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
QGoAboutWidget * m_AboutWidget
std::list< vtkLSMReader * > m_LSMReader
QStringList m_RecentDatabaseFiles
bool cdUp()
void on_actionDeveloper_mailing_list_triggered()
QDir FindPluginDirectory(const QString &iSubdir)
void SetUpGeneralMenusToolBars(QGoTabElementBase *iT)
QString GetLogin()
GoFigureFileInfoHelperMultiIndexContainer GetMultiIndexFileContainer()
QSize toSize() const
virtual void Update()
Update the rendering of the tab.
void LoadTracksFromDatabase(const int &iT)
void on_actionAbout_triggered()
void UpdateRecentFileActions(QStringList list, QMenu *menu, QAction *recentFileActions[MaxRecentFiles])
QString Name() const
return Plugin Name of the plugin.
Definition: QGoPlugin.cxx:39
unsigned int m_MaxNumberOfTraces
void LoadContoursFromDatabase(const int &iT)
QAction * recentSingleFileActions[MaxRecentFiles]
QByteArray saveState(int version) const
void on_actionOpen_MegaCapture_Files_triggered()
void setCheckable(bool)
void setMaximumSize(const QSize &)
Abstract class for representing one tab element which contains 2D or 3D image (without any temporal c...
QVariant value(const QString &key, const QVariant &defaultValue) const
QStringList m_PluginFileNames
void on_actionQuit_triggered()
QGoTabImageView3D * CreateNewTabFor3DImage(vtkImageData *, const QString &)
QString suffix() const
QStringList toStringList() const
QDesktopWidget * desktop()
virtual std::list< GoFigure::TabDimensionType > TabElementCompatibility() const =0
static vtkLSMReader * New()
QStringList entryList(QFlags< QDir::Filter > filters, QFlags< QDir::SortFlag > sort) const
Wraps a boost multi index container of TrackStructure. This class intends to synchronize Track repres...
QString GetPassword()
void setWindowTitle(const QString &)
bool ComputeFileType(const QString &iFileName, GoFigure::FileType &oFileType)
Compute GoFigure file type from a given filename.
void openRecentMultipleFile()
boost::multi_index::multi_index_container< GoFigureFileInfoHelper, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_PCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_RCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_CCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_XTileCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_YTileCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_ZTileCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_ZCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_Channel >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_TCoord >, > >> GoFigureFileInfoHelperMultiIndexContainer
QToolBar * m_ModeToolBar
StandardButton critical(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
QString absoluteFilePath(const QString &fileName) const
void openFilesfromDB()
void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget)
bool toBool() const
char * data()
void PopulateMenus(QObject *plugin)
void PrintCalculatedValuesForTrack(GoFigureTrackAttributes *iTrackAttributes, unsigned int iTrackID)
display in the table widget the values from iTrackAttributes for iTrackID
void setIconSize(const QSize &iconSize)
QPoint toPoint() const
void DisplayFilesfromDB(std::string iFirst_Filename)
StandardButton warning(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
typedef WindowFlags
const QRect availableGeometry(int screen) const
void prepend(const T &value)
TrackContainer * GetTrackContainer()
void on_actionAbout_Qt_triggered()
virtual void Update()
Update the rendering of the tab.
void addButton(QAbstractButton *button, ButtonRole role)
void show()
void on_actionCheck_For_Updates_triggered()
QStringList m_RecentMultipleFiles
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFlags< QFileDialog::Option > options)
void on_actionExport_LSM_to_MegaFile_triggered()
Open dialog window to set the file output path and format.
void on_actionOpen_Single_File_triggered()
bool openUrl(const QUrl &url)
About Widget which includes the list of authors, licenses, copyrights, dates, versions...
void aboutQt(QWidget *parent, const QString &title)
void SetCurrentSingleFile(const QString &fileName)
void on_actionUse_DataBase_triggered()
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString applicationDirPath()
QObject * parent() const
QString readAll()
int compare(const QString &other) const
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
void SetDatabaseVariables(const std::string &iNameDB, const std::string &iServer, const std::string &iUser, const std::string &iPassword, const unsigned int &iImgSessionID, const std::string &iImgSessionName)
set all the values needed for the database
QString toString() const
virtual void Update()=0
Update the rendering of the tab.
This class leads the user to chose its imagingsession and enables to get the corresponding filenames ...
Definition: QGoWizardDB.h:65
void setEnabled(bool)
As of now, the main purpose of this class is to check for updates on the official download site of go...
void beginGroup(const QString &prefix)
QGoTabImageView3DwT * CreateNewTabFor3DwtImage(const GoFigureFileInfoHelperMultiIndexContainer &iFileList, const GoFigure::FileType &iFileType, const std::string &iHeader, const int &iTimePoint, const bool &iUseDatabase)
Create a new tab in the TabWidget for a 3DwT image from one megacapture (from the database...
QByteArray toAscii() const
void openRecentDatabaseFile()
void setSearchPaths(const QString &prefix, const QStringList &searchPaths)
SmartPointer< Self > Pointer