From: dsarrut Date: Thu, 3 Mar 2011 10:16:29 +0000 (+0000) Subject: add memory usage info in panel (need libstatgrab) X-Git-Tag: v1.2.0~213 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=e49162511fd226bd3b5299e472dbd4db803cd01a;p=clitk.git add memory usage info in panel (need libstatgrab) --- diff --git a/vv/qt_ui/vvInfoPanel.ui b/vv/qt_ui/vvInfoPanel.ui index 9768d2f..756f444 100644 --- a/vv/qt_ui/vvInfoPanel.ui +++ b/vv/qt_ui/vvInfoPanel.ui @@ -30,8 +30,8 @@ 0 0 - 273 - 417 + 281 + 425 @@ -486,6 +486,23 @@ p, li { white-space: pre-wrap; } + + + + + 0 + 0 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#0000ff;">Memory usage: </span></p></body></html> + + + diff --git a/vv/vvInfoPanel.cxx b/vv/vvInfoPanel.cxx index 33564b3..e20a9c1 100644 --- a/vv/vvInfoPanel.cxx +++ b/vv/vvInfoPanel.cxx @@ -14,12 +14,14 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ + ======================================================================-====*/ #include #include #include "vvInfoPanel.h" +#include "clitkMemoryUsage.h" +//------------------------------------------------------------------------------ void vvInfoPanel::setFileName(QString text) { if (text.size() > 30) @@ -27,37 +29,58 @@ void vvInfoPanel::setFileName(QString text) else imageLabel->setText(text); } +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ void vvInfoPanel::setDimension(QString text) { dimensionLabel->setText(text); } +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ void vvInfoPanel::setSizeMM(QString text) { sizeMMLabel->setText(text); } +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ void vvInfoPanel::setNPixel(QString text) { nPixelLabel->setText(text); } +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ void vvInfoPanel::setSizePixel(QString text) { sizePixelLabel->setText(text); } +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ void vvInfoPanel::setOrigin(QString text) { originLabel->setText(text); } +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ void vvInfoPanel::setSpacing(QString text) { spacingLabel->setText(text); } +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ void vvInfoPanel::setCurrentInfo(int visibility, double x, double y, double z, double X, double Y, double Z, double value) { QString world = ""; @@ -78,8 +101,10 @@ void vvInfoPanel::setCurrentInfo(int visibility, double x, double y, double z, d pixelPosLabel->setText(mouse); valueLabel->setText(val); } +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ void vvInfoPanel::setViews(int window, int view, int slice) { QString viewString; @@ -125,3 +150,13 @@ void vvInfoPanel::setViews(int window, int view, int slice) } } } +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvInfoPanel::setMemoryInMb(QString text) +{ + memoryUsageLabel->setText("Memory usage: "+text); +} +//------------------------------------------------------------------------------ + diff --git a/vv/vvInfoPanel.h b/vv/vvInfoPanel.h index 8927018..63bc052 100644 --- a/vv/vvInfoPanel.h +++ b/vv/vvInfoPanel.h @@ -14,7 +14,7 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ + ======================================================================-====*/ #ifndef vvInfoPanel_h #define vvInfoPanel_h #include @@ -24,23 +24,24 @@ class vvInfoPanel : public QWidget, private Ui::vvInfoPanel { - Q_OBJECT - -public: - vvInfoPanel(QWidget * parent=0):QWidget(parent) { - setupUi(this); - } - ~vvInfoPanel() {} - - void setFileName(QString text); - void setSizeMM(QString text); - void setOrigin(QString text); - void setSpacing(QString text); - void setNPixel(QString text); - void setDimension(QString text); - void setSizePixel(QString text); - void setCurrentInfo(int visibility, double x, double y, double z, double X, double Y, double Z, double value); - void setViews(int window, int view, int slice); + Q_OBJECT + + public: + vvInfoPanel(QWidget * parent=0):QWidget(parent) { + setupUi(this); + } + ~vvInfoPanel() {} + + void setFileName(QString text); + void setSizeMM(QString text); + void setOrigin(QString text); + void setSpacing(QString text); + void setNPixel(QString text); + void setDimension(QString text); + void setSizePixel(QString text); + void setCurrentInfo(int visibility, double x, double y, double z, double X, double Y, double Z, double value); + void setViews(int window, int view, int slice); + void setMemoryInMb(QString text); public slots: diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 456e9bd..1c109f0 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -317,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(5000); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvMainWindow::UpdateMemoryUsage() +{ + clitk::PrintMemory(true); + ImageInfoChanged(); } //------------------------------------------------------------------------------ @@ -1076,6 +1091,9 @@ void vvMainWindow::ImageInfoChanged() infoPanel->setSpacing(GetVectorDoubleAsString(inputSpacing)); infoPanel->setNPixel(QString::number(NPixel)+" ("+inputSizeInBytes+")"); + infoPanel->setMemoryInMb(QString::number(clitk::GetMemoryUsageInMb())+" Mb"); + + landmarksPanel->SetCurrentLandmarks(mSlicerManagers[index]->GetLandmarks(), mSlicerManagers[index]->GetSlicer(0)->GetImage()->GetVTKImages().size()); landmarksPanel->SetCurrentPath(mInputPathName.toStdString()); @@ -1496,6 +1514,7 @@ void vvMainWindow::CloseImage(QTreeWidgetItem* item, int column) InitDisplay(); } } + ImageInfoChanged(); } //------------------------------------------------------------------------------ @@ -2739,6 +2758,7 @@ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filen qApp->processEvents(); // End + ImageInfoChanged(); return slicer_manager; } //------------------------------------------------------------------------------ diff --git a/vv/vvMainWindow.h b/vv/vvMainWindow.h index 87765a9..300d758 100644 --- a/vv/vvMainWindow.h +++ b/vv/vvMainWindow.h @@ -26,6 +26,7 @@ #include "vvToolManager.h" #include "vvConstants.h" #include "vvMesh.h" +#include "clitkMemoryUsage.h" class vvSlicerManager; class vvHelpDialog; @@ -146,6 +147,7 @@ public slots: mFrameRate = rate; } void UpdateRenderWindows(); + void UpdateMemoryUsage(); private: