MCPcopy Create free account
hub / github.com/PDAL/PDAL / decodeHeader

Method decodeHeader

plugins/e57/io/Scan.cpp:104–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void Scan::decodeHeader()
105{
106 m_numPoints = m_rawPoints->childCount();
107
108 auto supportedFields = pdal::e57plugin::supportedE57Types();
109 e57::StructureNode prototype(m_rawPoints->prototype());
110
111 // Extract fields that can be extracted
112 for (auto& field: supportedFields)
113 {
114 if (prototype.isDefined(field))
115 {
116 m_e57TypeToPdalDimension.insert(field);
117 }
118 }
119 // Get pose estimation
120 getPose();
121
122 // Get rescale factors for new scan, These factors are only for
123 // dimensions with limits. This is required Since,
124 // 1. E57 support colors in uint8 as well as uint16. This is specified
125 // in header as "colorLimits".
126 // - If colorLimits is 0-255 then it is uint8 and if 0-65535 then
127 // it
128 // is uint16.
129 // - To make this consistant, We are rescaling colors to 0-65535
130 // range, Since default types for colors in PDAL are Unsigned16.
131 // 2. E57 supports intensity in float ranging 0-1. This is specified in
132 // header as "intensityLimits".
133 // - Since default type for intensity in PDAL is Unsigned16, E57
134 // intensity (between 0-1) need to be rescaled in uint16 (between
135 // 0-65535).
136 // To do the rescaling we need the rescale factors so that we can
137 // directly multiply them with colors and intensity values. E.g. - If
138 // color limit is 0-255 then rescale factor would be 257.00
139 // (double value) i.e 65535/(255-0)=257.
140 // - If color limit is 0-65535 then rescale factor would be 1.00
141 // (double value) i.e 65535/(65535-0)= 1.
142
143 std::fill_n(m_rescaleFactors, pdal::Dimension::COUNT, 1.0f);
144
145 auto scalableFields = pdal::e57plugin::scalableE57Types();
146 for (auto& field : scalableFields)
147 {
148 auto minmax = std::make_pair(0.0, 0.0);
149 if (pdal::e57plugin::getLimits(*m_rawData, field, minmax))
150 {
151 auto dim = pdal::e57plugin::e57ToPdal(field);
152 m_rescaleFactors[(int)dim] =
153 (float)(pdal::e57plugin::getPdalBounds(dim).second / (minmax.second - minmax.first));
154 }
155 }
156
157 // Cartesian Bounds
158 auto minMaxx = std::make_pair(0.0, 0.0);
159 auto minMaxy = std::make_pair(0.0, 0.0);
160 auto minMaxz = std::make_pair(0.0, 0.0);
161 pdal::e57plugin::getLimits(*m_rawData, "x", minMaxx);

Callers

nothing calls this directly

Calls 10

supportedE57TypesFunction · 0.85
scalableE57TypesFunction · 0.85
getLimitsFunction · 0.85
e57ToPdalFunction · 0.85
getPdalBoundsFunction · 0.85
prototypeMethod · 0.80
childCountMethod · 0.45
isDefinedMethod · 0.45
insertMethod · 0.45
growMethod · 0.45

Tested by

no test coverage detected