From f193068e27846f29e8c9002a1993a407eb3ff74a Mon Sep 17 00:00:00 2001
From: Manuel Grizonnet <manuel.grizonnet@orfeo-toolbox.org>
Date: Wed, 25 Apr 2012 15:16:39 +0200
Subject: [PATCH] TEST:modify StreamingVectorizedSegmentation test to take Mean
 Shift parameters as input

---
 Testing/Code/OBIA/CMakeLists.txt                    |  3 +++
 .../OBIA/otbStreamingVectorizedSegmentationOGR.cxx  | 13 ++++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/Testing/Code/OBIA/CMakeLists.txt b/Testing/Code/OBIA/CMakeLists.txt
index ceb0fe1806..2b04fa7db0 100644
--- a/Testing/Code/OBIA/CMakeLists.txt
+++ b/Testing/Code/OBIA/CMakeLists.txt
@@ -253,6 +253,9 @@ ADD_TEST(obTvStreamingVectorizedSegmentationOGR ${OBIA_TESTS1}
      ${INPUTDATA}/QB_Toulouse_Ortho_PAN.tif
      ${TEMP}/obTvStreamingVectorizedSegmentationOGR.sqlite
      100
+     5
+     15.
+     100
      )
 
 # -------            otb::FusionOGRTileFilter   -------------
diff --git a/Testing/Code/OBIA/otbStreamingVectorizedSegmentationOGR.cxx b/Testing/Code/OBIA/otbStreamingVectorizedSegmentationOGR.cxx
index 6b62e0393b..f89547f188 100644
--- a/Testing/Code/OBIA/otbStreamingVectorizedSegmentationOGR.cxx
+++ b/Testing/Code/OBIA/otbStreamingVectorizedSegmentationOGR.cxx
@@ -51,10 +51,10 @@ int otbStreamingVectorizedSegmentationOGRNew(int argc, char * argv[])
 int otbStreamingVectorizedSegmentationOGR(int argc, char * argv[])
 {
 
-  if (argc != 4)
+  if (argc != 7)
     {
       std::cerr << "Usage: " << argv[0];
-      std::cerr << " inputImage outputVec TileDimension" << std::endl;
+      std::cerr << " inputImage outputVec TileDimension spatialRadius rangeRadius minObjectSize" << std::endl;
       return EXIT_FAILURE;
     }
 
@@ -64,6 +64,9 @@ int otbStreamingVectorizedSegmentationOGR(int argc, char * argv[])
   const double spatialbandwidth = 10;
   const double threshold = 0.001;
 
+  const unsigned int spatialRadiusOldMS     = atoi(argv[4]);
+  const double rangeRadiusOldMS             = atof(argv[5]);
+  const unsigned int minimumObjectSizeOldMS = atoi(argv[6]);
   /* conencted component parameters */
 
   const char * maskexpression = "";
@@ -128,9 +131,9 @@ int otbStreamingVectorizedSegmentationOGR(int argc, char * argv[])
   filter->SetFieldName(fieldName);
   filter->SetStartLabel(1);
   filter->SetUse8Connected(false);
-  filter->GetSegmentationFilter()->SetSpatialRadius(5);
-  filter->GetSegmentationFilter()->SetRangeRadius(15);
-  filter->GetSegmentationFilter()->SetMinimumRegionSize(100);
+  filter->GetSegmentationFilter()->SetSpatialRadius(spatialRadiusOldMS);
+  filter->GetSegmentationFilter()->SetRangeRadius(rangeRadiusOldMS);
+  filter->GetSegmentationFilter()->SetMinimumRegionSize(minimumObjectSizeOldMS);
   //filter->GetSegmentationFilter()->GetFunctor().SetExpression("distance<15");
 
   filter->SetFileName(argv[2]);
-- 
GitLab