Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Erik Palmer
VTK
Commits
5340dfd9
Commit
5340dfd9
authored
7 years ago
by
Dan Lipsa
Browse files
Options
Downloads
Patches
Plain Diff
Read the Point Data Record format from the header.
This determines the point scalar (classification or RGB)
parent
96bea510
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
IO/LAS/Testing/Cxx/TestLASReader.cxx
+2
-1
2 additions, 1 deletion
IO/LAS/Testing/Cxx/TestLASReader.cxx
IO/LAS/vtkLASReader.cxx
+24
-10
24 additions, 10 deletions
IO/LAS/vtkLASReader.cxx
IO/LAS/vtkLASReader.h
+0
-15
0 additions, 15 deletions
IO/LAS/vtkLASReader.h
with
26 additions
and
26 deletions
IO/LAS/Testing/Cxx/TestLASReader.cxx
+
2
−
1
View file @
5340dfd9
...
...
@@ -34,12 +34,13 @@ int TestLASReader(int argc, char **argv)
{
//const char* fileName = "Data/tp_manual_20160907131754_flt.las";
const
char
*
fileName
=
"Data/test_buildings.las"
;
//const char* fileName = "Data/test_1.las";
//const char* fileName = "Data/test_3.las";
const
char
*
path
=
vtkTestUtilities
::
ExpandDataFileName
(
argc
,
argv
,
fileName
);
vtkNew
<
vtkLASReader
>
reader
;
//Select source file
reader
->
SetFileName
(
path
);
reader
->
SetVisualizationType
(
vtkLASReader
::
Classification
);
//Read the output
reader
->
Update
();
...
...
This diff is collapsed.
Click to expand it.
IO/LAS/vtkLASReader.cxx
+
24
−
10
View file @
5340dfd9
...
...
@@ -29,6 +29,7 @@
#include
<fstream>
#include
<iostream>
#include
<valarray>
vtkStandardNewMacro
(
vtkLASReader
)
...
...
@@ -51,7 +52,6 @@ vtkLASReader::vtkLASReader() :
{
this
->
FileName
=
NULL
;
this
->
PointRecordsCount
=
0
;
this
->
VisualizationType
=
None
;
this
->
Header
=
NULL
;
this
->
SetNumberOfInputPorts
(
0
);
...
...
@@ -136,20 +136,30 @@ void vtkLASReader::ReadPointRecordData(liblas::Reader &reader, vtkPolyData* poin
vtkNew
<
vtkPoints
>
points
;
vtkNew
<
vtkUnsignedCharArray
>
colors
;
colors
->
SetNumberOfComponents
(
3
);
std
::
valarray
<
double
>
scale
=
{
this
->
Header
->
GetScaleX
(),
this
->
Header
->
GetScaleY
(),
this
->
Header
->
GetScaleZ
()
};
std
::
valarray
<
double
>
offset
=
{
this
->
Header
->
GetOffsetX
(),
this
->
Header
->
GetOffsetY
(),
this
->
Header
->
GetOffsetZ
()
};
liblas
::
PointFormatName
pointFormat
=
this
->
Header
->
GetDataFormatId
();
std
::
cout
<<
"PointFormat: "
<<
pointFormat
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
this
->
PointRecordsCount
&&
reader
.
ReadNextPoint
();
i
++
)
{
liblas
::
Point
const
&
p
=
reader
.
GetPoint
();
points
->
InsertNextPoint
(
p
.
GetX
()
*
this
->
Header
->
GetScaleX
()
*
2
+
this
->
Header
->
GetOffsetX
(),
p
.
GetY
()
*
this
->
Header
->
GetScaleY
()
*
2
+
this
->
Header
->
GetOffsetY
(),
p
.
GetZ
()
*
this
->
Header
->
GetScaleZ
()
*
2
+
this
->
Header
->
GetOffsetZ
());
std
::
valarray
<
double
>
lasPoint
=
{
p
.
GetX
(),
p
.
GetY
(),
p
.
GetZ
()
};
std
::
valarray
<
double
>
point
=
lasPoint
*
scale
+
offset
;
points
->
InsertNextPoint
(
&
lasPoint
[
0
]);
unsigned
char
*
color
;
switch
(
this
->
VisualizationType
)
switch
(
pointFormat
)
{
case
None
:
break
;
case
Color
:
case
liblas
::
ePointFormat2
:
case
liblas
::
ePointFormat3
:
case
liblas
::
ePointFormat5
:
{
unsigned
char
color
[
3
];
color
[
0
]
=
p
.
GetColor
().
GetRed
()
/
256
;
...
...
@@ -158,9 +168,13 @@ void vtkLASReader::ReadPointRecordData(liblas::Reader &reader, vtkPolyData* poin
colors
->
InsertNextTypedTuple
(
color
);
}
break
;
case
Classification
:
case
liblas
::
ePointFormat0
:
case
liblas
::
ePointFormat1
:
colors
->
InsertNextTypedTuple
(
this
->
ClassificationColorMap
[
p
.
GetClassification
().
GetClass
()]
);
break
;
case
liblas
::
ePointFormatUnknown
:
default
:
break
;
}
...
...
@@ -168,7 +182,7 @@ void vtkLASReader::ReadPointRecordData(liblas::Reader &reader, vtkPolyData* poin
pointsPolyData
->
SetPoints
(
points
);
if
(
this
->
VisualizationType
)
if
(
pointFormat
!=
liblas
::
ePointFormatUnknown
)
{
pointsPolyData
->
GetPointData
()
->
SetScalars
(
colors
);
}
...
...
This diff is collapsed.
Click to expand it.
IO/LAS/vtkLASReader.h
+
0
−
15
View file @
5340dfd9
...
...
@@ -46,15 +46,6 @@ public:
vtkTypeMacro
(
vtkLASReader
,
vtkPolyDataAlgorithm
);
virtual
void
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
override
;
/**
* All the Visualization Types have been listed here
*/
enum
VisualizationTypeConstants
{
None
=
0
,
Color
,
Classification
};
/**
* All the Classification Types according to LAS spec are listed here
*/
...
...
@@ -77,11 +68,6 @@ public:
vtkSetStringMacro
(
FileName
);
vtkGetStringMacro
(
FileName
);
/**
* Accessor for Visualization Type
*/
vtkSetMacro
(
VisualizationType
,
VisualizationTypeConstants
);
vtkGetMacro
(
VisualizationType
,
VisualizationTypeConstants
);
/**
* Accessor for the LAS Header file
...
...
@@ -116,7 +102,6 @@ protected:
unsigned
char
ClassificationColorMap
[
10
][
3
];
int
PointRecordsCount
;
VisualizationTypeConstants
VisualizationType
;
liblas
::
Header
*
Header
;
char
*
FileName
;
};
...
...
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