X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvMainWindow.cxx;h=5266fc15f236f1490d2d0bc40b00cd6510e4f3c8;hb=3d059f81bab4d113bdd5e87bc15a266381ee7182;hp=1c9765efbbb37983a293ffd37f72abc9768c6e0e;hpb=d3682a4b4db6ce9090a38c37d124ee9c24f6fd5f;p=clitk.git diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 1c9765e..5266fc1 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -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"); } //------------------------------------------------------------------------------ @@ -821,6 +837,7 @@ void vvMainWindow::LoadImages(std::vector 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 @@ -1494,6 +1511,7 @@ void vvMainWindow::CloseImage(QTreeWidgetItem* item, int column) InitDisplay(); } } + ImageInfoChanged(); } //------------------------------------------------------------------------------ @@ -1615,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) { @@ -1727,7 +1759,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 +1882,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 +1967,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++) { @@ -2717,6 +2755,7 @@ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filen qApp->processEvents(); // End + ImageInfoChanged(); return slicer_manager; } //------------------------------------------------------------------------------