]> Creatis software - clitk.git/commitdiff
Romulo:
authordelmon <delmon>
Thu, 10 Mar 2011 16:19:33 +0000 (16:19 +0000)
committerdelmon <delmon>
Thu, 10 Mar 2011 16:19:33 +0000 (16:19 +0000)
- Included visualization of the image's transformation interface on the main
window
- Removed panel information that preivously existed

vv/qt_ui/vvInfoPanel.ui
vv/vvInfoPanel.cxx
vv/vvInfoPanel.h
vv/vvMainWindow.cxx
vv/vvMainWindow.h

index c3a733f5db96affa67adf3c5ff7e010cc3a0edf1..6cf6ecc21f266b8ce994d4289e6d31160445fbb1 100644 (file)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>295</width>
-    <height>439</height>
+    <height>355</height>
    </rect>
   </property>
   <property name="sizePolicy">
        <rect>
         <x>0</x>
         <y>0</y>
+        vvInfoPanel.ui
+        <width>281</width>
+        <height>341</height>
         <width>281</width>
         <height>425</height>
+        1.3
        </rect>
       </property>
       <layout class="QGridLayout" name="gridLayout">
@@ -370,24 +374,8 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="12" column="0">
-        <widget class="QLabel" name="ULStaticLabel">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="text">
-          <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;  Top Left :&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-        </widget>
-       </item>
-       <item row="12" column="1">
-        <widget class="QLabel" name="ULLabel">
+       <item row="14" column="0" colspan="2">
+        <widget class="QLabel" name="transformationLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
            <horstretch>0</horstretch>
@@ -397,68 +385,13 @@ p, li { white-space: pre-wrap; }
          <property name="text">
           <string/>
          </property>
-        </widget>
-       </item>
-       <item row="13" column="0">
-        <widget class="QLabel" name="URStaticLabel">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="text">
-          <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;  &lt;span style=&quot; font-weight:600;&quot;&gt;Top Right :&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         <property name="textFormat">
+          <enum>Qt::PlainText</enum>
          </property>
         </widget>
        </item>
-       <item row="13" column="1">
-        <widget class="QLabel" name="URLabel">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-       </item>
-       <item row="14" column="0">
-        <widget class="QLabel" name="DLStaticLabel">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="text">
-          <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;  Bottom Left : &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-        </widget>
-       </item>
-       <item row="14" column="1">
-        <widget class="QLabel" name="DLLabel">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-       </item>
-       <item row="15" column="0">
-        <widget class="QLabel" name="DRStaticLabel">
+       <item row="12" column="0">
+        <widget class="QLabel" name="TransformationStaticLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
            <horstretch>0</horstretch>
@@ -466,23 +399,11 @@ p, li { white-space: pre-wrap; }
           </sizepolicy>
          </property>
          <property name="text">
-          <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+          <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
 p, li { white-space: pre-wrap; }
 &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;  Bottom Right :&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-        </widget>
-       </item>
-       <item row="15" column="1">
-        <widget class="QLabel" name="DRLabel">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="text">
-          <string/>
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Transformation Matrix:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
         </widget>
        </item>
index e20a9c1a4e071fa13e3bffca9f7af43cc81ae0fa..ee77cb1447b01e870c68ae72143663397fd75b3e 100644 (file)
 #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;
   }
-  }
+  }*/
 }
 //------------------------------------------------------------------------------
 
index 63bc052af787bcab42ef58bce56d5ebf0c7fc95b..8d10e244765c011d9bef5f2132bf23a5abfa9e07 100644 (file)
@@ -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:
 
index 5266fc15f236f1490d2d0bc40b00cd6510e4f3c8..141cd1836163fd8ca5144fdcc47c04f4e2d7a6aa 100644 (file)
 #include "vtkPNMWriter.h"
 #include "vtkPNGWriter.h"
 #include "vtkJPEGWriter.h"
+#include "vtkMatrix4x4.h"
+#include "vtkTransform.h"
 
 // Standard includes
 #include <iostream>
+#include <sstream>
+#include <iomanip>
 
 #define COLUMN_TREE 0
 #define COLUMN_UL_VIEW 1
@@ -996,6 +1000,7 @@ void vvMainWindow::ImageInfoChanged()
     std::vector<double> inputSpacing;
     std::vector<int> inputSize;
     std::vector<double> sizeMM;
+    vtkSmartPointer<vtkMatrix4x4> 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<vtkMatrix4x4> 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<double> vectorDouble)
 {
index 300d758463ac0ae38628092273e05ddeaa4038ab..b3cd6cd6834228ab2a47d1d5d0931d8a4910ca5c 100644 (file)
 #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<double> vectorDouble);
   QString GetVectorIntAsString(std::vector<int> vectorInt);
+  QString Get4x4MatrixDoubleAsString(vtkSmartPointer<vtkMatrix4x4> matrix);
   int GetSlicerIndexFromItem(QTreeWidgetItem* item);
   QTreeWidgetItem* GetItemFromSlicerManager(vvSlicerManager* sm);
   void SaveScreenshot(vtkImageData* image);