From: tbaudier Date: Mon, 29 Aug 2016 13:25:19 +0000 (+0200) Subject: test X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=5a7107ac4a5381de625e129b40c87f832a078c9f;p=clitk.git test --- diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index e756ddf..2403de4 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -2151,7 +2151,14 @@ void vvMainWindow::SelectWipeImage() vvWipeImage::Pointer wipeImage = vvWipeImage::New(); wipeImage->Initialize(mInputPathName, mSlicerManagers); - wipeImage->selectWipeImage(index); + wipeImage->selectWipeImage(index, GetTree()); + QTreeWidgetItem *item = DataTree->itemAt(index, COLUMN_CLOSE_IMAGE); + //connect(item,SIGNAL(clickedInto(QTreeWidgetItem*, int)), this,SLOT(CloseImage(QTreeWidgetItem*, int))); + UpdateTree(); + ImageInfoChanged(); + for(int i=0; i<4; i++) + DisplaySliders(index, i); + WindowLevelChanged(); /*QString Extensions = EXTENSIONS; Extensions += ";;All Files (*)"; diff --git a/vv/vvMainWindow.h b/vv/vvMainWindow.h index 1ddf45d..d587a7f 100644 --- a/vv/vvMainWindow.h +++ b/vv/vvMainWindow.h @@ -49,8 +49,6 @@ class vvMainWindow: public vvMainWindowBase, { Q_OBJECT - friend class vvWipeImage; - public: vvMainWindow(); ~vvMainWindow(); @@ -185,6 +183,8 @@ public slots: void UpdateMemoryUsage(); void show(); + static vvMainWindow* Instance(){return mSingleton;} + protected: void createRecentlyOpenedFilesMenu(); @@ -236,7 +236,7 @@ private: // vvMainWindowToolInfo * mCurrentToolInfo; // std::vector mListOfRunningTool; - static vvMainWindow * mSingleton; + static vvMainWindow* mSingleton; int mCurrentTime; diff --git a/vv/vvWipeImage.cxx b/vv/vvWipeImage.cxx index c2d5a7e..6729c98 100644 --- a/vv/vvWipeImage.cxx +++ b/vv/vvWipeImage.cxx @@ -19,6 +19,7 @@ // vv #include "vvWipeImage.h" #include "vvSlicer.h" +#include "vvMainWindow.h" // clitk #include "clitkCropImage_ggo.h" @@ -105,7 +106,7 @@ void vvWipeImage::UpdateWipe() //------------------------------------------------------------------------------ -void vvWipeImage::selectWipeImage(int index) +void vvWipeImage::selectWipeImage(int index, QTreeWidget* DataTree) { QString Extensions = EXTENSIONS; @@ -119,11 +120,11 @@ void vvWipeImage::selectWipeImage(int index) vecFileNames.push_back(files[i].toStdString()); } - AddWipeImage(index,vecFileNames,vvImageReader::IMAGE); + AddWipeImage(index,vecFileNames,vvImageReader::IMAGE, DataTree); } //------------------------------------------------------------------------------ -void vvWipeImage::AddWipeImage(int index, std::vector fileNames, vvImageReader::LoadedImageType type) +void vvWipeImage::AddWipeImage(int index, std::vector fileNames, vvImageReader::LoadedImageType type, QTreeWidget* DataTree) { QString file(fileNames[0].c_str()); if (QFile::exists(file)) @@ -144,10 +145,10 @@ void vvWipeImage::AddWipeImage(int index, std::vector fileNames, vv //create an item in the tree with good settings QTreeWidgetItem *item = new QTreeWidgetItem(); item->setData(0,Qt::UserRole,file.toStdString().c_str()); - item->setData(1,Qt::UserRole,tr("overlay")); + item->setData(1,Qt::UserRole,tr("wipe")); QFileInfo fileinfo(file); //Do not show the path item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName()); - item->setToolTip(COLUMN_IMAGE_NAME, mSlicerManagers[index]->GetListOfAbsoluteFilePathInOneString("overlay").c_str()); + item->setToolTip(COLUMN_IMAGE_NAME, mSlicerManagers[index]->GetListOfAbsoluteFilePathInOneString("wipe").c_str()); qApp->processEvents(); #if VTK_MAJOR_VERSION > 5 for ( unsigned int i = 0; i < mSlicerManagers[index]->GetNumberOfSlicers(); i++) @@ -155,7 +156,7 @@ void vvWipeImage::AddWipeImage(int index, std::vector fileNames, vv #endif for (int j = 1; j <= 4; j++) { - item->setData(j,Qt::CheckStateRole,GetTree()->topLevelItem(index)->data(j,Qt::CheckStateRole)); + item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole)); } //Create the buttons for reload and close @@ -165,16 +166,16 @@ void vvWipeImage::AddWipeImage(int index, std::vector fileNames, vv cButton->setColumn(COLUMN_CLOSE_IMAGE); cButton->setToolTip(tr("close image")); cButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/exit.png"))); - /*connect(cButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)), - this,SLOT(CloseImage(QTreeWidgetItem*, int))); + connect(cButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)), + vvMainWindow::Instance(),SLOT(CloseImage(QTreeWidgetItem*, int))); QTreePushButton* rButton = new QTreePushButton; rButton->setItem(item); rButton->setColumn(COLUMN_RELOAD_IMAGE); rButton->setToolTip(tr("reload image")); rButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/rotateright.png"))); - connect(rButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)), - this,SLOT(ReloadImage(QTreeWidgetItem*, int))); + //connect(rButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)), + // this,SLOT(ReloadImage(QTreeWidgetItem*, int))); DataTree->topLevelItem(index)->setExpanded(1); DataTree->topLevelItem(index)->addChild(item); @@ -184,21 +185,21 @@ void vvWipeImage::AddWipeImage(int index, std::vector fileNames, vv //set the id of the image QString id = DataTree->topLevelItem(index)->data(COLUMN_IMAGE_NAME,Qt::UserRole).toString(); item->setData(COLUMN_IMAGE_NAME,Qt::UserRole,id.toStdString().c_str()); - UpdateTree(); + //UpdateTree(DataTree); qApp->processEvents(); - ImageInfoChanged(); + //ImageInfoChanged(); QApplication::restoreOverrideCursor(); // Update the display to update, e.g., the sliders - for(int i=0; i<4; i++) - DisplaySliders(index, i); - } else { +// for(int i=0; i<4; i++) +// DisplaySliders(index, i); +/* } else { QApplication::restoreOverrideCursor(); QString error = "Cannot import the new image.\n"; error += mSlicerManagers[index]->GetLastError().c_str(); QMessageBox::information(this,tr("Problem reading image !"),error); - } - WindowLevelChanged(); */ + } */ + //WindowLevelChanged(); } else QMessageBox::information(NULL,tr("Problem reading wipe Image !"),"File doesn't exist!"); @@ -206,4 +207,3 @@ void vvWipeImage::AddWipeImage(int index, std::vector fileNames, vv //------------------------------------------------------------------------------ - diff --git a/vv/vvWipeImage.h b/vv/vvWipeImage.h index 138866d..76b9eb3 100644 --- a/vv/vvWipeImage.h +++ b/vv/vvWipeImage.h @@ -26,7 +26,6 @@ #include #include "QTreePushButton.h" // vv -#include "vvMainWindowBase.h" #include "vvImage.h" #include "vvImageReader.h" #include "vvProgressDialog.h" @@ -56,9 +55,9 @@ class vvWipeImage: ~vvWipeImage(); void Initialize(QString inputPathName, std::vector slicerManagers); - void selectWipeImage(int index); + void selectWipeImage(int index, QTreeWidget* DataTree); void setInputImage(int number, vvImage::Pointer image); - void AddWipeImage(int index, std::vector fileNames, vvImageReader::LoadedImageType type); + void AddWipeImage(int index, std::vector fileNames, vvImageReader::LoadedImageType type, QTreeWidget* DataTree); public slots: void crossPointerChanged();