From f9b448c0c49425e749a7e7381744dde28edfa20c Mon Sep 17 00:00:00 2001
From: Jonathan Guinet <jonathan.guinet@c-s.fr>
Date: Wed, 7 Mar 2012 17:24:05 +0100
Subject: [PATCH] TEST: mean shift test change.

---
 Testing/Code/BasicFilters/CMakeLists.txt      | 21 ++++++++++---------
 .../BasicFilters/otbMeanShiftImageFilter2.cxx |  8 +++----
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/Testing/Code/BasicFilters/CMakeLists.txt b/Testing/Code/BasicFilters/CMakeLists.txt
index d86af4ad2b..3ad40a027b 100644
--- a/Testing/Code/BasicFilters/CMakeLists.txt
+++ b/Testing/Code/BasicFilters/CMakeLists.txt
@@ -1142,11 +1142,11 @@ ADD_TEST(bfTvMeanShiftImageFilter2 ${BASICFILTERS_TESTS9}
         ${TEMP}/bfMeanShiftImageSpatialOutput.tif
         ${TEMP}/bfMeanShiftImageFilterSpectralOutput.tif
         ${TEMP}/bfMeanShiftImageFilterMetricOutput.tif
-        9 9 50 10 0.00001
+        9 9 50 10 0.00001 10
         )
         
-ADD_TEST(bfTvMeanShiftImageFilterValidMul ${BASICFILTERS_TESTS9}
-        otbMeanShiftImageFilter
+ADD_TEST(bfTvMeanShiftVectorImageFilterValidMul ${BASICFILTERS_TESTS9}
+        otbMeanShiftVectorImageFilter
         ${INPUTDATA}/ROI_QB_MUL_4.tif
         ${TEMP}/bfMeanShiftImageFilterOutputValidMul.tif
         ${TEMP}/bfMeanShiftImageFilterClusteredOutputValidMul.tif
@@ -1154,6 +1154,7 @@ ADD_TEST(bfTvMeanShiftImageFilterValidMul ${BASICFILTERS_TESTS9}
         ${TEMP}/bfMeanShiftImageFilterClusterBoundariesOutputValidMul.tif
         9 50 10 1.0
         )        
+     
         
 ADD_TEST(bfTvMeanShiftImageFilter2Mul ${BASICFILTERS_TESTS9}
         otbMeanShiftImageFilter2
@@ -1161,12 +1162,12 @@ ADD_TEST(bfTvMeanShiftImageFilter2Mul ${BASICFILTERS_TESTS9}
         ${TEMP}/bfMeanShiftImageSpatialOutputMul.tif
         ${TEMP}/bfMeanShiftImageFilterSpectralOutputMul.tif
         ${TEMP}/bfMeanShiftImageFilterMetricOutputMul.tif
-        9 9 50 10 0.001
+        9 9 50 10 0.01 100
         )
         
   
             
-#IF(OTB_DATA_USE_LARGEINPUT)
+IF(OTB_DATA_USE_LARGEINPUT)
 #
 #ADD_TEST(bfTvMeanShiftImageFilterValidLargeInput ${BASICFILTERS_TESTS9}
 #        otbMeanShiftImageFilter
@@ -1179,15 +1180,15 @@ ADD_TEST(bfTvMeanShiftImageFilter2Mul ${BASICFILTERS_TESTS9}
 #        )
         
 #ADD_TEST(bfTvMeanShiftImageFilter2LargeInput ${BASICFILTERS_TESTS9}
-#        otbMeanShiftImageFilter2
+#       otbMeanShiftImageFilter2
 #        ${LARGEINPUT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL/02APR01105228-M1BS-000000128955_01_P001.TIF
 #        ${TEMP}/bfMeanShiftImageSpatialOutputLargeInput.tif
 #        ${TEMP}/bfMeanShiftImageFilterSpectralOutputLargeInput.tif
-#        ${TEMP}/bfMeanShiftImageFilterMetricOutputLargeInput.tif
-#        9 9 50 10 0.001
+#       ${TEMP}/bfMeanShiftImageFilterMetricOutputLargeInput.tif
+#        9 9 10 10 0.001 10
 #        )
-#        
-#ENDIF(OTB_DATA_USE_LARGEINPUT)
+        
+ENDIF(OTB_DATA_USE_LARGEINPUT)
 
 
 ADD_TEST(bfTuMeanShiftVectorImageFilterNew ${BASICFILTERS_TESTS9}
diff --git a/Testing/Code/BasicFilters/otbMeanShiftImageFilter2.cxx b/Testing/Code/BasicFilters/otbMeanShiftImageFilter2.cxx
index 369fe1f7d4..7e4b0aecd4 100644
--- a/Testing/Code/BasicFilters/otbMeanShiftImageFilter2.cxx
+++ b/Testing/Code/BasicFilters/otbMeanShiftImageFilter2.cxx
@@ -24,10 +24,10 @@
 
 int otbMeanShiftImageFilter2(int argc, char * argv[])
 {
-  if (argc != 10)
+  if (argc != 11)
     {
     std::cerr << "Usage: " << argv[0] <<
-    " infname spatialfname spectralfname metricfname spatialRadius spectralRadius spectralbandwidth spatialBandwidth threshold"
+    " infname spatialfname spectralfname metricfname spatialRadius spectralRadius spectralbandwidth spatialBandwidth threshold maxiterationnumber"
               << std::endl;
     return EXIT_FAILURE;
     }
@@ -41,7 +41,7 @@ int otbMeanShiftImageFilter2(int argc, char * argv[])
   const double       spectralbandwidth         = atof(argv[7]);
   const double       spatialbandwidth          = atof(argv[8]);
   const double       threshold                 = atof(argv[9]);
-
+  const unsigned int maxiterationnumber        = atoi(argv[10]);
   /* maxit - threshold */
 
   const unsigned int Dimension = 2;
@@ -71,7 +71,7 @@ int otbMeanShiftImageFilter2(int argc, char * argv[])
   filter->SetSpectralBandwidth(spectralbandwidth);
   filter->SetSpatialBandwidth(spatialbandwidth);
   filter->SetThreshold(threshold);
-
+  filter->SetMaxIterationNumber(maxiterationnumber);
   filter->SetInput(reader->GetOutput());
   //filter->SetNumberOfThreads(1);
   WriterType::Pointer writer1 = WriterType::New();
-- 
GitLab