]> Creatis software - clitk.git/blobdiff - vv/vvMainWindow.cxx
New functionality: button apply windowing to all images
[clitk.git] / vv / vvMainWindow.cxx
index aa5b5cc7cf9a74e93d2bfa66074a7cebf57075ea..456e9bda79a93f4687ad29f0958d5e7a61466c4e 100644 (file)
@@ -133,18 +133,6 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
 
   contextMenu.addSeparator();
 
-  // QAction* actionCrop_image = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/crop.png")),
-  //                                                   tr("Crop Current Image"));
-  // connect(actionCrop_image,SIGNAL(triggered()),this,SLOT(CropImage()));
-  // contextActions.push_back(actionCrop_image);
-
-  QAction* actionSplit_image = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/cut.png")),
-                               tr("Split Current Image"));
-  connect(actionSplit_image,SIGNAL(triggered()),this,SLOT(SplitImage()));
-  contextActions.push_back(actionSplit_image);
-
-  contextMenu.addSeparator();
-
   contextMenu.addAction(actionAdd_VF_to_current_Image);
   contextActions.push_back(actionAdd_VF_to_current_Image);
 
@@ -246,6 +234,7 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   connect(actionOpen_Dicom_Struct,SIGNAL(triggered()),this,SLOT(OpenDCStructContour()));
   connect(actionOpen_VTK_contour,SIGNAL(triggered()),this,SLOT(OpenVTKContour()));
   connect(actionOpen_Multiple_Images_As_One,SIGNAL(triggered()),this,SLOT(MergeImages()));
+  connect(actionSlice_Image_As_Multiple_Images,SIGNAL(triggered()),this,SLOT(SliceImages()));
   connect(actionOpen_Image_With_Time,SIGNAL(triggered()),this,SLOT(OpenImageWithTime()));
   connect(actionMerge_images_as_n_dim_t, SIGNAL(triggered()), this, SLOT(MergeImagesWithTime()));
   connect(actionSave_As,SIGNAL(triggered()),this,SLOT(SaveAs()));
@@ -279,6 +268,7 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   connect(colorMapComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(UpdateColorMap()));
   connect(presetComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(UpdateWindowLevel()));
   connect(inverseButton,SIGNAL(clicked()),this,SLOT(SwitchWindowLevel()));
+  connect(applyWindowLevelToAllButton,SIGNAL(clicked()),this,SLOT(ApplyWindowLevelToAllImages()));
 
 
   connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(ShowContextMenu(QPoint)));
@@ -313,6 +303,7 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
     QMenu * rmenu = new QMenu("Recently opened files...");
     rmenu->setIcon(QIcon(QString::fromUtf8(":/common/icons/open.png")));
     menuFile->insertMenu(actionOpen_Image_With_Time,rmenu);
+    menuFile->insertSeparator(actionOpen_Image_With_Time);
     for (std::list<std::string>::iterator i = recent_files.begin(); i!=recent_files.end(); i++) {
       QAction* current=new QAction(QIcon(QString::fromUtf8(":/common/icons/open.png")),
                                    (*i).c_str(),this);
@@ -606,6 +597,22 @@ void vvMainWindow::MergeImages()
 }
 //------------------------------------------------------------------------------
 
