From 41c8f600e73a8a6961cbd58e628af44f1c395c37 Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@c-s.fr>
Date: Wed, 13 Dec 2006 17:12:58 +0000
Subject: [PATCH] =?UTF-8?q?Commit=20final=20du=20correctifs=20des=20tests?=
 =?UTF-8?q?=20de=20d=C3=A9tection=20de=20lignes=20en=20erreur.=20Certains?=
 =?UTF-8?q?=20tests=20ont=20=C3=A9t=C3=A9=20factoris=C3=A9s,=20le=20nombre?=
 =?UTF-8?q?=20total=20de=20tests=20de=20cette=20fonctionnalit=C3=A9=20a=20?=
 =?UTF-8?q?donc=20diminu=C3=A9.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../otbLineDetectorImageFilterBase.h          |   7 +-
 .../otbLineDetectorImageFilterBase.txx        | 219 +++++-------------
 Testing/Code/FeatureExtraction/CMakeLists.txt | 156 ++++++-------
 .../otbFeatureExtractionTests.cxx             |  18 +-
 .../otbLineCorrelationDetectorLinear.cxx      |  24 +-
 ...LineCorrelationDetectorLinearDirection.cxx |  96 --------
 .../otbLineRatioDetectorLinear.cxx            |  24 +-
 .../otbLineRatioDetectorLinearDirection.cxx   |  96 --------
 8 files changed, 174 insertions(+), 466 deletions(-)
 delete mode 100755 Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinearDirection.cxx
 delete mode 100755 Testing/Code/FeatureExtraction/otbLineRatioDetectorLinearDirection.cxx

diff --git a/Code/FeatureExtraction/otbLineDetectorImageFilterBase.h b/Code/FeatureExtraction/otbLineDetectorImageFilterBase.h
index 2526ec8a00..288c1699cb 100755
--- a/Code/FeatureExtraction/otbLineDetectorImageFilterBase.h
+++ b/Code/FeatureExtraction/otbLineDetectorImageFilterBase.h
@@ -134,7 +134,7 @@ public:
   
   virtual void GenerateInputRequestedRegion() throw(itk::InvalidRequestedRegionError);
   
-  const OutputImageType * GetOutputDirection();
+  OutputImageType * GetOutputDirection();
 
 protected:
   LineDetectorImageFilterBase();
@@ -168,16 +168,11 @@ protected:
   /** Size of the facelist*/
   SizeType m_FaceList;
   
-
-
   OutputImagePointerType m_OutputDirection;
 
   OutputPixelType m_Threshold;
 
   unsigned int m_NumberOfDirections;
-
-long unsigned int m_PadLowerBound[2];
-long unsigned int m_PadUpperBound[2];
 private:
   LineDetectorImageFilterBase(const Self&); //purposely not implemented
   void operator=(const Self&); //purposely not implemented
diff --git a/Code/FeatureExtraction/otbLineDetectorImageFilterBase.txx b/Code/FeatureExtraction/otbLineDetectorImageFilterBase.txx
index d8c0195442..2a3764deb6 100755
--- a/Code/FeatureExtraction/otbLineDetectorImageFilterBase.txx
+++ b/Code/FeatureExtraction/otbLineDetectorImageFilterBase.txx
@@ -46,17 +46,16 @@ namespace otb
 template <class TInputImage, class TOutputImage, class InterpolatorType >
 LineDetectorImageFilterBase<TInputImage, TOutputImage, InterpolatorType>::LineDetectorImageFilterBase()
 {
+  this->SetNumberOfOutputs(2);
+  this->SetNumberOfRequiredOutputs(1);
   m_Radius.Fill(1);
   m_LengthLine = 1;
   m_WidthLine = 0;
   m_Threshold = 0;
   m_NumberOfDirections = 4;
   m_FaceList.Fill(0);
-  m_OutputDirection = OutputImageType::New();
-  // m_PadLowerBound[0]=0;
-//   m_PadUpperBound[0]=0;
-//   m_PadLowerBound[1]=0;
-//   m_PadUpperBound[1]=0;
+  this->SetNthOutput(0,OutputImageType::New());
+  this->SetNthOutput(1,OutputImageType::New());
 }
 
 template <class TInputImage, class TOutputImage, class InterpolatorType>
@@ -78,8 +77,6 @@ void LineDetectorImageFilterBase<TInputImage, TOutputImage, InterpolatorType>::G
   // requested region)
   typename TInputImage::RegionType inputRequestedRegion;
   inputRequestedRegion = inputPtr->GetRequestedRegion();
-  otbMsgDevMacro(<<"GenerateInputRequestedRegion(): Original input requested region: "<<inputRequestedRegion.GetIndex()<<" "<<inputRequestedRegion.GetSize());
-
 
   // Define the size of the region by the radius
   m_Radius[1] = static_cast<unsigned int>(3*(2*m_WidthLine+1) + 2); 
@@ -94,30 +91,10 @@ void LineDetectorImageFilterBase<TInputImage, TOutputImage, InterpolatorType>::G
 
   // pad the input requested region by the operator radius
   inputRequestedRegion.PadByRadius( m_FaceList );
-  otbMsgDevMacro(<<"GenerateInputRequestedRegion(): padded input requested region: "<<inputRequestedRegion.GetIndex()<<" "<<inputRequestedRegion.GetSize());
  
