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
de4fe543
Commit
de4fe543
authored
16 years ago
by
Emmanuel Christophe
Browse files
Options
Downloads
Patches
Plain Diff
DOC: finishing up example for VectorDataExtractROI
parent
1e4c92d2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Examples/Projections/VectorDataExtractROIExample.cxx
+45
-9
45 additions, 9 deletions
Examples/Projections/VectorDataExtractROIExample.cxx
with
45 additions
and
9 deletions
Examples/Projections/VectorDataExtractROIExample.cxx
+
45
−
9
View file @
de4fe543
...
@@ -29,6 +29,9 @@
...
@@ -29,6 +29,9 @@
// Most of the time, you won't be interested in the whole area and would like
// Most of the time, you won't be interested in the whole area and would like
// to focuss only on the area corresponding to your satellite image.
// to focuss only on the area corresponding to your satellite image.
//
//
// The \doxygen{otb}{VectorDataExtractROI} is able to extract the area corresponding
// to your satellite image, even if the image is still in sensor geometry (provided
// the sensor model is supported by OTB). Let's see how we can do that.
//
//
// This example demonstrates the use of the
// This example demonstrates the use of the
// \doxygen{otb}{VectorDataExtractROI}.
// \doxygen{otb}{VectorDataExtractROI}.
...
@@ -60,7 +63,7 @@ int main( int argc, char* argv[] )
...
@@ -60,7 +63,7 @@ int main( int argc, char* argv[] )
typedef
double
Type
;
typedef
double
Type
;
typedef
otb
::
VectorData
<>
VectorDataType
;
typedef
otb
::
VectorData
<>
VectorDataType
;
typedef
otb
::
VectorDataExtractROI
<
VectorDataType
>
FilterType
;
typedef
otb
::
VectorDataFileReader
<
VectorDataType
>
VectorDataFileReaderType
;
typedef
otb
::
VectorDataFileReader
<
VectorDataType
>
VectorDataFileReaderType
;
typedef
otb
::
VectorDataFileWriter
<
VectorDataType
>
VectorDataWriterType
;
typedef
otb
::
VectorDataFileWriter
<
VectorDataType
>
VectorDataWriterType
;
...
@@ -72,11 +75,28 @@ int main( int argc, char* argv[] )
...
@@ -72,11 +75,28 @@ int main( int argc, char* argv[] )
imageReader
->
SetFileName
(
inImageName
);
imageReader
->
SetFileName
(
inImageName
);
imageReader
->
UpdateOutputInformation
();
imageReader
->
UpdateOutputInformation
();
// Software Guide : BeginLatex
//
// After the usual declaration (you can check the source file for the details),
// we can declare the \doxygen{otb}{VectorDataExtractROI}:
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef
otb
::
VectorDataExtractROI
<
VectorDataType
>
FilterType
;
FilterType
::
Pointer
filter
=
FilterType
::
New
();
FilterType
::
Pointer
filter
=
FilterType
::
New
();
VectorDataFileReaderType
::
Pointer
reader
=
VectorDataFileReaderType
::
New
();
// Software Guide : EndCodeSnippet
VectorDataWriterType
::
Pointer
writer
=
VectorDataWriterType
::
New
();
// Software Guide : BeginLatex
//
// Then, we need to specify the region to extract. This region is a bit special as
// it contains also information related to its reference system (cartographic projection
// or sensor model projection). We retrieve all these information from the image
// we gave as an input.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
TypedRegion
region
;
TypedRegion
region
;
TypedRegion
::
SizeType
size
;
TypedRegion
::
SizeType
size
;
TypedRegion
::
IndexType
index
;
TypedRegion
::
IndexType
index
;
...
@@ -92,18 +112,34 @@ int main( int argc, char* argv[] )
...
@@ -92,18 +112,34 @@ int main( int argc, char* argv[] )
region
.
SetSize
(
size
);
region
.
SetSize
(
size
);
region
.
SetOrigin
(
index
);
region
.
SetOrigin
(
index
);
otb
::
ImageMetadataInterface
::
Pointer
imageMetadataInterface
=
otb
::
ImageMetadataInterface
::
New
();
otb
::
ImageMetadataInterface
::
Pointer
imageMetadataInterface
region
.
SetRegionProjection
(
imageMetadataInterface
->
GetProjectionRef
(
imageReader
->
GetOutput
()
->
GetMetaDataDictionary
()));
=
otb
::
ImageMetadataInterface
::
New
();
region
.
SetRegionProjection
(
imageMetadataInterface
->
GetProjectionRef
(
imageReader
->
GetOutput
()
->
GetMetaDataDictionary
()));
region
.
SetKeywordList
(
imageReader
->
GetOutput
()
->
GetImageKeywordlist
());
region
.
SetKeywordList
(
imageReader
->
GetOutput
()
->
GetImageKeywordlist
());
reader
->
SetFileName
(
inVectorName
);
filter
->
SetInput
(
reader
->
GetOutput
());
filter
->
SetRegion
(
region
);
filter
->
SetRegion
(
region
);
// Software Guide : EndCodeSnippet
VectorDataFileReaderType
::
Pointer
reader
=
VectorDataFileReaderType
::
New
();
VectorDataWriterType
::
Pointer
writer
=
VectorDataWriterType
::
New
();
reader
->
SetFileName
(
inVectorName
);
writer
->
SetFileName
(
outVectorName
);
writer
->
SetFileName
(
outVectorName
);
// Software Guide : BeginLatex
//
// And finally, we can plug the filter in the pipeline:
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
filter
->
SetInput
(
reader
->
GetOutput
());
writer
->
SetInput
(
filter
->
GetOutput
());
writer
->
SetInput
(
filter
->
GetOutput
());
// Software Guide : EndCodeSnippet
writer
->
Update
();
writer
->
Update
();
...
...
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