]> Creatis software - clitk.git/commitdiff
ported the resampler to the new tool framework
authorschaerer <schaerer>
Tue, 6 Apr 2010 12:13:44 +0000 (12:13 +0000)
committerschaerer <schaerer>
Tue, 6 Apr 2010 12:13:44 +0000 (12:13 +0000)
vv/CMakeLists.txt
vv/icons/resample.png [new file with mode: 0644]
vv/qt_ui/vvMainWindow.ui
vv/qt_ui/vvToolResample.ui [new file with mode: 0644]
vv/qt_ui/vvTools.ui
vv/vvIcons.qrc
vv/vvMainWindow.cxx
vv/vvMainWindow.h
vv/vvToolResample.cxx [moved from vv/vvResamplerDialog.cxx with 82% similarity]
vv/vvToolResample.h [moved from vv/vvResamplerDialog.h with 80% similarity]

index 160fe69849d54451fa99d8702f08b1dc9aa5e37f..43d7d82f52fd2e8d72e5d0db32b7eacb54990bb0 100644 (file)
@@ -71,7 +71,6 @@ SET(vv_SRCS
   vvQProgressDialogITKCommand.cxx
   vvQDicomSeriesSelector.cxx
   QTreePushButton.cxx
-  vvResamplerDialog.cxx
   vvSegmentationDialog.cxx
   vvSurfaceViewerDialog.cxx
   vvMainWindowBase.cxx
@@ -116,6 +115,7 @@ SET(vv_SRCS
   # vvToolStructureSetManager.cxx
 #   vvStructureSetActor.cxx
 #   vvROIActor.cxx
+  vvToolResample.cxx
   )
 
 QT4_WRAP_CPP(vv_SRCS 
@@ -130,7 +130,6 @@ QT4_WRAP_CPP(vv_SRCS
   vvHelpDialog.h  
   vvProgressDialog.h 
   vvQDicomSeriesSelector.h 
-  vvResamplerDialog.h
   vvSegmentationDialog.h
   vvSurfaceViewerDialog.h
   vvDeformationDialog.h
@@ -150,6 +149,7 @@ QT4_WRAP_CPP(vv_SRCS
   # vvToolStructureSetManager.h
  #  vvStructureSetActor.h
 #   vvROIActor.h
+  vvToolResample.h
   )
 
 QT4_WRAP_UI(vv_UI_CXX 
@@ -164,7 +164,6 @@ QT4_WRAP_UI(vv_UI_CXX
   qt_ui/vvDicomSeriesSelector.ui 
   qt_ui/vvSegmentationDialog.ui
   qt_ui/vvSurfaceViewerDialog.ui
-  qt_ui/vvResamplerDialog.ui
   qt_ui/vvDeformationDialog.ui
   qt_ui/vvStructSelector.ui
   qt_ui/vvDummyWindow.ui #For testing
@@ -177,6 +176,7 @@ QT4_WRAP_UI(vv_UI_CXX
   qt_ui/vvToolBinarize.ui
   qt_ui/vvToolImageArithm.ui
   # qt_ui/vvToolStructureSetManager.ui
+  qt_ui/vvToolResample.ui
   )
 
 SET(vvUI_RCCS vvIcons.qrc)
diff --git a/vv/icons/resample.png b/vv/icons/resample.png
new file mode 100644 (file)
index 0000000..deaf416
Binary files /dev/null and b/vv/icons/resample.png differ
index 129cf074e5e09d98013de3565464571066b0aaf6..7f880c22c3690dd84aae2b1a859bef485132e5a2 100644 (file)
     <property name="title">
      <string>Tools</string>
     </property>
-    <addaction name="actionResampler"/>
     <addaction name="actionMaximum_Intensity_Projection"/>
     <addaction name="actionCompute_mid_position_image"/>
    </widget>
diff --git a/vv/qt_ui/vvToolResample.ui b/vv/qt_ui/vvToolResample.ui
new file mode 100644 (file)
index 0000000..09596da
--- /dev/null
@@ -0,0 +1,1123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>vvToolResample</class>
+ <widget class="QWidget" name="vvToolResample">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>566</width>
+    <height>477</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout">
+   <item>
+    <layout class="QVBoxLayout" name="_14">
+     <item>
+      <widget class="QFrame" name="frame">
+       <property name="frameShape">
+        <enum>QFrame::NoFrame</enum>
+       </property>
+       <property name="frameShadow">
+        <enum>QFrame::Raised</enum>
+       </property>
+       <layout class="QVBoxLayout" name="_15">
+        <property name="margin">
+         <number>4</number>
+        </property>
+        <item>
+         <layout class="QHBoxLayout" name="_17">
+          <item>
+           <widget class="QLabel" name="label_3">
+            <property name="text">
+             <string>File format</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="mInputFormatLabel">
+            <property name="text">
+             <string>.mhd</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="_18">
+          <item>
+           <widget class="QLabel" name="label_5">
+            <property name="text">
+             <string>Dimension</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="mInputDimLabel">
+            <property name="text">
+             <string>TextLabel</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="_19">
+          <item>
+           <widget class="QLabel" name="label_7">
+            <property name="text">
+             <string>Pixel Type</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="mInputPixelTypeLabel">
+            <property name="text">
+             <string>TextLabel</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="_20">
+          <item>
+           <widget class="QLabel" name="label_9">
+            <property name="text">
+             <string>Size</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="mInputSizeLabel">
+            <property name="text">
+             <string>TextLabel</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="_21">
+          <item>
+           <widget class="QLabel" name="label_11">
+            <property name="text">
+             <string>Spacing</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="mInputSpacingLabel">
+            <property name="text">
+             <string>TextLabel</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="_22">
+          <item>
+           <widget class="QLabel" name="label_6">
+            <property name="text">
+             <string>Memory size</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="mInputMemoryLabel">
+            <property name="text">
+             <string>TextLabel</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="_23">
+          <item>
+           <widget class="QLabel" name="label_8">
+            <property name="text">
+             <string>Display result?</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="display_result">
+            <property name="text">
+             <string/>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+            <property name="autoExclusive">
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item>
+      <widget class="QFrame" name="optionFrame">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="frameShape">
+        <enum>QFrame::StyledPanel</enum>
+       </property>
+       <property name="frameShadow">
+        <enum>QFrame::Raised</enum>
+       </property>
+       <layout class="QGridLayout" name="_24">
+        <property name="margin">
+         <number>4</number>
+        </property>
+        <item row="0" column="0">
+         <widget class="QRadioButton" name="sizeRadioButton">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="text">
+           <string>Size :</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0" colspan="3">
+         <widget class="QFrame" name="frame_2">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="frameShape">
+           <enum>QFrame::NoFrame</enum>
+          </property>
+          <property name="frameShadow">
+           <enum>QFrame::Raised</enum>
+          </property>
+          <layout class="QGridLayout" name="_25">
+           <property name="horizontalSpacing">
+            <number>5</number>
+           </property>
+           <property name="verticalSpacing">
+            <number>2</number>
+           </property>
+           <property name="margin">
+            <number>0</number>
+           </property>
+           <item row="0" column="0">
+            <widget class="QLabel" name="xSizeLabel">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>x :</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1">
+            <widget class="QLineEdit" name="xSizeLineEdit">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="maximumSize">
+              <size>
+               <width>50</width>
+               <height>16777215</height>
+              </size>
+             </property>
+             <property name="layoutDirection">
+              <enum>Qt::LeftToRight</enum>
+             </property>
+             <property name="text">
+              <string/>
+             </property>
+             <property name="alignment">
+              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+             </property>
+             <property name="readOnly">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="2">
+            <widget class="QLabel" name="ySizeLabel">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>y :</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="3">
+            <widget class="QLineEdit" name="ySizeLineEdit">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="maximumSize">
+              <size>
+               <width>50</width>
+               <height>16777215</height>
+              </size>
+             </property>
+             <property name="layoutDirection">
+              <enum>Qt::LeftToRight</enum>
+             </property>
+             <property name="alignment">
+              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+             </property>
+             <property name="readOnly">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="4">
+            <widget class="QLabel" name="zSizelabel">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>z :</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="5">
+            <widget class="QLineEdit" name="zSizeLineEdit">
+             <property name="enabled">
+              <bool>true</bool>
+             </property>
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="maximumSize">
+              <size>
+               <width>50</width>
+               <height>16777215</height>
+              </size>
+             </property>
+             <property name="layoutDirection">
+              <enum>Qt::LeftToRight</enum>
+             </property>
+             <property name="alignment">
+              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+             </property>
+             <property name="readOnly">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </item>
+        <item row="2" column="0">
+         <widget class="QRadioButton" name="scaleSizeRadioButton">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="text">
+           <string>Scale size :</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="1">
+         <widget class="QFrame" name="frame_6">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="frameShape">
+           <enum>QFrame::NoFrame</enum>
+          </property>
+          <property name="frameShadow">
+           <enum>QFrame::Raised</enum>
+          </property>
+          <layout class="QGridLayout" name="_26">
+           <property name="margin">
+            <number>0</number>
+           </property>
+           <property name="spacing">
+            <number>0</number>
+           </property>
+           <item row="0" column="0">
+            <widget class="QLineEdit" name="scaleSizeLineEdit">
+             <property name="maximumSize">
+              <size>
+               <width>50</width>
+               <height>16777215</height>
+              </size>
+             </property>
+             <property name="readOnly">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1">
+            <widget class="QLabel" name="purcentLabel">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>%</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </item>
+        <item row="2" column="2">
+         <spacer>
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>50</width>
+            <height>41</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="3" column="0">
+         <widget class="QRadioButton" name="isoSizeRadioButton">
+          <property name="text">
+           <string>Iso-size :</string>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="1">
+         <widget class="QLineEdit" name="isoSizeLineEdit">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="maximumSize">
+           <size>
+            <width>50</width>
+            <height>16777215</height>
+           </size>
+          </property>
+          <property name="readOnly">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="2">
+         <spacer>
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>50</width>
+            <height>23</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="4" column="0" colspan="3">
+         <widget class="Line" name="line">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+         </widget>
+        </item>
+        <item row="5" column="0">
+         <widget class="QRadioButton" name="spacingRadioButton">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="text">
+           <string>Spacing :</string>
+          </property>
+         </widget>
+        </item>
+        <item row="6" column="0" colspan="3">
+         <widget class="QFrame" name="frame_4">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="frameShape">
+           <enum>QFrame::NoFrame</enum>
+          </property>
+          <property name="frameShadow">
+           <enum>QFrame::Raised</enum>
+          </property>
+          <layout class="QGridLayout" name="_27">
+           <property name="horizontalSpacing">
+            <number>5</number>
+           </property>
+           <property name="verticalSpacing">
+            <number>2</number>
+           </property>
+           <property name="margin">
+            <number>0</number>
+           </property>
+           <item row="0" column="0">
+            <widget class="QLabel" name="xSpacingLabel">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>x :</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1">
+            <widget class="QLineEdit" name="xSpacingLineEdit">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="maximumSize">
+              <size>
+               <width>50</width>
+               <height>16777215</height>
+              </size>
+             </property>
+             <property name="layoutDirection">
+              <enum>Qt::LeftToRight</enum>
+             </property>
+             <property name="text">
+              <string/>
+             </property>
+             <property name="alignment">
+              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+             </property>
+             <property name="readOnly">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="2">
+            <widget class="QLabel" name="ySpacingLabel">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>y :</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="3">
+            <widget class="QLineEdit" name="ySpacingLineEdit">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="maximumSize">
+              <size>
+               <width>50</width>
+               <height>16777215</height>
+              </size>
+             </property>
+             <property name="layoutDirection">
+              <enum>Qt::LeftToRight</enum>
+             </property>
+             <property name="alignment">
+              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+             </property>
+             <property name="readOnly">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="4">
+            <widget class="QLabel" name="zSpacingLabel">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>z :</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="5">
+            <widget class="QLineEdit" name="zSpacingLineEdit">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="maximumSize">
+              <size>
+               <width>50</width>
+               <height>16777215</height>
+              </size>
+             </property>
+             <property name="layoutDirection">
+              <enum>Qt::LeftToRight</enum>
+             </property>
+             <property name="alignment">
+              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+             </property>
+             <property name="readOnly">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </item>
+        <item row="7" column="0">
+         <widget class="QRadioButton" name="scaleSpacingRadioButton">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="text">
+           <string>Scale spacing :</string>
+          </property>
+         </widget>
+        </item>
+        <item row="7" column="1">
+         <widget class="QFrame" name="frame_5">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="frameShape">
+           <enum>QFrame::NoFrame</enum>
+          </property>
+          <property name="frameShadow">
+           <enum>QFrame::Raised</enum>
+          </property>
+          <layout class="QGridLayout" name="_28">
+           <property name="margin">
+            <number>0</number>
+           </property>
+           <property name="spacing">
+            <number>0</number>
+           </property>
+           <item row="0" column="0">
+            <widget class="QLineEdit" name="scaleSpacingLineEdit">
+             <property name="maximumSize">
+              <size>
+               <width>50</width>
+               <height>16777215</height>
+              </size>
+             </property>
+             <property name="readOnly">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1">
+            <widget class="QLabel" name="purcentLabel2">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text">
+              <string>%</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </item>
+        <item row="7" column="2">
+         <spacer>
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>50</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="8" column="0">
+         <widget class="QRadioButton" name="isoSpacingRadioButton">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="text">
+           <string>Iso-spacing :</string>
+          </property>
+         </widget>
+        </item>
+        <item row="8" column="1">
+         <widget class="QLineEdit" name="isoSpacingLineEdit">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="maximumSize">
+           <size>
+            <width>50</width>
+            <height>16777215</height>
+           </size>
+          </property>
+          <property name="readOnly">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="8" column="2">
+         <spacer>
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>50</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>40</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QVBoxLayout">
+     <item>
+      <widget class="QFrame" name="frame_3">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="frameShape">
+        <enum>QFrame::StyledPanel</enum>
+       </property>
+       <property name="frameShadow">
+        <enum>QFrame::Raised</enum>
+       </property>
+       <layout class="QVBoxLayout" name="_2">
+        <item>
+         <layout class="QVBoxLayout" name="_3">
+          <item>
+           <widget class="QCheckBox" name="gaussianFilterCheckBox">
+            <property name="text">
+             <string>Apply Gaussian Filter</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QFrame" name="frame_7">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="frameShape">
+             <enum>QFrame::NoFrame</enum>
+            </property>
+            <property name="frameShadow">
+             <enum>QFrame::Raised</enum>
+            </property>
+            <layout class="QHBoxLayout" name="_4">
+             <item>
+              <widget class="QLabel" name="gaussianFilterLabel">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="text">
+                <string>Gaussian width :</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLineEdit" name="xGaussianLineEdit">
+               <property name="maximumSize">
+                <size>
+                 <width>40</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLineEdit" name="yGaussianLineEdit">
+               <property name="maximumSize">
+                <size>
+                 <width>40</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string/>
+               </property>
+               <property name="readOnly">
+                <bool>false</bool>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLineEdit" name="zGaussianLineEdit">
+               <property name="maximumSize">
+                <size>
+                 <width>40</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <widget class="Line" name="line_2">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="_5">
+          <item>
+           <widget class="QLabel" name="defaultPixelValueLabel">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="text">
+             <string>Default pixel value :</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="defaultPixelValueLineEdit">
+            <property name="maximumSize">
+             <size>
+              <width>50</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>0.0</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <spacer>
+            <property name="orientation">
+             <enum>Qt::Horizontal</enum>
+            </property>
+            <property name="sizeHint" stdset="0">
+             <size>
+              <width>121</width>
+              <height>21</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <widget class="Line" name="line_3">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="_6">
+          <item>
+           <widget class="QLabel" name="InterpolationLabel">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="text">
+             <string>Interpolation :</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QComboBox" name="interpolationComboBox">
+            <item>
+             <property name="text">
+              <string>NN</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 (faster BSpline)</string>
+             </property>
+            </item>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <widget class="Line" name="line_4">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="_7">
+          <item>
+           <widget class="QLabel" name="bSplineLabel">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="text">
+             <string>BSpline order :</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QSpinBox" name="bSplineOrderSpinBox">
+            <property name="maximum">
+             <number>5</number>
+            </property>
+            <property name="value">
+             <number>3</number>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="_8">
+          <item>
+           <widget class="QLabel" name="bLUTFactorLabel">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="minimumSize">
+             <size>
+              <width>0</width>
+              <height>16</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>BLUT sampling factor :</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QSpinBox" name="bLUTSpinBox">
+            <property name="value">
+             <number>30</number>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item>
+      <widget class="QFrame" name="frame_8">
+       <property name="frameShape">
+        <enum>QFrame::StyledPanel</enum>
+       </property>
+       <property name="frameShadow">
+        <enum>QFrame::Raised</enum>
+       </property>
+       <layout class="QVBoxLayout" name="_9">
+        <item>
+         <widget class="QLabel" name="outputLabel">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="text">
+           <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Output :&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="_10">
+          <item>
+           <widget class="QLabel" name="label_10">
+            <property name="text">
+             <string>Size</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="mOutputSizeLabel">
+            <property name="text">
+             <string>TextLabel</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="_11">
+          <item>
+           <widget class="QLabel" name="label_12">
+            <property name="text">
+             <string>Spacing</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="mOutputSpacingLabel">
+            <property name="text">
+             <string>TextLabel</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="_12">
+          <item>
+           <widget class="QLabel" name="label_4">
+            <property name="text">
+             <string>Memory size</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="mOutputMemoryLabel">
+            <property name="text">
+             <string>TextLabel</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <spacer>
+          <property name="orientation">
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>20</width>
+            <height>40</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index f8cd76b18d263705c50a13b2d5de58da9d44f6af..479632192e2670eef7f1ab912fb0bb4fa47e6e88 100644 (file)
          <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;Status : &lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;*not save*&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; 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-size:9pt;&quot;&gt;Status : &lt;/span&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;*not saved*&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
         </property>
        </widget>
        <widget class="QComboBox" name="comboBox">
index c3d2df7a25a274cc9494b2f39351fdf93d132f3f..9f7c8956f17c30a2d4edb3f6d6759ce784d5e802 100644 (file)
@@ -7,6 +7,7 @@
     <file>icons/8b.png</file>
     <file>icons/1b.png</file>
     <file>icons/binarize.png</file>
+    <file>icons/resample.png</file>
     <file>icons/crop.png</file>
     <file>icons/splashscreen2.png</file>
     <file>icons/splashscreen.PNG</file>
index 516c736acbc5eef76cdcbb9d56848464e2125ad4..9914710cdaddf8067d6a834ad15a5057604cfcdd 100644 (file)
@@ -33,7 +33,6 @@
 #include "vvSlicer.h"
 #include "vvInteractorStyleNavigator.h"
 #include "vvImageWriter.h"
-#include "vvResamplerDialog.h"
 #include "vvSegmentationDialog.h"
 #include "vvSurfaceViewerDialog.h"
 #include "vvDeformationDialog.h"
@@ -255,8 +254,6 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() {
   connect(actionDocumentation,SIGNAL(triggered()),this,SLOT(ShowDocumentation()));
 
   ///////////////////////////////////////////////
-  contextMenu.addAction(actionResampler);
-  connect(actionResampler,SIGNAL(triggered()),this,SLOT(ResampleCurrentImage()));
   connect(actionSegmentation,SIGNAL(triggered()),this,SLOT(SegmentationOnCurrentImage()));
   connect(actionSurface_Viewer,SIGNAL(triggered()),this,SLOT(SurfaceViewerLaunch()));
   ///////////////////////////////////////////////
@@ -2719,16 +2716,6 @@ void vvMainWindow::UpdateRenderWindows() {
 }
 //------------------------------------------------------------------------------
 
-//------------------------------------------------------------------------------
-void vvMainWindow::ResampleCurrentImage() {
-  vvResamplerDialog resampler;
-  int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
-  resampler.SetSlicerManagers(mSlicerManagers,index);
-  if (resampler.exec()) 
-    AddImage(resampler.GetOutput(),resampler.GetOutputFileName());
-}
-//------------------------------------------------------------------------------
-
 //------------------------------------------------------------------------------
 void vvMainWindow::SegmentationOnCurrentImage() {
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
index acacde84a1c5ce4e67d5eb052ea29ee6a24f9b49..60d37d6e3d39a128ea4f78705725a9e5ab180ccc 100644 (file)
@@ -88,7 +88,6 @@ public slots:
   void VectorChanged(int visibility, double x, double y, double z, double value);
   void OverlayChanged(int visibility, double valueOver, double valueRef);
   void FusionChanged(int visibility, double value);
-  void ResampleCurrentImage();
   void SegmentationOnCurrentImage();
   void SurfaceViewerLaunch();
 
similarity index 82%
rename from vv/vvResamplerDialog.cxx
rename to vv/vvToolResample.cxx
index 9e4c3ae706a849da6576fb9711250da3a083f11c..202d04e8fcadf4ed0b1bf4a62d5b5521dfe348d7 100644 (file)
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
 ======================================================================-====*/
 
-#ifndef _VVRESAMPLERDIALOG_CXX
-#define _VVRESAMPLERDIALOG_CXX
-
-#include "vvResamplerDialog.h"
-#include "clitkImageResampleGenericFilter.h"
+#include "vvToolResample.h"
 #include "vvSlicer.h"
+#include "vvToolCreator.h"
 
 #include <QFileInfo>
 #include <QMessageBox>
 
 #define COLUMN_IMAGE_NAME 7
 
-//====================================================================
-vvResamplerDialog::vvResamplerDialog(QWidget * parent, Qt::WindowFlags f)
-        :QDialog(parent,f), Ui::vvResamplerDialog() {
-
-    // initialization
-    setupUi(this);
-    Init();
-
-    // Connect signals & slots
-    connect(this, SIGNAL(accepted()), this, SLOT(Resample()));
-    connect(mImagesComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(UpdateCurrentInputImage()));
-
-    connect(sizeRadioButton, SIGNAL(clicked()), this, SLOT(UpdateControlSizeAndSpacing()));
-    connect(scaleSizeRadioButton, SIGNAL(clicked()), this, SLOT(UpdateControlSizeAndSpacing()));
-    connect(isoSizeRadioButton, SIGNAL(clicked()), this, SLOT(UpdateControlSizeAndSpacing()));
-    connect(spacingRadioButton, SIGNAL(clicked()), this, SLOT(UpdateControlSizeAndSpacing()));
-    connect(scaleSpacingRadioButton, SIGNAL(clicked()), this, SLOT(UpdateControlSizeAndSpacing()));
-    connect(isoSpacingRadioButton, SIGNAL(clicked()), this, SLOT(UpdateControlSizeAndSpacing()));
-
-    connect(xSizeLineEdit, SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSpacingFromSize()));
-    connect(ySizeLineEdit, SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSpacingFromSize()));
-    connect(zSizeLineEdit, SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSpacingFromSize()));
-    connect(xSpacingLineEdit, SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSizeFromSpacing()));
-    connect(ySpacingLineEdit, SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSizeFromSpacing()));
-    connect(zSpacingLineEdit, SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSizeFromSpacing()));
-    connect(scaleSizeLineEdit,SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSizeFromScale()));
-    connect(scaleSpacingLineEdit,SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSpacingFromScale()));
-    connect(isoSizeLineEdit,SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSizeFromIso()));
-    connect(isoSpacingLineEdit,SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSpacingFromIso()));
+ADD_TOOL(vvToolResample);
 