-  // typename TInputImage::IndexType minPad;
-//   typename TInputImage::IndexType maxPad;
-//   typename TInputImage::IndexType min;
-//   typename TInputImage::IndexType max;
-  
-//   minPad = inputRequestedRegion.GetIndex();
-//   min = inputPtr->GetLargestPossibleRegion().GetIndex();
-  
-//   maxPad[0]=inputRequestedRegion.GetIndex()[0]+inputRequestedRegion.GetSize()[0];  
-//   maxPad[1]=inputRequestedRegion.GetIndex()[1]+inputRequestedRegion.GetSize()[1];
-//   max[0]=inputPtr->GetLargestPossibleRegion().GetIndex()[0]+inputPtr->GetLargestPossibleRegion().GetSize()[0];  
-//   max[1]=inputPtr->GetLargestPossibleRegion().GetIndex()[1]+inputPtr->GetLargestPossibleRegion().GetSize()[1];
-
-//   m_PadLowerBound[0]=( minPad[0]<min[0] ? min[0]-minPad[0]+10 : 0);
-//   m_PadLowerBound[1]=( minPad[1]<min[1] ? min[1]-minPad[1]+10 : 0);
-//   m_PadUpperBound[0]=( maxPad[0]>max[0] ? maxPad[0]-max[0]+10 : 0);
-//   m_PadUpperBound[1]=( maxPad[1]>max[1] ? maxPad[1]-max[1]+10 : 0);
-
   // crop the input requested region at the input's largest possible region
   if ( inputRequestedRegion.Crop(inputPtr->GetLargestPossibleRegion()) )
     {
-      otbMsgDevMacro(<<"GenerateInputRequestedRegion(): cropped input requested region: "<<inputRequestedRegion.GetIndex()<<" "<<inputRequestedRegion.GetSize());
     inputPtr->SetRequestedRegion( inputRequestedRegion );
     return;
     }
@@ -150,33 +127,19 @@ template <class TInputImage, class TOutputImage, class InterpolatorType>
 void 
 LineDetectorImageFilterBase< TInputImage, TOutputImage, InterpolatorType>
 ::BeforeThreadedGenerateData()
-{
-
-  typename OutputImageType::RegionType  region;    
+{  
   typename OutputImageType::Pointer     output = this->GetOutput();
   output->FillBuffer(0);
-
-
-  region.SetSize(output->GetLargestPossibleRegion().GetSize());
-  region.SetIndex(output->GetLargestPossibleRegion().GetIndex());
-  m_OutputDirection->SetRegions( region );
-  m_OutputDirection->SetOrigin(output->GetOrigin());
-  m_OutputDirection->SetSpacing(output->GetSpacing());
-  m_OutputDirection->Allocate();
-  m_OutputDirection->FillBuffer(0);
-
-
-
-
+  typename OutputImageType::Pointer     outputDirection = this->GetOutputDirection();
+  outputDirection->FillBuffer(0);
 }
 
 template <class TInputImage, class TOutputImage, class InterpolatorType>
-const typename LineDetectorImageFilterBase< TInputImage, TOutputImage, InterpolatorType>::OutputImageType *
+typename LineDetectorImageFilterBase< TInputImage, TOutputImage, InterpolatorType>::OutputImageType *
 LineDetectorImageFilterBase< TInputImage, TOutputImage, InterpolatorType>
 ::GetOutputDirection()
 {
-  this->Update();
-  return 	static_cast< const OutputImageType *> (m_OutputDirection);
+  return static_cast<OutputImageType *> (this->GetOutput(1));
 }
 
 template< class TInputImage, class TOutputImage, class InterpolatorType>
@@ -186,19 +149,8 @@ void LineDetectorImageFilterBase< TInputImage, TOutputImage, InterpolatorType>
                        	int 	threadId
 		       )
 {
-//   typename InputImageType::ConstPointer inputPtr  = this->GetInput();
-//   typedef itk::ConstantPadImageFilter<InputImageType,InputImageType> PadFilterType;
-//   typename PadFilterType::Pointer pad = PadFilterType::New();
-//   pad->SetInput(inputPtr);
-//   pad->SetConstant(static_cast<InputPixelType>(0));
-//   pad->SetPadLowerBound(m_PadLowerBound);
-//   pad->SetPadUpperBound(m_PadUpperBound);
-//   pad->Update();
-//   typename InputImageType::ConstPointer paddedInput  = pad->GetOutput();
-  typename InputImageType::ConstPointer input  = this->GetInput();
 
- //  otbMsgDevMacro(<<"Padded input: "<<input->GetLargestPossibleRegion().GetIndex()
-// 		 <<" "<<input->GetLargestPossibleRegion().GetSize());
+  typename InputImageType::ConstPointer input  = this->GetInput();
 
 
   InterpolatorPointer interpolator2 = InterpolatorType::New();
@@ -215,26 +167,21 @@ void LineDetectorImageFilterBase< TInputImage, TOutputImage, InterpolatorType>
 
   // Allocate output
   typename OutputImageType::Pointer     output = this->GetOutput();  
-  typename OutputImageType::Pointer     outputDir = m_OutputDirection;
+  typename OutputImageType::Pointer     outputDir = this->GetOutputDirection();
   
-
-   
   // Find the data-set boundary "faces"
   typename itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<InputImageType>::FaceListType 		faceList;
   typename itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<InputImageType>::FaceListType::iterator 	fit;
 
-
   itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<InputImageType> bC;
   faceList = bC(input, outputRegionForThread, m_FaceList);
 
-
   // support progress methods/callbacks
   itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels());
   
   typename TInputImage::IndexType     bitIndex;
   typename InterpolatorType::ContinuousIndexType Index;
 
-
   // --------------------------------------------------------------------------
   
   // Number of direction
@@ -284,26 +231,14 @@ void LineDetectorImageFilterBase< TInputImage, TOutputImage, InterpolatorType>
  
   // Process each of the boundary faces.  These are N-d regions which border
   // the edge of the buffer.
