]> Creatis software - clitk.git/blobdiff - vv/vvMainWindow.cxx
Merge branch 'master' into wipe
[clitk.git] / vv / vvMainWindow.cxx
index 958cf5c837574cffa3f76e10a58e33d75220854e..335177a5327969bf87d6f0de12d20056330a25d2 100644 (file)
@@ -48,7 +48,7 @@ It is distributed under dual licence
 #include "vvMeshReader.h"
 #include "vvSaveState.h"
 #include "vvReadState.h"
-#ifdef CLITK_USE_PACS_CONNECTION
+#if CLITK_USE_PACS_CONNECTION
 #include "vvQPacsConnection.h"
 #endif
 #include "clitkConfiguration.h"
@@ -82,9 +82,7 @@ It is distributed under dual licence
 #include <vtkPNGWriter.h>
 #include <vtkJPEGWriter.h>
 #include <vtkGenericMovieWriter.h>
-#ifdef CLITK_EXPERIMENTAL
-#  include <vvAnimatedGIFWriter.h>
-#endif
+#include <vvAnimatedGIFWriter.h>
 #ifdef VTK_USE_VIDEO_FOR_WINDOWS
 #  include <vtkAVIWriter.h>
 #endif
@@ -112,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
@@ -202,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")),
@@ -235,7 +232,7 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   documentation = new vvDocumentation();
   help_dialog = new vvHelpDialog();
   dicomSeriesSelector = new vvDicomSeriesSelector();
-#ifdef CLITK_USE_PACS_CONNECTION
+#if CLITK_USE_PACS_CONNECTION
      PacsConnection = new vvQPacsConnection();
 #endif
 
@@ -245,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);
@@ -280,8 +278,8 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   connect(actionWarp_image_with_vector_field,SIGNAL(triggered()),this,SLOT(WarpImage()));
   connect(actionLoad_images,SIGNAL(triggered()),this,SLOT(OpenImages()));
   connect(actionOpen_Dicom,SIGNAL(triggered()),this,SLOT(OpenDicom()));
-  #ifdef CLITK_USE_PACS_CONNECTION
-connect(actionConnect_Pacs,SIGNAL(triggered()),this,SLOT(ConnectPacs()));
+#if CLITK_USE_PACS_CONNECTION
+  connect(actionConnect_Pacs,SIGNAL(triggered()),this,SLOT(ConnectPacs()));
 #endif
   //  connect(actionOpen_Dicom_Struct,SIGNAL(triggered()),this,SLOT(OpenDCStructContour()));
   connect(actionOpen_VTK_contour,SIGNAL(triggered()),this,SLOT(OpenVTKContour()));
@@ -294,6 +292,7 @@ connect(actionConnect_Pacs,SIGNAL(triggered()),this,SLOT(ConnectPacs()));
   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()));
@@ -397,6 +396,10 @@ connect(actionConnect_Pacs,SIGNAL(triggered()),this,SLOT(ConnectPacs()));
     menuExperimental->menuAction()->setVisible(false);
 #endif
 
+#if !CLITK_USE_PACS_CONNECTION
+    actionConnect_Pacs->setVisible(false);
+#endif
+
   QTimer * timerMemory = new QTimer(this);
   //timerMemory->setInterval(5);
   connect(timerMemory, SIGNAL(timeout()), this, SLOT(UpdateMemoryUsage()));
@@ -770,7 +773,7 @@ void vvMainWindow::OpenDicom()
     LoadImages(files, vvImageReader::DICOM);
   }
 }  
-#ifdef CLITK_USE_PACS_CONNECTION
+#if CLITK_USE_PACS_CONNECTION
 void vvMainWindow::ConnectPacs()
 {
   std::vector<std::string> files;
@@ -1080,6 +1083,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);
@@ -2166,6 +2170,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()
 { 
@@ -3338,9 +3378,7 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget)
 #ifdef VTK_USE_MPEG2_ENCODER
   Extensions += ";;Video( *.mpg)";
 #endif
-#ifdef CLITK_EXPERIMENTAL
   Extensions += ";;Video( *.gif)";
-#endif
 
   int smIndex=GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   QString fileName = QFileDialog::getSaveFileName(this,
@@ -3385,7 +3423,6 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget)
 
     // Video
     vtkGenericMovieWriter *vidwriter = NULL;
-#if CLITK_EXPERIMENTAL == 1
     if (ext==".gif") {
       vvAnimatedGIFWriter *gif = vvAnimatedGIFWriter::New();
       vidwriter = gif;
@@ -3410,7 +3447,6 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget)
       msgBox.addButton(tr("No"), QMessageBox::RejectRole);
       gif->SetDither(msgBox.exec() == QMessageBox::AcceptRole);
     }
-#endif
 #ifdef VTK_USE_VIDEO_FOR_WINDOWS
     if (ext==".avi") {
       vtkAVIWriter *mpg = vtkAVIWriter::New();