]> Creatis software - clitk.git/blobdiff - vv/vvMainWindow.cxx
Merge branch 'master' into wipe
[clitk.git] / vv / vvMainWindow.cxx
index a3d2000cbd9da993edcd9adccbd3b1130eaf9358..f3b36e36ac6166b0d4968524c0586ab0cf1dba61 100644 (file)
@@ -110,11 +110,7 @@ It is distributed under dual licence
 #define COLUMN_RELOAD_IMAGE 6
 #define COLUMN_IMAGE_NAME 7
 
-#ifdef CLITK_PRIVATE_FEATURES
-#define EXTENSIONS "Images ( *.bmp *.dcm *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan *.nii.gz *.usf *.svl)"
-#else
-#define EXTENSIONS "Images ( *.bmp *.dcm *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan *.nii.gz)"
-#endif
+#include <extensions.h>
 
 
 /*Data Tree values
@@ -200,6 +196,9 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   contextActions.push_back(actionAdd_USSequence_toCT);
 #endif
 
+  contextMenu.addAction(actionAdd_wipe_image);
+  contextActions.push_back(actionAdd_wipe_image);
+
 
   contextMenu.addSeparator();
   QAction* actionResetMatrix = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/identity.png")),
@@ -243,6 +242,7 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   actionAdd_VF_to_current_Image->setEnabled(0);
   actionAdd_fusion_image->setEnabled(0);
   actionAdd_USSequence_toCT->setEnabled(0);
+  actionAdd_wipe_image->setEnabled(0);
 
   //init the sliders
   verticalSliders.push_back(NOVerticalSlider);
@@ -292,6 +292,7 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   connect(actionRead_saved_state,SIGNAL(triggered()),this,SLOT(ReadSavedState()));
   connect(actionExit,SIGNAL(triggered()),this,SLOT(close()));
   connect(actionAdd_VF_to_current_Image,SIGNAL(triggered()),this,SLOT(OpenField()));
+  connect(actionAdd_wipe_image,SIGNAL(triggered()),this,SLOT(SelectWipeImage()));
   connect(actionAdd_fusion_image,SIGNAL(triggered()),this,SLOT(SelectFusionImage()));
   connect(actionAdd_overlay_image_to_current_image,SIGNAL(triggered()), this,SLOT(SelectOverlayImage()));
   connect(actionAdd_USSequence_toCT,SIGNAL(triggered()), this,SLOT(SelectFusionSequence()));
@@ -1083,6 +1084,7 @@ void vvMainWindow::ImageInfoChanged()
   actionSave_As->setEnabled(1);
   actionAdd_VF_to_current_Image->setEnabled(1);
   actionAdd_fusion_image->setEnabled(1);
+  actionAdd_wipe_image->setEnabled(1);
   actionAdd_overlay_image_to_current_image->setEnabled(1);
   actionAdd_USSequence_toCT->setEnabled(1);
   actionNorth_East_Window->setEnabled(1);
@@ -2169,6 +2171,42 @@ void vvMainWindow::AddROI(int index, QString file)
 }
 //------------------------------------------------------------------------------
 
+//------------------------------------------------------------------------------
+void vvMainWindow::SelectWipeImage()
+{ 
+  int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
+  
+
+  if (!(CheckAddedImage(index, "wipe")))
+    return;
+
+  vvWipeImage::Pointer wipeImage = vvWipeImage::New();
+  wipeImage->Initialize(mInputPathName, mSlicerManagers);
+  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 (*)";
+  QStringList files = QFileDialog::getOpenFileNames(this,tr("Load Wipe image"),mInputPathName,Extensions);
+  if (files.isEmpty())
+    return;
+
+  std::vector<std::string> vecFileNames;
+  for (int i = 0; i < files.size(); i++) {
+    vecFileNames.push_back(files[i].toStdString());
+  }*/
+
+  //AddWipeImage(index,vecFileNames,vvImageReader::IMAGE);
+}
+//------------------------------------------------------------------------------
+
+
 //------------------------------------------------------------------------------
 void vvMainWindow::SelectFusionImage()
 {