-  for (fit=faceList.begin(); fit != faceList.end(); ++fit)
-    { 
-
-
-       
 
-       // otbMsgDevMacro(<<"Region: "<<(*fit).GetIndex()<<" "<<(*fit).GetSize());
+  bool interiorFace = true;
 
-
-
-	
+  for (fit=faceList.begin(); fit != faceList.end(); ++fit)
+    { 	
     bit = itk::ConstNeighborhoodIterator<InputImageType>(m_Radius, input, *fit);
     cit = itk::ConstNeighborhoodIterator<InputImageType>(m_FaceList, input,*fit);
     unsigned int neighborhoodSize = bit.Size();
-//     typename InputImageType::IndexType min, max;
-
-    // min[0]=inputPtr->GetLargestPossibleRegion().GetIndex()[0];  
-//     min[1]=inputPtr->GetLargestPossibleRegion().GetIndex()[1];
-//     max[0]=inputPtr->GetLargestPossibleRegion().GetIndex()[0]+inputPtr->GetLargestPossibleRegion().GetSize()[0];  
-//     max[1]=inputPtr->GetLargestPossibleRegion().GetIndex()[1]+inputPtr->GetLargestPossibleRegion().GetSize()[1];
     
     it = itk::ImageRegionIterator<OutputImageType>(output, *fit);
     itdir = itk::ImageRegionIterator<OutputImageType>(outputDir, *fit);
@@ -317,53 +252,49 @@ void LineDetectorImageFilterBase< TInputImage, TOutputImage, InterpolatorType>
 
 
     while ( (!bit.IsAtEnd())&&(!cit.IsAtEnd()) )
-      {
-	
+      {	
+	InterpolatorPointer interpolator = InterpolatorType::New();
+	// Location of the central pixel of the region 
+	off.Fill(0);
+	bitIndex = bit.GetIndex(off);
+	Xc = bitIndex[0];
+	Yc = bitIndex[1];
 	
-      // Location of the central pixel of the region
-      off.Fill(0);
-      bitIndex = bit.GetIndex(off);
-      
-      typename InputImageType::RegionType tempRegion;
-      typename InputImageType::SizeType tempSize;
-      tempSize[0] = 2*m_FaceList[0]+1;
-      tempSize[1] = 2*m_FaceList[1]+1;
-      tempRegion.SetSize(tempSize);
-      typename itk::ConstNeighborhoodIterator<InputImageType>::OffsetType tempIndex;
-      tempIndex[0]=off[0]-m_FaceList[0];
-      tempIndex[1]=off[1]-m_FaceList[1];
-      tempRegion.SetIndex(cit.GetIndex(tempIndex));
-      
-      // otbMsgDevMacro(<<"TempRegion: index: "<<cit.GetIndex(tempIndex)<<" size: "<<tempSize);
-
-      typename InputImageType::Pointer tempImage = InputImageType::New();
-      tempImage->SetRegions(tempRegion);
-      tempImage->Allocate();
-      
-      for(int p = 0; p<=2*m_FaceList[0];p++)
-	{
-	  for(int q = 0; q<=2*m_FaceList[1];q++)
-	    {
-	      typename itk::ConstNeighborhoodIterator<InputImageType>::OffsetType  index;
-	      index[0]=p-m_FaceList[0];
-	      index[1]=q-m_FaceList[1];
-	      if(cit.GetPixel(index)!=input->GetPixel(cit.GetIndex(index))&&(*fit).IsInside(cit.GetIndex(index)))
-  		{
-  	      otbMsgDebugMacro(<<"Iterator Index: "<<index
-  			       <<" Iterator image value: "<<cit.GetIndex(index)<<"-> "<<static_cast<unsigned int>(cit.GetPixel(index))
-  	      <<" Original image value: "<<cit.GetIndex(index)<<" -> "<<static_cast<unsigned int>(input->GetPixel(cit.GetIndex(index))));
- 	    }
-	      tempImage->SetPixel(cit.GetIndex(index),cit.GetPixel(index));	      
-		
-	    }
-	}
-      
-      InterpolatorPointer interpolator = InterpolatorType::New();
-      interpolator->SetInputImage(tempImage);
-	
-      Xc = bitIndex[0];
-      Yc = bitIndex[1];
-
+	// JULIEN :  If the processed region is the center face
+	// the input image can be used for the interpolation
+	if(interiorFace)
+	  {
+	    interpolator->SetInputImage(input);
+	  }
+	// else we must feed the interpolator with a partial image corresponding
+	// to the boundary conditions
+	else
+	  {
+	    typename InputImageType::RegionType tempRegion;
+	    typename InputImageType::SizeType tempSize;
+	    tempSize[0] = 2*m_FaceList[0]+1;
+	    tempSize[1] = 2*m_FaceList[1]+1;
+	    tempRegion.SetSize(tempSize);
+	    typename itk::ConstNeighborhoodIterator<InputImageType>::OffsetType tempIndex;
+	    tempIndex[0]=off[0]-m_FaceList[0];
+	    tempIndex[1]=off[1]-m_FaceList[1];
+	    tempRegion.SetIndex(cit.GetIndex(tempIndex));
+	    typename InputImageType::Pointer tempImage = InputImageType::New();
+	    tempImage->SetRegions(tempRegion);
+	    tempImage->Allocate();
+	    
+	    for(int p = 0; p<=2*m_FaceList[0];p++)
+	      {
+		for(int q = 0; q<=2*m_FaceList[1];q++)
+		  {
+		    typename itk::ConstNeighborhoodIterator<InputImageType>::OffsetType  index;
+		    index[0]=p-m_FaceList[0];
+		    index[1]=q-m_FaceList[1];
+		    tempImage->SetPixel(cit.GetIndex(index),cit.GetPixel(index));	      
+		  }
+	      }
+	    interpolator->SetInputImage(tempImage);
+	  }
 
             
       // Location of the central pixel between zone 1 and zone 2
@@ -384,7 +315,6 @@ void LineDetectorImageFilterBase< TInputImage, TOutputImage, InterpolatorType>
                 PixelValues[i] = new std::vector<double>[NB_ZONE];
         }
 	//otbMsgDevMacro( << "\tCentre Xc/Yc="<<Xc<<" "<<Yc<<" Yc12/Yc13="<<Yc12<<" "<<Yc13);          
-
       // Loop on the region 
       for (int i = 0; i < m_Radius[0]; i++)
 	for (int j = 0; j < m_Radius[1]; j++)
@@ -397,10 +327,7 @@ void LineDetectorImageFilterBase< TInputImage, TOutputImage, InterpolatorType>
         X = bitIndex[0];
         Y = bitIndex[1];
 	
-
-
 	// We determine in the horizontal direction with which zone the pixel belongs. 
-         
         if ( Y < Yc12 )
       	  zone = 1;
         else if ( ( Yc12 < Y ) && ( Y < Yc13 ) )
@@ -409,8 +336,6 @@ void LineDetectorImageFilterBase< TInputImage, TOutputImage, InterpolatorType>
           zone = 2;
         else
           continue;
-
-                 
         //otbMsgDevMacro( << "\t\tPoint traite (i,j)=("<<i<<","<<j<<") -> X,Y="<<X<<","<<Y<<"  zone="<<zone);
         // Loop on the directions
         for (unsigned int dir=0; dir<NB_DIR; dir++ )
@@ -419,36 +344,12 @@ void LineDetectorImageFilterBase< TInputImage, TOutputImage, InterpolatorType>
 
 	  xout = (X-Xc)*cos(Theta[dir]) - (Y-Yc)*sin(Theta[dir]);
 	  yout = (X-Xc)*sin(Theta[dir]) + (Y-Yc)*cos(Theta[dir]);
-
-            
+  
 	  Index[0] = static_cast<CoordRepType>(xout + Xc);
 	  Index[1] = static_cast<CoordRepType>(yout + Yc);
 	  
-	 //  if(  Index[0]<min[0]
-// 	     ||Index[1]<min[1]
-// 	     ||Index[0]>max[0]
-// 	     ||Index[1]>max[1])
-// 	    {
-
-// 	      PixelValues[dir][zone].push_back(static_cast<double>(0));
-// 	    }
-// 	  else
-// 	    {
- 	      PixelValues[dir][zone].push_back(static_cast<double>(interpolator->EvaluateAtContinuousIndex( Index )));
-// 	    }
-
-	      if(interpolator->EvaluateAtContinuousIndex( Index )!=interpolator2->EvaluateAtContinuousIndex(Index)
-	      &&(*fit).IsInside(Index))
- 		 otbMsgDevMacro(<<"Index: "<<Index<<" specific interpolator: "<<interpolator->EvaluateAtContinuousIndex( Index )
-  			       <<" global interpolator: "<<interpolator2->EvaluateAtContinuousIndex( Index ));
-
-
-
-  	  // if(Index[0]<input->GetLargestPossibleRegion().GetIndex()[0])
-  	    // otbMsgDevMacro( << "\t\t\tInterpole : direction "<<dir<<" out(x,y)=("<<xout<<","<<yout<<") Index : "<<Index[0]<<" "<<Index[1]
-//   			    <<" Interpolated value: "<<PixelValues[dir][zone].back());
+	  PixelValues[dir][zone].push_back(static_cast<double>(interpolator->EvaluateAtContinuousIndex( Index )));
 	  }     
-
         } // end of the loop on the pixels of the region 
           
       R = 0.;
@@ -487,12 +388,12 @@ void LineDetectorImageFilterBase< TInputImage, TOutputImage, InterpolatorType>
 	  it.Set( itk::NumericTraits<OutputPixelType>::Zero );
 	  
 	  itdir.Set( static_cast<OutputPixelType>(0) );  
-	  }
-	
+	  }	
 	++bit;
 	++cit;
 	++it;
 	++itdir;
