]> Creatis software - clitk.git/commitdiff
- toolbase + binarize
authordsarrut <dsarrut>
Mon, 1 Mar 2010 07:37:20 +0000 (07:37 +0000)
committerdsarrut <dsarrut>
Mon, 1 Mar 2010 07:37:20 +0000 (07:37 +0000)
19 files changed:
filters/clitkBinarizeImageGenericFilter.txx
tools/clitkSignalMeanPositionTracking.ggo
vv/CMakeLists.txt
vv/qt_ui/vvToolBinarize.ui
vv/qt_ui/vvToolCrop.ui
vv/qt_ui/vvToolCropImage.ui
vv/qt_ui/vvToolFoo.ui
vv/vvImageContour.cxx
vv/vvImageContour.h
vv/vvIntensityValueSlider.cxx
vv/vvMainWindow.cxx
vv/vvSlicer.cxx
vv/vvSlicer.h
vv/vvToolBase.h
vv/vvToolBinarize.cxx
vv/vvToolBinarize.h
vv/vvToolCropImage.cxx
vv/vvToolCropImage.h
vv/vvToolWidgetBase.h

index 835decc2a2bb1da683a5eee8bc166876c65c3d6b..206b1431380bf14a54f1c4cbf30e4dba093b6bfe 100644 (file)
@@ -22,7 +22,7 @@ namespace clitk
   template<class args_info_type>
   BinarizeImageGenericFilter<args_info_type>::BinarizeImageGenericFilter():
     ImageToImageGenericFilter<Self>("Binarize") {
-    //    InitializeImageType<2>();
+    InitializeImageType<2>();
     InitializeImageType<3>();
     InitializeImageType<4>();
   }
@@ -33,9 +33,9 @@ namespace clitk
   template<class args_info_type>
   template<unsigned int Dim>
   void BinarizeImageGenericFilter<args_info_type>::InitializeImageType() {      
-    //ADD_IMAGE_TYPE(Dim, char);
+    ADD_IMAGE_TYPE(Dim, char);
     ADD_IMAGE_TYPE(Dim, short);
-    //ADD_IMAGE_TYPE(Dim, int);
+    ADD_IMAGE_TYPE(Dim, int);
     //ADD_IMAGE_TYPE(Dim, float);
   }
   //--------------------------------------------------------------------
index 46baa88d657a5068307e5da4a33e5f67ff02ddf4..20072ab42e7054d3ab813e4b94daf5b2ec762a3d 100644 (file)
@@ -1,5 +1,5 @@
 #File clitkSignalMeanPositionTracking.ggo
-Package "clitkSignalMeanPositionTracking"
+package "clitkSignalMeanPositionTracking"
 version "1.0"
 purpose "See Ruan 2008, compute mean position from a signal"
 
