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
Container Registry
Model registry
Operate
Environments
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
Main Repositories
otb
Commits
095060ea
Commit
095060ea
authored
16 years ago
by
Emmanuel Christophe
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Adding example for point set reader
parent
8303c36f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Examples/IO/CMakeLists.txt
+3
-0
3 additions, 0 deletions
Examples/IO/CMakeLists.txt
Examples/IO/LidarReaderExample.cxx
+101
-0
101 additions, 0 deletions
Examples/IO/LidarReaderExample.cxx
with
104 additions
and
0 deletions
Examples/IO/CMakeLists.txt
+
3
−
0
View file @
095060ea
...
...
@@ -61,6 +61,9 @@ TARGET_LINK_LIBRARIES(DEMToImageGenerator OTBProjections OTBIO OTBCommon ITKComm
ADD_EXECUTABLE
(
DEMToOrthoImageGenerator DEMToOrthoImageGenerator.cxx
)
TARGET_LINK_LIBRARIES
(
DEMToOrthoImageGenerator OTBProjections OTBIO OTBCommon ITKCommon ITKIO otbossim
)
ADD_EXECUTABLE
(
LidarReaderExample LidarReaderExample.cxx
)
TARGET_LINK_LIBRARIES
(
LidarReaderExample OTBIO OTBCommon ITKCommon ITKIO otbossim
)
IF
(
ITK_USE_REVIEW
)
ADD_EXECUTABLE
(
LidarToImageExample LidarToImageExample.cxx
)
TARGET_LINK_LIBRARIES
(
LidarToImageExample OTBIO OTBCommon ITKCommon ITKIO otbossim
)
...
...
This diff is collapsed.
Click to expand it.
Examples/IO/LidarReaderExample.cxx
0 → 100644
+
101
−
0
View file @
095060ea
/*=========================================================================
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.
=========================================================================*/
// Software Guide : BeginCommandLineArgs
// INPUTS: {srs.las}
// Software Guide : EndCommandLineArgs
// Software Guide : BeginLatex
//
// This example describes how to read a lidar data file and to display the basic
// information about it. Here, OTB make use of libLAS.
//
// The first step toward the use of these filters is to include the proper header files.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
#include
"otbPointSetFileReader.h"
#include
"itkPointSet.h"
#include
<fstream>
int
main
(
int
argc
,
char
*
argv
[])
{
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We need now to declare the data types that we will be using and instanciate the
// reader (which is a \doxygen{otb}{PointSetFileReader}).
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef
itk
::
PointSet
<
double
,
2
>
PointSetType
;
typedef
otb
::
PointSetFileReader
<
PointSetType
>
PointSetFileReaderType
;
PointSetFileReaderType
::
Pointer
reader
=
PointSetFileReaderType
::
New
();
reader
->
SetFileName
(
argv
[
1
]);
reader
->
Update
();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We can already display some interesting information such as the
// data extension and the number of points:
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
std
::
cout
<<
"*** Data area *** "
<<
std
::
endl
;
std
::
cout
<<
std
::
setprecision
(
15
);
std
::
cout
<<
" - Easting min: "
<<
reader
->
GetMinX
()
<<
std
::
endl
;
std
::
cout
<<
" - Easting max: "
<<
reader
->
GetMaxX
()
<<
std
::
endl
;
std
::
cout
<<
" - Northing min: "
<<
reader
->
GetMinY
()
<<
std
::
endl
;
std
::
cout
<<
" - Northing max: "
<<
reader
->
GetMaxY
()
<<
std
::
endl
;
std
::
cout
<<
"Data points: "
<<
reader
->
GetNumberOfPoints
()
<<
std
::
endl
;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We can also loop on the point to see each point with its coordinates and
// value. Be careful here, data set can have hundred of thousands of points:
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
PointSetType
::
Pointer
data
=
reader
->
GetOutput
();
unsigned
long
nPoints
=
data
->
GetNumberOfPoints
();
for
(
unsigned
long
i
=
0
;
i
<
nPoints
;
++
i
)
{
PointSetType
::
PointType
point
;
data
->
GetPoint
(
i
,
&
point
);
std
::
cout
<<
point
<<
" : "
;
PointSetType
::
PixelType
value
;
data
->
GetPointData
(
i
,
&
value
);
std
::
cout
<<
value
<<
std
::
endl
;
}
return
EXIT_SUCCESS
;
}
// Software Guide : EndCodeSnippet
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