+	interiorFace=false;
 	progress.CompletedPixel();  
 
 	// ROMAIN
diff --git a/Testing/Code/FeatureExtraction/CMakeLists.txt b/Testing/Code/FeatureExtraction/CMakeLists.txt
index ba97f8c58d..2d2d60b3dc 100755
--- a/Testing/Code/FeatureExtraction/CMakeLists.txt
+++ b/Testing/Code/FeatureExtraction/CMakeLists.txt
@@ -162,92 +162,88 @@ ADD_TEST(feTuLineCorrelationNew ${FEATUREEXTRACTION_TESTS}
         otbLineCorrelationDetectorNew)
         
 ADD_TEST(feTvLineCorrelationLinear ${FEATUREEXTRACTION_TESTS}  
-  --compare-image ${TOL}  ${BASELINE}/feFiltreLineCorrelationLinear_amst_2_3.hdr
+  --compare-n-images ${TOL} 2
+			  ${BASELINE}/feFiltreLineCorrelationLinear_amst_2_3.hdr
                           ${TEMP}/feFiltreLineCorrelationLinear_amst_2_3.hdr
+			  ${BASELINE}/feFiltreLineCorrelationLinear_amst_dir_2_3.hdr
+                          ${TEMP}/feFiltreLineCorrelationLinear_amst_dir_2_3.hdr
         otbLineCorrelationDetectorLinear
 	${INPUTDATA}/amst.png
 	${TEMP}/feFiltreLineCorrelationLinear_amst_2_3.hdr
+	${TEMP}/feFiltreLineCorrelationLinear_amst_dir_2_3.hdr
 	2 3)
-      
-#ADD_TEST(feTvLineCorrelationLinearDir ${FEATUREEXTRACTION_TESTS}  
-#  --compare-image ${TOL}  ${BASELINE}/feFiltreLineCorrelationLinear_amst_dir_2_3.hdr
-#                          ${TEMP}/feFiltreLineCorrelationLinear_amst_dir_2_3.hdr
-#        otbLineCorrelationDetectorLinearDirection
-#	${INPUTDATA}/amst.png
-#	${TEMP}/feFiltreLineCorrelationLinear_amst_dir_2_3.hdr
-#	2 3)
 		