-    connect(gaussianFilterCheckBox,SIGNAL(stateChanged(int)),this,SLOT(UpdateGaussianFilter()));
-    connect(interpolationComboBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(UpdateInterpolation()));
-}
 //====================================================================
+vvToolResample::vvToolResample(vvMainWindowBase * parent, Qt::WindowFlags f):
+    vvToolWidgetBase(parent,f),
+    vvToolBase<vvToolResample>(parent),
+    Ui::vvToolResample()
+{
+    Ui_vvToolResample::setupUi(mToolWidget);
 
-//====================================================================
-void vvResamplerDialog::Init() {
+    mFilter = clitk::ImageResampleGenericFilter::New();
     mLastError ="";
 
     mInputFileFormat = "";
     ComponentType = "";
     mPixelType = "";
+    mCurrentSlicerManager=NULL;
 
     mInputSize.resize(0);
     mInputSpacing.resize(0);
@@ -114,21 +86,50 @@ void vvResamplerDialog::Init() {
     mInputSizeLabel->setPalette(qPalette);
     mInputSpacingLabel->setPalette(qPalette);
 
-    UpdateCurrentInputImage();
+    // Set how many inputs are needed for this tool
+    AddInputSelector("Select an image to resample", mFilter);
+
+    // Connect signals & slots
+
+    connect(sizeRadioButton, SIGNAL(clicked()), this, SLOT(UpdateControlSizeAndSpacing()));
+    connect(scaleSizeRadioButton, SIGNAL(clicked()), this, SLOT(UpdateControlSizeAndSpacing()));
+    connect(isoSizeRadioButton, SIGNAL(clicked()), this, SLOT(UpdateControlSizeAndSpacing()));
+    connect(spacingRadioButton, SIGNAL(clicked()), this, SLOT(UpdateControlSizeAndSpacing()));
+    connect(scaleSpacingRadioButton, SIGNAL(clicked()), this, SLOT(UpdateControlSizeAndSpacing()));
+    connect(isoSpacingRadioButton, SIGNAL(clicked()), this, SLOT(UpdateControlSizeAndSpacing()));
+
+    connect(xSizeLineEdit, SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSpacingFromSize()));
+    connect(ySizeLineEdit, SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSpacingFromSize()));
+    connect(zSizeLineEdit, SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSpacingFromSize()));
+    connect(xSpacingLineEdit, SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSizeFromSpacing()));
+    connect(ySpacingLineEdit, SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSizeFromSpacing()));
+    connect(zSpacingLineEdit, SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSizeFromSpacing()));
+    connect(scaleSizeLineEdit,SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSizeFromScale()));
+    connect(scaleSpacingLineEdit,SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSpacingFromScale()));
+    connect(isoSizeLineEdit,SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSizeFromIso()));
+    connect(isoSpacingLineEdit,SIGNAL(textEdited(QString)),this,SLOT(ComputeNewSpacingFromIso()));
+
+    connect(gaussianFilterCheckBox,SIGNAL(stateChanged(int)),this,SLOT(UpdateGaussianFilter()));
+    connect(interpolationComboBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(UpdateInterpolation()));
 }
 //====================================================================
 
 //====================================================================
