diff --git a/Code/FeatureExtraction/otbLineSegmentDetector.txx b/Code/FeatureExtraction/otbLineSegmentDetector.txx
index 721ab73ecdf76adc249e70cbd9ec44b9122639fc..f86af66807c32f4151b6749915f952cc4be3edf8 100644
--- a/Code/FeatureExtraction/otbLineSegmentDetector.txx
+++ b/Code/FeatureExtraction/otbLineSegmentDetector.txx
@@ -249,7 +249,6 @@ LineSegmentDetector<TInputImage, TPrecision>
   /** Compute the rectangle*/
   CoordinateHistogramIteratorType     ItRegion = m_RegionList.begin();
   DirectionVectorIteratorType         ItDir    =  m_DirectionVector.begin();
-  std::cout << " NB DE REGIONS : "<< m_RegionList.size()<< std::endl;
   
   while(ItRegion != m_RegionList.end() && ItDir !=m_DirectionVector.end() )
     {
diff --git a/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.h b/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.h
index 69549c2df4a622e3f4dbd06b40f1750d12c2bc88..34a1cc142acdc85553262a791c42880a60648826 100644
--- a/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.h
+++ b/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.h
@@ -123,11 +123,11 @@ protected:
   /**
    * Distance between segments computation
    */
-  virtual float ComputeDistanceBetweenSegments(LineType * lineDst , LineType * lineSrc);
+  virtual double ComputeDistanceBetweenSegments(LineType * lineDst , LineType * lineSrc);
   /**
    * Angle computation
    */
-  virtual float ComputeAngleFormedBySegments(LineType * lineDst , LineType * lineSrc);
+  virtual double ComputeAngleFormedBySegments(LineType * lineDst , LineType * lineSrc);
   /**
    *  When we find a right angle, one compute the coordinate of the segments intersection
    */
@@ -137,6 +137,12 @@ protected:
    */
   virtual void AddRightAngleToPointSet(PointType rAngle  , LineType * LineDst , LineType* LineCur );
 
+  /**
+   * Compute the orienation of a segment
+   */
+  virtual double ComputeOrientation(LineType* line);
+  
+
 
 private:
 
diff --git a/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.txx b/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.txx
index d276d8b465ad795037eeb38c00dddd8f6096829f..d8b564573586e6480e9b92f385dca2205f1002ce 100644
--- a/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.txx
+++ b/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.txx
@@ -37,9 +37,8 @@ LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
   this->SetNumberOfRequiredInputs(2);
   this->SetNumberOfRequiredOutputs(1);
 
-  m_ThresholdDistance = 5.;
+  m_ThresholdDistance = 20.;
   m_ThresholdAngle = M_PI/36.;  //36 cause we want 5 degrees threshold
-
 }
 
 /**
@@ -100,31 +99,31 @@ LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
       while(itLinesListCur != itLinesListCurEnd )
         {
           /** Check If segments are already computed */
