]> Creatis software - clitk.git/blobdiff - vv/vvMainWindow.cxx
Add smartpointer for vtk objects
[clitk.git] / vv / vvMainWindow.cxx
index f62198883969d56e456f1d22e0a0a54d85b69d11..5266fc15f236f1490d2d0bc40b00cd6510e4f3c8 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)));
@@ -316,6 +317,21 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
 
   if (!CLITK_EXPERIMENTAL)
     menuExperimental->menuAction()->setVisible(false);
+
+
+  QTimer * timerMemory = new QTimer(this);
+  //timerMemory->setInterval(5);
+  connect(timerMemory, SIGNAL(timeout()), this, SLOT(UpdateMemoryUsage()));
+  timerMemory->start(2000);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvMainWindow::UpdateMemoryUsage()
+{
+  //  clitk::PrintMemory(true);
+  infoPanel->setMemoryInMb(QString::number(clitk::GetMemoryUsageInMb())+" MiB");
 }
 //------------------------------------------------------------------------------
 
@@ -1495,6 +1511,7 @@ void vvMainWindow::CloseImage(QTreeWidgetItem* item, int column)
       InitDisplay();
     }
   }
+  ImageInfoChanged();
 }
 //------------------------------------------------------------------------------
 
@@ -1616,6 +1633,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)
 {
@@ -2724,6 +2755,7 @@ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filen
   qApp->processEvents();
   
   // End
+  ImageInfoChanged();
   return slicer_manager;
 }
 //------------------------------------------------------------------------------