-#ADD_TEST(feTvLineCorrelation ${FEATUREEXTRACTION_TESTS}  
-#  --compare-image ${TOL}  ${BASELINE}/feFiltreLineCorrelation_amst_2_3.hdr
-#                          ${TEMP}/feFiltreLineCorrelation_amst_2_3.hdr
-#        otbLineCorrelationDetector
-#	${INPUTDATA}/amst.png
-#	${TEMP}/feFiltreLineCorrelation_amst_2_3.hdr
-#	2 3)
-#	
+ADD_TEST(feTvLineCorrelation ${FEATUREEXTRACTION_TESTS}  
+  --compare-image ${TOL}  ${BASELINE}/feFiltreLineCorrelation_amst_2_3.hdr
+                          ${TEMP}/feFiltreLineCorrelation_amst_2_3.hdr
+        otbLineCorrelationDetector
+	${INPUTDATA}/amst.png
+	${TEMP}/feFiltreLineCorrelation_amst_2_3.hdr
+	2 3)
+	
 # -------            otb::LineRatioDetector   ------------------------------
 
-#ADD_TEST(feTuLineRatioNew ${FEATUREEXTRACTION_TESTS}  
-#        otbLineRatioDetectorNew)
-#        
-#ADD_TEST(feTvLineRatioLinear ${FEATUREEXTRACTION_TESTS}  
-#  --compare-image ${TOL}  ${BASELINE}/feFiltreLineRatioLinear_amst_2_3.hdr
-#                          ${TEMP}/feFiltreLineRatioLinear_amst_2_3.hdr
-#        otbLineRatioDetectorLinear
-#	${INPUTDATA}/amst.png
-#	${TEMP}/feFiltreLineRatioLinear_amst_2_3.hdr
-#	2 3)
-
-#ADD_TEST(feTvLineRatioLinearDir ${FEATUREEXTRACTION_TESTS}  
-#  --compare-image ${TOL}  ${BASELINE}/feFiltreLineRatioLinear_amst_dir_2_3.hdr
-#                          ${TEMP}/feFiltreLineRatioLinear_amst_dir_2_3.hdr
-#        otbLineRatioDetectorLinearDirection
-#	${INPUTDATA}/amst.png
-#	${TEMP}/feFiltreLineRatioLinear_amst_dir_2_3.hdr
-#	2 3)
-#	
-#ADD_TEST(feTvLineRatioLinearAmsters1 ${FEATUREEXTRACTION_TESTS}  
-#  --compare-image ${TOL}  ${BASELINE}/feFiltreLineRatioLinear_amst_ers1_ima_extrait.hdr
-#                          ${TEMP}/feFiltreLineRatioLinear_amst_ers1_ima_extrait.hdr
-#        otbLineRatioDetectorLinear
-#	${INPUTDATA}/amst_ers1.ima.extrait.419_187_70_66.hdr
-#	${TEMP}/feFiltreLineRatioLinear_amst_ers1_ima_extrait.hdr
-#	1 2)
-#				
-#ADD_TEST(feTvLineRatio ${FEATUREEXTRACTION_TESTS}  
-#  --compare-image ${TOL}  ${BASELINE}/feFiltreLineRatio_amst_2_3.hdr
-#                          ${TEMP}/feFiltreLineRatio_amst_2_3.hdr
-#        otbLineRatioDetector
-#	${INPUTDATA}/amst.png
-#	${TEMP}/feFiltreLineRatio_amst_2_3.hdr
-#	2 3)
+ADD_TEST(feTuLineRatioNew ${FEATUREEXTRACTION_TESTS}  
+        otbLineRatioDetectorNew)
+        
+ADD_TEST(feTvLineRatioLinear ${FEATUREEXTRACTION_TESTS}  
+  --compare-n-images ${TOL} 2
+			  ${BASELINE}/feFiltreLineRatioLinear_amst_2_3.hdr
+                          ${TEMP}/feFiltreLineRatioLinear_amst_2_3.hdr
+			  ${BASELINE}/feFiltreLineRatioLinear_amst_dir_2_3.hdr
+                          ${TEMP}/feFiltreLineRatioLinear_amst_dir_2_3.hdr
+        otbLineRatioDetectorLinear
+	${INPUTDATA}/amst.png
+	${TEMP}/feFiltreLineRatioLinear_amst_2_3.hdr
+	${TEMP}/feFiltreLineRatioLinear_amst_dir_2_3.hdr
+	2 3)
+	
+ADD_TEST(feTvLineRatioLinearAmsters1 ${FEATUREEXTRACTION_TESTS}  
+  --compare-n-images ${TOL} 2
+			  ${BASELINE}/feFiltreLineRatioLinear_amst_ers1_ima_extrait.hdr
+                          ${TEMP}/feFiltreLineRatioLinear_amst_ers1_ima_extrait.hdr
+			  ${BASELINE}/feFiltreLineRatioLinear_amst_dir_ers1_ima_extrait.hdr
+			  ${TEMP}/feFiltreLineRatioLinear_amst_dir_ers1_ima_extrait.hdr
+        otbLineRatioDetectorLinear
+	${INPUTDATA}/amst_ers1.ima.extrait.419_187_70_66.hdr
+	${TEMP}/feFiltreLineRatioLinear_amst_ers1_ima_extrait.hdr
+	${TEMP}/feFiltreLineRatioLinear_amst_dir_ers1_ima_extrait.hdr
+	1 2)
+				
+ADD_TEST(feTvLineRatio ${FEATUREEXTRACTION_TESTS}  
+  --compare-image ${TOL}  ${BASELINE}/feFiltreLineRatio_amst_2_3.hdr
+                          ${TEMP}/feFiltreLineRatio_amst_2_3.hdr
+        otbLineRatioDetector
+	${INPUTDATA}/amst.png
+	${TEMP}/feFiltreLineRatio_amst_2_3.hdr
+	2 3)
 
 
 # -------            otb::AssociativeSymmetricalSum   ------------------------------
 	
