18 #ifndef __otbVectorDataToRoadDescriptionFilter_txx
19 #define __otbVectorDataToRoadDescriptionFilter_txx
27 template <
class TVectorData,
class TOpticalImage>
31 this->SetNumberOfRequiredInputs(3);
33 m_NDVIFeatureFunction = ParserConditionFeatureFunctionType::New();
34 m_NDVIFeatureFunction->SetExpression(
"ndvi(b3, b4) > 0.4");
36 m_SpectralAngleFeatureFunction = ParserConditionFeatureFunctionType::New();
37 m_SpectralAngleFeatureFunction->SetExpression(
"spectralAngle > 0.25");
46 m_SpectralAngleFeatureFunction->SetSpectralAngleReferencePixel(refPixel);
48 m_DBOverlapFeatureFunction = DBOverlapFeatureFunctionType::New();
50 m_DescriptorsList.push_back(
"NONDVI");
51 m_DescriptorsList.push_back(
"ROADSA");
52 m_DescriptorsList.push_back(
"NOBUIL");
55 template <
class TVectorData,
class TOpticalImage>
60 this->AddSupport(const_cast<OpticalImageType *>(support), 0);
63 template <
class TVectorData,
class TOpticalImage>
70 (this->GetSupport(0));
74 template <
class TVectorData,
class TOpticalImage>
79 this->AddSupport(const_cast<VectorDataType *>(support), 1);
82 template <
class TVectorData,
class TOpticalImage>
89 (this->GetSupport(1));
92 template <
class TVectorData,
class TOpticalImage>
97 m_NDVIFeatureFunction->SetInputImage(const_cast<OpticalImageType *>(this->GetOpticalImage()));
98 m_SpectralAngleFeatureFunction->SetInputImage(const_cast<OpticalImageType *>(this->GetOpticalImage()));
99 m_DBOverlapFeatureFunction->SetInputVectorData(const_cast<VectorDataType *>(this->GetBuildingsDB()));
102 typename DataNodeType::Pointer root = this->GetOutput(0)->GetDataTree()->GetRoot()->Get();
104 typename DataNodeType::Pointer document = DataNodeType::New();
107 this->GetOutput(0)->GetDataTree()->Add(document, root);
109 typename DataNodeType::Pointer folder = DataNodeType::New();
112 this->GetOutput(0)->GetDataTree()->Add(folder, document);
118 if (!itVector.
Get()->IsRoot() && !itVector.
Get()->IsDocument() && !itVector.
Get()->IsFolder())
120 typename DataNodeType::Pointer currentGeometry = itVector.
Get();
121 currentGeometry->SetFieldAsDouble(
"NONDVI", (
double)(m_NDVIFeatureFunction->Evaluate(*(currentGeometry.GetPointer()))[0]));
122 currentGeometry->SetFieldAsDouble(
"ROADSA", (
double)(m_SpectralAngleFeatureFunction->Evaluate(*(currentGeometry.GetPointer()))[0]));
123 currentGeometry->SetFieldAsDouble(
"NOBUIL", (
double)(m_DBOverlapFeatureFunction->Evaluate(*(currentGeometry.GetPointer()))[0]));
125 this->GetOutput(0)->GetDataTree()->Add(currentGeometry, folder);
132 template <
class TVectorData,
class TOpticalImage>
137 Superclass::PrintSelf(os, indent);