+//------------------------------------------------------------------------------
+void vvMainWindow::SliceImages()
+{
+  QString Extensions = EXTENSIONS;
+  Extensions += ";;All Files (*)";
+
+  QStringList files = QFileDialog::getOpenFileNames(this,tr("Slice Images"),mInputPathName,Extensions);
+  if (files.isEmpty())
+    return;
+  mInputPathName = itksys::SystemTools::GetFilenamePath(files[0].toStdString()).c_str();
+  std::vector<std::string> vector;
+  for (int i = 0; i < files.size(); i++)
+    vector.push_back(files[i].toStdString());
+  LoadImages(vector, SLICED);
+}
+//------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvMainWindow::MergeImagesWithTime()
@@ -741,6 +748,32 @@ void vvMainWindow::LoadImages(std::vector<std::string> files, LoadedImageType fi
   else
     fileSize = 1;
 
+  // For SLICED, we need the number of slices (ndim and #slices)
+  std::vector<unsigned int> nSlices;
+  nSlices.resize(files.size());
+  std::fill(nSlices.begin(), nSlices.end(), 1);
+  if (filetype == SLICED) {
+    for (int i = 0; i < fileSize; i++) {
+      itk::ImageIOBase::Pointer header = clitk::readImageHeader(files[i]);
+      QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+      if (!header) {
+        nSlices[i] = 0;
+        QString error = "Cannot open file \n";
+        error += files[i].c_str();
+        QMessageBox::information(this,tr("Reading problem"),error);
+        return;
+      }
+      if (header->GetNumberOfDimensions() < 3) {
+        nSlices[i] = 0;
+        QString error = "Dimension problem. Cannot slice \n";
+        error += files[i].c_str();
+        QMessageBox::information(this,tr("Reading problem"),error);
+        return;
+      }
+      nSlices[i] = header->GetDimensions( header->GetNumberOfDimensions()-1 );
+    }
+  }
+  
   //Only add to the list of recently opened files when a single file is opened,
   //to avoid polluting the list of recently opened files
   if (files.size() == 1) {
@@ -760,93 +793,96 @@ void vvMainWindow::LoadImages(std::vector<std::string> files, LoadedImageType fi
     progress.SetProgress(i,fileSize);
     qApp->processEvents();
 
-    //read the image and put it in mSlicerManagers
-    vvSlicerManager* imageManager = new vvSlicerManager(4);
-    qApp->processEvents();
+    for (unsigned int j = 0; j < nSlices[i]; j++) {
+      //read the image and put it in mSlicerManagers
+      vvSlicerManager* imageManager = new vvSlicerManager(4);
+      qApp->processEvents();
 
-    bool SetImageSucceed=false;
+      bool SetImageSucceed=false;
 
-    // Change filename if an image with the same already exist
-    int number = GetImageDuplicateFilenameNumber(files[i]);
+      // Change filename if an image with the same already exist
+      int number = GetImageDuplicateFilenameNumber(files[i] + std::string("_slice"));
 
-    if (filetype == IMAGE || filetype == IMAGEWITHTIME)
-      SetImageSucceed = imageManager->SetImage(files[i],filetype, number);
-    else {
-      SetImageSucceed = imageManager->SetImages(files,filetype, number);
-    }
-    if (SetImageSucceed == false) {
-      QApplication::restoreOverrideCursor();
-      QString error = "Cannot open file \n";
-      error += imageManager->GetLastError().c_str();
-      QMessageBox::information(this,tr("Reading problem"),error);
-      delete imageManager;
-    } else {
-      mSlicerManagers.push_back(imageManager);
+      if (filetype == IMAGE || filetype == IMAGEWITHTIME || filetype == SLICED)
+        SetImageSucceed = imageManager->SetImage(files[i],filetype, number, j);
+      else {
+        SetImageSucceed = imageManager->SetImages(files,filetype, number);
+      }
+      if (SetImageSucceed == false) {
+        QApplication::restoreOverrideCursor();
+        QString error = "Cannot open file \n";
+        error += imageManager->GetLastError().c_str();
+        QMessageBox::information(this,tr("Reading problem"),error);
+        delete imageManager;
+      } else {
+        mSlicerManagers.push_back(imageManager);
 
-      //create an item in the tree with good settings
-      QTreeWidgetItem *item = new QTreeWidgetItem();
-      item->setData(0,Qt::UserRole,files[i].c_str());
-      QFileInfo fileinfo(imageManager->GetFileName().c_str()); //Do not show the path
-      item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName());
-      qApp->processEvents();
+        //create an item in the tree with good settings
+        QTreeWidgetItem *item = new QTreeWidgetItem();
+        item->setData(0,Qt::UserRole,files[i].c_str());
+        QFileInfo fileinfo(imageManager->GetFileName().c_str()); //Do not show the path
+        item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName());
+        item->setToolTip(COLUMN_IMAGE_NAME,fileinfo.absoluteFilePath());
+        qApp->processEvents();
 
-      //Create the buttons for reload and close
-      qApp->processEvents();
-      QTreePushButton* cButton = new QTreePushButton;
-      cButton->setItem(item);
-      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)));
+        //Create the buttons for reload and close
+        qApp->processEvents();
+        QTreePushButton* cButton = new QTreePushButton;
+        cButton->setItem(item);
+        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)));
 
