diff --git a/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.h b/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.h index 9b8d7f4ea5ee0695f7da2b05e8d5b97893faa19c..9db4455a626ee4dd3b67fd316613a23595e55f56 100644 --- a/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.h +++ b/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.h @@ -129,6 +129,9 @@ public: itkGetConstMacro(CriterionFormula, std::string); itkSetMacro(CriterionFormula, std::string); + itkGetMacro(CriterionThreshold, double); + itkSetMacro(CriterionThreshold, double); + /** Fuzzy Models */ void SetFuzzyModel(const std::string& key, std::vector<double> model) { @@ -216,6 +219,7 @@ private: typename ParserType::Pointer m_Parser; std::string m_CriterionFormula; + double m_CriterionThreshold; unsigned int m_CurrentID; }; diff --git a/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.txx b/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.txx index d9dd283b9bafd64e07ae2c0cfc9b84ef2c3b4036..a1593010b6c6f5c0575ad21bd9bb919a78080f15 100644 --- a/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.txx +++ b/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.txx @@ -29,7 +29,8 @@ namespace otb template <class TVectorData, class TPrecision> VectorDataToDSValidatedVectorDataFilter<TVectorData, TPrecision> ::VectorDataToDSValidatedVectorDataFilter() : - m_CriterionFormula("((Belief + Plausibility)/2) >= 0.5"), + m_CriterionFormula("((Belief + Plausibility)/2.)"), + m_CriterionThreshold(0.5), m_CurrentID(0) { this->SetNumberOfRequiredInputs(1); @@ -165,7 +166,7 @@ VectorDataToDSValidatedVectorDataFilter<TVectorData, TPrecision> m_Bel = jointMassFilter->GetOutput()->GetBelief(m_Hypothesis); m_Plau = jointMassFilter->GetOutput()->GetPlausibility(m_Hypothesis); - if (m_Parser->Eval()) + if (m_Parser->Eval() >= m_CriterionThreshold) { currentGeometry->SetNodeId(this->GetNextID()); currentGeometry->SetFieldAsDouble("Belief", m_Bel);