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
47e2d0a6
Commit
47e2d0a6
authored
13 years ago
by
Otmane Lahlou
Browse files
Options
Downloads
Patches
Plain Diff
ENH: port concatenateVectorData application to new framework
parent
2ba184da
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Applications/Utils/otbConcatenateVectorData.cxx
+70
-56
70 additions, 56 deletions
Applications/Utils/otbConcatenateVectorData.cxx
with
70 additions
and
56 deletions
Applications/Utils/otbConcatenateVectorData.cxx
+
70
−
56
View file @
47e2d0a6
...
@@ -15,75 +15,89 @@
...
@@ -15,75 +15,89 @@
PURPOSE. See the above copyright notices for more information.
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
=========================================================================*/
#include
"otb
ConcatenateVectorData
.h"
#include
"otb
WrapperApplication
.h"
#include
"otbWrapperApplicationFactory.h"
#include
"otbConcatenateVectorDataFilter.h"
#include
"otbConcatenateVectorDataFilter.h"
#include
"otbVectorData.h"
#include
"otbVectorDataFileWriter.h"
#include
"otbVectorDataFileReader.h"
namespace
otb
namespace
otb
{
{
namespace
Wrapper
{
int
ConcatenateVectorData
::
Describe
(
ApplicationDescriptor
*
descriptor
)
class
ConcatenateVectorData
:
public
Application
{
{
descriptor
->
SetName
(
"ConcatenateVectorData"
);
descriptor
->
SetDescription
(
"Concatenate VectorDatas"
);
descriptor
->
AddOptionNParams
(
"InputVectorDatas"
,
"Input VectorDatas to concatenate"
,
"in"
,
true
,
ApplicationDescriptor
::
FileName
);
descriptor
->
AddOption
(
"OutputVectorData"
,
"Output vector data"
,
"out"
,
1
,
true
,
ApplicationDescriptor
::
FileName
);
return
EXIT_SUCCESS
;
public:
}
/** Standard class typedefs. */
typedef
ConcatenateVectorData
Self
;
typedef
Application
Superclass
;
typedef
itk
::
SmartPointer
<
Self
>
Pointer
;
typedef
itk
::
SmartPointer
<
const
Self
>
ConstPointer
;
int
ConcatenateVectorData
::
Execute
(
otb
::
ApplicationOptionsResult
*
parseResult
)
/** Standard macro */
{
itkNewMacro
(
Self
);
try
{
typedef
otb
::
VectorData
<>
VectorDataType
;
typedef
otb
::
VectorDataFileReader
<
VectorDataType
>
ReaderType
;
typedef
otb
::
VectorDataFileWriter
<
VectorDataType
>
WriterType
;
typedef
otb
::
ConcatenateVectorDataFilter
<
VectorDataType
>
ConcatenateFilterType
;
itkTypeMacro
(
ConcatenateVectorData
,
otb
::
Application
);
// Get number of input vectorDatas
/** VectorData Concatenate filter*/
unsigned
int
nbInputs
=
parseResult
->
GetNumberOfParameters
(
"InputVectorDatas"
)
;
typedef
otb
::
ConcatenateVectorDataFilter
<
VectorDataType
>
ConcatenateFilterType
;
// Instanciate a concatenate filter Concatenate the vector datas
private:
ConcatenateFilterType
::
Pointer
concatenate
=
ConcatenateFilterType
::
New
();
ConcatenateVectorData
()
{
for
(
unsigned
int
idx
=
0
;
idx
<
nbInputs
;
idx
++
)
SetName
(
"ConcatenateVectorData"
);
{
SetDescription
(
"Concatenate VectorDatas"
);
// Reader object
ReaderType
::
Pointer
reader
=
ReaderType
::
New
();
// SetDocName("Rescale Image Application");
reader
->
SetFileName
(
parseResult
->
GetParameterString
(
"InputVectorDatas"
,
idx
).
c_str
());
// SetDocLongDescription("This application scale the given image pixel intensity between two given values. "
reader
->
Update
();
// "By default min (resp. max) value is set to 0 (resp. 255).");
concatenate
->
AddInput
(
reader
->
GetOutput
());
// SetDocLimitations("None");
}
// SetDocAuthors("OTB-Team");
// SetDocSeeAlso(" ");
// SetDocCLExample("otbApplicationLauncherCommandLine Rescale ${OTB-BIN}/bin"
// " --in ${OTB-DATA}/Input/poupees.tif --out rescaledImage.tif --outmin 20 --outmax 150");
// AddDocTag("Image Manipulation");
}
virtual
~
ConcatenateVectorData
()
{
}
void
DoCreateParameters
()
{
AddParameter
(
ParameterType_InputVectorDataList
,
"vd"
,
"Input VectorDatas to concatenate"
);
SetParameterDescription
(
"vd"
,
"Vector Data of sample used to validate the estimator."
);
AddParameter
(
ParameterType_OutputVectorData
,
"out"
,
"Concatenated VectorData"
);
}
void
DoUpdateParameters
()
{
// Nothing to do here for the parameters : all are independent
}
void
DoExecute
()
{
// Get the input VectorData list
VectorDataListType
*
vectorDataList
=
GetParameterVectorDataList
(
"vd"
);
// Write the output
// Concatenate filter object
WriterType
::
Pointer
writer
=
WriterType
::
New
();
m_ConcatenateFilter
=
ConcatenateFilterType
::
New
();
writer
->
SetFileName
(
parseResult
->
GetParameterString
(
"OutputVectorData"
).
c_str
());
writer
->
SetInput
(
concatenate
->
GetOutput
());
writer
->
Update
();
}
for
(
unsigned
int
idx
=
0
;
idx
<
vectorDataList
->
Size
();
idx
++
)
catch
(
itk
::
ExceptionObject
&
err
)
{
{
m_ConcatenateFilter
->
AddInput
(
vectorDataList
->
GetNthElement
(
idx
));
std
::
cout
<<
"Following otbException caught :"
<<
std
::
endl
;
}
std
::
cout
<<
err
<<
std
::
endl
;
return
EXIT_FAILURE
;
// Set the output
}
SetParameterOutputVectorData
(
"out"
,
m_ConcatenateFilter
->
GetOutput
());
catch
(
std
::
bad_alloc
&
err
)
}
{
std
::
cout
<<
"Exception bad_alloc : "
<<
(
char
*
)
err
.
what
()
<<
std
::
endl
;
ConcatenateFilterType
::
Pointer
m_ConcatenateFilter
;
return
EXIT_FAILURE
;
};
}
catch
(
...
)
{
std
::
cout
<<
"Unknown Exception found !"
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
return
EXIT_SUCCESS
;
}
}
}
}
OTB_APPLICATION_EXPORT
(
otb
::
Wrapper
::
ConcatenateVectorData
)
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