]> Creatis software - clitk.git/blobdiff - vv/vvMainWindow.cxx
New functionality: button apply windowing to all images
[clitk.git] / vv / vvMainWindow.cxx
index 1c9765efbbb37983a293ffd37f72abc9768c6e0e..456e9bda79a93f4687ad29f0958d5e7a61466c4e 100644 (file)
@@ -268,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)));
@@ -821,6 +822,7 @@ void vvMainWindow::LoadImages(std::vector<std::string> files, LoadedImageType fi
         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
@@ -1615,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)
 {
@@ -1727,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++) {
@@ -1848,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++) {
@@ -1931,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++) {