-           if( segmentsUsedMatrix[counterTest][counterCur]== 0 && segmentsUsedMatrix[counterCur][counterTest] == 0 )
-             {
+	  if( segmentsUsedMatrix[counterTest][counterCur]== 0 && segmentsUsedMatrix[counterCur][counterTest] == 0 )
+	    {
               /** Set the segments to USED (== 1)*/
               segmentsUsedMatrix[counterTest][counterCur] = 1;
               segmentsUsedMatrix[counterCur][counterTest] = 1;
               
-              /** Compute the distance from CurLine to DstLine*/
-              float SegmentDist = this->ComputeDistanceBetweenSegments(*itLinesListTest , *itLinesListCur);
-                 
-              /** Check if the distance separating the segments is under the threshold*/
-              if(SegmentDist < m_ThresholdDistance /* Threshold : 5 Pixels*/)
-                {
-                  /** Compute the angle formed by the two segments */
-                  float Angle = this->ComputeAngleFormedBySegments(*itLinesListTest, *itLinesListCur);
-                                                    
-                  /** Check if the angle is a right one */
-                  if(vcl_abs(Angle - M_PI/2.) <= m_ThresholdAngle ) 
+	      /** Compute the angle formed by the two segments */
+	      double Angle = this->ComputeAngleFormedBySegments(*itLinesListTest, *itLinesListCur);
+
+	      /** Check if the angle is a right one */
+	      if(vcl_abs(Angle - M_PI/2.) < m_ThresholdAngle ) 
+		{
+		  /** Compute the distance from CurLine to DstLine*/
+		  double SegmentDist = this->ComputeDistanceBetweenSegments(*itLinesListTest , *itLinesListCur);
+		  
+		  /** Check if the distance separating the segments is under the threshold*/
+		  if(SegmentDist < m_ThresholdDistance )
                     {
-                      /** Right angle coordinate*/
+		      /** Right angle coordinate*/
                       PointType              RightAngleCoordinate;
                       RightAngleCoordinate = this->ComputeAngleRightCoordinate(*itLinesListTest, *itLinesListCur);
                       
                       /** If Right Angle:  Add it to the pointSet*/
                       this->AddRightAngleToPointSet(RightAngleCoordinate , *itLinesListTest , *itLinesListCur );
-                      
+		                            
                     }
                 }
             }
@@ -140,7 +139,7 @@ LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
  * Method : ComputeDistanceBetweenSegments 
  */
 template <class TImage, class TLinesList , class TPointSet>
-float
+double
 LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
 ::ComputeDistanceBetweenSegments(LineType * lineDst , LineType * lineSrc)
 {
@@ -159,21 +158,6 @@ LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
   
   /** Verify if the indexes of the line are inside the region*/
   typename InputImageType::SizeType size = this->GetInputImage()->GetRequestedRegion().GetSize();
-  //unsigned int width = size[0];
-  //unsigned int length = size[1];
-  
-//   if(IndexBeginSrc[0] > width)  IndexBeginSrc[0] = width-1;
-//   if(IndexBeginSrc[1] > length) IndexBeginSrc[1] = length-1;
-
-//   if(IndexEndSrc[0] > width)   IndexEndSrc[0] = width-1;
-//   if(IndexEndSrc[1] > length)  IndexEndSrc[1] = length-1;
-
-//   if(IndexBeginSrc[0] <0) IndexBeginSrc[0] = 0;
-//   if(IndexBeginSrc[1] <0) IndexBeginSrc[1] = 0;
-
-//   if(IndexEndSrc[0]<0)   IndexEndSrc[0] = 0;
-//   if(IndexEndSrc[1]<0)   IndexEndSrc[1] = 0;
-
  
   /** Extract Indexes from the Dst line to instantiate the line iterator*/
   typename LineType::PointListType &pointsListDst = lineDst->GetPoints();
@@ -196,7 +180,7 @@ LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
   itk::LineIterator<InputImageType> itLine(this->GetInputImage() , IndexBeginSrc , IndexEndSrc);
   itLine.GoToBegin();
   
-  float MinDistance = 10000.;
+  double MinDistance = 10000.;
 
   while(!itLine.IsAtEnd())
     {
@@ -204,12 +188,12 @@ LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
       
       if(this->GetInputImage()->GetRequestedRegion().IsInside(IndexCur) )
         {
-          float xp = static_cast<float>(itLine.GetIndex()[0]);
-          float yp = static_cast<float>(itLine.GetIndex()[1]);
-          float Num   = vcl_abs(xp*(Yq1-Yq2) + yp*(Xq2-Xq1) + CrossProduct);
+          double xp = static_cast<float>(itLine.GetIndex()[0]);
+          double yp = static_cast<float>(itLine.GetIndex()[1]);
+          double Num   = vcl_abs(xp*(Yq1-Yq2) + yp*(Xq2-Xq1) + CrossProduct);
           
           /** distance from Point P to Segment Q1Q2*/
-          float CurDistance = Num/SegmentLength;
+          double CurDistance = Num/SegmentLength;
 
           if(CurDistance <  MinDistance )
             MinDistance = CurDistance;
@@ -228,42 +212,43 @@ LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
  * 
  */
 template <class TImage, class TLinesList , class TPointSet>
-float
+double
 LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
 ::ComputeAngleFormedBySegments(LineType * lineDst , LineType * lineSrc)
 {
-  /** ----- */
-  typename LineType::PointListType & pointsList = lineSrc->GetPoints();
-  typename LineType::PointListType::const_iterator itPoints = pointsList.begin();
+  double oriDst = this->ComputeOrientation(lineDst);
+  double oriSrc = this->ComputeOrientation(lineSrc);
   
+  return vcl_abs(oriDst  - oriSrc);
+}
+
+/**
+ * Method : ComputeDistanceBetweenSegments 
+ */
+template <class TImage, class TLinesList , class TPointSet>
+double
+LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
+::ComputeOrientation(LineType * line)
+{
+  typename LineType::PointListType & pointsList = line->GetPoints();
+  typename LineType::PointListType::const_iterator itPoints = pointsList.begin();
   float Xp1 = (*itPoints).GetPosition()[0];  
   float Yp1 = (*itPoints).GetPosition()[1];  
   ++itPoints;
   float Xp2 = (*itPoints).GetPosition()[0];  
-  float Yp2 = (*itPoints).GetPosition()[1];  
- 
-  /** Extract Indexes from the Dst line to instantiate the line iterator*/
-  typename LineType::PointListType &pointsListDst = lineDst->GetPoints();
-  typename LineType::PointListType::const_iterator itPointsDst = pointsListDst.begin();
+  float Yp2 = (*itPoints).GetPosition()[1];
 
-  float Xq1 = (*itPointsDst).GetPosition()[0];  //xq1
-  float Yq1 = (*itPointsDst).GetPosition()[1];  //yq1
-  ++itPointsDst;
-  float Xq2 = (*itPointsDst).GetPosition()[0];  //xq2
-  float Yq2 = (*itPointsDst).GetPosition()[1];  //yq2
-
-  /** Vectors support computation */
-  float SegmentLengthP = vcl_sqrt( (Xp1-Xp2)* (Xp1-Xp2) + (Yp1-Yp2) *(Yp1-Yp2) );
-  float SegmentLengthQ = vcl_sqrt( (Xq1-Xq2)* (Xq1-Xq2) + (Yq1-Yq2) *(Yq1-Yq2) );
-  
-  float X = vcl_abs((Xp1 - Xp2)*(Xq1-Xq2));
-  float Y = vcl_abs((Yp1 - Yp2)*(Yq1-Yq2));
+  //Compute the orientation
+  double dx = Xp1 - Xp2;
+  double dy = Yp1 - Yp2 ;
+  double orientation = vcl_atan2(dy,dx);
+  if(orientation < 0) 
+    orientation += M_PI;
 
-  float angle = vcl_acos( ( X + Y )/( SegmentLengthP * SegmentLengthQ ));  //Scalar Product
-      
-  return angle;
+  return orientation ;   
 }
 
+
 /**
  * Method : ComputeDistanceBetweenSegments 
  */
@@ -295,7 +280,6 @@ LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
   float Xq2 = (*itPointsDst).GetPosition()[0];  //xq2
   float Yq2 = (*itPointsDst).GetPosition()[1];  //yq2
 
-  //std::cout << "Xp1 " <<Xp1 <<" Yp1 " << Yp1 << " Xp2 " << Xp2 << " Yp2 "<<Yp2  << " Xq1 " <<Xq1  << " Yq1 "<< Yq1 << " Xq2 " << Xq2<< " Yq2 " << Yq2 << std::endl;
   
   /** Compute the equation of the lines A and B  which are support of the segments Src & Dst*/
   // - Line 1 : slope and origin
@@ -353,7 +337,7 @@ LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
 {
   unsigned int CurrentPos = m_OutputPointSet->GetNumberOfPoints();
 
-  m_OutputPointSet->SetPoint(CurrentPos ,rAngle  );
+  m_OutputPointSet->SetPoint(CurrentPos ,rAngle);
   VectorLineType   vectorLine;
   vectorLine.push_back(LineDst);
   vectorLine.push_back(LineCur);
@@ -370,6 +354,7 @@ LineSpatialObjectListToRightAnglePointSetFilter<TImage,TLinesList ,TPointSet>
 ::PrintSelf(std::ostream& os, itk::Indent indent) const
 {
   Superclass::PrintSelf( os, indent );
+
 }
 
 
diff --git a/Examples/FeatureExtraction/CMakeLists.txt b/Examples/FeatureExtraction/CMakeLists.txt
index d501751e79fd7ea9d50072a4f20ca9575f3ac8b6..6306a0359dd5d64d6ad1c21acca9ae4c69b99d35 100644
--- a/Examples/FeatureExtraction/CMakeLists.txt
+++ b/Examples/FeatureExtraction/CMakeLists.txt
@@ -337,6 +337,21 @@ ADD_TEST(CloudDetectionExampleTest ${EXE_TESTS2}
         553 467 734 581 0.4 0.6 1.0
 )
 
+# ------- Right Angle Detection test----------
+
+ADD_TEST(RightAngleDetectionExample  ${EXE_TESTS2}
+        --compare-image ${TOL}	     
+        ${BASELINE}/RightAngleOutput.png
+        ${TEMP}/PrettyRightAngleOutput.png
+       RightAngleDetectionExample 
+	${INPUTDATA}/qb_RoadExtract2.tif
+	${TEMP}/RighAngleOutput.tif
+	${TEMP}/PrettyRightAngleInput.png	
+	${TEMP}/PrettyRightAngleOutput.png
+	0.09
+	20.
+)
+
 ADD_EXECUTABLE(otbFeatureExtractionExamplesTests1 otbFeatureExtractionExamplesTests1.cxx)
 TARGET_LINK_LIBRARIES(otbFeatureExtractionExamplesTests1  ITKAlgorithms ITKStatistics OTBBasicFilters OTBCommon OTBDisparityMap OTBIO OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction  OTBLearning  OTBMultiScale)
 
diff --git a/Examples/FeatureExtraction/RightAngleDetectionExample.cxx b/Examples/FeatureExtraction/RightAngleDetectionExample.cxx
index c4a3e7e5024113058f8b04a0f623bc50f660b747..ef2bf7d501ea85f9b036d2977b7f80a48bc8c9e4 100644
--- a/Examples/FeatureExtraction/RightAngleDetectionExample.cxx
+++ b/Examples/FeatureExtraction/RightAngleDetectionExample.cxx
@@ -1,18 +1,18 @@
 /*=========================================================================
 
-  Program:   ORFEO Toolbox
-  Language:  C++
-  Date:      $Date$
-  Version:   $Revision$
+Program:   ORFEO Toolbox
+Language:  C++
+Date:      $Date$
+Version:   $Revision$
 
 
-  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
-  See OTBCopyright.txt for details.
+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.
+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.
 
 =========================================================================*/
 
@@ -28,10 +28,12 @@
 #include "otbLineSpatialObjectList.h"
 #include "otbDrawLineSpatialObjectListFilter.h"
 #include "otbLineSegmentDetector.h"
+#include "itkMinimumMaximumImageCalculator.h"
 
 //  Software Guide : BeginCommandLineArgs
 //    INPUTS: {qb_RoadExtract2.tif}
-//    OUTPUTS: {RighAngleOutput.tif}, {PrettyRighAngleInput.png}, {PrettyRighAngleOutput.png}
+//    OUTPUTS: {RighAngleOutput.tif}, {PrettyRighAngleInput.png},  {PrettyRighAngleOutput.png}
+//  0.09 20
 //  Software Guide : EndCommandLineArgs
 
 // Software Guide : BeginLatex
@@ -58,6 +60,9 @@ int main( int argc, char * argv[] )
   const   char * outfname  = argv[2];
   const   char * inprettyfname = argv[3];
   const   char * outprettyfname  = argv[4];
+  double angleThreshold          = atof(argv[5]);
+  double distanceThreshold       = atof(argv[6]);
+
   
   const unsigned int           Dimension = 2;
   typedef float                PixelType;
@@ -70,115 +75,131 @@ int main( int argc, char * argv[] )
   reader->SetFileName(infname);
   WriterType::Pointer writer = WriterType::New();
 
-// Software Guide : BeginLatex
-//
-// After defining, as usual, the types for the input image and the
-// image reader, we define the specific types needed for this
-// example. First of all, we will use a list of line spatial objects
-// to store the detected lines which will be provided by the line
-// segment detector.
-//
-// Software Guide : EndLatex
+  // Software Guide : BeginLatex
+  //
+  // After defining, as usual, the types for the input image and the
+  // image reader, we define the specific types needed for this
+  // example. First of all, we will use a list of line spatial objects
+  // to store the detected lines which will be provided by the line
+  // segment detector.
+  //
+  // Software Guide : EndLatex
 
-// Software Guide : BeginCodeSnippet
+  // Software Guide : BeginCodeSnippet
   typedef otb::LineSpatialObjectList         LinesListType;
-// Software Guide : EndCodeSnippet
-// Software Guide : BeginLatex
-//
-// The right angle detector's output is a pointset where each point
-// gives the coordinate of the detected angle. In the data field of
-// the pointset, the 2 lines which define the right angle are stored
-// in a vector. Therefore we define the 2 following types.
-//
-// Software Guide : EndLatex
+  // Software Guide : EndCodeSnippet
+  // Software Guide : BeginLatex
+  //
+  // The right angle detector's output is a pointset where each point
+  // gives the coordinate of the detected angle. In the data field of
+  // the pointset, the 2 lines which define the right angle are stored
+  // in a vector. Therefore we define the 2 following types.
+  //
+  // Software Guide : EndLatex
 
-// Software Guide : BeginCodeSnippet  
+  // Software Guide : BeginCodeSnippet  
   typedef LinesListType::LineType            LineType;
   typedef std::vector<LineType*>             LineVectorType;
-// Software Guide : EndCodeSnippet
-// Software Guide : BeginLatex
-//
-// And we can now define the pointset type for storing all the
-// information related to the detected right angles.
-//
-// Software Guide : EndLatex
+  // Software Guide : EndCodeSnippet
+  // Software Guide : BeginLatex
+  //
+  // And we can now define the pointset type for storing all the
+  // information related to the detected right angles.
+  //
+  // Software Guide : EndLatex
 
-// Software Guide : BeginCodeSnippet    
+  // Software Guide : BeginCodeSnippet    
   typedef itk::PointSet<LineVectorType, Dimension>     PointSetType;
   // Software Guide : EndCodeSnippet
-// Software Guide : BeginLatex
-//
-// We define the type for the line segment detector. A detailed
-// example for this detector can be found in section \ref{sec:LSD}.
-//
-// Software Guide : EndLatex
+  // Software Guide : BeginLatex
+  //
+  // We define the type for the line segment detector. A detailed
+  // example for this detector can be found in section \ref{sec:LSD}.
+  //
+  // Software Guide : EndLatex
 
-// Software Guide : BeginCodeSnippet    
+  // Software Guide : BeginCodeSnippet    
   typedef otb::LineSegmentDetector<ImageType , PixelType>   LsdFilterType;
 
   // Software Guide : EndCodeSnippet
-// Software Guide : BeginLatex
-//
-// We can finally define the type for the right angle detection
-// filter. This filter is templated over the input image type, the
-// type of the lines provided by the line segment detector, and the
-// output pointset type containing the detected right angles.
-//
-// Software Guide : EndLatex
-
-// Software Guide : BeginCodeSnippet    
+  // Software Guide : BeginLatex
+  //
+  // We can finally define the type for the right angle detection
+  // filter. This filter is templated over the input image type, the
+  // type of the lines provided by the line segment detector, and the
+  // output pointset type containing the detected right angles.
+  //
+  // Software Guide : EndLatex
+  
+  typedef itk::MinimumMaximumImageCalculator<ImageType>  MinMaxFilterType;
+  
+  // Software Guide : BeginCodeSnippet    
   typedef otb::LineSpatialObjectListToRightAnglePointSetFilter<ImageType,
-                                            LinesListType, PointSetType>
-                                                    RightAngleFilterType;
+    LinesListType, PointSetType>
+    RightAngleFilterType;
   
-// Software Guide : EndCodeSnippet
-// Software Guide : BeginLatex
-//
-// We instantiate the line segment detector and the right angle detector.
-//
-// Software Guide : EndLatex
+  // Software Guide : EndCodeSnippet
+  // Software Guide : BeginLatex
+  //
+  // We instantiate the line segment detector and the right angle detector.
+  //
+  // Software Guide : EndLatex
 
-// Software Guide : BeginCodeSnippet    
+  // Software Guide : BeginCodeSnippet    
   LsdFilterType::Pointer         lsdFilter         = LsdFilterType::New();
-  RightAngleFilterType::Pointer  rightAngleFilter  =
-                                               RightAngleFilterType::New();
-
+  RightAngleFilterType::Pointer  rightAngleFilter  = RightAngleFilterType::New();
 
-// Software Guide : EndCodeSnippet
-// Software Guide : BeginLatex
-//
-// We plug the pipeline. The right angle detector has 2 inputs: the
-// image to be processed and the previously detected lines.
-//
-// Software Guide : EndLatex
+  // Software Guide : EndCodeSnippet
+  
+  MinMaxFilterType::Pointer      minmaxCalculator  = MinMaxFilterType::New();
+  
+  // Software Guide : BeginLatex
+  //
+  // We plug the pipeline. The right angle detector has 2 inputs: the
+  // image to be processed and the previously detected lines.
+  //
+  // Software Guide : EndLatex
 
-// Software Guide : BeginCodeSnippet    
+  // Software Guide : BeginCodeSnippet    
 
   lsdFilter->SetInput(reader->GetOutput());  
   rightAngleFilter->SetInputImage(reader->GetOutput());
   rightAngleFilter->SetInput(lsdFilter->GetOutput());
+
+  // Software Guide : EndCodeSnippet
+  // Software Guide : BeginLatex
+  //
+  // You can qualify how far the right angle must the segments be, and the tolerance 
+  // to consider an angle between two segments as an right one.
+  //
+  rightAngleFilter->SetThresholdAngle(angleThreshold);
+  rightAngleFilter->SetThresholdDistance(distanceThreshold);
+  //
+  // Software Guide : EndLatex
+  // Software Guide : BeginCodeSnippet  
+  
   rightAngleFilter->Update();
-// Software Guide : EndCodeSnippet
-// Software Guide : BeginLatex
-//
-// We will now draw the right angles on top of the inout image. For
-// this, we get the output of the right angle detector.
-//
-// Software Guide : EndLatex
+  // Software Guide : EndCodeSnippet
+  // Software Guide : BeginLatex
+  //
+  // We will now draw the right angles on top of the inout image. For
+  // this, we get the output of the right angle detector.
+  //
+  // Software Guide : EndLatex
 
-// Software Guide : BeginCodeSnippet    
+  // Software Guide : BeginCodeSnippet    
   PointSetType::Pointer          segmentOrtho      = PointSetType::New();     
   segmentOrtho = rightAngleFilter->GetOutput();
   // Software Guide : EndCodeSnippet
-// Software Guide : BeginLatex
-//
-// We will iterate through the pointset and get the lines which define
-// each right angle stored inside each point of the pointset. The
-// lines will be stored into a line list.
-//
-// Software Guide : EndLatex
+  // Software Guide : BeginLatex
+  //
+  // We will iterate through the pointset and get the lines which define
+  // each right angle stored inside each point of the pointset. The
+  // lines will be stored into a line list.
+  //
+  // Software Guide : EndLatex
 
-// Software Guide : BeginCodeSnippet    
+  // Software Guide : BeginCodeSnippet    
   PointSetType::PointType   pRight;
   LineVectorType            outputVectorLines;
   LinesListType::Pointer    outputLinesList = LinesListType::New();
@@ -186,54 +207,57 @@ int main( int argc, char * argv[] )
   for (unsigned int i = 0; i<segmentOrtho->GetNumberOfPoints(); i++)
     {
       // Software Guide : EndCodeSnippet
-// Software Guide : BeginLatex
-//
-// Even if we do not use it in this example, we show here how to get
-// the coordinates of the right angle.
-//
-// Software Guide : EndLatex
-
-// Software Guide : BeginCodeSnippet    
+      // Software Guide : BeginLatex
+      //
+      // Even if we do not use it in this example, we show here how to get
+      // the coordinates of the right angle.
+      //
+      // Software Guide : EndLatex
+
+      // Software Guide : BeginCodeSnippet    
       segmentOrtho->GetPoint(i, &pRight);
       // Software Guide : EndCodeSnippet
-// Software Guide : BeginLatex
-//
-// The lines associated to a given angle are obtained using the
-// \code{GetPointData} method of the pointset. Then they are stored
-// into the list of lines.
-//
-// Software Guide : EndLatex
-
-// Software Guide : BeginCodeSnippet          
+      // Software Guide : BeginLatex
+      //
+      // The lines associated to a given angle are obtained using the
+      // \code{GetPointData} method of the pointset. Then they are stored
+      // into the list of lines.
+      //
+      // Software Guide : EndLatex
+
+      // Software Guide : BeginCodeSnippet          
       segmentOrtho->GetPointData(i, &outputVectorLines);
       outputLinesList->push_back(outputVectorLines[0]);
       outputLinesList->push_back(outputVectorLines[1]);
     }
-      // Software Guide : EndCodeSnippet
-// Software Guide : BeginLatex
-//
-// We will use the \doxygen{otb}{DrawLineSpatialObjectListFilter} to
-// draw the list of lines on top of the input image.
-//
-// Software Guide : EndLatex
+  // Software Guide : EndCodeSnippet
+
+  minmaxCalculator->SetImage(reader->GetOutput());
+  minmaxCalculator->ComputeMaximum();
+    
+  // Software Guide : BeginLatex
+  //
+  // We will use the \doxygen{otb}{DrawLineSpatialObjectListFilter} to
+  // draw the list of lines on top of the input image.
+  // The value assigned to the line is the maximum of the input image.
+  // Software Guide : EndLatex
 
-// Software Guide : BeginCodeSnippet          
+  // Software Guide : BeginCodeSnippet          
   typedef otb::DrawLineSpatialObjectListFilter< ImageType,
-                                       ImageType > DrawLineListType;
+    ImageType > DrawLineListType;
   DrawLineListType::Pointer drawLineFilter =   DrawLineListType::New();
 
   drawLineFilter->SetInput(reader->GetOutput());
   drawLineFilter->SetInputLineSpatialObjectList(outputLinesList);
-
-
+  drawLineFilter->SetValue(minmaxCalculator->GetMaximum());
+  
   writer->SetInput(drawLineFilter->GetOutput());
   writer->SetFileName(outfname);
-
     
   reader->GenerateOutputInformation();
   writer->Update();
   // Software Guide : EndCodeSnippet
-    //  Software Guide : BeginLatex
+  //  Software Guide : BeginLatex
   // Figure~\ref{fig:RIGHTANGLE_FILTER} shows the result of applying
   // the right angle detection filter to an image.
   // \begin{figure}
diff --git a/Examples/FeatureExtraction/otbFeatureExtractionExamplesTests2.cxx b/Examples/FeatureExtraction/otbFeatureExtractionExamplesTests2.cxx
index dec218af753b8e7f491d495ead88ab46a4899ce7..72886db52192536659b8afc66da869fea72cd776 100644
--- a/Examples/FeatureExtraction/otbFeatureExtractionExamplesTests2.cxx
+++ b/Examples/FeatureExtraction/otbFeatureExtractionExamplesTests2.cxx
@@ -29,9 +29,10 @@ void RegisterTests()
   REGISTER_TEST(ExtractRoadExampleTest);
   REGISTER_TEST(SeamCarvingExampleTest);
   REGISTER_TEST(SeamCarvingOtherExampleTest);
-//REGISTER_TEST(ImageToSIFTKeyPointSetFilterTest);
+  //REGISTER_TEST(ImageToSIFTKeyPointSetFilterTest);
   REGISTER_TEST(ScaleInvariantFeatureImageFilterTest);
   REGISTER_TEST(CloudDetectionExampleTest);
+  REGISTER_TEST( RightAngleDetectionExample);
 }
 
 #undef main
@@ -62,3 +63,6 @@ void RegisterTests()
 #define main CloudDetectionExampleTest
 #include "CloudDetectionExample.cxx"
 
+#undef main
+#define main RightAngleDetectionExample
+#include "RightAngleDetectionExample.cxx"