From 1315679cfb34fe3bff80e6282b9f06a644c101cd Mon Sep 17 00:00:00 2001
From: Jonathan Guinet <jonathan.guinet@c-s.fr>
Date: Tue, 6 Mar 2012 16:56:53 +0100
Subject: [PATCH] TEST: MeanShift image filter test changes.

---
 Testing/Code/BasicFilters/CMakeLists.txt      | 48 ++++++++++++++++++-
 .../BasicFilters/otbMeanShiftImageFilter2.cxx |  8 +++-
 2 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/Testing/Code/BasicFilters/CMakeLists.txt b/Testing/Code/BasicFilters/CMakeLists.txt
index 9856641457..92d3827991 100644
--- a/Testing/Code/BasicFilters/CMakeLists.txt
+++ b/Testing/Code/BasicFilters/CMakeLists.txt
@@ -1135,14 +1135,60 @@ ADD_TEST(bfTvMeanShiftImageFilterValid ${BASICFILTERS_TESTS9}
         9 50 10 1.0
         )
         
+       
 ADD_TEST(bfTvMeanShiftImageFilter2 ${BASICFILTERS_TESTS9}
         otbMeanShiftImageFilter2
         ${INPUTDATA}/QB_Suburb.png
         ${TEMP}/bfMeanShiftImageSpatialOutput.tif
         ${TEMP}/bfMeanShiftImageFilterSpectralOutput.tif
         ${TEMP}/bfMeanShiftImageFilterMetricOutput.tif
-        9 9 50
+        9 9 50 10 0.001
         )
+        
+ADD_TEST(bfTvMeanShiftImageFilterValidMul ${BASICFILTERS_TESTS9}
+        otbMeanShiftImageFilter
+        ${INPUTDATA}/QB_MUL_ROI_1000_100.tif
+        ${TEMP}/bfMeanShiftImageFilterOutputValidMul.tif
+        ${TEMP}/bfMeanShiftImageFilterClusteredOutputValidMul.tif
+        ${TEMP}/bfMeanShiftImageFilterLabeledClusteredOutputValidMul.tif
+        ${TEMP}/bfMeanShiftImageFilterClusterBoundariesOutputValidMul.tif
+        9 50 10 1.0
+        )        
+        
+ADD_TEST(bfTvMeanShiftImageFilter2Mul ${BASICFILTERS_TESTS9}
+        otbMeanShiftImageFilter2
+        ${INPUTDATA}/ROI_QB_MUL_4.tif
+        ${TEMP}/bfMeanShiftImageSpatialOutputMul.tif
+        ${TEMP}/bfMeanShiftImageFilterSpectralOutputMul.tif
+        ${TEMP}/bfMeanShiftImageFilterMetricOutputMul.tif
+        9 9 50 10 0.001
+        )
+        
+  
+            
+#IF(OTB_DATA_USE_LARGEINPUT)
+#
+#ADD_TEST(bfTvMeanShiftImageFilterValidLargeInput ${BASICFILTERS_TESTS9}
+#        otbMeanShiftImageFilter
+#        ${LARGEINPUT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL/02APR01105228-M1BS-000000128955_01_P001.TIF
+#        ${TEMP}/bfMeanShiftImageFilterOutputValidLargeInput.tif
+#        ${TEMP}/bfMeanShiftImageFilterClusteredOutputValidLargeInput.tif
+#        ${TEMP}/bfMeanShiftImageFilterLabeledClusteredOutputValidLargeInput.tif
+#        ${TEMP}/bfMeanShiftImageFilterClusterBoundariesOutputValidLargeInput.tif
+#        9 50 10 1.0
+#        )
+        
+#ADD_TEST(bfTvMeanShiftImageFilter2LargeInput ${BASICFILTERS_TESTS9}
+#        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
+#        )
+#        
+#ENDIF(OTB_DATA_USE_LARGEINPUT)
+
 
 ADD_TEST(bfTuMeanShiftVectorImageFilterNew ${BASICFILTERS_TESTS9}
         otbMeanShiftVectorImageFilterNew )
diff --git a/Testing/Code/BasicFilters/otbMeanShiftImageFilter2.cxx b/Testing/Code/BasicFilters/otbMeanShiftImageFilter2.cxx
index 44c504572e..369fe1f7d4 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 != 8)
+  if (argc != 10)
     {
     std::cerr << "Usage: " << argv[0] <<
-    " infname spatialfname spectralfname metricfname spatialRadius spectralRadius spectralbandwidth"
+    " infname spatialfname spectralfname metricfname spatialRadius spectralRadius spectralbandwidth spatialBandwidth threshold"
               << std::endl;
     return EXIT_FAILURE;
     }
@@ -39,6 +39,8 @@ int otbMeanShiftImageFilter2(int argc, char * argv[])
   const unsigned int spatialRadius             = atoi(argv[5]);
   const unsigned int spectralRadius            = atoi(argv[6]);
   const double       spectralbandwidth         = atof(argv[7]);
+  const double       spatialbandwidth          = atof(argv[8]);
+  const double       threshold                 = atof(argv[9]);
 
   /* maxit - threshold */
 
@@ -67,6 +69,8 @@ int otbMeanShiftImageFilter2(int argc, char * argv[])
   radius[1]=spectralRadius;
   filter->SetRangeRadius(radius);
   filter->SetSpectralBandwidth(spectralbandwidth);
+  filter->SetSpatialBandwidth(spatialbandwidth);
+  filter->SetThreshold(threshold);
 
   filter->SetInput(reader->GetOutput());
   //filter->SetNumberOfThreads(1);
-- 
GitLab