]> Creatis software - clitk.git/commitdiff
Merge branch 'master' of /home/dsarrut/clitk3.server
authormpech <maxime.pech@insa-lyon.fr>
Mon, 20 Jun 2011 13:30:43 +0000 (15:30 +0200)
committermpech <maxime.pech@insa-lyon.fr>
Mon, 20 Jun 2011 13:30:43 +0000 (15:30 +0200)
itk/clitkResampleImageWithOptionsFilter.txx
itk/clitkSegmentationUtils.h
itk/clitkSegmentationUtils.txx
segmentation/clitkExtractLymphStation_2RL.txx
vv/CMakeLists.txt
vv/qt_ui/vvHelpDialog.ui
vv/vvMainWindow.cxx
vv/vvSlicer.cxx
vv/vvSlicerManagerCommand.cxx

index 7e5eeab4eb78e9d4745d4b9a92fd8f2e34d6430b..a3f88beb3db8443f08fa376da1480433f24e4051 100644 (file)
@@ -125,11 +125,15 @@ GenerateOutputInformation()
       // floor() is used to intentionally reduce the number of slices 
       // because, from a clinical point of view, it's better to 
       // remove data than to add data that privously didn't exist.
+      if(inputSpacing[i]*m_OutputSpacing[i]<0)
+        itkExceptionMacro( << "Input and output spacings don't have the same signs, can't cope with that" );
       m_OutputSize[i] = (int)floor(inputSize[i]*inputSpacing[i]/m_OutputSpacing[i]);
     }
   } else {
     if (m_OutputSpacing[0] != -1) { // apply spacing, compute size
       for(unsigned int i=0; i<dim; i++) {
+        if(inputSpacing[i]*m_OutputSpacing[i]<0)
+          itkExceptionMacro( << "Input and output spacings don't have the same signs, can't cope with that" );
        // see comment above for the use of floor()
        m_OutputSize[i] = (int)floor(inputSize[i]*inputSpacing[i]/m_OutputSpacing[i]);
       }
@@ -151,7 +155,7 @@ GenerateOutputInformation()
     m_OutputSize[l] = inputSize[l];
     m_OutputSpacing[l] = inputSpacing[l];
   }
-    
+
   // Set Size/Spacing
   OutputImagePointer outputImage = this->GetOutput(0);
   // OutputImageRegionType region;
index 7ae1c77515679e5d976982268a7cab7acb2d4369..7daf3c8345405463e12a47a459a5487da2847aa2 100644 (file)
@@ -23,6 +23,7 @@
 #include "clitkCommon.h"
 #include "clitkAutoCropFilter.h"
 #include "clitkLabelizeParameters.h"
+#include "clitkExtractSliceFilter.h"
 
 // itk
 #include <itkBoundingBox.h>
@@ -225,9 +226,19 @@ namespace clitk {
   //--------------------------------------------------------------------
   template<class ImageType>
   void
-  ExtractSlices(const ImageType * image, int dim, 
-               std::vector< typename itk::Image<typename ImageType::PixelType, 
-                                                 ImageType::ImageDimension-1>::Pointer > & slices);
+  ExtractSlices(const ImageType * image, int direction,
+                std::vector<typename itk::Image<typename ImageType::PixelType,
+                                                ImageType::ImageDimension-1>::Pointer > & slices)
+  {
+    typedef ExtractSliceFilter<ImageType> ExtractSliceFilterType;
+    typedef typename ExtractSliceFilterType::SliceType SliceType;
+    typename ExtractSliceFilterType::Pointer
+      extractSliceFilter = ExtractSliceFilterType::New();
+    extractSliceFilter->SetInput(image);
+    extractSliceFilter->SetDirection(direction);
+    extractSliceFilter->Update();
+    extractSliceFilter->GetOutputSlices(slices);
+  }
   //--------------------------------------------------------------------
 
 
index 4990b247c2b85dac1e342b77dc64901c80c553f6..b432188aec93aa8e34a21f1047ea3d22991a2c25 100644 (file)
@@ -466,7 +466,7 @@ namespace clitk {
     p[dim] = max;
     typename ImageType::IndexType end;
     image->TransformPhysicalPointToIndex(p, end);
-    size[dim] = fabs(end[dim]-start[dim]);
+    size[dim] = abs(end[dim]-start[dim]);
     region.SetIndex(start);
     region.SetSize(size);
   
@@ -585,25 +585,6 @@ namespace clitk {
   //--------------------------------------------------------------------
 
 
-  //--------------------------------------------------------------------
-  template<class ImageType>
-  void
-  ExtractSlices(const ImageType * image, int direction, 
-                std::vector<typename itk::Image<typename ImageType::PixelType, 
-                                                ImageType::ImageDimension-1>::Pointer > & slices) 
-  {
-    typedef ExtractSliceFilter<ImageType> ExtractSliceFilterType;
-    typedef typename ExtractSliceFilterType::SliceType SliceType;
-    typename ExtractSliceFilterType::Pointer 
-      extractSliceFilter = ExtractSliceFilterType::New();
-    extractSliceFilter->SetInput(image);
-    extractSliceFilter->SetDirection(direction);
-    extractSliceFilter->Update();
-    extractSliceFilter->GetOutputSlices(slices);
-  }
-  //--------------------------------------------------------------------
-
-
   //--------------------------------------------------------------------
   template<class ImageType>
   void
index 7e8c834b4aaa6d1d52510f7676881922cf20251f..71298eb5397dfa605888f7b7b7a578757bfeae2c 100644 (file)
@@ -35,7 +35,7 @@ void HypercubeCorners(std::vector<itk::Point<double, Dim> > & out) {
   std::vector<itk::Point<double, Dim-1> > previous;
   HypercubeCorners<Dim-1>(previous);
   out.resize(previous.size()*2);
-  for(uint i=0; i<out.size(); i++) {
+  for(unsigned int i=0; i<out.size(); i++) {
     itk::Point<double, Dim> p;
     if (i<previous.size()) p[0] = 0; 
     else p[0] = 1;
@@ -65,20 +65,21 @@ void ComputeImageBoundariesCoordinates(typename ImageType::Pointer image,
                                        std::vector<typename ImageType::PointType> & bounds) 
 {
   // Get image max/min coordinates
-  const uint dim=ImageType::ImageDimension;
+  const unsigned int dim=ImageType::ImageDimension;
   typedef typename ImageType::PointType PointType;
   typedef typename ImageType::IndexType IndexType;
   PointType min_c, max_c;
   IndexType min_i, max_i;
   min_i = image->GetLargestPossibleRegion().GetIndex();
-  for(uint i=0; i<dim; i++) max_i[i] = image->GetLargestPossibleRegion().GetSize()[i] + min_i[i];
+  for(unsigned int i=0; i<dim; i++)
+    max_i[i] = image->GetLargestPossibleRegion().GetSize()[i] + min_i[i];
   image->TransformIndexToPhysicalPoint(min_i, min_c);
   image->TransformIndexToPhysicalPoint(max_i, max_c);
   
   // Get corners coordinates
   HypercubeCorners<ImageType::ImageDimension>(bounds);
-  for(uint i=0; i<bounds.size(); i++) {
-    for(uint j=0; j<dim; j++) {
+  for(unsigned int i=0; i<bounds.size(); i++) {
+    for(unsigned int j=0; j<dim; j++) {
       if (bounds[i][j] == 0) bounds[i][j] = min_c[j];
       if (bounds[i][j] == 1) bounds[i][j] = max_c[j];
     }
@@ -371,7 +372,7 @@ ExtractStation_2RL_Ant_Limits2()
   clitk::ExtractSlices<MaskImageType>(Aorta, 2, slices_Aorta);
   std::vector<MaskSlicePointer> slices_Trachea;
   clitk::ExtractSlices<MaskImageType>(Trachea, 2, slices_Trachea);
-  uint n= slices_BrachioCephalicArtery.size();
+  unsigned int n= slices_BrachioCephalicArtery.size();
   
   // Get the boundaries of one slice
   std::vector<MaskSlicePointType> bounds;
@@ -382,7 +383,7 @@ ExtractStation_2RL_Ant_Limits2()
   std::vector<MaskImagePointType> p3D;
 
   vtkSmartPointer<vtkAppendPolyData> append = vtkSmartPointer<vtkAppendPolyData>::New();
-  for(uint i=0; i<n; i++) {
+  for(unsigned int i=0; i<n; i++) {
     // Labelize the slices
     slices_CommonCarotidArtery[i] = Labelize<MaskSliceType>(slices_CommonCarotidArtery[i], 
                                                             GetBackgroundValue(), true, 1);
@@ -425,12 +426,12 @@ ExtractStation_2RL_Ant_Limits2()
       centroids6.clear();
     }
 
-    for(uint j=1; j<centroids1.size(); j++) points2D.push_back(centroids1[j]);
-    for(uint j=1; j<centroids2.size(); j++) points2D.push_back(centroids2[j]);
-    for(uint j=1; j<centroids3.size(); j++) points2D.push_back(centroids3[j]);
-    for(uint j=1; j<centroids4.size(); j++) points2D.push_back(centroids4[j]);
-    for(uint j=1; j<centroids5.size(); j++) points2D.push_back(centroids5[j]);
-    for(uint j=1; j<centroids6.size(); j++) points2D.push_back(centroids6[j]);
+    for(unsigned int j=1; j<centroids1.size(); j++) points2D.push_back(centroids1[j]);
+    for(unsigned int j=1; j<centroids2.size(); j++) points2D.push_back(centroids2[j]);
+    for(unsigned int j=1; j<centroids3.size(); j++) points2D.push_back(centroids3[j]);
+    for(unsigned int j=1; j<centroids4.size(); j++) points2D.push_back(centroids4[j]);
+    for(unsigned int j=1; j<centroids5.size(); j++) points2D.push_back(centroids5[j]);
+    for(unsigned int j=1; j<centroids6.size(); j++) points2D.push_back(centroids6[j]);
     
     // Sort by angle according to trachea centroid and vertical line,
     // in polar coordinates :
@@ -439,7 +440,7 @@ ExtractStation_2RL_Ant_Limits2()
     ComputeCentroids<MaskSliceType>(slices_Trachea[i], GetBackgroundValue(), centroids_trachea);
     typedef std::pair<MaskSlicePointType, double> PointAngleType;
     std::vector<PointAngleType> angles;
-    for(uint j=0; j<points2D.size(); j++) {
+    for(unsigned int j=0; j<points2D.size(); j++) {
       //double r = centroids_trachea[1].EuclideanDistanceTo(points2D[j]);
       double x = (points2D[j][0]-centroids_trachea[1][0]); // X : Right to Left
       double y = (centroids_trachea[1][1]-points2D[j][1]); // Y : Post to Ant
@@ -475,7 +476,7 @@ ExtractStation_2RL_Ant_Limits2()
 
     // Sort points2D according to polar angles
     std::sort(angles.begin(), angles.end(), comparePointsWithAngle<PointAngleType>());
-    for(uint j=0; j<angles.size(); j++) {
+    for(unsigned int j=0; j<angles.size(); j++) {
       points2D[j] = angles[j].first;
     }
     //    DDV(points2D, points2D.size());
@@ -496,7 +497,7 @@ ExtractStation_2RL_Ant_Limits2()
        low, add one point
     */
     std::vector<MaskSlicePointType> toadd;
-    uint index = 0;
+    unsigned int index = 0;
     double dmax = 5;
     while (index<points2D.size()-1) {
       MaskSlicePointType a = points2D[index];
@@ -555,7 +556,7 @@ ExtractStation_2RL_Ant_Limits2()
     // Build 3D points from the 2D points
     std::vector<ImagePointType> points3D;
     clitk::PointsUtils<MaskImageType>::Convert2DListTo3DList(points2D, i, m_Working_Support, points3D);
-    for(uint x=0; x<points3D.size(); x++) p3D.push_back(points3D[x]);
+    for(unsigned int x=0; x<points3D.size(); x++) p3D.push_back(points3D[x]);
 
     // Build the mesh from the contour's points
     vtkSmartPointer<vtkPolyData> mesh = Build3DMeshFrom2DContour(points3D);
index f20765db15245d06d899cfe091f7541e60f6a627..515422bc3c5b316906349ec137c4d001de7478c0 100644 (file)
@@ -203,7 +203,8 @@ SET(foundationLibraries clitkCommon ${ITK_LIBRARIES} QVTK vtkHybrid)
 
 #=========================================================
 #Create binary and libs for tests
-SET(vvExternalLibs clitkSegmentationGgoLib clitkDicomRTStruct ${toolLibs} ${foundationLibraries})
+SET(vvExternalLibs ${QT_QTNETWORK_LIBRARY} clitkSegmentationGgoLib clitkDicomRTStruct ${toolLibs} ${foundationLibraries})
+# QtNetwork is required by vvRegisterForm
 
 ADD_LIBRARY(vvLib ${vv_SRCS} ${vv_UI_CXX})
 TARGET_LINK_LIBRARIES(vvLib ${vvExternalLibs})
@@ -215,8 +216,7 @@ ELSE(WIN32)
 ENDIF(WIN32)
 
 #TARGET_LINK_LIBRARIES(vv vvLib)
-# QtNetwork added specifically for Fedora build
-TARGET_LINK_LIBRARIES(vv vvLib QtNetwork)
+TARGET_LINK_LIBRARIES(vv vvLib)
 
 
 #=========================================================
index 2917b136dad1aba84f047f5943ce6dc407a213e0..6c827c350650fdb74ed7e350fe541da027926051 100644 (file)
@@ -74,7 +74,7 @@ p, li { white-space: pre-wrap; }
 &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:12pt; font-weight:600;&quot;&gt;u&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline;&quot;&gt;U&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;pdate Image&lt;/span&gt;&lt;/p&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:12pt; font-weight:600;&quot;&gt;f&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline;&quot;&gt;F&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;ly To Mouse Position&lt;/span&gt;&lt;/p&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:12pt; font-weight:600;&quot;&gt;g&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline;&quot;&gt;G&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;o to Crosshair Position&lt;/span&gt;&lt;/p&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:12pt; font-weight:600;&quot;&gt;o&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: Go to Image &lt;/span&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline;&quot;&gt;O&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;rigin&lt;/span&gt;&lt;/p&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:12pt; font-weight:600;&quot;&gt;Ctrl+g&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline;&quot;&gt;G&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;o to Coordinate System Origin&lt;/span&gt;&lt;/p&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:12pt; font-weight:600;&quot;&gt;h&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline;&quot;&gt;H&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;ide Crosshair and corner annotations&lt;/span&gt;&lt;/p&gt;
 &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;&quot;&gt;&lt;/p&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:12pt; font-weight:600;&quot;&gt;Up,Down&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: Change Slice&lt;/span&gt;&lt;/p&gt;
index 882bc2b16d631c7cf68233f30ac3fe0c3640cf81..13a5444d3bfd3dd5f20353d506d5d3f16b6a087e 100644 (file)
@@ -2493,27 +2493,22 @@ void vvMainWindow::UpdateTSlice(int slicer, int slice)
 void vvMainWindow::UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax)
 {
   int position = int((min+max)/2);
-  int tPosition = int((tmin+tmax)/2);
   if (slicer == 0) {
     NOVerticalSlider->setValue(position);
     NOVerticalSlider->setRange(min,max);
     NOHorizontalSlider->setRange(tmin,tmax);
-    NOHorizontalSlider->setValue(tPosition);
   } else if (slicer == 1) {
     NEVerticalSlider->setValue(position);
     NEVerticalSlider->setRange(min,max);
     NEHorizontalSlider->setRange(tmin,tmax);
-    NEHorizontalSlider->setValue(tPosition);
   } else if (slicer == 2) {
     SOVerticalSlider->setValue(position);
     SOVerticalSlider->setRange(min,max);
     SOHorizontalSlider->setRange(tmin,tmax);
-    SOHorizontalSlider->setValue(tPosition);
   } else if (slicer == 3) {
     SEVerticalSlider->setValue(position);
     SEVerticalSlider->setRange(min,max);
     SEHorizontalSlider->setRange(tmin,tmax);
-    SEHorizontalSlider->setValue(tPosition);
   }
 }
 //------------------------------------------------------------------------------
index 6100c56dfcc84aa5ad97ca19c980bad135cfd6c6..6b52ea1abc1e7b5f737946df19c1e2748bc7cf64 100644 (file)
@@ -98,22 +98,6 @@ vvSlicer::vvSlicer()
   mVFColor[1] = 1;
   mVFColor[2] = 0;
 
-  std::string text = "F1 = sagital; F2 = coronal; F3 = axial\n";
-  text += "F5 = horizontal flip; F6 = vertical flip\n\n";
-  text += "0,1,2,3,4,5 : preset windowing\n";
-  text += "6,7,8,9 : preset colormap\n";
-  text += "z : local windowing\n";
-  text += "r : reset view\n";
-  text += "l : reload image\n";
-  text += "f : fly to mouse position\n";
-  text += "g : go to cross hair position\n\n";
-  text += "Up,down : change slice\n";
-  text += "Left,right : change tenporal slice\n\n";
-  text += "Scrollbar (or w/x) : zoom in/out\n";
-  text += "left button : synchronize all views\n";
-  text += "middle button : grab image\n";
-  text += "right button : change windowing\n";
-
   crossCursor = vtkSmartPointer<vtkCursor2D>::New();
   crossCursor->AllOff();
   crossCursor->AxesOn();
@@ -793,6 +777,7 @@ void vvSlicer::AdjustResliceToSliceOrientation(vtkImageReslice *reslice)
   reslice->SetOutputOrigin(origin);
   reslice->SetOutputSpacing(spacing);
   reslice->UpdateInformation();
+  reslice->GetOutput()->UpdateInformation();
 }
 //------------------------------------------------------------------------------
 
index 09a95456a2a1fc574933b63ca3349fb3c81615ff..805f51bea4bd943a23abc0ed4399d007b8dd8b8e 100644 (file)
@@ -96,6 +96,7 @@ void vvSlicerManagerCommand::Execute(vtkObject *caller,
     if ( VisibleInWindow > -1 ) {
       if (event == vtkCommand::KeyPressEvent) {
         std::string KeyPress = isi->GetInteractor()->GetKeySym();
+        bool bCtrlKey = isi->GetInteractor()->GetControlKey();
         if (KeyPress == "Tab") {
           if(isi->GetInteractor()->GetShiftKey())
             this->SM->PrevImage(VisibleInWindow);
@@ -210,15 +211,13 @@ void vvSlicerManagerCommand::Execute(vtkObject *caller,
           return;
         }
         if (KeyPress == "g") {
-          double* cursorPos = this->SM->GetSlicer(VisibleInWindow)->GetCursorPosition();
-          this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(
-            cursorPos[0],cursorPos[1],cursorPos[2],cursorPos[3]);
-          this->SM->UpdateViews(1,VisibleInWindow);
-          this->SM->UpdateLinked(VisibleInWindow);
-          return;
-        }
-        if (KeyPress == "o") {
-          this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(0,0,0,0);
+          if(bCtrlKey)
+            this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(0,0,0,0);
+          else {
+            double* cursorPos = this->SM->GetSlicer(VisibleInWindow)->GetCursorPosition();
+            this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(
+              cursorPos[0],cursorPos[1],cursorPos[2],cursorPos[3]);
+          }
           this->SM->UpdateViews(1,VisibleInWindow);
           this->SM->UpdateLinked(VisibleInWindow);
           return;