diff --git a/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.h b/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.h index 792d2c93bf1a3f27fa1120ac7ad17932f2d93e10..e1c280258c8061aaaa00d2078f42cba8eb57bf2d 100644 --- a/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.h +++ b/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.h @@ -136,8 +136,18 @@ public: if (model.size() != 4) { - itkExceptionMacro(<< "Wrong model!") + itkExceptionMacro(<< "Wrong model! Size(=" + << model.size() + << ") > 4" ) } + else if (model[0]<0 || model[1]<model[0] || model[2]<model[1] || model[2]>1) + { + itkExceptionMacro(<< "Wrong model! Values have to be 0<=v1<=v2<=v3<=1" ) + } + else if (model[3]<.75 || model[3]>1) + { + itkExceptionMacro(<< "Wrong model! Values have to be 0.75<=v4<=1" ) + } else { for (unsigned j=0; j<nbDescriptor; j++) @@ -152,7 +162,7 @@ public: } else { - itkExceptionMacro(<< "Wrong model!") + itkExceptionMacro(<< "Wrong model! Value must be between 0 and 1") } } } @@ -171,6 +181,11 @@ public: m_Hypothesis = hypothesis; } + unsigned int GetNumberOfParameters() + { + return (m_DescriptorModels.size() * 4); + } + protected: /** Triggers the Computation */ diff --git a/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.txx b/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.txx index be620fdf5ebd2025f5ef38125b3aee3f21efbd1f..3d8d774ffb437e5a8a4c853a869ee06e457bdf8f 100644 --- a/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.txx +++ b/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.txx @@ -106,7 +106,6 @@ VectorDataToDSValidatedVectorDataFilter<TVectorData, TPrecision> } //Initialize parser - //std::cout << m_CriterionFormula << std::endl; m_Parser->SetExpr(m_CriterionFormula); m_Parser->DefineVar("Belief", &m_Bel); m_Parser->DefineVar("Plausibility", &m_Plau); @@ -154,12 +153,6 @@ VectorDataToDSValidatedVectorDataFilter<TVectorData, TPrecision> mass->SetMass(H, m_FuzzyVars[i]->GetMembership(fuzName, currentGeometry->GetFieldAsDouble(fuzName))); mass->SetMass(H_, m_FuzzyVars[i]->GetMembership(fuzName_, currentGeometry->GetFieldAsDouble(fuzName))); -/* - std::cout << fuzName << " : " << currentGeometry->GetFieldAsDouble(fuzName) - << " " << m_FuzzyVars[i]->GetMembership(fuzName, currentGeometry->GetFieldAsInt(fuzName)) << std::endl; - std::cout << fuzName_ << " : " << currentGeometry->GetFieldAsDouble(fuzName) - << " " << m_FuzzyVars[i]->GetMembership(fuzName_, currentGeometry->GetFieldAsDouble(fuzName)) << std::endl; -*/ mass->EstimateUncertainty(); jointMassFilter->PushBackInput(mass); @@ -168,21 +161,14 @@ VectorDataToDSValidatedVectorDataFilter<TVectorData, TPrecision> jointMassFilter->Update(); m_Bel = jointMassFilter->GetOutput()->GetBelief(m_Hypothesis); m_Plau = jointMassFilter->GetOutput()->GetPlausibility(m_Hypothesis); - /* - std::cout << "Bel : " << m_Bel << std::endl; - std::cout << "Plau: " << m_Plau << std::endl; - */ - if (m_Parser->Eval()) + + if (m_Parser->Eval()) { - //std::cout << "Feature Validated : " << m_Parser->Eval() << std::endl; currentGeometry->SetNodeId(this->GetNextID()); + currentGeometry->SetFieldAsDouble("Belief", m_Bel); + currentGeometry->SetFieldAsDouble("Plausi", m_Plau); this->GetOutput(0)->GetDataTree()->Add(currentGeometry, folder); } - else - { - //std::cout << "Feature Rejected : " << m_Parser->Eval() << std::endl; - } - //itVector.GoToEnd(); //TEST ONLY########################################### } ++itVector; }