54 #include <QDesktopServices>
55 #include <QDesktopWidget>
57 #include <QFileDialog>
58 #include <QMessageBox>
60 #include <QPluginLoader>
64 #include <QScrollArea>
65 #include <QTextStream>
71 #include "itkImageFileReader.h"
77 #include "vtkPLYReader.h"
79 #include "vtkImageData.h"
80 #include "vtkImageReader2Factory.h"
81 #include "vtkImageReader2.h"
82 #include "vtkSmartPointer.h"
91 QMainWindow(iParent, iFlags), m_ViewToolBar(NULL), m_ModeToolBar(NULL),
92 m_TracesToolBar(NULL), m_TraceSettingsToolBar(NULL),
93 m_MaxNumberOfTraces(5000)
95 QString title(
"<*)0|00|0>< ~~ <*)0|00|0>< GoFigure ><0|00|0(*> ~~ ><0|00|0(*>");
98 setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
99 setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
100 setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
101 setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
105 QSize MaximumSize = screen.
size() * numberOfScreens;
108 QSize SizeIcon(22, 22);
115 this->statusbar->showMessage(
tr(
"No data") );
117 this->CentralTabWidget->clear();
118 this->CentralTabWidget->setTabsClosable(
true);
119 this->CentralTabWidget->setMovable(
true);
121 this->statusbar->addPermanentWidget(&
m_Bar);
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);
167 SIGNAL( CheckForUpdatesDone(
QString,
bool) ),
223 SIGNAL( tabCloseRequested(
int) ),
227 SIGNAL( currentChanged(
int) ),
260 tr(
"Select Image"),
"",
261 tr(
"Images (*.png *.bmp *.jpg *.jpeg *.tiff *.tif *.mha *.mhd *.img *.lsm)")
277 tr(
"Select One Image from the Dataset"),
"",
278 tr(
"Images (*.png *.tif *.tiff *.jpg *.jpeg)")
295 tr(
"Error while trying to read this Megacatpure") );
305 int TimePoint = importer->GetOutput().get< m_TCoord >().begin()->m_TCoord;
308 importer->GetHeaderFilename(), TimePoint,
332 if ( extension.
compare(
"png", Qt::CaseInsensitive) == 0 )
339 if ( ( extension.
compare(
"tif", Qt::CaseInsensitive) == 0 )
340 || ( extension.
compare(
"tiff", Qt::CaseInsensitive) == 0 ) )
347 if ( ( extension.
compare(
"jpg", Qt::CaseInsensitive) == 0 )
348 || ( extension.
compare(
"jpeg", Qt::CaseInsensitive) == 0 ) )
355 std::cerr <<
"file not supported for megacapture!!!" << std::endl;
373 std::string temp =
"";
385 std::string Header_FileName;
388 Header_FileName, iFirst_Filename);
390 if ( file_container.size() == 0 )
392 std::cout <<
"GoFigureFileInfoHelperMultiIndexContainer empty ";
393 std::cout <<
"Debug: In " << __FILE__ <<
", line " << __LINE__;
394 std::cout << std::endl;
397 GoFigureFileInfoHelperMultiIndexContainer::iterator
398 temp_it = file_container.begin();
411 int TimePoint = file_container.get< m_TCoord >().begin()->m_TCoord;
415 filetype, Header_FileName, TimePoint,
418 QObject::connect( w3t, SIGNAL( UpdateBookmarkOpenActions(std::vector< QAction * > ) ),
419 this->
m_TabManager, SLOT( UpdateBookmarkMenu(std::vector< QAction * > ) ) );
426 this->menuBookmarks->setEnabled(
true);
439 #pragma omp sections nowait
520 typedef TrackContainer::MultiIndexContainerType::index< TraceID >::type::iterator
521 TrackContainerIterator;
523 TrackContainerIterator track_list_it = temp->
m_Container.get< TraceID >().begin();
524 TrackContainerIterator track_list_end = temp->
m_Container.get< TraceID >().end();
534 while ( track_list_it != track_list_end )
536 if ( track_list_it->Nodes )
542 track_list_it->TraceID);
561 std::string iFirst_FileName)
565 if ( iFirst_FileName.empty() )
567 std::string ImgSessionName =
577 if ( ofile_container.size() == 0 || !iFirst_FileName.empty() )
580 importer->SetFileName(iFirst_FileName);
589 tr(
"Error while trying to read this Megacatpure") );
590 return ofile_container;
593 ofile_container = importer->GetOutput();
594 ioHeader_Filename = importer->GetHeaderFilename();
600 return ofile_container;
629 int idx = this->CentralTabWidget->currentIndex();
654 if ( ext.
compare(
"lsm", Qt::CaseInsensitive) == 0 )
660 vtkImageReader2Factory *r_factory = vtkImageReader2Factory::New();
661 vtkImageReader2 * reader = r_factory->CreateImageReader2( iFile.
toAscii().
data() );
672 tr(
"Error while trying to read this file") );
676 vtkImageData *image = reader->GetOutput();
679 image->GetDimensions(dim);
681 if ( ( dim[0] != 1 ) && ( dim[1] != 1 ) && ( dim[2] != 1 ) )
702 m_LSMReader.back()->SetUpdateTimePoint(iTimePoint);
711 QString(
"Error while trying to read %1 at time %2").arg(iFile).arg(iTimePoint) );
718 int ImageDimensionality = 4;
725 ImageDimensionality = 2;
729 ImageDimensionality = 4;
734 ImageDimensionality = 4;
737 switch ( ImageDimensionality )
763 const std::string & iHeader,
764 const int & iTimePoint,
765 const bool & iUseDatabase)
819 for ( std::list< QAction * >::iterator
825 ( *list_it )->setEnabled(
true);
831 std::list< QGoTabElementBase::QGoDockWidgetStatusPair > dock_list = iT->
DockWidget();
833 for ( std::list< QGoTabElementBase::QGoDockWidgetStatusPair >::iterator
834 dck_it = dock_list.begin();
835 dck_it != dock_list.end();
838 if ( dck_it->first->m_Attached )
842 dck_it->second->setVisible(dck_it->first->m_Visibility);
845 int idx = this->CentralTabWidget->addTab( iT, iT->
windowTitle() );
852 this->CentralTabWidget->setCurrentIndex(idx);
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);
1004 QString url(
"mailto:gofigure2-developers@lists.sourceforge.net?subject=Bug Report&body=" );
1018 search_dir << app_up_dir +
"/Resources";
1020 search_dir << app_up_dir +
"/share/doc/gofigure2/Resources";
1022 search_dir << app_up_up_up_dir +
"/Resources";
1026 QFile file(
"BugEntryPath:BugEntry.txt");
1028 file.
open(QIODevice::ReadOnly);
1069 QString shownName =
"Untitled";
1095 QObject * plugin = loader.instance();
1120 std::cout <<
"This is not QGoImageFilterPlugin" << std::endl;
1129 QMenu *menu,
const char *member,
1132 std::list< GoFigure::TabDimensionType > dim_list;
1152 for ( std::list< GoFigure::TabDimensionType >::iterator it = dim_list.begin();
1153 it != dim_list.end();
1171 QWidget *w = this->CentralTabWidget->currentWidget();
1188 QWidget *w = this->CentralTabWidget->currentWidget();
1194 filter->SetInput( WnD->
GetImage() );
1207 QString shownName =
"Untitled";
1249 QAction *recentFileActions[MaxRecentFiles])
1255 if ( menu != this->menuDatabase_Files )
1257 QMutableStringListIterator i(list);
1258 while ( i.hasNext() )
1274 if ( j < list.
count() )
1280 recentFileActions[j]->setText(text);
1281 recentFileActions[j]->setData(list[j]);
1282 recentFileActions[j]->setVisible(
true);
1354 unsigned int NumberOfActionsIfSetUpDB = 1;
1356 unsigned int NumberOfCurrentActions = this->menuDatabase->actions().size();
1358 if ( NumberOfCurrentActions != NumberOfActionsIfSetUpDB )
1361 tr(
"Set Up Database"), this->menuDatabase);
1419 unsigned int maxNumberOfTraces =
1421 if(maxNumberOfTraces)
1467 tr(
"There was an error while trying to GoFigure2's update website!\n " \
1468 "Check your internet connection and try again later!") );
1474 if ( result.
compare(
tr(
"no-update\n"), Qt::CaseInsensitive) == 0 )
1479 tr(
"You have the lastest version!") );
1485 if ( result.
compare(
tr(
"update\n"), Qt::CaseInsensitive) == 0 )
1487 QMessageBox msgBox( QMessageBox::Information,
tr(
"GoFigure2 Updates"),
1488 tr(
"There is a new version of GoFigure2 available for download!") );
1491 msgBox.
addButton(
tr(
"Go to GoFigure2's website!"),
1492 QMessageBox::ActionRole);
1496 QMessageBox::ActionRole);
1502 QUrl address(
"http://sourceforge.net/projects/gofigure2/files/");
std::string toStdString() const
QString GetImagingSessionName()
Abstract class for one tab element in GoFigure2.
void addToolBar(Qt::ToolBarArea area, QToolBar *toolbar)
void LoadAllTracesFromDatabaseManager(const int &iT)
QString & append(QChar ch)
void SetLSMReader(vtkLSMReader *iReader, const int &iTimePoint)
void on_actionClose_all_triggered()
void SetIsAnOpenRecentFile(bool iIsAnOpenRecentFile)
void SetStatusBarPointer(QStatusBar *iStatusbar)
QGoTabManager * m_TabManager
QGoNetworkUtilities * m_NetworkUtilities
void RemoveSetUpDatabaseMenu()
remove the action 'Set up Database' from the Database menu.
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 CheckForUpdates()
Check for updates.
QToolBar * m_TracesToolBar
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 SetMaxNumberOfTraces(unsigned int iN)
void addToolBarBreak(Qt::ToolBarArea area)
void on_actionReport_a_bug_triggered()
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()
friend class QGoTabManager
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)
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.
QAction * recentMultipleFileActions[MaxRecentFiles]
void tobedone(std::vector< vtkImageData * >)
void LoadMeshesFromDatabase(const int &iT)
QGoMainWindow(QWidget *iParent=0, Qt::WindowFlags iFlags=0)
QToolBar * m_TraceSettingsToolBar
void setValue(const QString &key, const QVariant &value)
int GetTimeInterval() 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]
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
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
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.
void setObjectName(const QString &name)
Structure which represent a track, and used for interaction between Visualization and TableWidget...
std::string GetFirstFileName()
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)
itk::QtSignalAdaptor m_SignalAdaptor
void CreateSignalSlotsConnection()
void restoreOverrideCursor()
void openRecentFilesfromDB()
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 &)
QAction * actionSet_Up_Database
void openRecentSingleFile()
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
QGoAboutWidget * m_AboutWidget
std::list< vtkLSMReader * > m_LSMReader
QStringList m_RecentDatabaseFiles
void on_actionDeveloper_mailing_list_triggered()
QDir FindPluginDirectory(const QString &iSubdir)
void SetUpGeneralMenusToolBars(QGoTabElementBase *iT)
GoFigureFileInfoHelperMultiIndexContainer GetMultiIndexFileContainer()
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.
unsigned int m_MaxNumberOfTraces
void LoadContoursFromDatabase(const int &iT)
QAction * recentSingleFileActions[MaxRecentFiles]
QByteArray saveState(int version) const
void on_actionOpen_MegaCapture_Files_triggered()
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 &)
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...
bool ComputeFileType(const QString &iFileName, GoFigure::FileType &oFileType)
Compute GoFigure file type from a given filename.
void openRecentMultipleFile()
StandardButton critical(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
QString absoluteFilePath(const QString &fileName) const
void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget)
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)
void DisplayFilesfromDB(std::string iFirst_Filename)
StandardButton warning(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
void prepend(const T &value)
TrackContainer * GetTrackContainer()
void on_actionAbout_Qt_triggered()
virtual void Update()
Update the rendering of the tab.
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)
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()
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
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 ...
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()
vtkImageData * GetImage()
void setSearchPaths(const QString &prefix, const QStringList &searchPaths)
SmartPointer< Self > Pointer