From 0e6c62823833dad69fafef391ab8922a29912279 Mon Sep 17 00:00:00 2001
From: Jordi Inglada <jordi.inglada@orfeo-toolbox.org>
Date: Mon, 2 Mar 2009 10:37:53 +0100
Subject: [PATCH] ENH: Added enum for feature number  for SFS filter

---
 Code/FeatureExtraction/otbSFSTexturesImageFilter.h   | 12 +++++++-----
 Examples/FeatureExtraction/SFSExample.cxx            |  2 +-
 .../otbSFSTexturesImageFilterTest.cxx                |  2 +-
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/Code/FeatureExtraction/otbSFSTexturesImageFilter.h b/Code/FeatureExtraction/otbSFSTexturesImageFilter.h
index b42627dc7a..826c508b25 100644
--- a/Code/FeatureExtraction/otbSFSTexturesImageFilter.h
+++ b/Code/FeatureExtraction/otbSFSTexturesImageFilter.h
@@ -26,6 +26,7 @@ PURPOSE.  See the above copyright notices for more information.
 
 namespace otb
 {
+
 /** \class SFSTexturesImageFilter
  *  \brief This functor computes the texture describes in the following publication
  *  It is based on line direction estimation.
@@ -153,15 +154,16 @@ public:
     };
 
   /** Texture selection accessors 
-   *  1: length
-   *  2: width
+   *  1: LENGTH
+   *  2: WIDTH
    *  3: PSI
-   *  4: w-mean
-   *  5: ratio
+   *  4: WMEAN
+   *  5: RATIO
    *  6: SD
    *  Set to 1 means the texture will be computed.
    **/
-  void SetFeatureStatus( unsigned int id, bool isSelected )
+  typedef enum {LENGTH, WIDTH, PSI, WMEAN, RATIO, SD} FeatureType;
+  void SetFeatureStatus(FeatureType id, bool isSelected )
     {
       if ( id>this->GetTexturesStatus().size() || id == 0 )
 	  {
diff --git a/Examples/FeatureExtraction/SFSExample.cxx b/Examples/FeatureExtraction/SFSExample.cxx
index a61064b20e..24bca1e464 100644
--- a/Examples/FeatureExtraction/SFSExample.cxx
+++ b/Examples/FeatureExtraction/SFSExample.cxx
@@ -147,7 +147,7 @@ int main(int argc, char * argv[])
 // Software Guide : EndLatex
 
 // Software Guide : BeginCodeSnippet    
-  filter->SetFeatureStatus(3, true);
+  filter->SetFeatureStatus(SFSFilterType::PSI, true);
   filter->SetInput( reader->GetOutput() );
 
 
diff --git a/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterTest.cxx b/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterTest.cxx
index 204aa2d84d..74b85d6fec 100644
--- a/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterTest.cxx
+++ b/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterTest.cxx
@@ -64,7 +64,7 @@ int otbSFSTexturesImageFilterTest(int argc, char * argv[])
   filter->SetRatioMaxConsiderationNumber(maxConsideration);
   filter->SetAlpha(alpha);
   // disable PSI texture
-  filter->SetFeatureStatus(3, false);
+  filter->SetFeatureStatus(FilterType::PSI, false);
   filter->SetInput( reader->GetOutput() );
 
 
-- 
GitLab