diff --git a/Code/BasicFilters/otbBinaryImageToDensityImageFilter.txx b/Code/BasicFilters/otbBinaryImageToDensityImageFilter.txx
index 75691fe081a8faafe0b2ce9d0d2f767068868d0e..0052d8ef90a1cc80fb552eee479ebc5348252bc8 100644
--- a/Code/BasicFilters/otbBinaryImageToDensityImageFilter.txx
+++ b/Code/BasicFilters/otbBinaryImageToDensityImageFilter.txx
@@ -51,6 +51,7 @@ void
 BinaryImageToDensityImageFilter<TInputImage, TOutputImage, TCountFunction>
 ::GenerateInputRequestedRegion()
 {
+  std::cout<<"GenerateInputRequestedRegion"<<std::endl;
   // call the superclass' implementation of this method
   Superclass::GenerateInputRequestedRegion();
 
diff --git a/Code/BasicFilters/otbEdgeDensityImageFilter.h b/Code/BasicFilters/otbEdgeDensityImageFilter.h
index 0f8e34e9c0e8602b833d1797cb935d9ace0c6f68..157dd447c07596aaa69414db11f530ec83905dbc 100644
--- a/Code/BasicFilters/otbEdgeDensityImageFilter.h
+++ b/Code/BasicFilters/otbEdgeDensityImageFilter.h
@@ -22,9 +22,7 @@ PURPOSE.  See the above copyright notices for more information.
 
 #include "itkImageToImageFilter.h"
 #include "otbBinaryImageToDensityImageFilter.h"
-
 #include "itkProcessObject.h"
-
 #include "itkNumericTraits.h"
 
 
@@ -59,6 +57,8 @@ public:
   /** Template parameters typedefs*/
   typedef TInputImage                                    InputImageType;
   typedef typename InputImageType::Pointer               InputImagePointerType;
+  typedef typename InputImageType::PixelType             InputImagePixelType;
+  typedef typename InputImageType::SizeType              InputImageSizeType;
 
   /** OutputImageType typedef support*/
   typedef TOutputImage                                   OutputImageType;
@@ -71,7 +71,6 @@ public:
 
   /** Count Density Function typedef support*/
   typedef TDensityCount                                  DensityCountFunctionType;
-  
 
   /** PointSetToDensityImageFilter support*/
   typedef otb::BinaryImageToDensityImageFilter<InputImageType, 
@@ -82,15 +81,19 @@ public:
   
   /** Get/Set the radius of the neighborhood over which the
   statistics are evaluated */
-  itkSetMacro( NeighborhoodRadius, unsigned int );
-  itkGetConstReferenceMacro( NeighborhoodRadius, unsigned int );
+  itkSetMacro( NeighborhoodRadius, InputImageSizeType );
+  itkGetConstReferenceMacro( NeighborhoodRadius, InputImageSizeType );
+  void SetNeighborhoodRadius( unsigned int rad)
+    {
+      m_NeighborhoodRadius.Fill(rad);
+      this->Modified();
+    }
 
   /**Set/Get detector */
   itkSetObjectMacro(Detector, DetectorType);
   itkGetObjectMacro(Detector, DetectorType);
   itkGetObjectMacro(DensityImageFilter, DensityImageType);
-
-
+ 
 protected:
 
   /**
@@ -115,9 +118,9 @@ private:
   EdgeDensityImageFilter(const Self&); //purposely not implemented
   void operator=(const Self&); //purposely not implemented
 
-  DetectorPointerType       m_Detector;
-  DensityImagePointerType   m_DensityImageFilter;
-  unsigned int              m_NeighborhoodRadius;
+  DetectorPointerType     m_Detector;
+  DensityImagePointerType m_DensityImageFilter;
+  InputImageSizeType      m_NeighborhoodRadius;
 };
 }
 #ifndef OTB_MANUAL_INSTANTIATION
diff --git a/Code/BasicFilters/otbEdgeDensityImageFilter.txx b/Code/BasicFilters/otbEdgeDensityImageFilter.txx
index e32dcb85261c664d2c971a4d5b51c20aa88fbe0f..f2fb3cdfbc3c2664d47df4abb85dc5aa139dd875 100644
--- a/Code/BasicFilters/otbEdgeDensityImageFilter.txx
+++ b/Code/BasicFilters/otbEdgeDensityImageFilter.txx
@@ -19,7 +19,7 @@ PURPOSE.  See the above copyright notices for more information.
 =========================================================================*/
 
 #include "otbEdgeDensityImageFilter.h"
-
+#include "otbImageFileWriter.h"
 
 namespace otb
 {
@@ -32,7 +32,7 @@ EdgeDensityImageFilter<TInputImage, TOutputImage, TEdgeDetector, TDensityCount>
 { 
   this->SetNumberOfRequiredInputs( 1 );
   
-  m_NeighborhoodRadius = 1;
+  m_NeighborhoodRadius.Fill( 1 );
   m_Detector =  DetectorType::New();
   m_DensityImageFilter = DensityImageType::New();
 }
@@ -55,19 +55,11 @@ void
 EdgeDensityImageFilter<TInputImage, TOutputImage, TEdgeDetector, TDensityCount>
 ::GenerateData()
 {
+  typename ImageFileWriter<TInputImage>::Pointer writer = ImageFileWriter<TInputImage>::New();
   m_Detector->SetInput( this->GetInput() );
-
-  std::cout<<"###"<<this->GetInput()->GetLargestPossibleRegion()<<std::endl; 
-  m_Detector->Update();
-  m_Detector->UpdateOutputInformation();
-  //m_Detector->SetRequestedRegionToLargestPossibleRegion();
-  std::cout<<"~~~"<<m_Detector->GetOutput()->GetLargestPossibleRegion()<<std::endl;
-
+  
   m_DensityImageFilter->SetNeighborhoodRadius(m_NeighborhoodRadius);
-  m_DensityImageFilter->SetInput(m_Detector->GetOutput());
-
-  m_DensityImageFilter->UpdateOutputInformation();
-  std::cout<<"***"<<m_DensityImageFilter->GetOutput()->GetLargestPossibleRegion()<<std::endl;
+  m_DensityImageFilter->SetInput( m_Detector->GetOutput() );
 
   m_DensityImageFilter->GraftOutput(this->GetOutput());
   m_DensityImageFilter->Update();
diff --git a/Code/BasicFilters/otbEdgeDetectorImageFilter.h b/Code/BasicFilters/otbEdgeDetectorImageFilter.h
index fce003d80257a4d7e8551e35f5ea2837dc6b5d4a..3ab70edbe444570c757285f67422ed1ede5a425d 100644
--- a/Code/BasicFilters/otbEdgeDetectorImageFilter.h
+++ b/Code/BasicFilters/otbEdgeDetectorImageFilter.h
@@ -94,7 +94,18 @@ public:
       m_BinaryFilter->SetUpperThreshold(val);
       this->Modified();
     }
-  
+  /** Set Inside value. */
+  void SetInsideValue(InputImagePixelType val)
+    {
+      m_BinaryFilter->SetInsideValue(val);
+      this->Modified();
+    }
+  /** Set Outside value. */
+  void SetOutsideValue(InputImagePixelType val)
+    {
+      m_BinaryFilter->SetOutsideValue(val);
+      this->Modified();
+    }
  protected:
 
   EdgeDetectorImageFilter();
diff --git a/Code/BasicFilters/otbEdgeDetectorImageFilter.txx b/Code/BasicFilters/otbEdgeDetectorImageFilter.txx
index 56c5a92ca8ff3ca00e4d09c3b31b897450b27327..604da9634bd1c26c087eccf9094e1c6474fff371 100644
--- a/Code/BasicFilters/otbEdgeDetectorImageFilter.txx
+++ b/Code/BasicFilters/otbEdgeDetectorImageFilter.txx
@@ -33,10 +33,10 @@ EdgeDetectorImageFilter<TInputImage, TOutputImage, TEdgeDetection>
   
   m_Detector =  DetectionType::New();
   m_BinaryFilter = BinaryFilterType::New();
-  m_BinaryFilter->SetInsideValue( static_cast<OutputImagePixelType>(1.) );
-  m_BinaryFilter->SetOutsideValue( static_cast<OutputImagePixelType>(0.) );
-  m_BinaryFilter->SetUpperThreshold( itk::NumericTraits<InputImagePixelType>::max() );
-  m_BinaryFilter->SetLowerThreshold( itk::NumericTraits<InputImagePixelType>::min() );
+  m_BinaryFilter->SetInsideValue( static_cast<OutputImagePixelType>(0.) );
+  m_BinaryFilter->SetOutsideValue( static_cast<OutputImagePixelType>(1.) );
+  m_BinaryFilter->SetUpperThreshold( static_cast<InputImagePixelType>(255) );
+  m_BinaryFilter->SetLowerThreshold( static_cast<InputImagePixelType>(0) );
 }
 
 
@@ -63,11 +63,6 @@ EdgeDetectorImageFilter<TInputImage, TOutputImage, TEdgeDetection>
   m_BinaryFilter->GraftOutput(this->GetOutput());
   m_BinaryFilter->Update();
   this->GraftOutput(m_BinaryFilter->GetOutput());
-  /*
- m_Detector->GraftOutput(this->GetOutput());
-  m_Detector->Update();
-  this->GraftOutput(m_Detector->GetOutput());
-  */
 }
 
 
diff --git a/Testing/Code/BasicFilters/CMakeLists.txt b/Testing/Code/BasicFilters/CMakeLists.txt
index 7c30fd1edc8b34fa3c4f65c8ba3a2ac184862ff4..2657e4fec3fbc340ecd1c46c6d90e9433f223b16 100644
--- a/Testing/Code/BasicFilters/CMakeLists.txt
+++ b/Testing/Code/BasicFilters/CMakeLists.txt
@@ -1463,10 +1463,10 @@ ADD_TEST(bfTvEdgeDetectorImageFilter ${BASICFILTERS_TESTS12}
 	    ${BASELINE}/bfTvEdgeDetectorImageFilter.tif
 	    ${TEMP}/bfTvEdgeDetectorImageFilter.tif
 	 otbEdgeDetectorImageFilter
-	 ${INPUTDATA}/poupees_sub.png
+	 ${INPUTDATA}/poupees_sub_c1.png
 	 ${TEMP}/bfTvEdgeDetectorImageFilter.tif
-	 50000   # lower threshold
-	 2000000 # upper  threshold
+	 0   # lower threshold
+	 255 # upper  threshold
 )