-void vvResamplerDialog::UpdateCurrentInputImage() {
-    // Set current image & index
-    mCurrentIndex = mImagesComboBox->currentIndex();
-    if (mCurrentIndex == -1) {
-        mCurrentImage = NULL;
-        return ;
-    }
-    mCurrentImage = mSlicerManagers[mCurrentIndex]->GetSlicer(0)->GetImage();
+void vvToolResample::Initialize() {
+  SetToolName("Resample Image");
+  SetToolMenuName("Resample");
+  SetToolIconFilename(":/common/icons/resample.png");
+  SetToolTip("Resample image with various interpolation methods.");
+}
+//====================================================================
+
+//====================================================================
+void vvToolResample::InputIsSelected(vvSlicerManager* m) {
+
+    mCurrentSlicerManager = m;
+    mCurrentImage = mCurrentSlicerManager->GetSlicer(0)->GetImage();
     if (mCurrentImage.IsNull()) return;
-    mInputFileName = mSlicerManagers[mCurrentIndex]->GetFileName().c_str();
+    mInputFileName = mCurrentSlicerManager->GetFileName().c_str();
 
     // Set current information
     mPixelType = mCurrentImage->GetScalarTypeAsString().c_str();
@@ -168,7 +169,7 @@ void vvResamplerDialog::UpdateCurrentInputImage() {
 //====================================================================
 
 //====================================================================
-void vvResamplerDialog::UpdateOutputInfo() {
+void vvToolResample::UpdateOutputInfo() {
     mOutputSizeLabel->setText(GetVectorIntAsString(mOutputSize));
     mOutputSpacingLabel->setText(GetVectorDoubleAsString(mOutputSpacing));
     mOutputMemoryLabel->setText(GetSizeInBytes(mOutputSize));
@@ -176,7 +177,7 @@ void vvResamplerDialog::UpdateOutputInfo() {
 //====================================================================
 
 //====================================================================
-QString vvResamplerDialog::GetSizeInBytes(std::vector<int> & size) {
+QString vvToolResample::GetSizeInBytes(std::vector<int> & size) {
     int t = 1;
     for (unsigned int i=0; i<size.size(); i++) t *= size[i];
     t *= mCurrentImage->GetScalarSize()*mCurrentImage->GetNumberOfScalarComponents();
@@ -202,7 +203,7 @@ QString vvResamplerDialog::GetSizeInBytes(std::vector<int> & size) {
 //====================================================================
 
 //====================================================================
-QString vvResamplerDialog::GetVectorDoubleAsString(std::vector<double> vectorDouble) {
+QString vvToolResample::GetVectorDoubleAsString(std::vector<double> vectorDouble) {
     QString result;
     for (unsigned int i= 0; i<vectorDouble.size(); i++) {
         if (i != 0)
@@ -214,7 +215,7 @@ QString vvResamplerDialog::GetVectorDoubleAsString(std::vector<double> vectorDou
 //====================================================================
 
 //====================================================================
-QString vvResamplerDialog::GetVectorIntAsString(std::vector<int> vectorInt) {
+QString vvToolResample::GetVectorIntAsString(std::vector<int> vectorInt) {
     QString result;
     for (unsigned int i= 0; i<vectorInt.size(); i++) {
         if (i != 0)
@@ -226,7 +227,7 @@ QString vvResamplerDialog::GetVectorIntAsString(std::vector<int> vectorInt) {
 //====================================================================
 
 //====================================================================
-void vvResamplerDialog::FillSizeEdit(std::vector<int> size) {
+void vvToolResample::FillSizeEdit(std::vector<int> size) {
     xSizeLineEdit->setText(QString::number(size[0]));
     ySizeLineEdit->setText(QString::number(size[1]));
     if (size.size() > 2)
@@ -235,7 +236,7 @@ void vvResamplerDialog::FillSizeEdit(std::vector<int> size) {
 //====================================================================
 
 //====================================================================
-void vvResamplerDialog::FillSpacingEdit(std::vector<double> spacing) {
+void vvToolResample::FillSpacingEdit(std::vector<double> spacing) {
     xSpacingLineEdit->setText(QString::number(spacing[0]));
     ySpacingLineEdit->setText(QString::number(spacing[1]));
     if (spacing.size() > 2)
@@ -244,7 +245,7 @@ void vvResamplerDialog::FillSpacingEdit(std::vector<double> spacing) {
 //====================================================================
 
 //====================================================================
-void vvResamplerDialog::UpdateOutputSizeAndSpacing() {
+void vvToolResample::UpdateOutputSizeAndSpacing() {
     mOutputSize.resize(mDimension);
     mOutputSize = mInputSize;
     mOutputSpacing.resize(mDimension);
@@ -264,7 +265,7 @@ void vvResamplerDialog::UpdateOutputSizeAndSpacing() {
 //====================================================================
 
 //====================================================================
-void vvResamplerDialog::UpdateControlSizeAndSpacing() {
+void vvToolResample::UpdateControlSizeAndSpacing() {
     scaleSizeLineEdit->setText("");
     scaleSpacingLineEdit->setText("");
     isoSizeLineEdit->setText("");
@@ -308,7 +309,7 @@ void vvResamplerDialog::UpdateControlSizeAndSpacing() {
 //====================================================================
 
 //====================================================================
-void vvResamplerDialog::ComputeNewSpacingFromSize() {
+void vvToolResample::ComputeNewSpacingFromSize() {
     double newSpacing = mInputSpacing[0]*mInputSize[0];
     xSpacingLineEdit->setText(QString::number(newSpacing/xSizeLineEdit->text().toDouble()));
     newSpacing = mInputSpacing[1]*mInputSize[1];
@@ -323,7 +324,7 @@ void vvResamplerDialog::ComputeNewSpacingFromSize() {
 //====================================================================
 
 //====================================================================
-void vvResamplerDialog::ComputeNewSizeFromSpacing() {
+void vvToolResample::ComputeNewSizeFromSpacing() {
     double newSize = mInputSpacing[0]*mInputSize[0];
     xSizeLineEdit->setText(QString::number(newSize/xSpacingLineEdit->text().toDouble()));
     newSize = mInputSpacing[1]*mInputSize[1];
@@ -338,7 +339,7 @@ void vvResamplerDialog::ComputeNewSizeFromSpacing() {
 //====================================================================
 
 //====================================================================
-void vvResamplerDialog::ComputeNewSpacingFromScale() {
+void vvToolResample::ComputeNewSpacingFromScale() {
     xSpacingLineEdit->setText(QString::number(mInputSpacing[0]*scaleSpacingLineEdit->text().toDouble()/100));
     ySpacingLineEdit->setText(QString::number(mInputSpacing[1]*scaleSpacingLineEdit->text().toDouble()/100));
     if (mDimension > 2)
@@ -348,7 +349,7 @@ void vvResamplerDialog::ComputeNewSpacingFromScale() {
 //====================================================================
 
 //====================================================================
-void vvResamplerDialog::ComputeNewSizeFromScale() {
+void vvToolResample::ComputeNewSizeFromScale() {
     xSizeLineEdit->setText(QString::number(mInputSize[0]*scaleSizeLineEdit->text().toDouble()/100));
     ySizeLineEdit->setText(QString::number(mInputSize[1]*scaleSizeLineEdit->text().toDouble()/100));
     if (mDimension > 2)
@@ -358,7 +359,7 @@ void vvResamplerDialog::ComputeNewSizeFromScale() {
 //====================================================================
 
 //====================================================================
-void vvResamplerDialog::ComputeNewSpacingFromIso() {
+void vvToolResample::ComputeNewSpacingFromIso() {
     xSpacingLineEdit->setText(QString::number(isoSpacingLineEdit->text().toDouble()));
     ySpacingLineEdit->setText(QString::number(isoSpacingLineEdit->text().toDouble()));
     if (mDimension > 2)
@@ -368,7 +369,7 @@ void vvResamplerDialog::ComputeNewSpacingFromIso() {
 //====================================================================
 
 //====================================================================
-void vvResamplerDialog::ComputeNewSizeFromIso() {
+void vvToolResample::ComputeNewSizeFromIso() {
     xSizeLineEdit->setText(QString::number(isoSizeLineEdit->text().toDouble()));
     ySizeLineEdit->setText(QString::number(isoSizeLineEdit->text().toDouble()));
     if (mDimension > 2)
@@ -378,7 +379,7 @@ void vvResamplerDialog::ComputeNewSizeFromIso() {
 //====================================================================
 
 //====================================================================
-void vvResamplerDialog::UpdateInterpolation() {
+void vvToolResample::UpdateInterpolation() {
     if (interpolationComboBox->currentText() == "BSpline") {
         bSplineLabel->show();
         bSplineOrderSpinBox->show();
@@ -401,7 +402,7 @@ void vvResamplerDialog::UpdateInterpolation() {
 //====================================================================
 
 //====================================================================
-void vvResamplerDialog::UpdateGaussianFilter() {
+void vvToolResample::UpdateGaussianFilter() {
     if (gaussianFilterCheckBox->isChecked()) {
         gaussianFilterLabel->show();
         xGaussianLineEdit->show();
@@ -418,18 +419,9 @@ void vvResamplerDialog::UpdateGaussianFilter() {
 }
 //====================================================================
 
-//====================================================================
-void vvResamplerDialog::SetSlicerManagers(std::vector<vvSlicerManager*> & m,int current_image_index) {
-    mSlicerManagers = m;
-    for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
-        mImagesComboBox->addItem(mSlicerManagers[i]->GetFileName().c_str());
-    }
-    mImagesComboBox->setCurrentIndex(current_image_index);
-}
-//====================================================================
 
 //====================================================================
-void vvResamplerDialog::Resample() {
+void vvToolResample::apply() {
 
     // Get resampler options
     std::vector<double> sigma;
@@ -437,36 +429,33 @@ void vvResamplerDialog::Resample() {
     sigma.push_back(yGaussianLineEdit->text().toDouble());
     if (mDimension > 2) sigma.push_back(zGaussianLineEdit->text().toDouble());
 
-
-    // Create resampler filter
-    clitk::ImageResampleGenericFilter::Pointer filter = clitk::ImageResampleGenericFilter::New();
-    filter->SetOutputSize(mOutputSize);
-    filter->SetOutputSpacing(mOutputSpacing);
-    filter->SetInterpolationName(interpolationComboBox->currentText().toLower().toStdString());
+    mFilter->SetOutputSize(mOutputSize);
+    mFilter->SetOutputSpacing(mOutputSpacing);
+    mFilter->SetInterpolationName(interpolationComboBox->currentText().toLower().toStdString());
 
     if (interpolationComboBox->currentText() == "BSpline")
-        filter->SetBSplineOrder(bSplineOrderSpinBox->value());
+        mFilter->SetBSplineOrder(bSplineOrderSpinBox->value());
     else if (interpolationComboBox->currentText() == "Blut (faster BSpline)") {
-        filter->SetInterpolationName("blut");
-        filter->SetBSplineOrder(bSplineOrderSpinBox->value());
-        filter->SetBLUTSampling(bLUTSpinBox->value());
+        mFilter->SetInterpolationName("blut");
+        mFilter->SetBSplineOrder(bSplineOrderSpinBox->value());
+        mFilter->SetBLUTSampling(bLUTSpinBox->value());
     }
     if (gaussianFilterCheckBox->isChecked())
-        filter->SetGaussianSigma(sigma);
-    //  filter->SetOutputFileName(OutputFileName.toStdString());
-    filter->SetDefaultPixelValue(defaultPixelValueLineEdit->text().toDouble());
-    filter->SetInputVVImage(mCurrentImage);
+        mFilter->SetGaussianSigma(sigma);
+    //  mFilter->SetOutputFileName(OutputFileName.toStdString());
+    mFilter->SetDefaultPixelValue(defaultPixelValueLineEdit->text().toDouble());
+    mFilter->SetInputVVImage(mCurrentImage);
 
     // Go !
-    filter->Update();
-    mOutput = filter->GetOutputVVImage();
+    mFilter->Update();
+    mOutput = mFilter->GetOutputVVImage();
+    AddImage(mOutput,GetOutputFileName());
+    close();
 }
 //====================================================================
-std::string vvResamplerDialog::GetOutputFileName()
+std::string vvToolResample::GetOutputFileName()
 {
-    QFileInfo info(mImagesComboBox->currentText());
+    QFileInfo info(QString(mCurrentSlicerManager->GetFileName().c_str()));
     return (info.path().toStdString() + "/resampled_" + info.fileName().toStdString());
 }
 
-#endif /* end #define _vvResamplerDialog_CXX */
-
similarity index 80%
rename from vv/vvResamplerDialog.h
rename to vv/vvToolResample.h
index a5c7dd687384f9d444447339e3b19c762214590f..5a72a4135fc6986e70f9269c75d2fe868dfc0537 100644 (file)
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
 ======================================================================-====*/
-#ifndef _VVRESAMPLERDIALOG_H
-#define _VVRESAMPLERDIALOG_H
-#include "ui_vvResamplerDialog.h"
+#ifndef _vvToolResample_h
+#define _vvToolResample_h
+#include "ui_vvToolResample.h"
 #include "clitkCommon.h"
 #include "vvImage.h"
 #include "vvSlicerManager.h"
+#include "vvToolWidgetBase.h"
+#include "vvToolBase.h"
+#include "clitkImageResampleGenericFilter.h"
 
 #include <QtDesigner/QDesignerExportWidget>
 #include <QTreeWidget>
 
 //====================================================================
-class vvResamplerDialog :  public QDialog, private Ui::vvResamplerDialog {
+class vvToolResample :  
+    public vvToolWidgetBase,
+    public vvToolBase<vvToolResample>, 
+    private Ui::vvToolResample 
+{
 
     Q_OBJECT
 
 public:
     // constructor - destructor
-    vvResamplerDialog(QWidget * parent=0, Qt::WindowFlags f=0);
-    void SetSlicerManagers(std::vector<vvSlicerManager*> & m,int current_image_index);
+    vvToolResample(vvMainWindowBase * parent=0, Qt::WindowFlags f=0);
 
     // Get output result
     vvImage::Pointer GetOutput() {
@@ -43,10 +49,11 @@ public:
         return display_result->checkState() > 0;
     }
     std::string GetOutputFileName();
+    static void Initialize();
+    void apply();
 
 public slots:
 //  void SetImagesList(QTreeWidget * tree);
-    void Resample();
     void UpdateControlSizeAndSpacing();
     void ComputeNewSizeFromSpacing();
     void ComputeNewSizeFromScale();
@@ -56,13 +63,14 @@ public slots:
     void ComputeNewSpacingFromIso();
     void UpdateInterpolation();
     void UpdateGaussianFilter();
-    void UpdateCurrentInputImage();
+    void InputIsSelected(vvSlicerManager* m);
 
 protected:
-    Ui::vvResamplerDialog ui;
-    std::vector<vvSlicerManager*> mSlicerManagers;
+    Ui::vvToolResample ui;
     vvImage::Pointer mOutput;
+    clitk::ImageResampleGenericFilter::Pointer mFilter;
 
+    vvSlicerManager* mCurrentSlicerManager;
     vvImage::Pointer mCurrentImage;
     int mCurrentIndex;
 
@@ -83,7 +91,6 @@ protected:
 
     QStringList OutputListFormat;
 
-    void Init();
     void UpdateInputInfo();
     void UpdateOutputInfo();
     void UpdateOutputFormat();
@@ -95,8 +102,8 @@ protected:
     QString GetVectorDoubleAsString(std::vector<double> vectorDouble);
     QString GetVectorIntAsString(std::vector<int> vectorInt);
 
-}; // end class vvResamplerDialog
+}; // end class vvToolResample
 //====================================================================
 
-#endif /* end #define _VVRESAMPLERDIALOG_H */
+#endif