From: delmon Date: Thu, 10 Mar 2011 16:19:33 +0000 (+0000) Subject: Romulo: X-Git-Tag: v1.2.0~181 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=686056dfe2391eed76302af43b08d30791901965;p=clitk.git Romulo: - Included visualization of the image's transformation interface on the main window - Removed panel information that preivously existed --- diff --git a/vv/qt_ui/vvInfoPanel.ui b/vv/qt_ui/vvInfoPanel.ui index c3a733f..6cf6ecc 100644 --- a/vv/qt_ui/vvInfoPanel.ui +++ b/vv/qt_ui/vvInfoPanel.ui @@ -7,7 +7,7 @@ 0 0 295 - 439 + 355 @@ -30,8 +30,12 @@ 0 0 + vvInfoPanel.ui + 281 + 341 281 425 + 1.3 @@ -370,24 +374,8 @@ p, li { white-space: pre-wrap; } - - - - - 0 - 0 - - - - <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;"> Top Left :</span></p></body></html> - - - - - + + 0 @@ -397,68 +385,13 @@ p, li { white-space: pre-wrap; } - - - - - - - 0 - 0 - - - - <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;">Top Right :</span></p></body></html> + + Qt::PlainText - - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - <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;"> Bottom Left : </span></p></body></html> - - - - - - - - 0 - 0 - - - - - - - - - + + 0 @@ -466,23 +399,11 @@ p, li { white-space: pre-wrap; } - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> + <!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;"> Bottom Right :</span></p></body></html> - - - - - - - - 0 - 0 - - - - +<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;">Transformation Matrix:</span></p></body></html> diff --git a/vv/vvInfoPanel.cxx b/vv/vvInfoPanel.cxx index e20a9c1..ee77cb1 100644 --- a/vv/vvInfoPanel.cxx +++ b/vv/vvInfoPanel.cxx @@ -22,6 +22,13 @@ #include "clitkMemoryUsage.h" //------------------------------------------------------------------------------ +void vvInfoPanel::setTransformation(QString text) +{ + transformationLabel->setText(text); +} + +//------------------------------------------------------------------------------ + void vvInfoPanel::setFileName(QString text) { if (text.size() > 30) @@ -106,7 +113,7 @@ void vvInfoPanel::setCurrentInfo(int visibility, double x, double y, double z, d //------------------------------------------------------------------------------ void vvInfoPanel::setViews(int window, int view, int slice) -{ +{/* QString viewString; switch (view) { case 0: { @@ -148,7 +155,7 @@ void vvInfoPanel::setViews(int window, int view, int slice) DRLabel->setText(text); break; } - } + }*/ } //------------------------------------------------------------------------------ diff --git a/vv/vvInfoPanel.h b/vv/vvInfoPanel.h index 63bc052..8d10e24 100644 --- a/vv/vvInfoPanel.h +++ b/vv/vvInfoPanel.h @@ -26,22 +26,23 @@ 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); - void setMemoryInMb(QString text); +public: + vvInfoPanel(QWidget * parent=0):QWidget(parent) { + setupUi(this); + } + ~vvInfoPanel() {} + + void setTransformation(QString text); + 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 5266fc1..141cd18 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -67,9 +67,13 @@ #include "vtkPNMWriter.h" #include "vtkPNGWriter.h" #include "vtkJPEGWriter.h" +#include "vtkMatrix4x4.h" +#include "vtkTransform.h" // Standard includes #include +#include +#include #define COLUMN_TREE 0 #define COLUMN_UL_VIEW 1 @@ -996,6 +1000,7 @@ void vvMainWindow::ImageInfoChanged() std::vector inputSpacing; std::vector inputSize; std::vector sizeMM; + vtkSmartPointer transformation; int dimension=0; QString pixelType; QString inputSizeInBytes; @@ -1029,6 +1034,7 @@ void vvMainWindow::ImageInfoChanged() sizeMM[i] = inputSize[i]*inputSpacing[i]; NPixel *= inputSize[i]; } + transformation = imageSelected->GetTransform()->GetMatrix(); inputSizeInBytes = GetSizeInBytes(imageSelected->GetActualMemorySize()*1000); } else if (DataTree->selectedItems()[0]->data(1,Qt::UserRole).toString() == "vector") { vvImage::Pointer imageSelected = mSlicerManagers[index]->GetSlicer(0)->GetVF(); @@ -1090,6 +1096,7 @@ void vvMainWindow::ImageInfoChanged() infoPanel->setOrigin(GetVectorDoubleAsString(origin)); infoPanel->setSpacing(GetVectorDoubleAsString(inputSpacing)); infoPanel->setNPixel(QString::number(NPixel)+" ("+inputSizeInBytes+")"); + infoPanel->setTransformation(Get4x4MatrixDoubleAsString(transformation)); landmarksPanel->SetCurrentLandmarks(mSlicerManagers[index]->GetLandmarks(), mSlicerManagers[index]->GetSlicer(0)->GetImage()->GetVTKImages().size()); @@ -1240,6 +1247,29 @@ QString vvMainWindow::GetSizeInBytes(unsigned long size) } //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +QString vvMainWindow::Get4x4MatrixDoubleAsString(vtkSmartPointer matrix) +{ + std::ostringstream strmatrix; + + for (unsigned int i = 0; i < 4; i++) { + for (unsigned int j = 0; j < 4; j++) { + strmatrix.flags(ios::showpos); + strmatrix.width(10); + strmatrix.precision(3); + strmatrix.setf(ios::fixed,ios::floatfield); + strmatrix.fill(' '); + strmatrix << std::left << matrix->GetElement(i, j); + //strmatrix.width(10); + strmatrix << " "; + } + strmatrix << std::endl; + } + QString result = strmatrix.str().c_str(); + return result; +} +//------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ QString vvMainWindow::GetVectorDoubleAsString(std::vector vectorDouble) { diff --git a/vv/vvMainWindow.h b/vv/vvMainWindow.h index 300d758..b3cd6cd 100644 --- a/vv/vvMainWindow.h +++ b/vv/vvMainWindow.h @@ -28,12 +28,16 @@ #include "vvMesh.h" #include "clitkMemoryUsage.h" +#include "vtkSmartPointer.h" + + class vvSlicerManager; class vvHelpDialog; class vvDocumentation; class vtkRenderWindowInteractor; class vtkImageData; class vtkRenderer; +class vtkMatrix4x4; class vvDicomSeriesSelector; //------------------------------------------------------------------------------ @@ -173,6 +177,7 @@ private: QString GetSizeInBytes(unsigned long size); QString GetVectorDoubleAsString(std::vector vectorDouble); QString GetVectorIntAsString(std::vector vectorInt); + QString Get4x4MatrixDoubleAsString(vtkSmartPointer matrix); int GetSlicerIndexFromItem(QTreeWidgetItem* item); QTreeWidgetItem* GetItemFromSlicerManager(vvSlicerManager* sm); void SaveScreenshot(vtkImageData* image);