-      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)));
+        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)));
 
-      DataTree->addTopLevelItem(item);
-      DataTree->setItemWidget(item, COLUMN_CLOSE_IMAGE, cButton);
-      DataTree->setItemWidget(item, COLUMN_RELOAD_IMAGE, rButton);
+        DataTree->addTopLevelItem(item);
+        DataTree->setItemWidget(item, COLUMN_CLOSE_IMAGE, cButton);
+        DataTree->setItemWidget(item, COLUMN_RELOAD_IMAGE, rButton);
 
-      //set the id of the image
-      QString id = files[i].c_str() + QString::number(mSlicerManagers.size()-1);
-      item->setData(COLUMN_IMAGE_NAME,Qt::UserRole,id.toStdString().c_str());
-      mSlicerManagers.back()->SetId(id.toStdString());
-
-      linkPanel->addImage(imageManager->GetFileName(), id.toStdString());
-
-      connect(mSlicerManagers.back(), SIGNAL(currentImageChanged(std::string)),
-              this,SLOT(CurrentImageChanged(std::string)));
-      connect(mSlicerManagers.back(), SIGNAL(UpdatePosition(int, double, double, double, double, double, double, double)),
-              this,SLOT(MousePositionChanged(int,double, double, double, double, double, double, double)));
-      connect(mSlicerManagers.back(), SIGNAL(UpdateVector(int, double, double, double, double)),
-              this, SLOT(VectorChanged(int,double,double,double, double)));
-      connect(mSlicerManagers.back(), SIGNAL(UpdateOverlay(int, double, double)),
-              this, SLOT(OverlayChanged(int,double,double)));
-      connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)),
-              this, SLOT(FusionChanged(int,double)));
-      connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)),
-              this,SLOT(WindowsChanged(int, int, int)));
-      connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)),
-              this,SLOT(WindowLevelChanged(double, double, int, int)));
-      connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)),
-              this,SLOT(UpdateSlice(int,int)));
-      connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)),
-              this,SLOT(UpdateTSlice(int, int)));
-      connect(mSlicerManagers.back(), SIGNAL(UpdateSliceRange(int,int,int,int,int)),
-              this,SLOT(UpdateSliceRange(int,int,int,int,int)));
-      connect(mSlicerManagers.back(), SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)),
-              this,SLOT(UpdateLinkManager(std::string,int,double,double,double,int)));
-      connect(mSlicerManagers.back(), SIGNAL(UpdateLinkedNavigation(std::string,vvSlicerManager*)),
-              this,SLOT(UpdateLinkedNavigation(std::string,vvSlicerManager*)));
-      connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)),
-              this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)));
-      connect(mSlicerManagers.back(),SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
-      InitSlicers();
+        //set the id of the image
+        QString id = files[i].c_str() + QString::number(mSlicerManagers.size()-1);
+        item->setData(COLUMN_IMAGE_NAME,Qt::UserRole,id.toStdString().c_str());
+        mSlicerManagers.back()->SetId(id.toStdString());
+
+        linkPanel->addImage(imageManager->GetFileName(), id.toStdString());
+
+        connect(mSlicerManagers.back(), SIGNAL(currentImageChanged(std::string)),
+                this,SLOT(CurrentImageChanged(std::string)));
+        connect(mSlicerManagers.back(), SIGNAL(UpdatePosition(int, double, double, double, double, double, double, double)),
+                this,SLOT(MousePositionChanged(int,double, double, double, double, double, double, double)));
+        connect(mSlicerManagers.back(), SIGNAL(UpdateVector(int, double, double, double, double)),
+                this, SLOT(VectorChanged(int,double,double,double, double)));
+        connect(mSlicerManagers.back(), SIGNAL(UpdateOverlay(int, double, double)),
+                this, SLOT(OverlayChanged(int,double,double)));
+        connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)),
+                this, SLOT(FusionChanged(int,double)));
+        connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)),
+                this,SLOT(WindowsChanged(int, int, int)));
+        connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)),
+                this,SLOT(WindowLevelChanged(double, double, int, int)));
+        connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)),
+                this,SLOT(UpdateSlice(int,int)));
+        connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)),
+                this,SLOT(UpdateTSlice(int, int)));
+        connect(mSlicerManagers.back(), SIGNAL(UpdateSliceRange(int,int,int,int,int)),
+                this,SLOT(UpdateSliceRange(int,int,int,int,int)));
+        connect(mSlicerManagers.back(), SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)),
+                this,SLOT(UpdateLinkManager(std::string,int,double,double,double,int)));
+        connect(mSlicerManagers.back(), SIGNAL(UpdateLinkedNavigation(std::string,vvSlicerManager*)),
+                this,SLOT(UpdateLinkedNavigation(std::string,vvSlicerManager*)));
+        connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)),
+                this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)));
+        connect(mSlicerManagers.back(),SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
+        InitSlicers();
+      }
       numberofsuccesulreads++;
     }
   }
@@ -916,8 +952,8 @@ void vvMainWindow::CurrentImageChanged(std::string id)
 //------------------------------------------------------------------------------
 void vvMainWindow::ImageInfoChanged()
 {
-  contextActions[7]->setEnabled(1);
   contextActions[6]->setEnabled(1);
+  contextActions[5]->setEnabled(1);
   actionSave_As->setEnabled(1);
   actionAdd_VF_to_current_Image->setEnabled(1);
   actionAdd_fusion_image->setEnabled(1);
@@ -1493,136 +1529,6 @@ void vvMainWindow::ReloadImage(QTreeWidgetItem* item, int column)
 }
 //------------------------------------------------------------------------------
 
-// void vvMainWindow::CropImage()
-// {
-//   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
-//   vvCropDialog crop(mSlicerManagers,index);
-//   if(crop.exec())
-//     AddImage(crop.GetOutput(),"cropped.mhd");
-// }
-
-//------------------------------------------------------------------------------
-void vvMainWindow::SplitImage()
-{
-  int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
-  int dim = mSlicerManagers[index]->GetDimension();
-  QString warning = "Do you really want to split the ";
-  warning += QString::number(dim) + "D image ";
-  warning += DataTree->selectedItems()[0]->data(COLUMN_IMAGE_NAME,Qt::DisplayRole).toString() + " into ";
-  warning += QString::number(mSlicerManagers[index]->GetSlicer(0)->GetImage()->GetSize()[dim-1]) + " ";
-  warning += QString::number(dim-1) + "D images.";
-  QMessageBox msgBox(QMessageBox::Warning, tr("Split Image"),
-                     warning, 0, this);
-  msgBox.addButton(tr("Split"), QMessageBox::AcceptRole);
-  msgBox.addButton(tr("Cancel"), QMessageBox::RejectRole);
-  if (msgBox.exec() == QMessageBox::AcceptRole) {
-    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
-    if (dim > 2) {
-      std::string filename = DataTree->selectedItems()[0]->data(0,Qt::UserRole).toString().toStdString();
-      int numberOfSlice = mSlicerManagers[index]->GetSlicer(0)->GetImage()->GetSize()[dim-1];
-      std::string path = itksys::SystemTools::GetFilenamePath(
-                           filename);
-      path += "/";
-      path += DataTree->selectedItems()[0]->data(COLUMN_IMAGE_NAME,Qt::DisplayRole).toString().toStdString();
-      path += "%03d";
-      path += itksys::SystemTools::GetFilenameLastExtension(
-                filename).c_str();
-
-      typedef itk::NumericSeriesFileNames NameGeneratorType;
-      NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();
-      nameGenerator->SetSeriesFormat(path.c_str());
-      nameGenerator->SetStartIndex(0);
-      nameGenerator->SetEndIndex(numberOfSlice-1);
-      nameGenerator->SetIncrementIndex(1);
-
-      for (int i = 0; i < numberOfSlice; i++) {
-        vvSlicerManager* imageManager = new vvSlicerManager(4);
-        imageManager->SetExtractedImage(nameGenerator->GetFileNames()[i],
-                                        mSlicerManagers[index]->GetSlicer(0)->GetImage(), i);
-        mSlicerManagers.push_back(imageManager);
-
-        //create an item in the tree with good settings
-        QTreeWidgetItem *item = new QTreeWidgetItem();
-        item->setData(0,Qt::UserRole,nameGenerator->GetFileNames()[i].c_str());
-        std::string fileI = itksys::SystemTools::GetFilenameWithoutLastExtension(
-                              nameGenerator->GetFileNames()[i]).c_str();
-        item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileI.c_str());
-        for (int j = 1; j <= 4; j++) {
-          for (int i = 0; i < DataTree->topLevelItemCount(); i++) {
-            DataTree->topLevelItem(i)->setData(j,Qt::CheckStateRole,0);
-          }
-          item->setData(j,Qt::CheckStateRole,2);
-        }
-
-        //Create the buttons for reload and close
-        QTreePushButton* cButton = new QTreePushButton;
-        cButton->setItem(item);
-        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)));
-
-        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")));
-        rButton->setEnabled(false);
-        connect(rButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
-                this,SLOT(ReloadImage(QTreeWidgetItem*, int)));
-
-        DataTree->addTopLevelItem(item);
-        DataTree->setItemWidget(item, COLUMN_CLOSE_IMAGE, cButton);
-        DataTree->setItemWidget(item, COLUMN_RELOAD_IMAGE, rButton);
-
-        //set the id of the image
-        QString id = nameGenerator->GetFileNames()[i].c_str() + QString::number(mSlicerManagers.size()-1);
-        item->setData(COLUMN_IMAGE_NAME,Qt::UserRole,id.toStdString().c_str());
-        mSlicerManagers.back()->SetId(id.toStdString());
-        linkPanel->addImage(fileI, id.toStdString());
-        connect(mSlicerManagers.back(),SIGNAL(currentImageChanged(std::string)),
-                this,SLOT(CurrentImageChanged(std::string)));
-        connect(mSlicerManagers.back(),SIGNAL(
-                  UpdatePosition(int, double, double, double, double, double, double, double)),this,
-                SLOT(MousePositionChanged(int,double, double, double, double, double, double, double)));
-        connect(mSlicerManagers.back(),SIGNAL(UpdateVector(int, double, double, double, double)),
-                this, SLOT(VectorChanged(int,double,double,double, double)));
-        connect(mSlicerManagers.back(),SIGNAL(UpdateOverlay(int, double, double)),
-                this, SLOT(OverlayChanged(int,double,double)));
-        connect(mSlicerManagers.back(),SIGNAL(UpdateFusion(int, double)),
-                this, SLOT(FusionChanged(int,double)));
-        connect(mSlicerManagers.back(),SIGNAL(UpdateWindows(int, int, int)),
-                this,SLOT(WindowsChanged(int, int, int)));
-        connect(mSlicerManagers.back(),SIGNAL(WindowLevelChanged(double, double,int, int)),
-                this,SLOT(WindowLevelChanged(double, double, int, int)));
-        connect(mSlicerManagers.back(),SIGNAL(UpdateSlice(int,int)),
-                this,SLOT(UpdateSlice(int,int)));
-        connect(mSlicerManagers.back(),SIGNAL(UpdateTSlice(int, int)),
-                this,SLOT(UpdateTSlice(int, int)));
-        connect(mSlicerManagers.back(),SIGNAL(UpdateSliceRange(int,int,int,int,int)),
-                this,SLOT(UpdateSliceRange(int,int,int,int,int)));
-        connect(mSlicerManagers.back(),SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)),
-                this,SLOT(UpdateLinkManager(std::string,int,double,double,double,int)));
-        connect(mSlicerManagers.back(), SIGNAL(UpdateLinkedNavigation(std::string,vvSlicerManager*)),
-                this,SLOT(UpdateLinkedNavigation(std::string,vvSlicerManager*)));
-        connect(mSlicerManagers.back(),SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
-        UpdateTree();
-        qApp->processEvents();
-        InitSlicers();
-        InitDisplay();
-        qApp->processEvents();
-      }
-      QApplication::restoreOverrideCursor();
-    } else {
-      QApplication::restoreOverrideCursor();
-      QString error = "Cannot split file (dimensions must be greater than 2) ";
-      QMessageBox::information(this,tr("Splitting problem"),error);
-    }
-  }
-}
-//------------------------------------------------------------------------------
-
 //------------------------------------------------------------------------------
 void vvMainWindow::MousePositionChanged(int visibility,double x, double y, double z, double X, double Y, double Z , double value)
 {
@@ -1711,6 +1617,20 @@ void vvMainWindow::SwitchWindowLevel()
 }
 //------------------------------------------------------------------------------
 