index 8797f8cc1f363fe903504a0a43c31df21aac8549..d704adc84b3eb60b5ce56024bb844b17ed3027c7 100644 (file)
@@ -105,6 +105,7 @@ SET(vv_SRCS
   vvToolCreatorBase.cxx
   vvToolWidgetBase.cxx
   vvToolFoo.cxx
+  vvToolFooWithWidgetBase.cxx
   vvToolCropImage.cxx
   vvToolBinarize.cxx
   vvToolInputSelectorWidget.cxx
@@ -133,6 +134,7 @@ QT4_WRAP_CPP(vv_SRCS
   vvIntensityValueSlider.h
   vvToolCreatorBase.h
   vvToolFoo.h
+  vvToolFooWithWidgetBase.h
   vvToolBinarize.h
   vvToolInputSelectorWidget.h
   vvToolWidgetBase.h
index c58f08519dd9e9cec2e37d5736a7cede016c670d..eb5f9bd39e50d812f2a8a7f7855255ec37ac494b 100644 (file)
     </widget>
    </item>
    <item>
-    <widget class="QCheckBox" name="checkBox_2">
+    <widget class="QCheckBox" name="mCheckBoxInteractiveDisplay">
      <property name="enabled">
-      <bool>false</bool>
+      <bool>true</bool>
      </property>
      <property name="text">
       <string>Interactive (unchek to disable on the fly contours drawing)</string>
      </property>
+     <property name="checked">
+      <bool>true</bool>
+     </property>
     </widget>
    </item>
   </layout>
index 9a4fa747b48fd6867bbee937aea7b1474039828c..0f596875563555774ab1e61180f72c41af6860e7 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>192</width>
-    <height>169</height>
+    <width>394</width>
+    <height>220</height>
    </rect>
   </property>
   <property name="windowTitle">
   </layout>
  </widget>
  <resources/>
- <connections/>
+ <connections>
+  <connection>
+   <sender>xminSlider</sender>
+   <signal>sliderMoved(int)</signal>
+   <receiver>spin_xmin</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>83</x>
+     <y>23</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>334</x>
+     <y>25</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spin_xmin</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>xminSlider</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>334</x>
+     <y>25</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>86</x>
+     <y>19</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>xmaxSlider</sender>
+   <signal>sliderMoved(int)</signal>
+   <receiver>spin_xmax</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>99</x>
+     <y>54</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>334</x>
+     <y>61</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spin_xmax</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>xmaxSlider</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>334</x>
+     <y>60</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>97</x>
+     <y>54</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>yminSlider</sender>
+   <signal>sliderMoved(int)</signal>
+   <receiver>spin_ymin</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>102</x>
+     <y>89</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>334</x>
+     <y>95</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spin_ymin</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>yminSlider</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>334</x>
+     <y>82</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>111</x>
+     <y>84</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>ymaxSlider</sender>
+   <signal>sliderMoved(int)</signal>
+   <receiver>spin_ymax</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>72</x>
+     <y>121</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>334</x>
+     <y>125</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spin_ymax</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>ymaxSlider</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>334</x>
+     <y>123</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>86</x>
+     <y>117</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>zminSlider</sender>
+   <signal>sliderMoved(int)</signal>
+   <receiver>spin_zmin</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>64</x>
+     <y>156</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>334</x>
+     <y>159</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spin_zmin</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>zminSlider</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>334</x>
+     <y>158</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>85</x>
+     <y>159</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>zmaxSlider</sender>
+   <signal>sliderMoved(int)</signal>
+   <receiver>spin_zmax</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>75</x>
+     <y>188</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>334</x>
+     <y>189</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spin_zmax</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>zmaxSlider</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>334</x>
+     <y>188</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>80</x>
+     <y>192</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
 </ui>
index e7c06193c45a40ea42b207276ff3a34a4fd897ec..7f27048adde2beaa221b89060aa15833e448f994 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>300</height>
+    <width>472</width>
+    <height>292</height>
    </rect>
   </property>
   <property name="windowTitle">
        </property>
       </widget>
      </item>
-     <item row="0" column="1">
-      <widget class="QSlider" name="xminSlider">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-      </widget>
-     </item>
      <item row="1" column="0">
       <widget class="QLabel" name="label_2">
        <property name="text">
      <item row="5" column="2">
       <widget class="QSpinBox" name="spin_zmax"/>
      </item>
+     <item row="0" column="1">
+      <widget class="QSlider" name="xminSlider">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+      </widget>
+     </item>
     </layout>
    </item>
   </layout>
  </widget>
  <resources/>
- <connections/>
+ <connections>
+  <connection>
+   <sender>spin_xmin</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>xminSlider</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>412</x>
+     <y>37</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>308</x>
+     <y>37</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>xminSlider</sender>
+   <signal>sliderMoved(int)</signal>
+   <receiver>spin_xmin</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>227</x>
+     <y>38</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>418</x>
+     <y>39</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>xmaxSlider</sender>
+   <signal>sliderMoved(int)</signal>
+   <receiver>spin_xmax</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>311</x>
+     <y>82</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>412</x>
+     <y>85</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>yminSlider</sender>
+   <signal>sliderMoved(int)</signal>
+   <receiver>spin_ymin</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>321</x>
+     <y>126</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>412</x>
+     <y>128</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>ymaxSlider</sender>
+   <signal>sliderMoved(int)</signal>
+   <receiver>spin_ymax</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>246</x>
+     <y>171</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>417</x>
+     <y>167</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>zminSlider</sender>
+   <signal>sliderMoved(int)</signal>
+   <receiver>spin_zmin</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>291</x>
+     <y>214</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>412</x>
+     <y>213</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>zmaxSlider</sender>
+   <signal>sliderMoved(int)</signal>
+   <receiver>spin_zmax</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>250</x>
+     <y>257</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>415</x>
+     <y>253</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spin_xmax</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>xmaxSlider</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>412</x>
+     <y>83</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>285</x>
+     <y>84</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spin_ymin</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>yminSlider</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>412</x>
+     <y>126</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>304</x>
+     <y>127</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spin_ymax</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>ymaxSlider</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>412</x>
+     <y>165</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>305</x>
+     <y>169</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spin_zmin</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>zminSlider</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>412</x>
+     <y>213</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>319</x>
+     <y>210</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>spin_zmax</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>zmaxSlider</receiver>
+   <slot>setValue(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>413</x>
+     <y>259</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>308</x>
+     <y>254</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
 </ui>
index 9748f2b34adaea3a398ac4df336a9a8d117afb86..eab637ac1cc4424f9df8bc40b65dde65d5acf459 100644 (file)
   <property name="windowTitle">
    <string>Form</string>
   </property>
-  <widget class="QPushButton" name="pushButton">
-   <property name="geometry">
-    <rect>
-     <x>150</x>
-     <y>90</y>
-     <width>75</width>
-     <height>23</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>Foo !</string>
-   </property>
-  </widget>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0">
+    <widget class="QPushButton" name="mButton">
+     <property name="text">
+      <string>Foo !</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
  </widget>
  <resources/>
- <connections>
-  <connection>
-   <sender>pushButton</sender>
-   <signal>clicked()</signal>
-   <receiver>vvToolFoo</receiver>
-   <slot>close()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>220</x>
-     <y>135</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>100</x>
-     <y>-18</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
+ <connections/>
 </ui>
index 85a9f2bb05767de4d46f7931dfcc4460a2d873bd..88924c1895d5c27cd247a603419508e77f398d8f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   vv
   Module:    $RCSfile: vvImageContour.cxx,v $
   Language:  C++
-  Date:      $Date: 2010/02/24 11:42:42 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2010/03/01 07:37:25 $
+  Version:   $Revision: 1.4 $
   Author :   David Sarrut (david.sarrut@creatis.insa-lyon.fr)
 
   Copyright (C) 2010
 #include "vvImageContour.h"
 #include <vtkImageActor.h>
 #include <vtkCamera.h>
+#include <vtkRenderer.h>
 #include <vtkMarchingSquares.h>
 #include <vtkImageClip.h>
 #include <vtkImageData.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkProperty.h>
 
 //------------------------------------------------------------------------------
 vvImageContour::vvImageContour() {
@@ -57,7 +60,6 @@ void vvImageContour::setSlicer(vvSlicer * slicer) {
   mSlicer = slicer;  
 
   for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) {
-    // DD(numImage);
     vtkImageClip * mClipper = vtkImageClip::New();
     vtkMarchingSquares * mSquares = vtkMarchingSquares::New();
     vtkPolyDataMapper * mSquaresMapper = vtkPolyDataMapper::New();
@@ -77,31 +79,42 @@ void vvImageContour::setSlicer(vvSlicer * slicer) {
     mSquaresList.push_back(mSquares);
     mClipperList.push_back(mClipper);
   }
-  //mSquares->Update();
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::removeActors() {
- //  DD("removeActors");
+void vvImageContour::hideActors() {
   if (!mSlicer) return;
   mSlice = mSlicer->GetSlice();
- //  DD(mSlice);
   for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
     mSquaresActorList[i]->VisibilityOff();
-    //mSquaresActorList[i]->Update();
   }
 }
 //------------------------------------------------------------------------------
 
   
 //------------------------------------------------------------------------------
-void vvImageContour::update(int value) {
-  //  DD(value);
+void vvImageContour::showActors() {
   if (!mSlicer) return;
   mSlice = mSlicer->GetSlice();
+  mTSlice = mSlicer->GetTSlice();
+  //  for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
+  mSquaresActorList[mTSlice]->VisibilityOn();
+  update(mValue);
+  //}
+}
+//------------------------------------------------------------------------------
+
+  
+//------------------------------------------------------------------------------
+void vvImageContour::update(int value) {
+  mValue= value;
+  if (!mSlicer) return;
 
+  // how to not update if not visible ?
+
+  mSlice = mSlicer->GetSlice();
   // Only change actor visibility if tslice change
   if (mTSlice != mSlicer->GetTSlice()) {
     if (mTSlice != -1) 
@@ -133,36 +146,30 @@ void vvImageContour::update(int value) {
       if (mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[0] > mSlice)
         {
          mSquaresActor->SetPosition(1,0,0);
-         // mSquaresActor2->SetPosition(1,0,0);
         }
       else
         {
          mSquaresActor->SetPosition(-1,0,0);
-         // mSquaresActor2->SetPosition(-1,0,0);
         }
       break;
     case 2:
       if (mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[1] > mSlice)
         {
          mSquaresActor->SetPosition(0,1,0);
-          //   mSquaresActor2->SetPosition(0,1,0);
         }
       else
         {
          mSquaresActor->SetPosition(0,-1,0);
-         // mSquaresActor2->SetPosition(0,-1,0);
         }
       break;
     case 4:
       if (mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[2] > mSlice)
         {
          mSquaresActor->SetPosition(0,0,1);
-         // mSquaresActor2->SetPosition(0,0,1);
         }
       else
         {
          mSquaresActor->SetPosition(0,0,-1);
-         // mSquaresActor2->SetPosition(0,0,-1);
         }
       break;
     }
index be96b05e8665a26d383d0ed16632274663636427..3bf4a6e3c07203ca4177d615e615f2aaf24c6803 100644 (file)
@@ -3,8 +3,8 @@
   Program:   vv
   Module:    $RCSfile: vvImageContour.h,v $
   Language:  C++
-  Date:      $Date: 2010/02/24 11:42:42 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2010/03/01 07:37:25 $
+  Version:   $Revision: 1.4 $
   Author :   David Sarrut (david.sarrut@creatis.insa-lyon.fr)
 
   Copyright (C) 2010
 #ifndef VVIMAGECONTOUR_H
 #define VVIMAGECONTOUR_H
 
-#include <vtkMarchingCubes.h>
-#include <vtkPolyData.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkActor.h>
-#include <vtkProperty.h>
-#include <vtkRenderer.h>
-#include <vtkImageClip.h>
-
 #include "clitkCommon.h"
 #include "vvSlicer.h"
+class vtkImageClip;
+class vtkMarchingSquares;
+class vtkActor;
 
 //------------------------------------------------------------------------------
 class vvImageContour
 {
   //  Q_OBJECT
   public:
+ public:
   vvImageContour();
   ~vvImageContour();
 
   void setSlicer(vvSlicer * slicer);
-  // vtkActor * getActor() { return mSquaresActor;}
   void update(int value);
-  void removeActors();
+  void hideActors();
+  void showActors();
 
  protected:
   vvSlicer * mSlicer;
   int mSlice;
   int mTSlice;
+  int mValue;
 
   std::vector<vtkImageClip*> mClipperList;
   std::vector<vtkMarchingSquares*> mSquaresList;
index 55ae8f23243cfd1015ebdba4a042365da3d40358..c1973aff97ccbb04ba6020e1cfa433134c78503e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   vv
   Module:    $RCSfile: vvIntensityValueSlider.cxx,v $
   Language:  C++
-  Date:      $Date: 2010/02/24 11:42:42 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2010/03/01 07:37:25 $
+  Version:   $Revision: 1.4 $
   Author :   David Sarrut (david.sarrut@creatis.insa-lyon.fr)
 
   Copyright (C) 2008
@@ -26,7 +26,6 @@
   =========================================================================*/
 
 #include "vvIntensityValueSlider.h"
-#include "clitkCommon.h"
 
 //------------------------------------------------------------------------------
 vvIntensityValueSlider::vvIntensityValueSlider(QWidget * parent, Qt::WindowFlags f)
@@ -47,15 +46,12 @@ vvIntensityValueSlider::vvIntensityValueSlider(QWidget * parent, Qt::WindowFlags
 
 //------------------------------------------------------------------------------
 vvIntensityValueSlider::~vvIntensityValueSlider() {
-  // DD("Delete vvIntensityValueSlider");
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
 void vvIntensityValueSlider::valueChangedFromSpinBox(double v) {
-  //  DD("valueChangedFromSpinBox");
-  //   DD(v);
   mSlider->setValue(v);
   mValue = v;
   emit valueChanged(v);
@@ -65,11 +61,7 @@ void vvIntensityValueSlider::valueChangedFromSpinBox(double v) {
 
 //------------------------------------------------------------------------------
 void vvIntensityValueSlider::valueChangedFromSlider(int v) {
-  //   DD("valueChangedFromSlider");
-  //   DD(v);
-  //   DD(v*mSliderFactor);
   mSpinBox->setValue(v*mSliderFactor);
-  //  emit valueChanged(v*mSliderFactor);
 }
 //------------------------------------------------------------------------------
 
@@ -120,13 +112,6 @@ void vvIntensityValueSlider::SetMinimum(double min) {
 
 //------------------------------------------------------------------------------
 void vvIntensityValueSlider::Update() {
- //  DD(mImage->GetScalarTypeAsString());
-//   DD(mImage->GetFirstVTKImageData()->GetScalarTypeMax());
-//   DD(mImage->GetFirstVTKImageData()->GetScalarTypeMin());
-
-  // double max = mImage->GetFirstVTKImageData()->GetScalarTypeMax();
-//   double min = mImage->GetFirstVTKImageData()->GetScalarTypeMin();
-    
   if (mImage->IsScalarTypeInteger()) {
 
     mSpinBox->setSingleStep(1.0);
@@ -137,8 +122,6 @@ void vvIntensityValueSlider::Update() {
     mImage->GetFirstVTKImageData()->GetScalarRange(range);
     mMin = range[0];
     mMax = range[1];
-   //  DD(mMax);
-//     DD(mMin);
     mSlider->setMaximum(mMax);
     mSlider->setMinimum(mMin);
     mSpinBox->setMaximum(mMax);
index 924bf19b534c8534a15323e27ed94693e9797cf1..9d179e3304a9ce48bce07ce0b37d5d50a86b59b1 100644 (file)
@@ -3,8 +3,8 @@
   Program:   vv
   Module:    $RCSfile: vvMainWindow.cxx,v $
   Language:  C++
-  Date:      $Date: 2010/02/24 11:42:42 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2010/03/01 07:37:25 $
+  Version:   $Revision: 1.13 $
   Author :   Pierre Seroul (pierre.seroul@gmail.com)
 
   Copyright (C) 200COLUMN_IMAGE_NAME
@@ -2350,7 +2350,7 @@ void vvMainWindow::NOVerticalSliderChanged() {
       if (DataTree->topLevelItem(i)->data(COLUMN_UL_VIEW,Qt::CheckStateRole).toInt() > 1)
         {
           mSlicerManagers[i]->GetSlicer(0)->SetSlice(value);
-          //mSlicerManagers[i]->UpdateSlice(0); // <-- NO ! too much update...
+          mSlicerManagers[i]->UpdateSlice(0); // <-- DS add this. Not too much update ? 
           break;
         }
     }
index 35897ddbfa151784b6843742c4830c73a8bd30ad..66a62ed2372729986119b3b812996027bae76188 100644 (file)
@@ -78,6 +78,7 @@ vvSlicer::vvSlicer()
 {
   mImage = NULL;
   mCurrentTSlice = 0;
+  mUseReducedExtent = false;
 
   mCurrent[0] = -VTK_DOUBLE_MAX;
   mCurrent[1] = -VTK_DOUBLE_MAX;
@@ -165,6 +166,21 @@ vtkCornerAnnotation* vvSlicer::GetAnnotation() {
   return ca.GetPointer();
 }
 
+//------------------------------------------------------------------------------
+void vvSlicer::EnableReducedExtent(bool b) {
+  mUseReducedExtent = b;
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvSlicer::SetReducedExtent(int * ext) {
+  mReducedExtent = ext;
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
 void vvSlicer::AddContour(vvMesh::Pointer contour,bool propagate)
 {
 
@@ -551,7 +567,16 @@ void vvSlicer::UpdateDisplayExtent()
       return;
     }
   input->UpdateInformation();
-  int *w_ext = input->GetWholeExtent();
+  int *w_ext;// = input->GetWholeExtent();
+
+  if (mUseReducedExtent) {
+    w_ext = mReducedExtent;
+  }
+  else w_ext = input->GetWholeExtent();
+
+  DD(w_ext[0]);
+  DD(w_ext[1]);
+  DD(w_ext[2]);
 
   switch (this->SliceOrientation)
     {
@@ -1140,7 +1165,11 @@ void vvSlicer::UpdateLandmarks()
 //----------------------------------------------------------------------------
 void vvSlicer::SetSlice(int slice)
 {
+  DD("vvSlicer::SetSlice");
+  DD(slice);
   int *range = this->GetSliceRange();
+  DD(range[0]);
+  DD(range[1]);
   if (range)
     {
       if (slice < range[0])
index 7060b25318288300308e9ad9324fda653f76baf5..e96a5b15b8239a6fa429ca575d49cb3072058b70 100644 (file)
@@ -162,6 +162,9 @@ public:
     virtual void SetColorWindow(double s);
     virtual void SetColorLevel(double s);
 
+    void EnableReducedExtent(bool b);
+    void SetReducedExtent(int * ext);
+
 protected:
     vvSlicer();
     ~vvSlicer();
@@ -205,6 +208,8 @@ protected:
     int mSubSampling;
     int mScale;
     int mVFLog;
+    bool mUseReducedExtent;
+    int * mReducedExtent;
 
 private:
     void UpdateOrientation();
index 005217fb30be94ad0fa8513fc332b2f5e3dd7663..e86b0407df78d6657e7f1ec7511a11d46203f6e0 100644 (file)
@@ -3,8 +3,8 @@
   Program:   vv
   Module:    $RCSfile: vvToolBase.h,v $
   Language:  C++
-  Date:      $Date: 2010/02/24 11:42:42 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2010/03/01 07:37:25 $
+  Version:   $Revision: 1.4 $
   Author :   David Sarrut (david.sarrut@creatis.insa-lyon.fr)
 
   Copyright (C) 2008
@@ -43,6 +43,10 @@ public:
   static void SetToolIconFilename(QString n) { vvToolCreator<ToolType>::mSingleton->mToolIconFilename = n; }
   static void SetToolTip(QString n) { vvToolCreator<ToolType>::mSingleton->mToolTip = n; }
 
+  void AddImage(vvImage::Pointer image,std::string filename) {
+    CREATOR(ToolType)->GetMainWindow()->AddImage(image,filename); 
+  }
+
 };
 //------------------------------------------------------------------------------
 
index bccf02151d761b807c9240d93e4fb2a19f8873e4..2d6a410756d016e1c56268875eb31ff192e08f0f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   vv
   Module:    $RCSfile: vvToolBinarize.cxx,v $
   Language:  C++
-  Date:      $Date: 2010/02/24 11:42:42 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2010/03/01 07:37:25 $
+  Version:   $Revision: 1.9 $
   Author :   David Sarrut (david.sarrut@creatis.insa-lyon.fr)
 
   Copyright (C) 2008
@@ -61,6 +61,7 @@ vvToolBinarize::vvToolBinarize(vvMainWindowBase * parent, Qt::WindowFlags f)
 {
   // GUI Initialization
   Ui_vvToolBinarize::setupUi(mToolWidget);
+  mInteractiveDisplayIsEnabled = mCheckBoxInteractiveDisplay->isChecked();
 
   // Connect signals & slots  
   connect(mThresholdSlider1, SIGNAL(valueChanged(double)), this, SLOT(valueChangedT1(double)));
@@ -68,6 +69,7 @@ vvToolBinarize::vvToolBinarize(vvMainWindowBase * parent, Qt::WindowFlags f)
   connect(mRadioButtonLowerThan, SIGNAL(toggled(bool)), this, SLOT(enableLowerThan(bool)));
   connect(mCheckBoxUseFG, SIGNAL(toggled(bool)), this, SLOT(useFGBGtoggled(bool)));
   connect(mCheckBoxUseBG, SIGNAL(toggled(bool)), this, SLOT(useFGBGtoggled(bool)));
+  connect(mCheckBoxInteractiveDisplay, SIGNAL(toggled(bool)), this, SLOT(InteractiveDisplayToggled(bool)));
 
   // Initialize some widget
   mThresholdSlider1->SetText("");
@@ -87,6 +89,47 @@ vvToolBinarize::~vvToolBinarize() {
 //------------------------------------------------------------------------------
 
 
+//------------------------------------------------------------------------------
+void vvToolBinarize::InteractiveDisplayToggled(bool b) {
+  mInteractiveDisplayIsEnabled = b;
+  if (!mInteractiveDisplayIsEnabled) {
+    RemoveVTKObjects();
+  }
+  else {
+    for(unsigned int i=0; i<mImageContour.size(); i++)
+      mImageContour[i]->showActors();
+    if (mCurrentSlicerManager)
+      mCurrentSlicerManager->Render();
+  }
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolBinarize::RemoveVTKObjects() { 
+  for(unsigned int i=0; i<mImageContour.size(); i++)
+    mImageContour[i]->hideActors();
+  if (mCurrentSlicerManager)
+    mCurrentSlicerManager->Render();
+}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+bool vvToolBinarize::close() { 
+  RemoveVTKObjects();
+  return vvToolWidgetBase::close(); 
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolBinarize::reject() { 
+  RemoveVTKObjects();
+  return vvToolWidgetBase::reject(); 
+}
+//------------------------------------------------------------------------------
+
+
 //------------------------------------------------------------------------------
 void vvToolBinarize::enableLowerThan(bool b) {
   if (!b) {
@@ -143,6 +186,7 @@ void vvToolBinarize::InputIsSelected(vvSlicerManager * m) {
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::UpdateSlice(int slicer,int slices) {
+  if (!mInteractiveDisplayIsEnabled) return;
   if (!mCurrentSlicerManager) close();
   for(int i=0;i<mCurrentSlicerManager->NumberOfSlicers(); i++) {
     mImageContour[i]->update(mThresholdSlider1->GetValue());
@@ -184,7 +228,6 @@ void vvToolBinarize::GetArgsInfoFromGUI() {
   mArgsInfo.fg_arg = mFGSlider->GetValue();
   mArgsInfo.bg_arg = mBGSlider->GetValue();
 
-  // DD(inverseBGandFG);
   if (inverseBGandFG) {
     mArgsInfo.fg_arg = mFGSlider->GetValue();
     mArgsInfo.bg_arg = mBGSlider->GetValue();
@@ -225,8 +268,8 @@ void vvToolBinarize::apply() {
   // Output ???
   vvImage::Pointer output = filter->GetOutputVVImage();
   std::ostringstream osstream;
-  osstream << "Binarized_" << mCurrentSlicerManager->GetSlicer(0)->GetFileName();
-  CREATOR(vvToolBinarize)->GetMainWindow()->AddImage(output,osstream.str()); 
+  osstream << "Binarized_" << mCurrentSlicerManager->GetSlicer(0)->GetFileName() << ".mhd";
+  AddImage(output,osstream.str()); 
   close();
 }
 //------------------------------------------------------------------------------
@@ -246,7 +289,8 @@ void vvToolBinarize::valueChangedT1(double v) {
 //   DD(mCurrentSlicerManager->GetSlicer(0));
   mThresholdSlider2->SetMinimum(v);
   int m1 = (int)lrint(v);
-
+  
+  if (!mInteractiveDisplayIsEnabled) return;
   for(int i=0;i<mCurrentSlicerManager->NumberOfSlicers(); i++) {
     mImageContour[i]->update(m1);
   }
index f29d1190367a797b46e1f5fdd53a366135f33843..0453ad1ee019febfe0487b8b43f312649d02f5ed 100644 (file)
@@ -3,8 +3,8 @@
   Program:   vv
   Module:    $RCSfile: vvToolBinarize.h,v $
   Language:  C++
-  Date:      $Date: 2010/02/24 11:42:42 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2010/03/01 07:37:25 $
+  Version:   $Revision: 1.7 $
   Author :   David Sarrut (david.sarrut@creatis.insa-lyon.fr)
 
   Copyright (C) 2010
@@ -29,7 +29,6 @@
 #define VVTOOLBINARIZE_H
 
 #include <QtDesigner/QDesignerExportWidget>
-//#include <QDialog>
 
 #include "vvToolBase.h"
 #include "vvToolWidgetBase.h"
 #include "ui_vvToolBinarize.h"
 #include "clitkBinarizeImage_ggo.h"
 
-#include "vtkMarchingSquares.h"
-#include "vtkImageClip.h"
-#include "vtkMarchingCubes.h"
-#include "vtkPolyData.h"
-#include "vtkPolyDataMapper.h"
-#include "vtkActor.h"
-#include "vtkProperty.h"
-#include "vtkRenderer.h"
-
 //------------------------------------------------------------------------------
 class vvToolBinarize:
   public vvToolWidgetBase,
@@ -64,32 +54,23 @@ class vvToolBinarize:
 
   //-----------------------------------------------------
   public slots:
-  void apply();
+  virtual void apply();
+  virtual bool close();
+  virtual void reject();
   void valueChangedT1(double v);
   void valueChangedT2(double v);
   void UpdateSlice(int slicer,int slices);
   void InputIsSelected(vvSlicerManager * m);
   void enableLowerThan(bool b);
   void useFGBGtoggled(bool);
-  virtual bool close() { DD("vvToolBinarize::close"); 
-    for(unsigned int i=0; i<mImageContour.size(); i++)
-      mImageContour[i]->removeActors();
-    if (mCurrentSlicerManager)
-      mCurrentSlicerManager->Render();
-    return vvToolWidgetBase::close(); }
-
-  virtual void reject() { DD("vvToolBinarize::reject"); 
-    for(unsigned int i=0; i<mImageContour.size(); i++)
-      mImageContour[i]->removeActors();
-    if (mCurrentSlicerManager)
-      mCurrentSlicerManager->Render();
-    return vvToolWidgetBase::reject(); }
-
+  void InteractiveDisplayToggled(bool b);
 
  protected:
+  void RemoveVTKObjects();
   Ui::vvToolBinarize ui;
   args_info_clitkBinarizeImage mArgsInfo;
   std::vector<vvImageContour*> mImageContour;
+  bool mInteractiveDisplayIsEnabled;
 
 }; // end class vvToolBinarize
 //------------------------------------------------------------------------------
index 126a46f5f35882f23c5669dda8d02a2e73215f54..a8cec28d5bfea452a561e090256fd191172dbab3 100644 (file)
@@ -3,8 +3,8 @@
   Program:   vv
   Module:    $RCSfile: vvToolCropImage.cxx,v $
   Language:  C++
-  Date:      $Date: 2010/02/24 11:43:37 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2010/03/01 07:37:25 $
+  Version:   $Revision: 1.2 $
   Author :   David Sarrut (david.sarrut@creatis.insa-lyon.fr)
 
   Copyright (C) 2008
   =========================================================================*/
 
 #include "vvToolCropImage.h"
+#include <QComboBox>
+#include <QCursor>
+#include <QApplication>
+#include <vtkImageClip.h>
+#include <vtkImageTranslateExtent.h>
+#include <vtkImageData.h>
+#include <vtkSmartPointer.h>
+#include "vvSlicer.h"
 
 //------------------------------------------------------------------------------
 // Create the tool and automagically (I like this word) insert it in
@@ -39,13 +47,13 @@ vvToolCropImage::vvToolCropImage(vvMainWindowBase * parent, Qt::WindowFlags f):
   vvToolWidgetBase(parent, f), 
   vvToolBase<vvToolCropImage>(parent), 
   Ui::vvToolCropImage() {
+
   // GUI Initialization
   Ui_vvToolCropImage::setupUi(mToolWidget);
+  mReducedExtent = new int[6]; // TO CHANGE !! nb dim
 
-  // Initialize the input selection
-  //UpdateInfoFromMainWindow();
- //  InitializeListOfInputImages(*mMainWindowToolInfo->mSlicerManagers, 
-//                           mMainWindowToolInfo->mSlicerManagerCurrentIndex); 
+  // Connect
+  connect(xminSlider, SIGNAL(sliderMoved(int)), this, SLOT(sliderMoved(int)));
 }
 //------------------------------------------------------------------------------
 
@@ -57,8 +65,82 @@ vvToolCropImage::~vvToolCropImage() {
 //------------------------------------------------------------------------------
 
 
+//------------------------------------------------------------------------------
+void vvToolCropImage::sliderMoved(int s) {
+  DD(s);
+  mReducedExtent[0] = xminSlider->value();
+  for(int i=0; i<mCurrentSlicerManager->NumberOfSlicers(); i++) {
+    mCurrentSlicerManager->GetSlicer(i)->SetReducedExtent(mReducedExtent);
+  }
+}
+//------------------------------------------------------------------------------
+
+
 //------------------------------------------------------------------------------
 void vvToolCropImage::InputIsSelected(vvSlicerManager * slicer) {
-  DD("InputIsSelected");
+  DD("InputIsSelected"); 
+
+  mReducedExtent = mCurrentSlicerManager->GetImage()->GetFirstVTKImageData()->GetWholeExtent();
+  DD(mReducedExtent[0]);
+  DD(mReducedExtent[1]);
+
+  
+  // TODO : set min/max
+    std::vector<int> imsize = mCurrentSlicerManager->GetImage()->GetSize();
+    xminSlider->setMaximum(imsize[0]-1);
+    xmaxSlider->setMaximum(imsize[0]-1);
+    xmaxSlider->setValue(imsize[0]-1);
+    yminSlider->setMaximum(imsize[1]-1);
+    ymaxSlider->setMaximum(imsize[1]-1);
+    ymaxSlider->setValue(imsize[1]-1);
+    zminSlider->setMaximum(imsize[2]-1);
+    zmaxSlider->setMaximum(imsize[2]-1);
+    zmaxSlider->setValue(imsize[2]-1);
+    spin_xmin->setMaximum(imsize[0]-1);
+    spin_xmax->setMaximum(imsize[0]-1);
+    spin_xmax->setValue(imsize[0]-1);
+    spin_ymin->setMaximum(imsize[1]-1);
+    spin_ymax->setMaximum(imsize[1]-1);
+    spin_ymax->setValue(imsize[1]-1);
+    spin_zmin->setMaximum(imsize[2]-1);
+    spin_zmax->setMaximum(imsize[2]-1);
+    spin_zmax->setValue(imsize[2]-1);
 }
 //------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolCropImage::apply() {
+  DD("apply");
+
+    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+    vvImage::Pointer mResult=vvImage::New();
+    //vvSlicerManager * current=mSlicerManagers[inputSequenceBox->currentIndex()];
+    vvImage::Pointer image= mCurrentSlicerManager->GetImage();
+    for (std::vector<vtkImageData*>::const_iterator i=image->GetVTKImages().begin();
+            i!=image->GetVTKImages().end();i++)
+    {
+        vtkSmartPointer<vtkImageClip> filter=vtkSmartPointer<vtkImageClip>::New();
+        ///Vtk is very weird, you need to "translate the extent" to get the correct origin
+        //http://markmail.org/message/vndc2tr6kcabiakp#query:vtkImageClip%20origin+page:1+mid:6na7y57floutklvz+state:results
+        vtkSmartPointer<vtkImageTranslateExtent> translate=vtkSmartPointer<vtkImageTranslateExtent>::New();
+        filter->SetInput(*i);
+        filter->SetOutputWholeExtent(xminSlider->value(),xmaxSlider->value(),
+                yminSlider->value(),ymaxSlider->value(),
+                zminSlider->value(),zmaxSlider->value());
+        translate->SetTranslation(-xminSlider->value(),-yminSlider->value(),-zminSlider->value());
+        translate->SetInput(filter->GetOutput());
+        filter->ClipDataOn(); //Really create a cropped copy of the image
+        translate->Update();
+        vtkImageData* output=vtkImageData::New();
+        output->ShallowCopy(translate->GetOutput());
+        mResult->AddImage(output);
+    }
+    QApplication::restoreOverrideCursor();
+
+  AddImage(mResult,"crop.mhd"); 
+
+  close();
+}
+//------------------------------------------------------------------------------
+
index c039653e7d75d7f2e9a5843132acbaf212b153b9..42b85b7c73ae6efe0d32ff8703cee3b42d96fc98 100644 (file)
@@ -3,8 +3,8 @@
   Program:   vv
   Module:    $RCSfile: vvToolCropImage.h,v $
   Language:  C++
-  Date:      $Date: 2010/02/24 11:43:37 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2010/03/01 07:37:25 $
+  Version:   $Revision: 1.2 $
   Author :   David Sarrut (david.sarrut@creatis.insa-lyon.fr)
 
   Copyright (C) 2010
@@ -47,17 +47,11 @@ class vvToolCropImage:
   vvToolCropImage(vvMainWindowBase * parent=0, Qt::WindowFlags f=0);
   ~vvToolCropImage();
 
-  //-----------------------------------------------------
-  typedef vvToolCropImage Self;
-  bool close() { return QWidget::close(); }
   virtual void InputIsSelected(vvSlicerManager *m);
-  //void AnImageIsBeingClosed(vvSlicerManager * m) { vvToolWidgetBase::TTAnImageIsBeingClosed(m); }
-
-  void bar() { DD("crop::bar"); }
-
 
 public slots:
-  void apply() { DD("Apply"); }
+  virtual void apply();
+  void sliderMoved(int s);
 
   //-----------------------------------------------------
   static void Initialize() {
@@ -69,7 +63,7 @@ public slots:
 
  protected:
   Ui::vvToolCropImage ui;
-
+  int * mReducedExtent;
 
 }; // end class vvToolCropImage
 //------------------------------------------------------------------------------
index 225b5f2ea4f5a0392d2c12255ed5d5ccd7d394f5..4c5ca4d96f3149f1238a60cf5d8a4536238dda8f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   vv
   Module:    $RCSfile: vvToolWidgetBase.h,v $
   Language:  C++
-  Date:      $Date: 2010/02/24 11:43:37 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2010/03/01 07:37:25 $
+  Version:   $Revision: 1.2 $
   Author :   David Sarrut (david.sarrut@creatis.insa-lyon.fr)
 
   Copyright (C) 2010
@@ -48,10 +48,10 @@ class vvToolWidgetBase:
 
 public slots:
   virtual void apply() = 0;
+  virtual bool close();
   void InputIsSelected();
   void AnImageIsBeingClosed(vvSlicerManager * m);
   void show();
-  virtual bool close();
 
 protected:
   void InitializeInputs();