-#ADD_TEST(feTuAssociativeSymmetricalSumNew ${FEATUREEXTRACTION_TESTS}  
-#        otbAssociativeSymmetricalSumNew)
-#        
-#ADD_TEST(feTvAssociativeSymmetricalSum ${FEATUREEXTRACTION_TESTS}  
-#  --compare-image ${TOL}  ${BASELINE}/feFiltreASS_amst_2_3.hdr
-#                          ${TEMP}/feFiltreASS_amst_2_3.hdr
-#        otbAssociativeSymmetricalSum
-#        ${TEMP}/feFiltreLineRatioLinear_amst_2_3.hdr
-#        ${TEMP}/feFiltreLineCorrelationLinear_amst_2_3.hdr
-#        ${TEMP}/feFiltreASS_amst_2_3.hdr)
+ADD_TEST(feTuAssociativeSymmetricalSumNew ${FEATUREEXTRACTION_TESTS}  
+        otbAssociativeSymmetricalSumNew)
+        
+ADD_TEST(feTvAssociativeSymmetricalSum ${FEATUREEXTRACTION_TESTS}  
+  --compare-image ${TOL}  ${BASELINE}/feFiltreASS_amst_2_3.hdr
+                          ${TEMP}/feFiltreASS_amst_2_3.hdr
+        otbAssociativeSymmetricalSum
+        ${TEMP}/feFiltreLineRatioLinear_amst_2_3.hdr
+        ${TEMP}/feFiltreLineCorrelationLinear_amst_2_3.hdr
+        ${TEMP}/feFiltreASS_amst_2_3.hdr)
 
 # -------            otb::AssymmetricFusionOfLineDetector   ------------------------------
         
-#ADD_TEST(feTuAssymmetricFusionOfLineDetectorNew ${FEATUREEXTRACTION_TESTS}  
-#        otbAssymmetricFusionOfLineDetectorNew)
-        
-#ADD_TEST(feTvAssymmetricFusionOfLineDetector ${FEATUREEXTRACTION_TESTS}  
-#  --compare-image ${TOL}  ${BASELINE}/feFiltreAssymmetricFusion_amst_2_3.hdr
-#                          ${TEMP}/feFiltreAssymmetricFusion_amst_2_3.hdr
-#        otbAssymmetricFusionOfLineDetector
-#	${INPUTDATA}/amst.png
-#	${TEMP}/feFiltreAssymmetricFusion_amst_2_3.hdr
-#	2 3)
+ADD_TEST(feTuAssymmetricFusionOfLineDetectorNew ${FEATUREEXTRACTION_TESTS}  
+        otbAssymmetricFusionOfLineDetectorNew)
+       
+ADD_TEST(feTvAssymmetricFusionOfLineDetector ${FEATUREEXTRACTION_TESTS}  
+  --compare-image ${TOL}  ${BASELINE}/feFiltreAssymmetricFusion_amst_2_3.hdr
+                          ${TEMP}/feFiltreAssymmetricFusion_amst_2_3.hdr
+        otbAssymmetricFusionOfLineDetector
+	${INPUTDATA}/amst.png
+	${TEMP}/feFiltreAssymmetricFusion_amst_2_3.hdr
+	2 3)
 
 # -------            otb::HarrisImage   ------------------------------
         
@@ -477,16 +473,14 @@ otbTouziEdgeDetectorDirection.cxx
 otbLineDetectorBaseNew.cxx
 otbLineCorrelationDetectorNew.cxx
 otbLineCorrelationDetectorLinear.cxx
-#otbLineCorrelationDetectorLinearDirection.cxx
-#otbLineCorrelationDetector.cxx
-#otbLineRatioDetectorNew.cxx
-#otbLineRatioDetectorLinear.cxx
-#otbLineRatioDetectorLinearDirection.cxx
-#otbLineRatioDetector.cxx
-#otbAssociativeSymmetricalSumNew.cxx
-#otbAssociativeSymmetricalSum.cxx
-#otbAssymmetricFusionOfLineDetectorNew.cxx
-#otbAssymmetricFusionOfLineDetector.cxx
+otbLineCorrelationDetector.cxx
+otbLineRatioDetectorNew.cxx
+otbLineRatioDetectorLinear.cxx
+otbLineRatioDetector.cxx
+otbAssociativeSymmetricalSumNew.cxx
+otbAssociativeSymmetricalSum.cxx
+otbAssymmetricFusionOfLineDetectorNew.cxx
+otbAssymmetricFusionOfLineDetector.cxx
 otbHarrisImage.cxx
 otbMultiplyByScalarImageTest.cxx
 otbThresholdImageToPointSetTest.cxx
diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx
index b86611f13c..9e11336e0f 100755
--- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx
+++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx
@@ -52,18 +52,16 @@ REGISTER_TEST(otbTouziEdgeDetectorNew);
 REGISTER_TEST(otbTouziEdgeDetector);
 REGISTER_TEST(otbTouziEdgeDetectorDirection);
 REGISTER_TEST(otbLineDetectorBaseNew);
-//REGISTER_TEST(otbLineRatioDetectorNew);
-//REGISTER_TEST(otbLineRatioDetectorLinear);
-//REGISTER_TEST(otbLineRatioDetectorLinearDirection);
-//REGISTER_TEST(otbLineRatioDetector);
+REGISTER_TEST(otbLineRatioDetectorNew);
+REGISTER_TEST(otbLineRatioDetectorLinear);
+REGISTER_TEST(otbLineRatioDetector);
 REGISTER_TEST(otbLineCorrelationDetectorNew);
 REGISTER_TEST(otbLineCorrelationDetectorLinear);
