Skip to content
Snippets Groups Projects
Commit f1570e6f authored by Jonathan Guinet's avatar Jonathan Guinet
Browse files

ENH: vector data projection filter have been replaced by...

ENH: vector data projection filter have been replaced by vectordataintoimageprojection filter, dem handling.
parent 63a34cf4
No related branches found
No related tags found
No related merge requests found
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
// Classification filter // Classification filter
#include "otbSVMImageClassificationFilter.h" #include "otbSVMImageClassificationFilter.h"
// VectorData projection filter // Extract a ROI of the vectordata
#include "otbVectorDataProjectionFilter.h" #include "otbVectorDataIntoImageProjectionFilter.h"
namespace otb namespace otb
{ {
...@@ -111,8 +111,8 @@ public: ...@@ -111,8 +111,8 @@ public:
typedef otb::ConfusionMatrixCalculator<LabelListSampleType, LabelListSampleType> ConfusionMatrixCalculatorType; typedef otb::ConfusionMatrixCalculator<LabelListSampleType, LabelListSampleType> ConfusionMatrixCalculatorType;
typedef ClassifierType::OutputType ClassifierOutputType; typedef ClassifierType::OutputType ClassifierOutputType;
// Projection of a vectorData // Extract ROI and Project vectorData
typedef otb::VectorDataProjectionFilter<VectorDataType, VectorDataType> VectorDataProjectionFilterType; typedef otb::VectorDataIntoImageProjectionFilter<VectorDataType, VectorImageType> VectorDataReprojectionType;
private: private:
ValidateSVMImagesClassifier() ValidateSVMImagesClassifier()
...@@ -180,21 +180,33 @@ private: ...@@ -180,21 +180,33 @@ private:
VectorDataType::Pointer vectorData = vectorDataList->GetNthElement(imgIndex); VectorDataType::Pointer vectorData = vectorDataList->GetNthElement(imgIndex);
vectorData->Update(); vectorData->Update();
// Project the vectorData in the Image Coodinate system VectorDataReprojectionType::Pointer vdreproj = VectorDataReprojectionType::New();
VectorDataProjectionFilterType::Pointer vproj = VectorDataProjectionFilterType::New(); vdreproj->SetInputImage(image);
vproj->SetInput(vectorData); vdreproj->SetInput(vectorData);
vproj->SetInputProjectionRef(vectorData->GetProjectionRef()); vdreproj->SetUseOutputSpacingAndOriginFromImage(false);
vproj->SetOutputKeywordList(image->GetImageKeywordlist());
vproj->SetOutputProjectionRef(image->GetProjectionRef()); // Configure DEM directory
// TODO add DEM support if (HasUserValue("dem"))
vproj->Update(); {
vdreproj->SetDEMDirectory(GetParameterString("dem"));
}
else
{
if (otb::ConfigurationFile::GetInstance()->IsValid())
{
vdreproj->SetDEMDirectory(otb::ConfigurationFile::GetInstance()->GetDEMDirectory());
}
}
vdreproj->Update();
//Sample list generator //Sample list generator
ListSampleGeneratorType::Pointer sampleGenerator = ListSampleGeneratorType::New(); ListSampleGeneratorType::Pointer sampleGenerator = ListSampleGeneratorType::New();
//Set inputs of the sample generator //Set inputs of the sample generator
//TODO the ListSampleGenerator perform UpdateOutputData over the input image (need a persistent implementation) //TODO the ListSampleGenerator perform UpdateOutputData over the input image (need a persistent implementation)
sampleGenerator->SetInput(image); sampleGenerator->SetInput(image);
sampleGenerator->SetInputVectorData(vproj->GetOutput()); sampleGenerator->SetInputVectorData(vdreproj->GetOutput());
sampleGenerator->SetValidationTrainingProportion(1.0); // All in validation sampleGenerator->SetValidationTrainingProportion(1.0); // All in validation
sampleGenerator->SetClassKey("Class"); sampleGenerator->SetClassKey("Class");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment