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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
David Youssefi
otb
Commits
ac14e9f7
Commit
ac14e9f7
authored
13 years ago
by
Cyrille Valladeau
Browse files
Options
Downloads
Patches
Plain Diff
ADD: otbVectorDataDSValidation application
parents
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CartographicDBValidation/otbVectorDataDSValidation.cxx
+98
-0
98 additions, 0 deletions
CartographicDBValidation/otbVectorDataDSValidation.cxx
with
98 additions
and
0 deletions
CartographicDBValidation/otbVectorDataDSValidation.cxx
0 → 100644
+
98
−
0
View file @
ac14e9f7
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include
"otbVectorDataDSValidation.h"
#include
"otbVectorDataToDSValidatedVectorDataFilter.h"
#include
"otbVectorData.h"
#include
"otbVectorDataFileReader.h"
#include
"otbVectorDataFileWriter.h"
#include
"otbFuzzyDescriptorsModelManager.h"
namespace
otb
{
int
VectorDataDSValidation
::
Describe
(
ApplicationDescriptor
*
descriptor
)
{
descriptor
->
SetName
(
"Vector data validation parser function"
);
descriptor
->
SetDescription
(
"Vector data validation."
);
descriptor
->
AddOption
(
"InputShapeFileName"
,
"Input Shape file name"
,
"in"
,
1
,
true
,
ApplicationDescriptor
::
FileName
);
descriptor
->
AddOption
(
"OutputShapeFileName"
,
"Output Shape file name"
,
"out"
,
1
,
true
,
ApplicationDescriptor
::
FileName
);
descriptor
->
AddOptionNParams
(
"Hypothesis"
,
"Hypothesis"
,
"hyp"
,
true
,
ApplicationDescriptor
::
StringList
);
descriptor
->
AddOption
(
"DescriptorsModelFileName"
,
"Fuzzy descriptors model xml file"
,
"descMod"
,
1
,
true
,
ApplicationDescriptor
::
FileName
);
descriptor
->
AddOption
(
"CriterionFormula"
,
"Criterion formula expression"
,
"exp"
,
1
,
true
,
ApplicationDescriptor
::
FileName
);
return
EXIT_SUCCESS
;
}
int
VectorDataDSValidation
::
Execute
(
otb
::
ApplicationOptionsResult
*
parseResult
)
{
typedef
float
PrecisionType
;
typedef
otb
::
VectorData
<
PrecisionType
>
VectorDataType
;
typedef
otb
::
VectorDataFileReader
<
VectorDataType
>
VectorDataReaderType
;
typedef
otb
::
VectorDataFileWriter
<
VectorDataType
>
VectorDataWriterType
;
typedef
otb
::
VectorDataToDSValidatedVectorDataFilter
<
VectorDataType
,
PrecisionType
>
VectorDataValidationFilterType
;
typedef
VectorDataValidationFilterType
::
LabelSetType
LabelSetType
;
typedef
FuzzyDescriptorsModelManager
::
DescriptorsModelType
DescriptorsModelType
;
// Read the vector data
VectorDataReaderType
::
Pointer
vdReader
=
VectorDataReaderType
::
New
();
vdReader
->
SetFileName
(
parseResult
->
GetParameterString
(
"InputShapeFileName"
));
vdReader
->
Update
();
// Load the descriptors model
std
::
string
descModFile
=
parseResult
->
GetParameterString
(
"DescriptorsModelFileName"
);
DescriptorsModelType
descMod
=
FuzzyDescriptorsModelManager
::
Read
(
descModFile
.
c_str
()
);
// Load the hypothesis
LabelSetType
hypothesis
;
unsigned
int
nbOfHypo
=
parseResult
->
GetNumberOfParameters
(
"Hypothesis"
);
for
(
unsigned
int
i
=
0
;
i
<
nbOfHypo
;
i
++
)
{
hypothesis
.
insert
(
parseResult
->
GetParameterString
(
"Hypothesis"
,
i
));
}
// Process
VectorDataValidationFilterType
::
Pointer
filter
=
VectorDataValidationFilterType
::
New
();
filter
->
SetInput
(
vdReader
->
GetOutput
());
filter
->
SetDescriptorModels
(
descMod
);
filter
->
SetHypothesis
(
hypothesis
);
filter
->
SetCriterionFormula
(
parseResult
->
GetParameterString
(
"CriterionFormula"
));
// Write the output
VectorDataWriterType
::
Pointer
vdWriter
=
VectorDataWriterType
::
New
();
vdWriter
->
SetFileName
(
parseResult
->
GetParameterString
(
"OutputShapeFileName"
));
vdWriter
->
SetInput
(
filter
->
GetOutput
());
vdWriter
->
Update
();
return
EXIT_SUCCESS
;
}
}
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