-//REGISTER_TEST(otbLineCorrelationDetectorLinearDirection);
-//REGISTER_TEST(otbLineCorrelationDetector);
-//REGISTER_TEST(otbAssociativeSymmetricalSumNew);
-//REGISTER_TEST(otbAssociativeSymmetricalSum);
-//REGISTER_TEST(otbAssymmetricFusionOfLineDetectorNew);
-//REGISTER_TEST(otbAssymmetricFusionOfLineDetector);
+REGISTER_TEST(otbLineCorrelationDetector);
+REGISTER_TEST(otbAssociativeSymmetricalSumNew);
+REGISTER_TEST(otbAssociativeSymmetricalSum);
+REGISTER_TEST(otbAssymmetricFusionOfLineDetectorNew);
+REGISTER_TEST(otbAssymmetricFusionOfLineDetector);
 REGISTER_TEST(otbHarrisImage);
 REGISTER_TEST(otbMultiplyByScalarImageFilterTest);
 REGISTER_TEST(otbThresholdImageToPointSetTest);
diff --git a/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinear.cxx b/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinear.cxx
index 06ea6b4fbd..c0e978487b 100755
--- a/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinear.cxx
+++ b/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinear.cxx
@@ -39,12 +39,13 @@ int otbLineCorrelationDetectorLinear( int argc, char* argv[] )
   try 
     { 
         const char * inputFilename  = argv[1];
-        const char * outputFilename = argv[2];
+        const char * outputFilename1 = argv[2];
+	const char * outputFilename2 = argv[3];
 
 	// Largeur de la ligne à detecter = 2*WidthLine+1
-        unsigned int  WidthLine((unsigned int)::atoi(argv[3]));
+        unsigned int  WidthLine((unsigned int)::atoi(argv[4]));
         // Longueur de la ligne à detecter = 2*LengthLine+1
-        unsigned int  LengthLine((unsigned int)::atoi(argv[4]));
+        unsigned int  LengthLine((unsigned int)::atoi(argv[5]));
         
         typedef unsigned char                                   InputPixelType;
         typedef double		   	                        OutputPixelType;
@@ -65,16 +66,21 @@ int otbLineCorrelationDetectorLinear( int argc, char* argv[] )
 	FilterLineCorrelation->SetLengthLine( LengthLine );
 	
         ReaderType::Pointer reader = ReaderType::New();
-        WriterType::Pointer writer = WriterType::New();
+        WriterType::Pointer writer1 = WriterType::New();
+	WriterType::Pointer writer2 = WriterType::New();
 
         reader->SetFileName( inputFilename  );
-        writer->SetFileName( outputFilename );
-        
+        writer1->SetFileName( outputFilename1 );
+        writer2->SetFileName(outputFilename2);
+
+
         FilterLineCorrelation->SetInput( reader->GetOutput() );
-        writer->SetInput( FilterLineCorrelation->GetOutput() );
-        
-        writer->Update();
+        writer1->SetInput( FilterLineCorrelation->GetOutput() );
+        writer2->SetInput( FilterLineCorrelation->GetOutputDirection() );
+
 
+        writer1->Update();
+	writer2->Update();
     } 
   catch( itk::ExceptionObject & err ) 
     { 
diff --git a/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinearDirection.cxx b/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinearDirection.cxx
deleted file mode 100755
index 4a59e13b2b..0000000000
--- a/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinearDirection.cxx
+++ /dev/null
@@ -1,96 +0,0 @@
-/*=========================================================================
-
-  Program:   ORFEO Toolbox
-  Language:  C++
-  Date:      $Date$
-  Version:   $Revision$
-
-
-  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
-  See OTBCopyright.txt for details.
-
-
-     This software is distributed WITHOUT ANY WARRANTY; without even 
-     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
-     PURPOSE.  See the above copyright notices for more information.
-
-=========================================================================*/
-
-#if defined(_MSC_VER)
-#pragma warning ( disable : 4786 )
-#endif
-
-#define MAIN
-
-
-#include "itkExceptionObject.h"
-#include "itkImage.h"
-#include "itkImageFileWriter.h"
-#include <iostream>
-
-#include "otbImageFileReader.h"
-#include "otbImageFileWriter.h"
-#include "otbLineCorrelationDetectorImageFilter.h"
-
-#include "itkLinearInterpolateImageFunction.h"
-
-int otbLineCorrelationDetectorLinearDirection( int argc, char* argv[] )
-{
-  try 
-    { 
-        const char * inputFilename  = argv[1];
-        const char * outputFilename = argv[2];
-
-	// Largeur de la ligne à detecter = 2*WidthLine+1
-        unsigned int  WidthLine((unsigned int)::atoi(argv[3]));
-        // Longueur de la ligne à detecter = 2*LengthLine+1
-        unsigned int  LengthLine((unsigned int)::atoi(argv[4]));
-        
-        typedef unsigned char                                   InputPixelType;
-        typedef double		   	                        OutputPixelType;
-        const   unsigned int        	                        Dimension = 2;
-
-        typedef itk::Image< InputPixelType,  Dimension >        InputImageType;
-        typedef itk::Image< OutputPixelType, Dimension >        OutputImageType;
-
-        typedef otb::ImageFileReader< InputImageType  >         ReaderType;
-        typedef otb::ImageFileWriter< OutputImageType >         WriterType;
-
-        typedef itk::LinearInterpolateImageFunction< InputImageType, double >	InterpolatorType;
-        typedef otb::LineCorrelationDetectorImageFilter< InputImageType, OutputImageType, InterpolatorType >   FilterType;
-	
-        FilterType::Pointer FilterLineCorrelation = FilterType::New();
-        
-	FilterLineCorrelation->SetWidthLine( WidthLine );
-	FilterLineCorrelation->SetLengthLine( LengthLine );
-	
-        ReaderType::Pointer reader = ReaderType::New();
-        WriterType::Pointer writer = WriterType::New();
-
-        reader->SetFileName( inputFilename  );
-        writer->SetFileName( outputFilename );
-        
-        FilterLineCorrelation->SetInput( reader->GetOutput() );
-        writer->SetInput( FilterLineCorrelation->GetOutputDirection() );
-        
-        writer->Update();
-
-    } 
-  catch( itk::ExceptionObject & err ) 
-    { 
-    std::cout << "Exception itk::ExceptionObject levee !" << std::endl; 
-    std::cout << err << std::endl; 
-    return EXIT_FAILURE;
-    } 
-  catch( ... ) 
-    { 
-    std::cout << "Exception levee inconnue !" << std::endl; 
-    return EXIT_FAILURE;
-    } 
-  // Software Guide : EndCodeSnippet
-
-//#endif
-  return EXIT_SUCCESS;
-}
-
-
diff --git a/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinear.cxx b/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinear.cxx
index ec306212cb..9c72b1d822 100755
--- a/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinear.cxx
+++ b/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinear.cxx
@@ -39,12 +39,14 @@ int otbLineRatioDetectorLinear( int argc, char* argv[] )
   try 
     { 
         const char * inputFilename  = argv[1];
-        const char * outputFilename = argv[2];
+        const char * outputFilename1 = argv[2];
+	const char * outputFilename2 = argv[3];
+
 
 	// Width of the linear feature = 2*WidthLine+1
-        unsigned int  WidthLine((unsigned int)::atoi(argv[3]));
+        unsigned int  WidthLine((unsigned int)::atoi(argv[4]));
         // Length of the linear feature = 2*LengthLine+1
-        unsigned int  LengthLine((unsigned int)::atoi(argv[4]));
+        unsigned int  LengthLine((unsigned int)::atoi(argv[5]));
         
         typedef unsigned char                                   InputPixelType;
         typedef double		   	                        OutputPixelType;
@@ -65,15 +67,19 @@ int otbLineRatioDetectorLinear( int argc, char* argv[] )
 	FilterLineRatio->SetLengthLine( LengthLine );
 	
         ReaderType::Pointer reader = ReaderType::New();
-        WriterType::Pointer writer = WriterType::New();
+        WriterType::Pointer writer1 = WriterType::New();
+	WriterType::Pointer writer2 = WriterType::New();
 
         reader->SetFileName( inputFilename  );
-        writer->SetFileName( outputFilename );
-        
+        writer1->SetFileName( outputFilename1 );
+        writer2->SetFileName( outputFilename2 );
+
         FilterLineRatio->SetInput( reader->GetOutput() );
-        writer->SetInput( FilterLineRatio->GetOutput() );
-        
-        writer->Update();
+        writer1->SetInput( FilterLineRatio->GetOutput() );
+        writer2->SetInput( FilterLineRatio->GetOutputDirection() );
+
+        writer1->Update();
+	writer2->Update();
 
     } 
   catch( itk::ExceptionObject & err ) 
diff --git a/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinearDirection.cxx b/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinearDirection.cxx
deleted file mode 100755
index 8151042cb3..0000000000
--- a/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinearDirection.cxx
+++ /dev/null
@@ -1,96 +0,0 @@
-/*=========================================================================
-
-  Program:   ORFEO Toolbox
-  Language:  C++
-  Date:      $Date$
-  Version:   $Revision$
-
-
-  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
-  See OTBCopyright.txt for details.
-
-
-     This software is distributed WITHOUT ANY WARRANTY; without even 
-     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
-     PURPOSE.  See the above copyright notices for more information.
-
-=========================================================================*/
-
-#if defined(_MSC_VER)
-#pragma warning ( disable : 4786 )
-#endif
-
-#define MAIN
-
-
-#include "itkExceptionObject.h"
-#include "itkImage.h"
-#include "itkImageFileWriter.h"
-#include <iostream>
-
-#include "otbImageFileReader.h"
-#include "otbImageFileWriter.h"
-#include "otbLineRatioDetectorImageFilter.h"
-
-#include "itkLinearInterpolateImageFunction.h"
-
-int otbLineRatioDetectorLinearDirection( int argc, char* argv[] )
-{
-  try 
-    { 
-        const char * inputFilename  = argv[1];
-        const char * outputFilename = argv[2];
-
-	// Width of the linear feature = 2*WidthLine+1
-        unsigned int  WidthLine((unsigned int)::atoi(argv[3]));
-        // Length of the linear feature = 2*LengthLine+1
-        unsigned int  LengthLine((unsigned int)::atoi(argv[4]));
-        
-        typedef unsigned char                                   InputPixelType;
-        typedef double		   	                        OutputPixelType;
-        const   unsigned int        	                        Dimension = 2;
-
-        typedef itk::Image< InputPixelType,  Dimension >        InputImageType;
-        typedef itk::Image< OutputPixelType, Dimension >        OutputImageType;
-
-        typedef otb::ImageFileReader< InputImageType  >         ReaderType;
-        typedef otb::ImageFileWriter< OutputImageType >         WriterType;
-
-        typedef itk::LinearInterpolateImageFunction< InputImageType, double >	InterpolatorType;
-        typedef otb::LineRatioDetectorImageFilter< InputImageType, OutputImageType, InterpolatorType >   FilterType;
-	
-        FilterType::Pointer FilterLineRatio = FilterType::New();
-        
-	FilterLineRatio->SetWidthLine( WidthLine );
-	FilterLineRatio->SetLengthLine( LengthLine );
-	
-        ReaderType::Pointer reader = ReaderType::New();
-        WriterType::Pointer writer = WriterType::New();
-
-        reader->SetFileName( inputFilename  );
-        writer->SetFileName( outputFilename );
-        
-        FilterLineRatio->SetInput( reader->GetOutput() );
-        writer->SetInput( FilterLineRatio->GetOutputDirection() );
-        
-        writer->Update();
-
-    } 
-  catch( itk::ExceptionObject & err ) 
-    { 
-    std::cout << "Exception itk::ExceptionObject levee !" << std::endl; 
-    std::cout << err << std::endl; 
-    return EXIT_FAILURE;
-    } 
-  catch( ... ) 
-    { 
-    std::cout << "Exception levee inconnue !" << std::endl; 
-    return EXIT_FAILURE;
-    } 
-  // Software Guide : EndCodeSnippet
-
-//#endif
-  return EXIT_SUCCESS;
-}
-
-
-- 
GitLab