]> Creatis software - clitk.git/blobdiff - itk/clitkSegmentationUtils.h
changes in license header
[clitk.git] / itk / clitkSegmentationUtils.h
index 6f4deb4c01726349b756449770023d7d29f2e825..fcc7f2840ac88d2fd8d29742b94c63e29807e65e 100644 (file)
@@ -3,7 +3,7 @@
 
   Authors belong to: 
   - University of LYON              http://www.universite-lyon.fr/
-  - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
 
   This software is distributed WITHOUT ANY WARRANTY; without even
@@ -14,7 +14,7 @@
 
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-  ======================================================================-====*/
+  ===========================================================================**/
 
 #ifndef CLITKSEGMENTATIONUTILS_H
 #define CLITKSEGMENTATIONUTILS_H
@@ -26,6 +26,7 @@
 
 // itk
 #include <itkBoundingBox.h>
+#include <itkJoinSeriesImageFilter.h>
 
 /*
   According to 
@@ -221,11 +222,23 @@ namespace clitk {
 
 
   //--------------------------------------------------------------------
-  //template<class ImageType>
-  //typename ImageType::Pointer
-  //JoinSlices(std::vector<typename itk::Image<typename ImageType::PixelType, 
-  //                                           ImageType::ImageDimension-1>::Pointer > & slices, 
-        //    const ImageType * input, int dim);
+  template<class ImageType>
+  typename ImageType::Pointer
+  JoinSlices(std::vector<typename itk::Image<typename ImageType::PixelType, 
+                                             ImageType::ImageDimension-1>::Pointer > & slices, 
+             const ImageType * input, 
+             int direction) {
+    typedef typename itk::Image<typename ImageType::PixelType, ImageType::ImageDimension-1> SliceType;
+    typedef itk::JoinSeriesImageFilter<SliceType, ImageType> JoinSeriesFilterType;
+    typename JoinSeriesFilterType::Pointer joinFilter = JoinSeriesFilterType::New();
+    joinFilter->SetOrigin(input->GetOrigin()[direction]);
+    joinFilter->SetSpacing(input->GetSpacing()[direction]);
+    for(unsigned int i=0; i<slices.size(); i++) {
+      joinFilter->PushBackInput(slices[i]);
+    }
+    joinFilter->Update();
+    return joinFilter->GetOutput();
+  }
   //--------------------------------------------------------------------
 
 
@@ -349,6 +362,22 @@ namespace clitk {
   IsOnTheSameLineSide(PointType C, PointType A, PointType B, PointType like);
   //--------------------------------------------------------------------
 
+
+  //--------------------------------------------------------------------
+  template<class ImageType>
+  void 
+  SliceBySliceBuildLineSegmentAccordingToExtremaPosition(const ImageType * input, 
+                                                         typename ImageType::PixelType BG, 
+                                                         int sliceDimension, 
+                                                         int extremaDirection, 
+                                                         bool extremaOppositeFlag, 
+                                                         int lineDirection,
+                                                         double margin,
+                                                         std::vector<typename ImageType::PointType> & A, 
+                                                         std::vector<typename ImageType::PointType> & B);  
+  //--------------------------------------------------------------------
+
+
 }
 
 #include "clitkSegmentationUtils.txx"