MCPcopy Create free account
hub / github.com/LAStools/LAStools / read_waveform

Method read_waveform

LASlib/src/laswaveform13reader.cpp:268–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266}
267
268BOOL LASwaveform13reader::read_waveform(const LASpoint* point)
269{
270 U32 index = point->wavepacket.getIndex();
271 if (index == 0)
272 {
273 return FALSE;
274 }
275
276 if (wave_packet_descr[index] == 0)
277 {
278 laserror("wavepacket is indexing non-existant descriptor %u", index);
279 return FALSE;
280 }
281
282 nbits = wave_packet_descr[index]->getBitsPerSample();
283 if ((nbits != 8) && (nbits != 16))
284 {
285 laserror("waveform with %d bits per samples not supported yet", nbits);
286 return FALSE;
287 }
288
289 nsamples = wave_packet_descr[index]->getNumberOfSamples();
290
291// temporary Optech Fix
292// nsamples = point->wavepacket.getSize();
293// if (nbits == 16) nsamples / 2;
294
295 if (nsamples == 0)
296 {
297 laserror("waveform has no samples");
298 return FALSE;
299 }
300
301 temporal = wave_packet_descr[index]->getTemporalSpacing();
302 location = point->wavepacket.getLocation();
303
304 XYZt[0] = point->wavepacket.getXt();
305 XYZt[1] = point->wavepacket.getYt();
306 XYZt[2] = point->wavepacket.getZt();
307
308 XYZreturn[0] = point->get_x();
309 XYZreturn[1] = point->get_y();
310 XYZreturn[2] = point->get_z();
311
312 // alloc data
313
314 if (size < ((nbits/8) * nsamples))
315 {
316 if (samples) delete [] samples;
317 samples = new U8[((nbits/8) * nsamples)];
318 }
319
320 size = ((nbits/8) * nsamples);
321
322 // read waveform
323
324 I64 position = start_of_waveform_data_packet_record + point->wavepacket.getOffset();
325 stream->seek(position);

Callers 2

mainFunction · 0.80
mainFunction · 0.80

Calls 7

laserrorFunction · 0.85
initDecompressorMethod · 0.80
decompressMethod · 0.80
seekMethod · 0.45
getBytesMethod · 0.45
initMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected