]> Creatis software - clitk.git/commitdiff
test
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Mon, 29 Aug 2016 13:25:19 +0000 (15:25 +0200)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Mon, 29 Aug 2016 13:25:19 +0000 (15:25 +0200)
vv/vvMainWindow.cxx
vv/vvMainWindow.h
vv/vvWipeImage.cxx
vv/vvWipeImage.h

index e756ddf6b1288c04d20b5fb286f0f953de4acef3..2403de46585a734557f7be9983d1276acb26ea79 100644 (file)
@@ -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 (*)";
index 1ddf45d307bea1adb5756fae9b6290b2f1a860f7..d587a7f91ab9a203bd22fe78fed76c1c27fbc34b 100644 (file)
@@ -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<vvToolCreatorBase*> mListOfRunningTool;
 
-  static vvMainWindow * mSingleton;
+  static vvMainWindow* mSingleton;
 
   int mCurrentTime;
   
index c2d5a7e303378483d01924a61b7e6aca7c6c4f9b..6729c98ca2dda96e9f44b831ac36b3dfd9f1c69d 100644 (file)
@@ -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<std::string> fileNames, vvImageReader::LoadedImageType type)
+void vvWipeImage::AddWipeImage(int index, std::vector<std::string> 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<std::string> 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<std::string> 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<std::string> 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<std::string> 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<std::string> fileNames, vv
 //------------------------------------------------------------------------------
 
 
-
index 138866d0283246fcee54bdb93462bdc21d370aac..76b9eb34dc550c640009328fa49aba20f89fd7dd 100644 (file)
@@ -26,7 +26,6 @@
 #include <QMessageBox>
 #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<vvSlicerManager*> slicerManagers);
-  void selectWipeImage(int index);
+  void selectWipeImage(int index, QTreeWidget* DataTree);
   void setInputImage(int number, vvImage::Pointer image);
-  void AddWipeImage(int index, std::vector<std::string> fileNames, vvImageReader::LoadedImageType type);
+  void AddWipeImage(int index, std::vector<std::string> fileNames, vvImageReader::LoadedImageType type, QTreeWidget* DataTree);
 
 public slots:
   void crossPointerChanged();