]> Creatis software - clitk.git/commitdiff
Put back and refactored manual rigid registration
authorSimon Rit <simon.rit@creatis.insa-lyon.fr>
Mon, 13 Feb 2012 13:28:08 +0000 (14:28 +0100)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Mon, 13 Feb 2012 13:28:08 +0000 (14:28 +0100)
vv/CMakeLists.txt
vv/qt_ui/vvToolRigidReg.ui
vv/vvToolRigidReg.cxx
vv/vvToolRigidReg.h

index 8ecd3ccb0db23a27a7b7185e7d160fd53650fc1e..320e1948b4c52c09cc451ff3f3cc4e4bc3ab791a 100644 (file)
@@ -12,7 +12,7 @@ endif(COMMAND cmake_policy)
 #List of vv tools to compile
 SET(vv_TOOLS
   vvToolMedianFilter
-#  vvToolRigidReg ## Very long to compile
+  vvToolRigidReg
   vvToolCropImage
   vvToolBinarize
   vvToolImageArithm
@@ -32,7 +32,6 @@ SET(vv_TOOLS
 # dependencies of the tools
 # Future issues : when tool depend on other tools ... how to manage that ?
 #  >> add the relevant $_LIBS variable to the tool that has dependencies?
-SET(vvToolRigidReg_LIBS clitkAffineRegistrationLib)
 SET(vvToolBinarize_LIBS clitkBinarizeImageLib)
 SET(vvToolResample_LIBS clitkResampleImageLib)
 SET(vvToolConvert_LIBS clitkImageConvertLib)
index 296e6d587dbc063e25ee76d1af69713f824b1bf3..10e77d6d613ec91abb6b54eadbec4dcdff65085b 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>757</width>
-    <height>472</height>
+    <width>266</width>
+    <height>333</height>
    </rect>
   </property>
   <property name="windowTitle">
   </property>
   <layout class="QGridLayout" name="gridLayout">
    <item row="0" column="0">
-    <widget class="QTabWidget" name="tabWidget">
-     <property name="currentIndex">
-      <number>1</number>
-     </property>
-     <widget class="QWidget" name="tab_3">
-      <attribute name="title">
-       <string>Manual</string>
-      </attribute>
-      <layout class="QVBoxLayout" name="verticalLayout">
-       <item>
-        <layout class="QGridLayout" name="gridLayout_4">
-         <item row="0" column="0">
-          <layout class="QHBoxLayout" name="horizontalLayout_28">
-           <item>
-            <widget class="QLabel" name="label">
-             <property name="text">
-              <string>Rotation Center(X,Y,Z)</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QLineEdit" name="Xval"/>
-           </item>
-           <item>
-            <widget class="QLineEdit" name="Yval"/>
-           </item>
-           <item>
-            <widget class="QLineEdit" name="Zval"/>
-           </item>
-           <item>
-            <widget class="QPushButton" name="resetbutton">
-             <property name="text">
-              <string>Reset</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
+    <layout class="QGridLayout" name="gridLayout_4">
+     <item row="2" column="0">
+      <layout class="QHBoxLayout" name="horizontalLayout_29">
+       <item>
+        <widget class="QLabel" name="ytans">
+         <property name="text">
+          <string>X</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_37"/>
+       </item>
+       <item>
+        <widget class="QSlider" name="xtrans_slider">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QDoubleSpinBox" name="xtrans_sb"/>
+       </item>
+      </layout>
+     </item>
+     <item row="7" column="0">
+      <layout class="QHBoxLayout" name="horizontalLayout_33">
+       <item>
+        <widget class="QLabel" name="xrot">
+         <property name="text">
+          <string>X</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_42"/>
+       </item>
+       <item>
+        <widget class="QSlider" name="xrot_slider">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QDoubleSpinBox" name="xrot_sb"/>
+       </item>
+      </layout>
+     </item>
+     <item row="9" column="0">
+      <layout class="QHBoxLayout" name="horizontalLayout_34">
+       <item>
+        <widget class="QLabel" name="zrot">
+         <property name="text">
+          <string>Z</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_43"/>
+       </item>
+       <item>
+        <widget class="QSlider" name="zrot_slider">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QDoubleSpinBox" name="zrot_sb"/>
+       </item>
+      </layout>
+     </item>
+     <item row="12" column="0">
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <widget class="QLabel" name="TransformationStaticLabel">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="text">
+          <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; color:#0000ff;&quot;&gt;Original Transformation Matrix:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QLabel" name="transformationLabel">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="font">
+          <font>
+           <family>Monospace</family>
+           <pointsize>8</pointsize>
+          </font>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+         <property name="textFormat">
+          <enum>Qt::PlainText</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_5">
+         <item>
+          <widget class="QPushButton" name="savebutton">
+           <property name="text">
+            <string>Save</string>
+           </property>
+          </widget>
          </item>
-         <item row="1" column="0">
-          <layout class="QHBoxLayout" name="horizontalLayout_29">
-           <item>
-            <widget class="QLabel" name="ytans">
-             <property name="text">
-              <string>X Trans</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <layout class="QHBoxLayout" name="horizontalLayout_37"/>
-           </item>
-           <item>
-            <widget class="QSlider" name="xtrans_slider">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QDoubleSpinBox" name="xtrans_sb"/>
-           </item>
-          </layout>
+         <item>
+          <widget class="QPushButton" name="loadbutton">
+           <property name="text">
+            <string>Load</string>
+           </property>
+          </widget>
          </item>
-         <item row="4" column="0">
-          <layout class="QHBoxLayout" name="horizontalLayout_32">
-           <item>
-            <widget class="QLabel" name="yrot">
-             <property name="text">
-              <string>Y Rot   </string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <layout class="QHBoxLayout" name="horizontalLayout_40"/>
-           </item>
-           <item>
-            <widget class="QSlider" name="yrot_slider">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QDoubleSpinBox" name="yrot_sb"/>
-           </item>
-          </layout>
+         <item>
+          <widget class="QPushButton" name="resetbutton">
+           <property name="text">
+            <string>Reset</string>
+           </property>
+          </widget>
          </item>
-         <item row="5" column="0">
-          <layout class="QHBoxLayout" name="horizontalLayout_33">
-           <item>
-            <widget class="QLabel" name="xrot">
-             <property name="text">
-              <string>X Rot   </string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <layout class="QHBoxLayout" name="horizontalLayout_42"/>
-           </item>
-           <item>
-            <widget class="QSlider" name="xrot_slider">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QDoubleSpinBox" name="xrot_sb"/>
-           </item>
-          </layout>
+        </layout>
+       </item>
+      </layout>
+     </item>
+     <item row="4" column="0">
+      <layout class="QHBoxLayout" name="horizontalLayout_31">
+       <item>
+        <widget class="QLabel" name="ztrans">
+         <property name="text">
+          <string>Z</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_39"/>
+       </item>
+       <item>
+        <widget class="QSlider" name="ztrans_slider">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QDoubleSpinBox" name="ztrans_sb"/>
+       </item>
+      </layout>
+     </item>
+     <item row="3" column="0">
+      <layout class="QHBoxLayout" name="horizontalLayout_30">
+       <item>
+        <widget class="QLabel" name="ytrans">
+         <property name="text">
+          <string>Y</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_38"/>
+       </item>
+       <item>
+        <widget class="QSlider" name="ytrans_slider">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QDoubleSpinBox" name="ytrans_sb"/>
+       </item>
+      </layout>
+     </item>
+     <item row="12" column="1">
+      <layout class="QHBoxLayout" name="horizontalLayout_49"/>
+     </item>
+     <item row="8" column="0">
+      <layout class="QHBoxLayout" name="horizontalLayout_32">
+       <item>
+        <widget class="QLabel" name="yrot">
+         <property name="text">
+          <string>Y</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_40"/>
+       </item>
+       <item>
+        <widget class="QSlider" name="yrot_slider">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QDoubleSpinBox" name="yrot_sb"/>
+       </item>
+      </layout>
+     </item>
+     <item row="1" column="0">
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <item>
+        <widget class="QLabel" name="label_3">
+         <property name="font">
+          <font>
+           <pointsize>14</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="text">
+          <string>Translations</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="horizontalSpacer">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QLabel" name="label_2">
+         <property name="text">
+          <string>Steps</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QDoubleSpinBox" name="stepTransSpinBox">
+         <property name="toolTip">
+          <string>Translations</string>
+         </property>
+         <property name="singleStep">
+          <double>1.000000000000000</double>
+         </property>
+         <property name="value">
+          <double>1.000000000000000</double>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item row="5" column="0">
+      <layout class="QHBoxLayout" name="horizontalLayout_3">
+       <item>
+        <widget class="QLabel" name="label_4">
+         <property name="font">
+          <font>
+           <pointsize>14</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="text">
+          <string>Rotations</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="horizontalSpacer_3">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QCheckBox" name="checkBoxDegrees">
+         <property name="text">
+          <string>Deg</string>
+         </property>
+         <property name="checked">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <spacer name="horizontalSpacer_2">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
          </item>
-         <item row="6" column="0">
-          <layout class="QHBoxLayout" name="horizontalLayout_34">
-           <item>
-            <widget class="QLabel" name="zrot">
-             <property name="text">
-              <string>Z Rot   </string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <layout class="QHBoxLayout" name="horizontalLayout_43"/>
-           </item>
-           <item>
-            <widget class="QSlider" name="zrot_slider">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QDoubleSpinBox" name="zrot_sb"/>
-           </item>
-          </layout>
+         <item>
+          <widget class="QLabel" name="label_5">
+           <property name="text">
+            <string>Steps</string>
+           </property>
+          </widget>
          </item>
-         <item row="9" column="0">
-          <layout class="QGridLayout" name="gridLayout_6">
-           <item row="1" column="3">
-            <widget class="QTextEdit" name="textEdit">
-             <property name="sizePolicy">
-              <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
-               <horstretch>0</horstretch>
-               <verstretch>0</verstretch>
-              </sizepolicy>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="0">
-            <widget class="QPushButton" name="loadbutton">
-             <property name="text">
-              <string>Load</string>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="1">
-            <widget class="QPushButton" name="savebutton">
-             <property name="text">
-              <string>Save</string>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="2">
-            <widget class="QTextEdit" name="textEdit_2">
-             <property name="sizePolicy">
-              <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
-               <horstretch>0</horstretch>
-               <verstretch>0</verstretch>
-              </sizepolicy>
-             </property>
-            </widget>
-           </item>
-           <item row="0" column="2">
-            <widget class="QLabel" name="label_2">
-             <property name="text">
-              <string>Initial Transform</string>
-             </property>
-             <property name="alignment">
-              <set>Qt::AlignBottom|Qt::AlignHCenter</set>
-             </property>
-            </widget>
-           </item>
-           <item row="0" column="3">
-            <widget class="QLabel" name="label_3">
-             <property name="text">
-              <string>Current Transform</string>
-             </property>
-             <property name="alignment">
-              <set>Qt::AlignCenter</set>
-             </property>
-            </widget>
-           </item>
-          </layout>
+         <item>
+          <widget class="QDoubleSpinBox" name="stepRotSpinBox">
+           <property name="toolTip">
+            <string>Rotations</string>
+           </property>
+           <property name="value">
+            <double>1.000000000000000</double>
+           </property>
+          </widget>
          </item>
-         <item row="3" column="0">
-          <layout class="QHBoxLayout" name="horizontalLayout_31">
-           <item>
-            <widget class="QLabel" name="ztrans">
-             <property name="text">
-              <string>Z Trans</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <layout class="QHBoxLayout" name="horizontalLayout_39"/>
-           </item>
-           <item>
-            <widget class="QSlider" name="ztrans_slider">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QDoubleSpinBox" name="ztrans_sb"/>
-           </item>
-          </layout>
+        </layout>
+       </item>
+      </layout>
+     </item>
+     <item row="6" column="0">
+      <layout class="QHBoxLayout" name="horizontalLayout_28">
+       <item>
+        <widget class="QLabel" name="label">
+         <property name="text">
+          <string>Center</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_4">
+         <item>
+          <widget class="QLineEdit" name="Zval"/>
          </item>
-         <item row="2" column="0">
-          <layout class="QHBoxLayout" name="horizontalLayout_30">
-           <item>
-            <widget class="QLabel" name="ytrans">
-             <property name="text">
-              <string>Y Trans</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <layout class="QHBoxLayout" name="horizontalLayout_38"/>
-           </item>
-           <item>
-            <widget class="QSlider" name="ytrans_slider">
-             <property name="orientation">
-              <enum>Qt::Horizontal</enum>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QDoubleSpinBox" name="ytrans_sb"/>
-           </item>
-          </layout>
+         <item>
+          <widget class="QLineEdit" name="Yval"/>
          </item>
-         <item row="9" column="1">
-          <layout class="QHBoxLayout" name="horizontalLayout_49"/>
+         <item>
+          <widget class="QLineEdit" name="Xval"/>
          </item>
         </layout>
        </item>
       </layout>
-     </widget>
-     <widget class="QWidget" name="tab_4">
-      <attribute name="title">
-       <string>Automatic</string>
-      </attribute>
-      <widget class="QWidget" name="gridLayoutWidget_2">
-       <property name="geometry">
-        <rect>
-         <x>0</x>
-         <y>0</y>
-         <width>721</width>
-         <height>421</height>
-        </rect>
-       </property>
-       <layout class="QGridLayout" name="gridLayout_5">
-        <item row="1" column="0">
-         <layout class="QHBoxLayout" name="horizontalLayout_45"/>
-        </item>
-        <item row="2" column="0">
-         <layout class="QHBoxLayout" name="horizontalLayout_46"/>
-        </item>
-        <item row="0" column="3">
-         <widget class="QTextEdit" name="tab2textedit"/>
-        </item>
-        <item row="0" column="0">
-         <layout class="QVBoxLayout" name="verticalLayout_2"/>
-        </item>
-        <item row="0" column="2">
-         <widget class="QStackedWidget" name="stackedWidget">
-          <widget class="QWidget" name="page_3">
-           <widget class="QPushButton" name="tab2applybutton">
-            <property name="geometry">
-             <rect>
-              <x>20</x>
-              <y>228</y>
-              <width>90</width>
-              <height>32</height>
-             </rect>
-            </property>
-            <property name="text">
-             <string>Run!</string>
-            </property>
-           </widget>
-           <widget class="QPushButton" name="tab2loadbutton">
-            <property name="geometry">
-             <rect>
-              <x>20</x>
-              <y>183</y>
-              <width>91</width>
-              <height>32</height>
-             </rect>
-            </property>
-            <property name="styleSheet">
-             <string notr="true">font: 9pt &quot;Arial&quot;;</string>
-            </property>
-            <property name="text">
-             <string>Load</string>
-            </property>
-           </widget>
-           <widget class="QCheckBox" name="checkBox_rigid">
-            <property name="geometry">
-             <rect>
-              <x>30</x>
-              <y>113</y>
-              <width>87</width>
-              <height>20</height>
-             </rect>
-            </property>
-            <property name="text">
-             <string>Rigid</string>
-            </property>
-           </widget>
-           <widget class="QCheckBox" name="checkBox_deformable">
-            <property name="geometry">
-             <rect>
-              <x>30</x>
-              <y>143</y>
-              <width>101</width>
-              <height>20</height>
-             </rect>
-            </property>
-            <property name="text">
-             <string>Deformable</string>
-            </property>
-           </widget>
-           <widget class="QPushButton" name="tab2savebutton">
-            <property name="geometry">
-             <rect>
-              <x>20</x>
-              <y>273</y>
-              <width>91</width>
-              <height>32</height>
-             </rect>
-            </property>
-            <property name="styleSheet">
-             <string notr="true">font: 9pt &quot;Arial&quot;;</string>
-            </property>
-            <property name="text">
-             <string>Save</string>
-            </property>
-           </widget>
-           <widget class="QComboBox" name="cb_transform">
-            <property name="geometry">
-             <rect>
-              <x>160</x>
-              <y>90</y>
-              <width>151</width>
-              <height>26</height>
-             </rect>
-            </property>
-            <item>
-             <property name="text">
-              <string>Identity</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Translations</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Rigid</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Affine</string>
-             </property>
-            </item>
-           </widget>
-           <widget class="QLabel" name="translabel">
-            <property name="geometry">
-             <rect>
-              <x>204</x>
-              <y>70</y>
-              <width>71</width>
-              <height>16</height>
-             </rect>
-            </property>
-            <property name="text">
-             <string>Transform</string>
-            </property>
-           </widget>
-           <widget class="QLabel" name="interpollabel">
-            <property name="geometry">
-             <rect>
-              <x>201</x>
-              <y>120</y>
-              <width>81</width>
-              <height>16</height>
-             </rect>
-            </property>
-            <property name="text">
-             <string>Interpolator</string>
-            </property>
-           </widget>
-           <widget class="QComboBox" name="cb_interpolator">
-            <property name="geometry">
-             <rect>
-              <x>160</x>
-              <y>140</y>
-              <width>151</width>
-              <height>26</height>
-             </rect>
-            </property>
-            <item>
-             <property name="text">
-              <string>Nearest Neighborhood</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Linear</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>BSpline</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>BLUT</string>
-             </property>
-            </item>
-           </widget>
-           <widget class="QLabel" name="optimlabel">
-            <property name="geometry">
-             <rect>
-              <x>204</x>
-              <y>170</y>
-              <width>71</width>
-              <height>16</height>
-             </rect>
-            </property>
-            <property name="text">
-             <string>Optimizer</string>
-            </property>
-           </widget>
-           <widget class="QComboBox" name="cb_optimizer">
-            <property name="geometry">
-             <rect>
-              <x>160</x>
-              <y>190</y>
-              <width>151</width>
-              <height>26</height>
-             </rect>
-            </property>
-            <item>
-             <property name="text">
-              <string>Simplex</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Powell</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>FRPR</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Regular Step GD</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>VersorRigid3D</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Conjugated Gradient</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>L-BFGS</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>L-BFGS-B</string>
-             </property>
-            </item>
-           </widget>
-           <widget class="QLabel" name="metriclabel">
-            <property name="geometry">
-             <rect>
-              <x>218</x>
-              <y>220</y>
-              <width>60</width>
-              <height>16</height>
-             </rect>
-            </property>
-            <property name="text">
-             <string>Metric</string>
-            </property>
-           </widget>
-           <widget class="QComboBox" name="cb_metric">
-            <property name="geometry">
-             <rect>
-              <x>160</x>
-              <y>240</y>
-              <width>151</width>
-              <height>26</height>
-             </rect>
-            </property>
-            <item>
-             <property name="text">
-              <string>Mean Squares</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Normalized CC</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Histogram CC</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Gradient Difference</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Viola Wells MI</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Histogram MI</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Mattes MI</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Normalized MI</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>CR</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>SSD (BLUT FFD)</string>
-             </property>
-            </item>
-           </widget>
-           <widget class="QComboBox" name="cb_selectoutput">
-            <property name="geometry">
-             <rect>
-              <x>162</x>
-              <y>294</y>
-              <width>151</width>
-              <height>26</height>
-             </rect>
-            </property>
-            <item>
-             <property name="text">
-              <string>Transformed Image</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Checker After Reg</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Checker Before Reg</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Difference After Reg</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Difference Before Reg</string>
-             </property>
-            </item>
-           </widget>
-           <widget class="QLabel" name="outputlabel">
-            <property name="geometry">
-             <rect>
-              <x>195</x>
-              <y>274</y>
-              <width>91</width>
-              <height>20</height>
-             </rect>
-            </property>
-            <property name="text">
-             <string>Select Output</string>
-            </property>
-           </widget>
-           <widget class="QLabel" name="presetlabel">
-            <property name="geometry">
-             <rect>
-              <x>208</x>
-              <y>20</y>
-              <width>71</width>
-              <height>16</height>
-             </rect>
-            </property>
-            <property name="text">
-             <string>Presets</string>
-            </property>
-           </widget>
-           <widget class="QComboBox" name="cb_presets">
-            <property name="geometry">
-             <rect>
-              <x>160</x>
-              <y>40</y>
-              <width>151</width>
-              <height>26</height>
-             </rect>
-            </property>
-            <item>
-             <property name="text">
-              <string>Mono Modal Registration</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>Multi Modal Registration</string>
-             </property>
-            </item>
-           </widget>
-          </widget>
-          <widget class="QWidget" name="page_4"/>
-         </widget>
-        </item>
-       </layout>
-      </widget>
-     </widget>
-    </widget>
+     </item>
+    </layout>
    </item>
   </layout>
  </widget>
- <resources>
-  <include location="../vvIcons.qrc"/>
- </resources>
+ <resources/>
  <connections/>
 </ui>
index e99d8674b628fe06f0e9da5ca6d325b68aa74cd6..1a2d1c7679a71c3bee66a7ad249b692cd59e4717 100644 (file)
@@ -18,7 +18,6 @@
 
 // vv
 #include "vvToolRigidReg.h"
-#include "vvImageReader.h"
 #include "vvSlicer.h"
 
 // vtk
 #include <vtkSmartPointer.h>
 #include <vtkTransform.h>
 
+// itk
+#include <itkEuler3DTransform.h>
+
 // clitk
 #include "clitkTransformUtilities.h"
-#include "clitkAffineRegistrationGenericFilter.h"      
+
 // qt
 #include <QMessageBox>
 #include <QFileDialog>
 #include <QTextStream>
-#include <QComboBox>
-#include <QCursor>
 
 
 //------------------------------------------------------------------------------
@@ -51,1301 +51,379 @@ vvToolRigidReg::vvToolRigidReg(vvMainWindowBase * parent, Qt::WindowFlags f):
 {
   // GUI Initialization
   Ui_vvToolRigidReg::setupUi(mToolWidget);
-   // QSize qsize;
-//    qsize.setHeight(470);
-//    qsize.setWidth(850);
-//    mToolWidget->setFixedSize(qsize);
-  // Set how many inputs are needed for this tool
-  cb_transform->hide();
-  cb_interpolator->hide();
-  cb_optimizer->hide();
-  cb_metric->hide();
-  cb_selectoutput->hide();
-  cb_presets->hide();
-  translabel->hide();
-  metriclabel->hide();
-  outputlabel->hide();
-  optimlabel->hide();
-  interpollabel->hide();
-  presetlabel->hide();
-  
   
   // Set how many inputs are needed for this tool
   AddInputSelector("Select moving image");
-  AddInputSelector("Select fixed image");
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-vvToolRigidReg::~vvToolRigidReg()
-{
-}
-//------------------------------------------------------------------------------
 
-//------------------------------------------------------------------------------
-bool vvToolRigidReg::close()
-{
-  ResetTransform();
-  RemoveOverlay();
-  return vvToolWidgetBase::close();
+  QFont font = transformationLabel->font();
+  font.setStyleHint(QFont::TypeWriter);
+  transformationLabel->setFont(font);
+
+  mInitialMatrix = vtkSmartPointer<vtkMatrix4x4>::New();
+
+  // Set slider ranges, assume degrees, will not be changed for radians
+  std::vector<QSlider *> transSliders, rotSliders;
+  std::vector<QDoubleSpinBox *> transSBs, rotSBs;
+  GetSlidersAndSpinBoxes(transSliders, rotSliders, transSBs, rotSBs);
+  for(int i=0; i<3; i++) {
+    transSliders[i]->setRange(-2000,2000);
+    rotSliders[i]->setRange(-360,360);
+    transSBs[i]->setRange(-2000,2000);
+    transSBs[i]->setDecimals(3);
+    rotSBs[i]->setRange(-360,360);
+    rotSBs[i]->setDecimals(3);
+  }
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvToolRigidReg::reject()
+vvToolRigidReg::~vvToolRigidReg()
 {
-
-  return vvToolWidgetBase::reject();
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvToolRigidReg::GetArgsInfoFromGUI()
-{   
-  QFont font=QFont("Courier",10);
-  tab2textedit->setTextColor(QColor(255,0,0));
-  tab2textedit->setCurrentFont(font);
-  tab2textedit->update();
-   
-  QString file = QFileDialog::getOpenFileName(
-                    this,
-                   "Locate the Config File",
-                    mMainWindow->GetInputPathName(),
-                    "Text (*.conf *.txt *.rtf *.doc)");
-  
-  if (file.isEmpty())
-  return;
-  
-  QFile Qfile1(file);
-  mConfigFile= file.toStdString();
-  CmdlineParser(1, 1);//1,1 - override, initialize
-  cb_transform->setCurrentIndex(mArgsInfo.transform_arg);
-  cb_interpolator->setCurrentIndex(mArgsInfo.interp_arg);
-  cb_optimizer->setCurrentIndex(mArgsInfo.optimizer_arg);
-  cb_metric->setCurrentIndex(mArgsInfo.metric_arg);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvToolRigidReg::Presets()
-{
-  mConfigFile="Presets";
-  std::string matrixfilename;
-if(cb_presets->currentIndex()==0)
+void vvToolRigidReg::Initialize()
 {
-    mArgsInfo.reference_arg=new char;  
-    mArgsInfo.reference_given=0;
-    mArgsInfo.target_arg=new char;      
-    mArgsInfo.target_given=0;
-    mArgsInfo.output_arg=new char;      
-    mArgsInfo.referenceMask_arg=new char;       
-    mArgsInfo.targetMask_arg=new char;          
-    mArgsInfo.initMatrix_arg=new char;          
-    mArgsInfo.matrix_arg=new char;
-    mArgsInfo.referenceMask_given=0;    
-    mArgsInfo.reference_given=0;        
-    mArgsInfo.reference_arg=new char;   
-    mArgsInfo.target_given=0;   
-    mArgsInfo.target_arg=new char;      
-    mArgsInfo.output_given=0;   
-    mArgsInfo.output_arg=new char;      
-    mArgsInfo.checker_after_given=0;    
-    mArgsInfo.checker_before_given=0;   
-    mArgsInfo.after_given=0;    
-    mArgsInfo.before_given=0;   
-    mArgsInfo.threads_given=1;          
-    mArgsInfo.threads_arg=3;    
-    mArgsInfo.normalize_flag=0;         
-    mArgsInfo.blur_arg=0.0;     
-    mArgsInfo.referenceMask_arg=new char;       
-    mArgsInfo.targetMask_arg=new char;          
-    mArgsInfo.targetMask_given=0;       
-    mArgsInfo.levels_given=1;   
-    mArgsInfo.levels_arg=2;     
-    mArgsInfo.moment_flag=1;    
-    mArgsInfo.intThreshold_given=0;     
-    mArgsInfo.intThreshold_arg=0.0;     
-    mArgsInfo.transX_arg=0.0;   
-    mArgsInfo.transY_arg=0.0;   
-    mArgsInfo.transZ_arg=0.0;   
-    mArgsInfo.transform_arg=2;          
-    mArgsInfo.gradient_flag=1;          
-    mArgsInfo.interp_given=1;   
-    mArgsInfo.interp_arg=1;     
-    mArgsInfo.interpOrder_given=1;      
-    mArgsInfo.interpOrder_arg=3;        
-    mArgsInfo.interpSF_given=1;         
-    mArgsInfo.interpSF_arg=20;//default         
-    mArgsInfo.metric_given=1;   
-    mArgsInfo.metric_arg=0;     
-    mArgsInfo.samples_arg=1;//default   
-    mArgsInfo.stdDev_arg=0.4;   
-    mArgsInfo.step_arg=2.0;     
-    mArgsInfo.relax_arg=0.7;    
-    mArgsInfo.valueTol_arg=0.01;        
-    mArgsInfo.stepTol_arg=0.1;          
-    mArgsInfo.gradTol_arg=1e-5;         
-    mArgsInfo.lineAcc_arg=0.9;          
-    mArgsInfo.convFactor_arg=1e+12;     
-    mArgsInfo.maxIt_arg=500;    
-    mArgsInfo.maxLineIt_arg=50;         
-    mArgsInfo.maxEval_arg=500;          
-    mArgsInfo.maxCorr_arg=5;    
-    mArgsInfo.selectBound_arg=0;        
-    mArgsInfo.inc_arg=1.2;      
-    mArgsInfo.dec_arg=4;        
-    mArgsInfo.optimizer_arg=1;          
-    mArgsInfo.initMatrix_given=0;       
-    mArgsInfo.initMatrix_arg=new char;          
-    mArgsInfo.tWeight_given=1;          
-    mArgsInfo.tWeight_arg=1.0;          
-    mArgsInfo.rWeight_given=1.0;        
-    mArgsInfo.rWeight_arg=50.0;         
-    mArgsInfo.matrix_given=1;
-    matrixfilename="/home/bharath/bin/writematrix.txt";//put ur path here for retreiving your matrix
-    mArgsInfo.matrix_arg=const_cast<char*>(matrixfilename.c_str()); 
-    UpdateTextEditor2();
-}
-else {
-  QMessageBox::information(this,"Sorry", "Other Presets are not available for the moment!");
-  return;
- }
+  SetToolName("Register");
+  SetToolMenuName("Register manually");
+  SetToolIconFilename(":/common/icons/register.png");
+  SetToolTip("Register manually.");
+  SetToolExperimental(false);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvToolRigidReg::UpdateTextEditor2()
+void vvToolRigidReg::InputIsSelected(vvSlicerManager *input)
 {
-  
-    QString str1,str2,str3;
-    QColor color;
-    tab2textedit->clear();
-    tab2textedit->setAcceptRichText(true);
-    str2=tab2textedit->toPlainText();
-    tab2textedit->setTextColor(QColor(255,0,0));
-    str2.append(str3.append("threads="+str1.setNum(mArgsInfo.threads_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("reference="+str1.append(mArgsInfo.reference_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("target="+str1.append(mArgsInfo.target_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("matrix="+str1.append(mArgsInfo.matrix_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("interp="+str1.setNum(mArgsInfo.interp_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("transform="+str1.setNum(mArgsInfo.transform_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("transX="+str1.setNum(mArgsInfo.transX_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("transY="+str1.setNum(mArgsInfo.transY_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("transZ="+str1.setNum(mArgsInfo.transZ_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("metric="+str1.setNum(mArgsInfo.metric_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("samples="+str1.setNum(mArgsInfo.samples_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("intThreshold="+str1.setNum(mArgsInfo.intThreshold_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
+  mInput = input;
+  HideInputSelector();
+  QTabWidget * tab = dynamic_cast<vvMainWindow*>(mMainWindow)->GetTab();
+  move(tab->mapToGlobal(tab->pos()));
+  resize(tab->width(), 0);
 
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("stdDev="+str1.setNum(mArgsInfo.stdDev_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
+  //default image rotation center is the center of the image
+  QString xcord,ycord,zcord;
+  std::vector<double> imageorigin;
+  imageorigin=mInput->GetImage()->GetOrigin();
+  std::vector<int> imageSize = mInput->GetImage()->GetSize();
+  std::vector<double> imageSpacing = mInput->GetImage()->GetSpacing();
+  xcord=xcord.setNum(imageorigin[0]+imageSize[0]*imageSpacing[0]/2, 'g', 3);
+  ycord=ycord.setNum(imageorigin[1]+imageSize[1]*imageSpacing[1]/2, 'g', 3);
+  zcord=zcord.setNum(imageorigin[2]+imageSize[2]*imageSpacing[2]/2, 'g', 3);
+  Xval->setText(xcord);
+  Yval->setText(ycord);
+  Zval->setText(zcord);
 
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("blur="+str1.setNum(mArgsInfo.blur_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
+  //backup original matrix
+  for(int j=0; j<4; j++)
+    for(int i=0; i<4; i++)
+      mInitialMatrix->SetElement(i,j, mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix()->GetElement(i,j));
+  QString origTransformString = dynamic_cast<vvMainWindow*>(mMainWindow)->Get4x4MatrixDoubleAsString(mInitialMatrix);
+  transformationLabel->setText(origTransformString);
+  SetTransform(mInitialMatrix);
 
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("optimizer="+str1.setNum(mArgsInfo.optimizer_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
+  //connect all sigs to slots
+  connect(resetbutton, SIGNAL(pressed()), this, SLOT(ResetTransform()));
+  connect(loadbutton, SIGNAL(pressed()), this, SLOT(LoadFile()));
+  connect(savebutton, SIGNAL(pressed()), this, SLOT(SaveFile()));
 
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("step="+str1.setNum(mArgsInfo.step_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
+  connect(xtrans_slider, SIGNAL(valueChanged(int)), this, SLOT(SliderChange(int)));
+  connect(ytrans_slider, SIGNAL(valueChanged(int)), this, SLOT(SliderChange(int)));
+  connect(ztrans_slider, SIGNAL(valueChanged(int)), this, SLOT(SliderChange(int)));
+  connect(xrot_slider, SIGNAL(valueChanged(int)), this, SLOT(SliderChange(int)));
+  connect(yrot_slider, SIGNAL(valueChanged(int)), this, SLOT(SliderChange(int)));
+  connect(zrot_slider, SIGNAL(valueChanged(int)), this, SLOT(SliderChange(int)));
+  connect(xtrans_sb, SIGNAL(valueChanged(double)), this, SLOT(SpinBoxChange(double)));
+  connect(ytrans_sb, SIGNAL(valueChanged(double)), this, SLOT(SpinBoxChange(double)));
+  connect(ztrans_sb, SIGNAL(valueChanged(double)), this, SLOT(SpinBoxChange(double)));
+  connect(xrot_sb,   SIGNAL(valueChanged(double)), this, SLOT(SpinBoxChange(double)));
+  connect(yrot_sb,   SIGNAL(valueChanged(double)), this, SLOT(SpinBoxChange(double)));
+  connect(zrot_sb,   SIGNAL(valueChanged(double)), this, SLOT(SpinBoxChange(double)));
 
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("relax="+str1.setNum(mArgsInfo.relax_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
+  connect(stepTransSpinBox, SIGNAL(valueChanged(double)), this, SLOT(SetTranslationStep(double)));
+  connect(stepRotSpinBox, SIGNAL(valueChanged(double)), this, SLOT(SetRotationStep(double)));
 
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("valueTol="+str1.setNum(mArgsInfo.valueTol_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-    
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("stepTol="+str1.setNum(mArgsInfo.stepTol_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
+  connect(checkBoxDegrees, SIGNAL(stateChanged(int)), this, SLOT(ToggleSpinBoxAnglesUnit()));
 
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("gradTol="+str1.setNum(mArgsInfo.gradTol_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
+  connect(Xval, SIGNAL(editingFinished()), this, SLOT(ChangeOfRotationCenter()));
+  connect(Yval, SIGNAL(editingFinished()), this, SLOT(ChangeOfRotationCenter()));
+  connect(Zval, SIGNAL(editingFinished()), this, SLOT(ChangeOfRotationCenter()));
 
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("lineAcc="+str1.setNum(mArgsInfo.lineAcc_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("convFactor="+str1.setNum(mArgsInfo.convFactor_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("maxIt="+str1.setNum(mArgsInfo.maxIt_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("maxLineIt="+str1.setNum(mArgsInfo.maxLineIt_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-    str2=tab2textedit->toPlainText();
-    str2.append(str3.append("maxEval="+str1.setNum(mArgsInfo.maxEval_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-      str2=tab2textedit->toPlainText();
-    str2.append(str3.append("maxCorr="+str1.setNum(mArgsInfo.maxCorr_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-      str2=tab2textedit->toPlainText();
-    str2.append(str3.append("selectBound="+str1.setNum(mArgsInfo.selectBound_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-      str2=tab2textedit->toPlainText();
-    str2.append(str3.append("rWeight="+str1.setNum(mArgsInfo.rWeight_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-      str2=tab2textedit->toPlainText();
-    str2.append(str3.append("tWeight="+str1.setNum(mArgsInfo.tWeight_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-      str2=tab2textedit->toPlainText();
-    str2.append(str3.append("levels="+str1.setNum(mArgsInfo.levels_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-      str2=tab2textedit->toPlainText();
-    str2.append(str3.append("inc="+str1.setNum(mArgsInfo.inc_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
-    
-      str2=tab2textedit->toPlainText();
-    str2.append(str3.append("dec="+str1.setNum(mArgsInfo.dec_arg)));
-    tab2textedit->setText(str2);
-    str3.clear();
-    str1.clear();
-
-    str2=tab2textedit->toPlainText();
-    str2.append("\n");
-    tab2textedit->setText(str2);
+  // Init step modifiers
+  stepTransSpinBox->setValue(1.);
+  stepRotSpinBox->setValue(1.);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvToolRigidReg::TransformSelect()
-{
-  if(!mConfigFile.empty()){
-   mArgsInfo.transform_arg=cb_transform->currentIndex();
-   UpdateTextEditor2();
-  }
-  else{
-    QMessageBox::information(this,"Warning","Load the Config File First!..");
-  }
-}
-//------------------------------------------------------------------------------
-  
-//------------------------------------------------------------------------------
-void vvToolRigidReg::CmdlineParser(int override, int initialize)
+void vvToolRigidReg::apply()
 {
-   //0 opened, 1 not opened fine
-   int opened=cmdline_parser_clitkAffineRegistration_configfile(const_cast<char*>(mConfigFile.c_str()),&mArgsInfo,override,initialize,1);
-   DD(opened);
-   mArgsInfo.gradient_flag=1;
-   QString str;
-   //Read the transformation parameters from the  path in the config file(mArgsInfo.matrix_arg) and display it on the TextBox 2
-   ifstream readfile;
-   std::vector<QString> Qstr;
-   
-   if(!opened){
-   readfile.open(mConfigFile.c_str());
-   }
-   else{
-   QMessageBox::information(this,"Warning","Load the Config File First..");
-   }
-   if (readfile.is_open()) 
-   { 
-    while (!readfile.eof())
-      {
-      readfile >> mConfigFile;
-      Qstr.push_back(QString(mConfigFile.c_str()));
-      }
-      readfile.close();
-   }
-    else {
-      QMessageBox::information(this,"Warning","Cannot Open File!");
-      return;
-    }
-     for(unsigned int i=0;i<Qstr.size()-1;i++)
-      {
-    str=tab2textedit->toPlainText();
-    str.append(Qstr.at(i));
-    tab2textedit->setText(str);
-    str.append("\n");
-    tab2textedit->setText(str);
-      }
+  vvToolWidgetBase::close();
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvToolRigidReg::OptimizerSelect()
+bool vvToolRigidReg::close()
 {
-  if(!mConfigFile.empty()){
-  mArgsInfo.optimizer_arg=cb_optimizer->currentIndex();
-  UpdateTextEditor2();
-   }
-  else{
-    QMessageBox::information(this,"Warning","Load the Config File First!..");
+  QString warning = "Are you sure you want to reset the original transform?";
+  QMessageBox msgBox(QMessageBox::Warning, tr("Reset transform"),warning, 0, this);
+  msgBox.addButton(tr("Yes"), QMessageBox::AcceptRole);
+  msgBox.addButton(tr("No"), QMessageBox::RejectRole);
+  if (msgBox.exec() == QMessageBox::AcceptRole) {
+    SetTransform(mInitialMatrix);
+    return vvToolWidgetBase::close();
   }
+  return false;
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvToolRigidReg::InterpolatorSelect()
+void vvToolRigidReg::reject()
 {
-  if(!mConfigFile.empty()){
-  mArgsInfo.interp_arg=cb_interpolator->currentIndex();
-  UpdateTextEditor2();
-   }
-  else{
-    QMessageBox::information(this,"Warning","Load the Config File First!..");
-  }
+  return vvToolWidgetBase::reject();
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvToolRigidReg::MetricSelect()
+void vvToolRigidReg::SetTranslationStep(double v)
 {
-  if(!mConfigFile.empty()){
- mArgsInfo.metric_arg=cb_metric->currentIndex();
- UpdateTextEditor2();
-   }
-  else{
-    QMessageBox::information(this,"Warning","Load the Config File First!..");
-  }
+  xtrans_sb->setSingleStep(v);
+  ytrans_sb->setSingleStep(v);
+  ztrans_sb->setSingleStep(v);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvToolRigidReg::OutputSelect()
+void vvToolRigidReg::SetRotationStep(double v)
 {
-  std::ostringstream osstream;
-  if(!mConfigFile.empty()){
-    if(cb_selectoutput->currentIndex()==0){
-      mArgsInfo.output_given=0;
-      mArgsInfo.checker_after_given=0;
-      mArgsInfo.checker_before_given=0;
-      mArgsInfo.after_given=0;
-      mArgsInfo.before_given=0;
-    }//get transformed output image
-    if(cb_selectoutput->currentIndex()==1){ 
-      mArgsInfo.output_given=0;
-      mArgsInfo.checker_after_given=1;
-      mArgsInfo.checker_before_given=0;
-      mArgsInfo.after_given=0;
-      mArgsInfo.before_given=0;
-    }//get checkered image after reg
-    if(cb_selectoutput->currentIndex()==2){  
-      mArgsInfo.output_given=0;
-      mArgsInfo.checker_after_given=0;
-      mArgsInfo.checker_before_given=1;
-      mArgsInfo.after_given=0;
-      mArgsInfo.before_given=0;
-    }//get checkered  image before reg
-    if(cb_selectoutput->currentIndex()==3){
-      mArgsInfo.output_given=0;
-      mArgsInfo.checker_after_given=0;
-      mArgsInfo.checker_before_given=0;
-      mArgsInfo.after_given=1;
-      mArgsInfo.before_given=0;
-    }//get difference image after reg
-    if(cb_selectoutput->currentIndex()==4){  
-      mArgsInfo.output_given=0;
-      mArgsInfo.checker_after_given=0;
-      mArgsInfo.checker_before_given=0;
-      mArgsInfo.after_given=0;
-      mArgsInfo.before_given=1;
-    }//get difference image before reg
-  }
-  else{
-    QMessageBox::information(this,"Warning","Load the Config File First!..");
-  }
+  xrot_sb->setSingleStep(v);
+  yrot_sb->setSingleStep(v);
+  zrot_sb->setSingleStep(v);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvToolRigidReg::SaveTextEdit()
+void vvToolRigidReg::SliderChange(int newVal)
 {
-     DD(mArgsInfo.transform_arg);
-   QString f1 = QFileDialog::getSaveFileName(this, tr("Save Config File"),
-                                              mMainWindow->GetInputPathName(),
-                                              tr("Text (*.mat *.txt *.doc *.rtf)"));
-   QFile file(f1);                                   
-   if(file.open(QFile::WriteOnly | QFile::Truncate) & !mConfigFile.empty() ){
-   QTextStream stream( &file );
-   stream << tab2textedit->toPlainText();
-     }
-    else
-     {
-      QMessageBox::information(this,"Warning","Nothing to Save!");
-      return;
-     }
-   tab2textedit->clear();
-   DD(mArgsInfo.transform_arg);
+  std::vector<QSlider *> transSliders, rotSliders;
+  std::vector<QDoubleSpinBox *> transSBs, rotSBs;
+  GetSlidersAndSpinBoxes(transSliders, rotSliders, transSBs, rotSBs);
+  for(int i=0; i<3; i++) {
+    if(transSliders[i] == QObject::sender()) {
+      transSBs[i]->setValue(newVal);
+    }
+    if(rotSliders[i] == QObject::sender()) {
+      double rad = (checkBoxDegrees->checkState()==Qt::Unchecked)?itk::Math::pi/180.:1.;
+      rotSBs[i]->setValue(newVal*rad);
+    }
+  }
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvToolRigidReg::InputIsSelected(std::vector<vvSlicerManager *> & l)
+void vvToolRigidReg::SpinBoxChange(double newVal)
 {
-  //inputs
-  mInput1 = l[0];
-  mInput2 = l[1];
-  UpdateTextEditor(mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix(),textEdit_2);
-
-  for(int i =0;i<4;i++)
-  {
-    for(int j=0;j<4;j++)
-    {
-      mInitialMatrix[i*4+j]=mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix()->GetElement(i,j);
+  std::vector<QSlider *> transSliders, rotSliders;
+  std::vector<QDoubleSpinBox *> transSBs, rotSBs;
+  GetSlidersAndSpinBoxes(transSliders, rotSliders, transSBs, rotSBs);
+  for(int i=0; i<3; i++) {
+    if(transSBs[i] == QObject::sender()) {
+      transSliders[i]->blockSignals(true);
+      transSliders[i]->setValue(itk::Math::Round(newVal));
+      transSliders[i]->blockSignals(false);
+    }
+    if(rotSBs[i] == QObject::sender()) {
+      double rad = (checkBoxDegrees->checkState()==Qt::Unchecked)?180./itk::Math::pi:1.;
+      rotSliders[i]->blockSignals(true);
+      rotSliders[i]->setValue(itk::Math::Round(newVal*rad));
+      rotSliders[i]->blockSignals(false);
     }
   }
 
-  if(mInput1->GetFileName()==mInput2->GetFileName())
-  {
-    QMessageBox::information(this, "Warning","Your Reference and Target Images are the same");
+  // Compute transform and set
+  vtkSmartPointer<vtkTransform> transform_final=mInput->GetImage()->GetTransform();
+  transform_final->Identity();
+  transform_final->PostMultiply();
+
+  // Rotations
+  double x=0, y=0 ,z=0;
+  x= Xval->text().toDouble();
+  y= Yval->text().toDouble();
+  z= Zval->text().toDouble();
+  double rad = (checkBoxDegrees->checkState()==Qt::Unchecked)?180./itk::Math::pi:1.;
+  transform_final->Translate(-x,-y,-z);
+  transform_final->RotateY(yrot_sb->value()*rad);
+  transform_final->RotateX(xrot_sb->value()*rad);
+  transform_final->RotateZ(zrot_sb->value()*rad);
+  transform_final->Translate(x,y,z);
+
+  // Translation
+  transform_final->Translate(xtrans_sb->value(),
+                             ytrans_sb->value(),
+                             ztrans_sb->value());
+  transform_final->Update();
+  SetTransform(transform_final->GetMatrix());
+}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+void vvToolRigidReg::ToggleSpinBoxAnglesUnit()
+{
+  double rad = (checkBoxDegrees->checkState()==Qt::Unchecked)?itk::Math::pi/180.:180./itk::Math::pi;
+  std::vector<QSlider *> transSliders, rotSliders;
+  std::vector<QDoubleSpinBox *> transSBs, rotSBs;
+  GetSlidersAndSpinBoxes(transSliders, rotSliders, transSBs, rotSBs);
+  for(int i=0; i<3; i++) {
+    rotSBs[i]->blockSignals(true);
+    rotSBs[i]->setValue(rotSBs[i]->value()*rad);
+    rotSBs[i]->blockSignals(false);
   }
-  mTwoInputs = true;
-  SetOverlay(mInput2->GetImage());
-  mImageSize=mInput1->GetImage()->GetSize();
-  SetRotationCenter();
-  SetSliderRanges();
-
-    //connect all sigs to slots
-   connect(resetbutton, SIGNAL(pressed()), this, SLOT(ResetTransform()));
-   connect(tab2loadbutton, SIGNAL(pressed()), this, SLOT(GetArgsInfoFromGUI()));
-   connect(tab2applybutton, SIGNAL(pressed()), this, SLOT(AutoRegister()));
-
-
-   connect(Xval, SIGNAL(editingFinished()), this, SLOT(SetXvalue()));
-   connect(Yval, SIGNAL(editingFinished()), this, SLOT(SetYvalue()));
-   connect(Zval, SIGNAL(editingFinished()), this, SLOT(SetZvalue()));
-
-   connect(xtrans_slider, SIGNAL(valueChanged(int)), this, SLOT(UpdateTransform_sliders()));
-   connect(ytrans_slider, SIGNAL(valueChanged(int)), this, SLOT(UpdateTransform_sliders()));
-   connect(ztrans_slider, SIGNAL(valueChanged(int)), this, SLOT(UpdateTransform_sliders()));
-
-
-   connect(xrot_slider, SIGNAL(valueChanged(int)), this, SLOT(UpdateTransform_sliders()));
-   connect(yrot_slider, SIGNAL(valueChanged(int)), this, SLOT(UpdateTransform_sliders()));
-   connect(zrot_slider, SIGNAL(valueChanged(int)), this, SLOT(UpdateTransform_sliders()));
-
-   connect(xtrans_sb, SIGNAL(valueChanged(double)), this, SLOT(UpdateTransform_sb()));
-   connect(ytrans_sb, SIGNAL(valueChanged(double)), this, SLOT(UpdateTransform_sb()));
-   connect(ztrans_sb, SIGNAL(valueChanged(double)), this, SLOT(UpdateTransform_sb()));
-   connect(xrot_sb, SIGNAL(valueChanged(double)), this, SLOT(UpdateTransform_sb()));
-   connect(yrot_sb, SIGNAL(valueChanged(double)), this, SLOT(UpdateTransform_sb()));
-   connect(zrot_sb, SIGNAL(valueChanged(double)), this, SLOT(UpdateTransform_sb()));
-   
-   connect(loadbutton, SIGNAL(pressed()), this, SLOT(LoadFile()));
-   connect(savebutton, SIGNAL(pressed()), this, SLOT(SaveFile()));
-   
-   connect(checkBox_rigid, SIGNAL(clicked(bool)), this, SLOT(CheckRigidReg()));
-   connect(checkBox_deformable, SIGNAL(clicked(bool)), this, SLOT(CheckDeformableReg()));
-   
-   connect(cb_presets, SIGNAL(activated(int)), this, SLOT(Presets()));
-   connect(cb_transform, SIGNAL(activated(int)), this, SLOT(TransformSelect()));
-   connect(cb_optimizer, SIGNAL(activated(int)), this, SLOT(OptimizerSelect()));
-   connect(cb_interpolator, SIGNAL(activated(int)), this, SLOT(InterpolatorSelect()));
-   connect(cb_metric, SIGNAL(activated(int)), this, SLOT(MetricSelect()));
-   connect(cb_selectoutput, SIGNAL(activated(int)), this, SLOT(OutputSelect()));
-   connect(tab2savebutton, SIGNAL(pressed()), this, SLOT(SaveTextEdit()));
-   
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvToolRigidReg::apply()
-{
-  RemoveOverlay();
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvToolRigidReg::CheckRigidReg()
-{
-  checkBox_deformable->setChecked(false);
-  cb_transform->show();
-  cb_presets->show();
-  cb_metric->show();
-  cb_interpolator->show();
-  cb_optimizer->show();
-  cb_selectoutput->show();
-  translabel->show();
-  metriclabel->show();
-  outputlabel->show();
-  optimlabel->show();
-  interpollabel->show();
-  presetlabel->show();
-  
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvToolRigidReg::CheckDeformableReg()
-{
-  checkBox_rigid->setChecked(false);
-  presetlabel->hide();
-  cb_transform->show();
-  cb_metric->show();
-  cb_interpolator->show();
-  cb_optimizer->show();
-  cb_selectoutput->show();
-  cb_presets->hide();
-  translabel->show();
-  metriclabel->show();
-  outputlabel->show();
-  optimlabel->show();
-  interpollabel->show();
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvToolRigidReg::SetOverlay(vvImage::Pointer Image)
+void vvToolRigidReg::SaveFile()
 {
-    for (int i =0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
-   mCurrentSlicerManager->GetSlicer(i)->SetOverlay(Image);
-   mCurrentSlicerManager->GetSlicer(i)->SetActorVisibility("overlay",0,true);
-   mCurrentSlicerManager->SetColorMap();
-   mCurrentSlicerManager->Render();
-   }
+  //Write the Transformation Matrix
+  std::string absPath = mCurrentSlicerManager->GetFileName();
+  absPath = itksys::SystemTools::GetFilenameWithoutExtension(absPath) + std::string(".mat");
+  QString filename = QFileDialog::getSaveFileName(this, tr("Save Transformation Matrix File"),
+                                            absPath.c_str(),
+                                            tr("Text (*.mat *.txt *.doc *.rtf)"));
+
+  QFile file(filename);
+  if (file.open(QFile::WriteOnly | QFile::Truncate)) {
+    vtkMatrix4x4* matrix = mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix();
+    QString matrixStr = dynamic_cast<vvMainWindow*>(mMainWindow)->Get4x4MatrixDoubleAsString(matrix,16);
+    QTextStream out(&file);
+    out << matrixStr;
   }
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvToolRigidReg::RemoveOverlay()
-{
-   for(int i=0;i<mCurrentSlicerManager->GetNumberOfSlicers();i++)
+  else
   {
-     mInput1->RemoveActor("overlay",0);
-     mInput1->SetColorMap(0);
-     mInput1->Render();
-     hide();
+    QMessageBox::information(this,"Error","Unable to open file for writing");
   }
 }
 //------------------------------------------------------------------------------
 
-//------------------------------------------------------------------------------
-void vvToolRigidReg::SetXvalue()
-{
-  QString xstr = Xval->text();
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvToolRigidReg::SetYvalue()
-{
-  QString ystr = Yval->text();
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvToolRigidReg::SetZvalue()
-{
-  QString zstr = Zval->text();
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvToolRigidReg::SetTransform(double tX, double tY, double tZ, double aX, double aY, double aZ,bool update)
-{
-  vtkSmartPointer<vtkTransform> transform = mInput1->GetImage()->GetTransform();
-  transform->PostMultiply();
-  //Rotations
-  if (aX!=0 || aY!=0 || aZ!=0) {
-    double x, y ,z;
-    x= Xval->text().toDouble();
-    y= Yval->text().toDouble();
-    z= Zval->text().toDouble();
-    transform->Translate(-x,-y,-z);
-    if (aX!=0) transform->RotateX(aX);
-    if (aY!=0) transform->RotateY(aY);
-    if (aZ!=0) transform->RotateZ(aZ);
-    transform->Translate(x,y,z);
-  }
-  //Translations
-  if (tX!=0||tY!=0||tZ!=0)
-    transform->Translate(tX*mInput1->GetImage()->GetSpacing()[0],
-                         tY*mInput1->GetImage()->GetSpacing()[1],
-                         tZ*mInput1->GetImage()->GetSpacing()[2]);
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvToolRigidReg::SetTransform(vtkMatrix4x4 *matrix)
-{
-   vtkSmartPointer<vtkTransform> transform=vtkSmartPointer<vtkTransform>::New();
-    for(int i=0; i<4;i++)
-      for(int j=0;j<4;j++)
-    mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix()->SetElement(i,j,matrix->GetElement(i,j));
-    
-    Render();
-}
-//------------------------------------------------------------------------------
-
 //------------------------------------------------------------------------------
 void vvToolRigidReg::LoadFile()
 {
-  ReadFile(false);
-}
-//------------------------------------------------------------------------------
-  
-//------------------------------------------------------------------------------
-void vvToolRigidReg::Render()
-{
-  for (int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
-       mCurrentSlicerManager->GetSlicer(i)->ForceUpdateDisplayExtent();
-       mCurrentSlicerManager->GetSlicer(i)->Render();
-      }
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-  void vvToolRigidReg::UpdateTextEditor(vtkMatrix4x4 *matrix,QTextEdit* textEdit)
-{
-    QFont font=QFont("Courier",11);
-    textEdit->setCurrentFont(font);
-    textEdit->update();
-
-    QString str1,str2,str3;
-    QColor color;
-    textEdit->clear();
-    textEdit->setAcceptRichText(true);
-    str2=textEdit->toPlainText();
-    str2.append("#Rotation Center(mm): \n#");
-    textEdit->setText(str2);
-
-    str2=textEdit->toPlainText();
-    textEdit->setTextColor(QColor(255,0,0));
-    str2.append(str3.append(Xval->text()));
-    textEdit->setText(str2);
-    str3.clear();
-
-    str2=textEdit->toPlainText();
-    str2.append("\t");
-    textEdit->setText(str2);
-
-    str2=textEdit->toPlainText();
-    str2.append(str3.append(Yval->text()));
-    textEdit->setText(str2);
-    str3.clear();
-
-    str2=textEdit->toPlainText();
-    str2.append("\t");
-    textEdit->setText(str2);
-
-
-    str2=textEdit->toPlainText();
-    str2.append(str3.append(Zval->text()));
-    textEdit->setText(str2);
-
-
-    str2=textEdit->toPlainText();
-    str2.append("\n");
-    textEdit->setText(str2);
+  //Open File to read the transformation parameters
+  QString file = QFileDialog::getOpenFileName(
+                   this,
+                   "Choose the filename for the transformation matrix",
+                   vtksys::SystemTools::GetFilenamePath(mCurrentSlicerManager->GetFileName()).c_str(),
+                   "Text (*.mat *.txt *.rtf *.doc)");
+   if (file.isEmpty())
+     return;
 
 
-    str2=textEdit->toPlainText();
-    str2.append("#Transformation Matrix(mm):\n");
-    textEdit->setText(str2);
-    for(int i=0;i<4;i++)
-    {
-    for(int j=0;j<4;j++)
-      {
-    str2=textEdit->toPlainText();
-   // str2.append("\t"+str1.setNum(matrix->Element[i][j]));
-    str2.append(QString("%1\t").arg(str1.setNum(matrix->Element[i][j]),2));
-    textEdit->setText(str2);
-      }
-    str2=textEdit->toPlainText();
-    str2.append("\n");
-    textEdit->setText(str2);
-    }
-    //QString str = QFileDialog::getOpenFileName();
-    textEdit->setTextColor(QColor(255,0,0));
-    textEdit->setFont(QFont("courrier new",12,4,true));
-    textEdit->toPlainText().toAscii();
-
-    str2=textEdit->toPlainText();
-    textEdit->setText(str2);
+  itk::Matrix<double, 4, 4> itkMat = clitk::ReadMatrix3D(file.toStdString());
+  vtkSmartPointer<vtkMatrix4x4> matrix = vtkSmartPointer<vtkMatrix4x4>::New();
+  matrix->Identity();
+  for(int j=0; j<4; j++)
+    for(int i=0; i<4; i++)
+      matrix->SetElement(j,i,itkMat[j][i]);
+  SetTransform(matrix);
 }
 //------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvToolRigidReg::UpdateTransform_sliders()
-{
-       InitializeSliders(xtrans_slider->value()*mInput1->GetImage()->GetSpacing()[0],
-                        ytrans_slider->value()*mInput1->GetImage()->GetSpacing()[1],
-                        ztrans_slider->value()*mInput1->GetImage()->GetSpacing()[2],
-                       xrot_slider->value(),yrot_slider->value(),zrot_slider->value(),false);
-        UpdateTransform(true);
-        Render();
-}
-//------------------------------------------------------------------------------
-
+  
 //------------------------------------------------------------------------------
-void vvToolRigidReg::UpdateTransform_sb()
+void vvToolRigidReg::ChangeOfRotationCenter()
 {
-   InitializeSliders(xtrans_sb->value(),
-      ytrans_sb->value(),
-      ztrans_sb->value(),
-                       xrot_sb->value(),yrot_sb->value(),zrot_sb->value(),false);
-      UpdateTransform(false);
-      Render();
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvToolRigidReg::AutoRegister()
-{ 
-    if (!mCurrentSlicerManager) close();
-    
-    if(!mConfigFile.empty()){
-    std::vector<vvImage::Pointer> inputs;
-    // Input
-    inputs.push_back(mInput1->GetImage());
-    inputs.push_back(mInput2->GetImage());
-    // Check input type
-    // Main filter
-    clitk::AffineRegistrationGenericFilter::Pointer filter =
-    clitk::AffineRegistrationGenericFilter::New();
-    filter->SetInputVVImages(inputs);
-    filter->SetArgsInfo(mArgsInfo);
-    filter->EnableReadOnDisk(false);
-    filter->Update();
-    std::ostringstream osstream;
-    vvImage::Pointer output;
-    output = filter->GetOutputVVImage();
-    SetOverlay(output);
-    
-    if(!cb_selectoutput->currentIndex()==0){
-     std::string outputstring;
-     output = filter->GetOutputVVImages()[1];
-     if(cb_selectoutput->currentIndex()==1){outputstring="Checkered_after_reg";}
-     if(cb_selectoutput->currentIndex()==2){outputstring="Checkered_before_reg";}
-     if(cb_selectoutput->currentIndex()==3){outputstring="Diff_after_reg";}
-     if(cb_selectoutput->currentIndex()==4){outputstring="Diff_before_reg";}
-    osstream << outputstring << mCurrentSlicerManager->GetSlicer(0)->GetFileName() << ".mhd";
-    AddImage(output,osstream.str());
-    filter->DeleteLastOutputImage();
-    }
-    DD(filter->GetOutputVVImages().capacity());
-    QApplication::restoreOverrideCursor();
-    ReadFile(true);
-    }
-    else
-    {
-      QMessageBox::information(this, "Warning","Load the Config File First!...");
-      return;
-    }
+  SetTransform(mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix());
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvToolRigidReg::UpdateTransform(bool slider_enabled)
+void vvToolRigidReg::ResetTransform()
 {
-     vtkSmartPointer<vtkTransform> transform_final=mInput1->GetImage()->GetTransform();
-     transform_final->SetMatrix(mInitialMatrix);
-     transform_final->PostMultiply();
-  //Rotations
-    double x=0, y=0 ,z=0;
-    x= Xval->text().toDouble();
-    y= Yval->text().toDouble();
-    z= Zval->text().toDouble();
-    transform_final->Translate(-x,-y,-z);
-    if(slider_enabled){
-    transform_final->RotateY(yrot_slider->value());
-    transform_final->RotateX(xrot_slider->value());
-    transform_final->RotateZ(zrot_slider->value());
-    }
-    else{
-    transform_final->RotateY(yrot_sb->value());
-    transform_final->RotateX(xrot_sb->value());
-    transform_final->RotateZ(zrot_sb->value());
-    }
-    transform_final->Translate(x,y,z);
-    transform_final->PreMultiply();
-    if(slider_enabled){
-    transform_final->Translate(xtrans_slider->value()*mInput1->GetImage()->GetSpacing()[0],0,0);
-    transform_final->Translate(0,ytrans_slider->value()*mInput1->GetImage()->GetSpacing()[1],0);
-    transform_final->Translate(0,0,ztrans_slider->value()*mInput1->GetImage()->GetSpacing()[2]);
-    }
-    else{
-    transform_final->Translate(xtrans_sb->value(),0,0);
-    transform_final->Translate(0,ytrans_sb->value(),0);
-    transform_final->Translate(0,0,ztrans_sb->value());
-    }
-    transform_final->Update();
-    Render();
-    UpdateTextEditor(transform_final->GetMatrix(),textEdit);
+  SetTransform(mInitialMatrix);
 }
 //------------------------------------------------------------------------------
 
-
 //------------------------------------------------------------------------------
-void vvToolRigidReg::SaveFile()
+void vvToolRigidReg::SetTransform(vtkMatrix4x4 *matrix)
 {
-  //Write the Transformation Matrix
-    QString f1 = QFileDialog::getSaveFileName(this, tr("Save Transformation Matrix File"),
-                                              mMainWindow->GetInputPathName(),
-                                              tr("Text (*.mat *.txt *.doc *.rtf)"));
-    QFile file1(f1);
-    std::vector<QString> transparameters;
-    QString line1;
-
-    for(int i =0;i<4;i++)
-      for(int j=0;j<4;j++)
-    transparameters.push_back(line1.setNum(mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix()->Element[i][j]));
-
-    if (file1.open(QFile::WriteOnly | QFile::Truncate)) {
-    QTextStream out1(&file1);
-     for(int i =0;i<4;i++){
-      for(int j=0;j<4;j++) {
-      out1<<transparameters[i*4+j]+"\t";
-      }
-      out1<<"\n";
-     }
-    }
-     else
-     {
-      QMessageBox::information(this,"Warning","Error Reading Parameters");
-     }
+  vtkSmartPointer<vtkTransform> transform=vtkSmartPointer<vtkTransform>::New();
+  mCurrentSlicerManager->GetImage()->GetTransform()->SetMatrix(matrix);
+  transform->Update();
+  Render();
+  dynamic_cast<vvMainWindow*>(mMainWindow)->ImageInfoChanged();
+
+  // Compute parameters from transfer using itk Euler transform
+  itk::Euler3DTransform<double>::CenterType center;
+  center[0] = Xval->text().toDouble();
+  center[1] = Yval->text().toDouble();
+  center[2] = Zval->text().toDouble();
+  itk::Euler3DTransform<double>::MatrixType rotMat;
+  itk::Euler3DTransform<double>::OutputVectorType transVec;
+  for(int i=0; i<3; i++) {
+    transVec[i] = matrix->GetElement(i,3);
+    for(int j=0; j<3; j++)
+      rotMat[i][j] = matrix->GetElement(i,j);
+  }
+  itk::Euler3DTransform<double>::Pointer euler;
+  euler = itk::Euler3DTransform<double>::New();
+  euler->SetCenter(center);
+  euler->SetMatrix(rotMat);
+  euler->SetOffset(transVec);
+
+
+  // Modify GUI according to the new parameters
+  std::vector<QSlider *> transSliders, rotSliders;
+  std::vector<QDoubleSpinBox *> transSBs, rotSBs;
+  GetSlidersAndSpinBoxes(transSliders, rotSliders, transSBs, rotSBs);
+  for(int i=0; i<3; i++) {
+    transSBs[i]->blockSignals(true);
+    transSBs[i]->setValue( euler->GetParameters()[i+3] );
+    transSBs[i]->blockSignals(false);
+    transSliders[i]->blockSignals(true);
+    transSliders[i]->setValue( itk::Math::Round(euler->GetParameters()[i+3]) );
+    transSliders[i]->blockSignals(false);
+    double rad = (checkBoxDegrees->checkState()==Qt::Checked)?180./itk::Math::pi:1.;
+    rotSBs[i]->blockSignals(true);
+    rotSBs[i]->setValue( euler->GetParameters()[i]*rad );
+    rotSBs[i]->blockSignals(false);
+    rotSliders[i]->blockSignals(true);
+    rotSliders[i]->setValue( itk::Math::Round(euler->GetParameters()[i]*180./itk::Math::pi) );
+    rotSliders[i]->blockSignals(false);
+  }
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvToolRigidReg::ReadFile(bool matrix_given)
+// Just an helper function to shorten the code with loops on sliders and spinboxes
+void vvToolRigidReg::GetSlidersAndSpinBoxes(std::vector<QSlider *>&transSliders, std::vector<QSlider *>&rotSliders,
+                                            std::vector<QDoubleSpinBox *>&transSBs, std::vector<QDoubleSpinBox *>&rotSBs)
 {
-   std::string x;
-   QString center;
-   double * orientations=new double[3];
-   double * translations=new double[3];
-   vtkMatrix4x4 *matrix=vtkMatrix4x4::New();
-   std::string transfile;
-   vtkSmartPointer<vtkTransform> transform = mCurrentSlicerManager->GetImage()->GetTransform();
-   if(!matrix_given)
-   {
-   //Open File to read the transformation parameters
-   QString file1 = QFileDialog::getOpenFileName(
-                    this,
-                   "Choose the Transformation Parameters file",
-                    mMainWindow->GetInputPathName(),
-                    "Text (*.mat *.txt *.rtf *.doc)");
-    if (file1.isEmpty())
-    return;
-   QFile Qfile1(file1);
-  // ifstream readfile;
-   transfile= file1.toStdString();
-   }
-   else
-   {
-    transfile=mArgsInfo.matrix_arg;
-    DD(transfile);
-   }
-   std::string filename1(transfile);
-   std::ifstream f1(filename1.c_str());
-   if(f1.is_open())
-   {
-   f1.close();
-   itk::Matrix<double, 4, 4> itkMat = clitk::ReadMatrix3D(transfile);
-   for(int j=0; j<4; j++)
-      for(int i=0; i<4; i++)
-    matrix->SetElement(i,j,rint(itkMat[i][j]));
-   }
-    UpdateTextEditor(matrix,textEdit);
-    transform->SetMatrix(matrix);
-    transform->GetOrientation(orientations);
-    transform->PostMultiply();
-
-     //Obtain the Rotation Center , set it to origin
-    Xval->setText(center.setNum(0));
-    Yval->setText(center.setNum(0));
-    Zval->setText(center.setNum(0));
+  transSliders.push_back(xtrans_slider);
+  transSliders.push_back(ytrans_slider);
+  transSliders.push_back(ztrans_slider);
 
-    //In the Order or Y X Z //
-    //now  postmultiply for the rotations
-    SetTransform(0,0,0,0,0,-rint(orientations[2]),false);
-    SetTransform(0,0,0,-rint(orientations[0]),0,0,false);
-    SetTransform(0,0,0,0,-rint(orientations[1]),0,false);
+  rotSliders.push_back(xrot_slider);
+  rotSliders.push_back(yrot_slider);
+  rotSliders.push_back(zrot_slider);
 
-    transform->GetPosition(translations);
-    transform->Identity();
+  transSBs.push_back(xtrans_sb);
+  transSBs.push_back(ytrans_sb);
+  transSBs.push_back(ztrans_sb);
 
-    DD(translations[0]/mInput1->GetImage()->GetSpacing()[0]);
-    DD(translations[1]/mInput1->GetImage()->GetSpacing()[1]);
-    DD(translations[2]/mInput1->GetImage()->GetSpacing()[2]);
-    DD(mInput1->GetImage()->GetSpacing()[0]);
-    DD(mInput1->GetImage()->GetSpacing()[1]);
-    DD(mInput1->GetImage()->GetSpacing()[2]);
-    DD(orientations[0]);
-    DD(orientations[1]);
-    DD(orientations[2]);
-      //set the sliders  and spin box values
-    InitializeSliders(rint(translations[0]),rint(translations[1])
-    ,rint(translations[2]),rint(orientations[0]),rint(orientations[1]),rint(orientations[2]),true);
-    SetTransform(matrix);
+  rotSBs.push_back(xrot_sb);
+  rotSBs.push_back(yrot_sb);
+  rotSBs.push_back(zrot_sb);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvToolRigidReg::ResetTransform()
-{
-  vtkSmartPointer<vtkTransform> transform = mCurrentSlicerManager->GetImage()->GetTransform();
-  transform->SetMatrix(mInitialMatrix);
-  transform->Update();
-  
-   Render();
-   SetRotationCenter();
-   SetSliderRanges();
-   UpdateTextEditor(transform->GetMatrix(),textEdit);
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvToolRigidReg::SetRotationCenter()
-{
-    //default image rotation center is the center of the image
-    QString xcord,ycord,zcord;
-    std::vector<double> imageorigin;
-    imageorigin=mInput1->GetImage()->GetOrigin();
-    DD("before bug");
-    xcord=xcord.setNum(imageorigin[0]+mImageSize[0]*mInput1->GetImage()->GetSpacing()[0]/2, 'g', 3);
-    ycord=ycord.setNum(imageorigin[1]+mImageSize[1]*mInput1->GetImage()->GetSpacing()[1]/2, 'g', 3);
-    zcord=zcord.setNum(imageorigin[2]+mImageSize[2]*mInput1->GetImage()->GetSpacing()[2]/2, 'g', 3);
-
-    Xval->setText(xcord);
-    Yval->setText(ycord);
-    Zval->setText(zcord);
-    InitializeSliders(0,0,0,0,0,0,true);
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvToolRigidReg::InitializeSliders(double xtrans,double ytrans, double ztrans, double xrot, double yrot, double zrot,bool sliders)
+void vvToolRigidReg::Render()
 {
-
-    xtrans_sb->blockSignals(true);
-    xtrans_sb->setSingleStep(mInput1->GetImage()->GetSpacing()[0]);
-    xtrans_sb->setValue(xtrans);
-    xtrans_sb->blockSignals(false);
-    ytrans_sb->blockSignals(true);
-    ytrans_sb->setSingleStep(mInput1->GetImage()->GetSpacing()[1]);
-    ytrans_sb->setValue(ytrans);
-    ytrans_sb->blockSignals(false);
-    ztrans_sb->blockSignals(true);
-    ztrans_sb->setSingleStep(mInput1->GetImage()->GetSpacing()[2]);
-    ztrans_sb->setValue(ztrans);
-    ztrans_sb->blockSignals(false);
-
-    if(sliders){
-    xtrans_slider->blockSignals(true);
-    xtrans_slider->setValue(rint(xtrans/mInput1->GetImage()->GetSpacing()[0]));
-    xtrans_slider->blockSignals(false);
-    ytrans_slider->blockSignals(true);
-    ytrans_slider->setValue(rint(ytrans/mInput1->GetImage()->GetSpacing()[1]));
-    ytrans_slider->blockSignals(false);
-    ztrans_slider->blockSignals(true);
-    ztrans_slider->setValue(rint(ztrans/mInput1->GetImage()->GetSpacing()[2]));
-    ztrans_slider->blockSignals(false);
+  for (int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++)
+    {
+    mCurrentSlicerManager->GetSlicer(i)->ForceUpdateDisplayExtent();
+    mCurrentSlicerManager->GetSlicer(i)->Render();
     }
-    xrot_sb->blockSignals(true);
-    xrot_sb->setValue(xrot);                                                                   
-    xrot_sb->blockSignals(false);
-    yrot_sb->blockSignals(true);
-    yrot_sb->setValue(yrot);
-    yrot_sb->blockSignals(false);
-    zrot_sb->blockSignals(true);
-    zrot_sb->setValue(zrot);
-    zrot_sb->blockSignals(false);
-    xrot_slider->blockSignals(true);
-    xrot_slider->setValue(xrot);
-    xrot_slider->blockSignals(false);
-    yrot_slider->blockSignals(true);
-    yrot_slider->setValue(yrot);
-    yrot_slider->blockSignals(false);
-    zrot_slider->blockSignals(true);
-    zrot_slider->setValue(zrot);
-    zrot_slider->blockSignals(false);
 }
 //------------------------------------------------------------------------------
 
-//------------------------------------------------------------------------------
-void vvToolRigidReg::SetSliderRanges()
-{
-  xtrans_slider->blockSignals(true);
-  xtrans_slider->setRange(-2000,2000);
-  xtrans_slider->blockSignals(false);
-
-  ytrans_slider->blockSignals(true);
-  ytrans_slider->setRange(-2000,2000);
-  ytrans_slider->blockSignals(false);
-
-  ztrans_slider->blockSignals(true);
-  ztrans_slider->setRange(-2000,2000);
-  ztrans_slider->blockSignals(false);
-
-  xtrans_sb->blockSignals(true);
-  xtrans_sb->setRange(-2000,2000);
-  xtrans_sb->setDecimals(3);
-  xtrans_sb->blockSignals(false);
-
-  ytrans_sb->blockSignals(true);
-  ytrans_sb->setRange(-2000,2000);
-  ytrans_sb->setDecimals(3);
-  ytrans_sb->blockSignals(false);
-
-  ztrans_sb->blockSignals(true);
-  ztrans_sb->setRange(-2000,2000);
-  ztrans_sb->setDecimals(3);
-  ztrans_sb->blockSignals(false);
-
-  xrot_slider->blockSignals(true);
-  xrot_slider->setRange(-360,360);
-  xrot_slider->blockSignals(false);
-
-  yrot_slider->blockSignals(true);
-  yrot_slider->setRange(-360,360);
-  yrot_slider->blockSignals(false);
-
-  zrot_slider->blockSignals(true);
-  zrot_slider->setRange(-360,360);
-  zrot_slider->blockSignals(false);
-
-  xrot_sb->blockSignals(true);
-  xrot_sb->setRange(-360,360);
-  xrot_sb->blockSignals(false);
-
-  yrot_sb->blockSignals(true);
-  yrot_sb->setRange(-360,360);
-  yrot_sb->blockSignals(false);
-
-  zrot_sb->blockSignals(true);
-  zrot_sb->setRange(-360,360);
-  zrot_sb->blockSignals(false);
-}
index f543ff5f4a0dcaa10db268e0269aed2bb05f24d8..559aca5bfecb83ee3abe41c501d9648d61b9aae1 100644 (file)
@@ -1,4 +1,3 @@
-
 /*=========================================================================
   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
 
 ===========================================================================**/
 #ifndef VVTOOLRIGIDREG_H
 #define VVTOOLRIGIDREG_H
-#include <QtDesigner/QDesignerExportWidget>
-#include <QDialog>
 
 #include "vvToolBase.h"
 #include "vvToolWidgetBase.h"
-#include "vvMainWindowBase.h"
 #include "vvMainWindow.h"
 #include "ui_vvToolRigidReg.h"
 #include "vtkMatrix4x4.h"
-#include "clitkAffineRegistration_ggo.h"
 
 //------------------------------------------------------------------------------
 class vvToolRigidReg:
@@ -39,61 +34,31 @@ class vvToolRigidReg:
 public:
   vvToolRigidReg(vvMainWindowBase * parent=0, Qt::WindowFlags f=0);
   ~vvToolRigidReg();
-  virtual void InputIsSelected(std::vector<vvSlicerManager *> & m);
+  static void Initialize();
+  virtual void InputIsSelected(vvSlicerManager *input);
+
 public slots:
   virtual void apply();
   virtual bool close();
   virtual void reject();
-  //-----------------------------------------------------
-  static void Initialize() {
-    SetToolName("Register");
-    SetToolMenuName("Register");
-    SetToolIconFilename(":/common/icons/register.png");
-    SetToolTip("Register Image.");
-    SetToolExperimental(true);
-  }
-  virtual void GetArgsInfoFromGUI();
-  void SetOverlay(vvImage::Pointer Image);
-  void RemoveOverlay();
-  void SetXvalue();
-  void SetYvalue();
-  void SetZvalue();
-  void Render();
-  void UpdateTextEditor(vtkMatrix4x4 *matrix,QTextEdit *textEdit);
-  void UpdateTransform_sliders();
-  void UpdateTransform_sb();
-  void UpdateTransform(bool slider_enabled);  
-  void AutoRegister();
+  void SetTranslationStep(double v);
+  void SetRotationStep(double v);
+  void SliderChange(int newVal);
+  void SpinBoxChange(double newVal);
+  void ToggleSpinBoxAnglesUnit();
   void SaveFile();
-  void ReadFile(bool matrix_given);
   void LoadFile();
+  void ChangeOfRotationCenter();
   void ResetTransform();
-  void SetRotationCenter();
-  void SetSliderRanges();
-  void InitializeSliders(double xtrans,double ytrans, double ztrans, double xrot, double yrot, double zrot,bool sliders);
-  void TransformSelect();
-  void OptimizerSelect();
-  void InterpolatorSelect();
-  void MetricSelect();
-  void OutputSelect();
-  void SaveTextEdit();
-  void CmdlineParser(int override, int initialize);
-  void Presets();
-  void UpdateTextEditor2();
-  void CheckRigidReg(); //Deformable or Rigid
-  void CheckDeformableReg();
-  protected:
+
+protected:
   Ui::vvToolRigidReg ui;
-  vvSlicerManager * mInput1;
-  vvSlicerManager * mInput2;
-  vvMainWindow * mWindow;
-  std::string mConfigFile;
-  bool mTwoInputs;
-  std::vector<int> mImageSize;
-  args_info_clitkAffineRegistration mArgsInfo;
-  double mInitialMatrix[16];
-  void SetTransform(double tX, double tY, double tZ, double aX, double aY, double aZ,bool update);
+  vvSlicerManager * mInput;
+  vtkSmartPointer<vtkMatrix4x4> mInitialMatrix;
   void SetTransform(vtkMatrix4x4 * matrix);
+  void GetSlidersAndSpinBoxes(std::vector<QSlider *>&transSliders, std::vector<QSlider *>&rotSliders,
+                              std::vector<QDoubleSpinBox *>&transSBs, std::vector<QDoubleSpinBox *>&rotSBs);
+  void Render();
 }; // end class vvToolRigidReg
 //------------------------------------------------------------------------------