+//------------------------------------------------------------------------------
+void vvMainWindow::ApplyWindowLevelToAllImages()
+{
+  for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
+    if (mSlicerManagers[i] == NULL)
+      continue;
+    mSlicerManagers[i]->SetColorWindow(windowSpinBox->value());
+    mSlicerManagers[i]->SetColorLevel(levelSpinBox->value());
+    mSlicerManagers[i]->SetPreset(6);
+    mSlicerManagers[i]->Render();
+  }
+}
+//------------------------------------------------------------------------------
+
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateLinkManager(std::string id, int slicer, double x, double y, double z, int temps)
 {
@@ -1746,7 +1666,6 @@ void vvMainWindow::ShowContextMenu(QPoint point)
     contextActions[4]->setEnabled(0);
     contextActions[5]->setEnabled(0);
     contextActions[6]->setEnabled(0);
-    contextActions[7]->setEnabled(0);
   } else {
     int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
     contextActions[1]->setEnabled(1);
@@ -1756,7 +1675,6 @@ void vvMainWindow::ShowContextMenu(QPoint point)
     contextActions[3]->setEnabled(1);
     contextActions[5]->setEnabled(1);
     contextActions[6]->setEnabled(1);
-    contextActions[7]->setEnabled(1);
 
     if (mSlicerManagers[index]->GetDimension() < 3)
       contextActions[4]->setEnabled(0);
@@ -1825,7 +1743,9 @@ void vvMainWindow::AddOverlayImage(int index, QString file)
     QTreeWidgetItem *item = new QTreeWidgetItem();
     item->setData(0,Qt::UserRole,file.toStdString().c_str());
     item->setData(1,Qt::UserRole,tr("overlay"));
-    item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,filename.c_str());
+    QFileInfo fileinfo(file); //Do not show the path
+    item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName());
+    item->setToolTip(COLUMN_IMAGE_NAME,fileinfo.absoluteFilePath());
     qApp->processEvents();
 
     for (int j = 1; j <= 4; j++) {
@@ -1946,7 +1866,9 @@ void vvMainWindow::AddFusionImage(int index, QString file)
       QTreeWidgetItem *item = new QTreeWidgetItem();
       item->setData(0,Qt::UserRole,file.toStdString().c_str());
       item->setData(1,Qt::UserRole,tr("fusion"));
-      item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,filename.c_str());
+      QFileInfo fileinfo(filename.c_str()); //Do not show the path
+      item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName());
+      item->setToolTip(COLUMN_IMAGE_NAME,fileinfo.absoluteFilePath());
       qApp->processEvents();
 
       for (int j = 1; j <= 4; j++) {
@@ -2029,7 +1951,9 @@ void vvMainWindow::AddFieldEntry(QString filename,int index,bool from_disk)
   QTreeWidgetItem *item = new QTreeWidgetItem();
   item->setData(0,Qt::UserRole,filename.toStdString().c_str());
   item->setData(1,Qt::UserRole,tr("vector"));
-  item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,filename);
+  QFileInfo fileinfo(filename); //Do not show the path
+  item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName());
+  item->setToolTip(COLUMN_IMAGE_NAME,fileinfo.absoluteFilePath());
   qApp->processEvents();
 
   for (int j = 1; j <= 4; j++) {