Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main Repositories
otb
Commits
3366436e
Commit
3366436e
authored
13 years ago
by
Aurélien Bricier
Browse files
Options
Downloads
Patches
Plain Diff
DOC: added class documentation and cleaned code
parent
44192b38
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.h
+36
-13
36 additions, 13 deletions
Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.h
Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.txx
+22
-23
22 additions, 23 deletions
Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.txx
with
58 additions
and
36 deletions
Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.h
+
36
−
13
View file @
3366436e
...
...
@@ -31,11 +31,37 @@
namespace
otb
{
/** \class VectorDataToVectorDataFilter
* \brief
.
*
/** \class VectorDataTo
DSValidated
VectorDataFilter
* \brief
VectorData filter validating data nodes using
*
Dempster-Shafer theory.
*
* This filter takes as input a vector data containing
* features score and validate (or not) each data node
* according to these features score, a fuzzy model corresponding
* to each feature and a criterion according to the Dempster-Shafer
* theory. By default the filter is (for now) parametrized to process
* VectorDatas providing by the VectorDataToRoadDescriptionFilter.
* The hypothesis must be set using the SetHypothesis method.
* The convention is for each feature Fe, a mass of Belief is defined
* with two variables named Fe and Fe_. Thus, an hypothesis must declared:
* VectorDataToVectorDataFilter::LabelSetType hyp;
* hyp.insert("Fe(i)");
* hyp.insert("Fe(j)_");
* hyp.insert("Fe(k)_");
*
* Fe(i), Fe(j) and Fe(k) being descriptors.
*
* The criterion can be set through SetCriterionFormula() as a
* string refering to "Belief" and "Plausibility" from the
* Dempster-Shafer theory. By default the criterion is:
* "((Belief + Plausibility)/2) >= 0.5"
*
* The concidered features will be the intersection between
* the features embedded in this filter and the features embedded
* in the input vector data. For now, the filter uses "NDVI" and
* "RADIOM" features.
*
*
* \ingroup VectorDataFilter
* \sa VectorDataToRoadDescriptionFilter
* \sa VectorDataToBuildingDescriptionFilter
...
...
@@ -87,14 +113,6 @@ public:
itkGetConstMacro
(
CriterionFormula
,
std
::
string
);
itkSetMacro
(
CriterionFormula
,
std
::
string
);
itkGetConstMacro
(
CriterionThreshold
,
double
);
itkSetMacro
(
CriterionThreshold
,
double
);
/*
itkGetConstMacro(Hypothesis, LabelSetType);
itkSetMacro(Hypothesis, LabelSetType);
*/
LabelSetType
GetHypothesis
()
{
return
m_Hypothesis
;
...
...
@@ -116,6 +134,12 @@ protected:
/**PrintSelf method */
virtual
void
PrintSelf
(
std
::
ostream
&
os
,
itk
::
Indent
indent
)
const
;
std
::
string
GetNextID
()
{
std
::
ostringstream
oss
;
oss
<<
m_CurrentID
++
;
return
oss
.
str
();
}
private
:
VectorDataToDSValidatedVectorDataFilter
(
const
Self
&
);
//purposely not implemented
...
...
@@ -130,8 +154,7 @@ private:
typename
ParserType
::
Pointer
m_Parser
;
std
::
string
m_CriterionFormula
;
double
m_CriterionThreshold
;
unsigned
int
m_CurrentID
;
};
}
// end namespace otb
...
...
This diff is collapsed.
Click to expand it.
Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.txx
+
22
−
23
View file @
3366436e
...
...
@@ -29,20 +29,20 @@ namespace otb
template <class TVectorData, class TPrecision>
VectorDataToDSValidatedVectorDataFilter<TVectorData, TPrecision>
::VectorDataToDSValidatedVectorDataFilter() :
m_CriterionFormula("(Belief + Plausibility)/2"),
m_C
riterionThreshold(0.5
)
m_CriterionFormula("(
(
Belief + Plausibility)/2
) >= 0.5
"),
m_C
urrentID(0
)
{
this->SetNumberOfRequiredInputs(1);
//Default road descriptors
std::vector<double> ndvi, radiom, lsd, shadow;
ndvi.push_back(0.25); ndvi.push_back(0.5);ndvi.push_back(0.75); ndvi.push_back(0.99);
radiom.push_back(0.25); radiom.push_back(0.5); radiom.push_back(0.75); radiom.push_back(0.90);
lsd.push_back(0.25); lsd.push_back(0.5); lsd.push_back(0.75); lsd.push_back(0.96);
shadow.push_back(0.25); shadow.push_back(0.5); shadow.push_back(0.75); shadow.push_back(0.98);
//
lsd.push_back(0.25); lsd.push_back(0.5); lsd.push_back(0.75); lsd.push_back(0.96);
//
shadow.push_back(0.25); shadow.push_back(0.5); shadow.push_back(0.75); shadow.push_back(0.98);
AddDescriptor("NDVI", ndvi);
AddDescriptor("RADIOM", radiom);
AddDescriptor("LSD", lsd);
//
AddDescriptor("LSD", lsd);
//AddDescriptor("SHADOW", shadow);
m_Parser = ParserType::New();
...
...
@@ -105,7 +105,7 @@ VectorDataToDSValidatedVectorDataFilter<TVectorData, TPrecision>
}
//Initialize parser
std::cout << m_CriterionFormula << std::endl;
//
std::cout << m_CriterionFormula << std::endl;
m_Parser->SetExpr(m_CriterionFormula);
m_Parser->DefineVar("Belief", &m_Bel);
m_Parser->DefineVar("Plausibility", &m_Plau);
...
...
@@ -150,17 +150,15 @@ VectorDataToDSValidatedVectorDataFilter<TVectorData, TPrecision>
H.insert(fuzName);
H_.insert(fuzName_);
mass->SetMass(H, m_FuzzyVars[i]->GetMembership(fuzName,
(double)(currentGeometry->GetFieldAsInt(fuzName))/100.0));
mass->SetMass(H_, m_FuzzyVars[i]->GetMembership(fuzName_,
(double)(currentGeometry->GetFieldAsInt(fuzName))/100.0));
std::cout << fuzName << " : " << (double)(currentGeometry->GetFieldAsInt(fuzName))/100.
<< " " << m_FuzzyVars[i]->GetMembership(fuzName, (double)(currentGeometry->GetFieldAsInt(fuzName))/100.0) << std::endl;
std::cout << fuzName_ << " : " << (double)(currentGeometry->GetFieldAsInt(fuzName))/100.
<< " " << m_FuzzyVars[i]->GetMembership(fuzName_, (double)(currentGeometry->GetFieldAsInt(fuzName))/100.0) << std::endl;
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);
...
...
@@ -169,20 +167,21 @@ 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()
>= m_CriterionThreshold
)
*/
if (m_Parser->Eval())
{
std::cout << "Feature Validated : " << m_Parser->Eval() << std::endl;
//std::cout << "Feature Validated : " << m_Parser->Eval() << std::endl;
currentGeometry->SetNodeId(this->GetNextID());
this->GetOutput(0)->GetDataTree()->Add(currentGeometry, folder);
}
else
{
std::cout << "Feature Rejected : " << m_Parser->Eval() << std::endl;
//
std::cout << "Feature Rejected : " << m_Parser->Eval() << std::endl;
}
itVector.GoToEnd();//TEST ONLY###########################################
//
itVector.GoToEnd();//TEST ONLY###########################################
}
++itVector;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment