ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccWaveform Class Reference

Waveform. More...

#include <ecvWaveform.h>

Inheritance diagram for ccWaveform:
[legend]
Collaboration diagram for ccWaveform:
[legend]

Public Member Functions

 ccWaveform (uint8_t descriptorID=0)
 Default constructor. More...
 
 ~ccWaveform () override=default
 Destructor. More...
 
uint8_t descriptorID () const
 Returns the associated descriptor (ID) More...
 
void setDescriptorID (uint8_t id)
 Sets the associated descriptor (ID) More...
 
void setDataDescription (uint64_t dataOffset, uint32_t byteCount)
 Describes the waveform data. More...
 
uint32_t getRawSample (uint32_t i, const WaveformDescriptor &descriptor, const uint8_t *dataStorage) const
 Returns the (raw) value of a given sample. More...
 
double getSample (uint32_t i, const WaveformDescriptor &descriptor, const uint8_t *dataStorage) const
 Returns the (real) value of a given sample (in volts) More...
 
double getRange (double &minVal, double &maxVal, const WaveformDescriptor &descriptor, const uint8_t *dataStorage) const
 Returns the range of (real) samples. More...
 
bool decodeSamples (std::vector< double > &values, const WaveformDescriptor &descriptor, const uint8_t *dataStorage) const
 Decodes the samples and store them in a vector. More...
 
bool toASCII (const QString &filename, const WaveformDescriptor &descriptor, const uint8_t *dataStorage) const
 Exports (real) samples to an ASCII file. More...
 
CCVector3 getSamplePos (float i, const CCVector3 &P0, const WaveformDescriptor &descriptor) const
 Returns the sample position in 3D. More...
 
uint32_t byteCount () const
 Returns the number of allocated bytes. More...
 
uint64_t dataOffset () const
 Returns the byte offset to waveform data. More...
 
void setDataOffset (uint64_t offset)
 Sets the byte offset to waveform data. More...
 
const uint8_t * data (const uint8_t *dataStorage) const
 Gives access to the internal data. More...
 
void setBeamDir (const CCVector3f &dir)
 Sets the beam direction. More...
 
const CCVector3f & beamDir () const
 Returns the beam direction. More...
 
void setEchoTime_ps (float time_ps)
 Set the echo time (in picoseconds) More...
 
float echoTime_ps () const
 Returns the echo time (in picoseconds) More...
 
void applyRigidTransformation (const ccGLMatrix &trans)
 Applies a rigid transformation (on the beam direction) More...
 
uint8_t returnIndex () const
 Returns the return index. More...
 
void setReturnIndex (uint8_t index)
 Sets the return index. More...
 
bool isSerializable () const override
 Returns whether object is serializable of not. More...
 
bool toFile (QFile &out, short dataVersion) const override
 Saves data to binary stream. More...
 
short minimumFileVersion () const override
 Returns the minimum file version required to save this instance. More...
 
bool fromFile (QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
 Loads data from binary stream. More...
 
- Public Member Functions inherited from ccSerializableObject
virtual ~ccSerializableObject ()=default
 Destructor. More...
 

Static Public Member Functions

static bool ToASCII (const QString &filename, std::vector< double > &values, uint32_t samplingRate_ps)
 Helper: exports a series of values as an ASCII file. More...
 
- Static Public Member Functions inherited from ccSerializableObject
static bool WriteError ()
 Sends a custom error message (write error) and returns 'false'. More...
 
static bool ReadError ()
 Sends a custom error message (read error) and returns 'false'. More...
 
static bool MemoryError ()
 Sends a custom error message (not enough memory) and returns 'false'. More...
 
static bool CorruptError ()
 Sends a custom error message (corrupted file) and returns 'false'. More...
 

Protected Attributes

uint32_t m_byteCount
 Waveform packet size in bytes. More...
 
uint64_t m_dataOffset
 Byte offset to waveform data. More...
 
CCVector3f m_beamDir
 Laser beam direction. More...
 
float m_echoTime_ps
 Return Point location (in picoseconds) More...
 
uint8_t m_descriptorID
 Wave Packet descriptor index. More...
 
uint8_t m_returnIndex
 Return index. More...
 

Additional Inherited Members

- Public Types inherited from ccSerializableObject
enum  DeserializationFlags { DF_POINT_COORDS_64_BITS, DF_SCALAR_VAL_32_BITS = 2 }
 Deserialization flags (bit-field) More...
 
typedef QMultiMap< unsigned, unsigned > LoadedIDMap
 Map of loaded unique IDs (old ID --> new ID) More...
 

Detailed Description

Waveform.

Warning
Waveforms do not own their data!

Constructor & Destructor Documentation

◆ ccWaveform()

ccWaveform::ccWaveform ( uint8_t  descriptorID = 0)

Default constructor.

◆ ~ccWaveform()

ccWaveform::~ccWaveform ( )
overridedefault

Destructor.

Member Function Documentation

◆ applyRigidTransformation()

void ccWaveform::applyRigidTransformation ( const ccGLMatrix &  trans)

◆ beamDir()

const CCVector3f& ccWaveform::beamDir ( ) const
inline

Returns the beam direction.

Referenced by define_ccWaveform(), LasWaveformSaver::handlePoint(), and LASFWFFilter::saveToFile().

◆ byteCount()

uint32_t ccWaveform::byteCount ( ) const
inline

◆ data()

const uint8_t* ccWaveform::data ( const uint8_t *  dataStorage) const
inline

Gives access to the internal data.

Referenced by getRawSample().

◆ dataOffset()

uint64_t ccWaveform::dataOffset ( ) const
inline

◆ decodeSamples()

bool ccWaveform::decodeSamples ( std::vector< double > &  values,
const WaveformDescriptor &  descriptor,
const uint8_t *  dataStorage 
) const

Decodes the samples and store them in a vector.

References getSample(), and WaveformDescriptor::numberOfSamples.

Referenced by toASCII().

◆ descriptorID()

uint8_t ccWaveform::descriptorID ( ) const
inline

Returns the associated descriptor (ID)

Warning
A value of zero indicates that there is no associated waveform data.

Referenced by ccPointCloud::append(), define_ccWaveform(), LasWaveformSaver::handlePoint(), ccPointCloud::partialClone(), ccPointCloud::SelectByIndex(), and ccPointCloud::waveformProxy().

◆ echoTime_ps()

float ccWaveform::echoTime_ps ( ) const
inline

Returns the echo time (in picoseconds)

Referenced by define_ccWaveform(), LasWaveformSaver::handlePoint(), and LASFWFFilter::saveToFile().

◆ fromFile()

bool ccWaveform::fromFile ( QFile &  in,
short  dataVersion,
int  flags,
LoadedIDMap &  oldToNewIDMap 
)
overridevirtual

Loads data from binary stream.

Parameters
ininput file (already opened)
dataVersionfile version (for version-specific deserialization)
flagsdeserialization flags (see ccSerializableObject::DeserializationFlags)
oldToNewIDMapmap to link old IDs with new IDs
Returns
success
Note: When implementing, use dataVersion checks to handle different
versions:
  • if (dataVersion >= X) { read new field } else { use default value } This ensures forward compatibility with older file formats.

Reimplemented from ccSerializableObject.

◆ getRange()

double ccWaveform::getRange ( double &  minVal,
double &  maxVal,
const WaveformDescriptor &  descriptor,
const uint8_t *  dataStorage 
) const

Returns the range of (real) samples.

References getSample(), and WaveformDescriptor::numberOfSamples.

◆ getRawSample()

uint32_t ccWaveform::getRawSample ( uint32_t  i,
const WaveformDescriptor &  descriptor,
const uint8_t *  dataStorage 
) const

Returns the (raw) value of a given sample.

References WaveformDescriptor::bitsPerSample, data(), and m_byteCount.

Referenced by define_ccWaveform(), and getSample().

◆ getSample()

double ccWaveform::getSample ( uint32_t  i,
const WaveformDescriptor &  descriptor,
const uint8_t *  dataStorage 
) const

Returns the (real) value of a given sample (in volts)

References WaveformDescriptor::digitizerGain, WaveformDescriptor::digitizerOffset, and getRawSample().

Referenced by decodeSamples(), and getRange().

◆ getSamplePos()

CCVector3 ccWaveform::getSamplePos ( float  i,
const CCVector3 &  P0,
const WaveformDescriptor &  descriptor 
) const

◆ isSerializable()

bool ccWaveform::isSerializable ( ) const
inlineoverridevirtual

Returns whether object is serializable of not.

Reimplemented from ccSerializableObject.

◆ minimumFileVersion()

short ccWaveform::minimumFileVersion ( ) const
overridevirtual

Returns the minimum file version required to save this instance.

To be overridden by subclasses to indicate their minimum required version. This enables the system to determine:

  • Forward compatibility: newer software can read older files (dataVersion check in fromFile)
  • Backward compatibility: determine minimum version needed to save current data
    Returns
    minimum file version required for this object

Implements ccSerializableObject.

References m_returnIndex.

◆ returnIndex()

uint8_t ccWaveform::returnIndex ( ) const
inline

Returns the return index.

Referenced by define_ccWaveform(), and LASFWFFilter::saveToFile().

◆ setBeamDir()

void ccWaveform::setBeamDir ( const CCVector3f &  dir)
inline

◆ setDataDescription()

void ccWaveform::setDataDescription ( uint64_t  dataOffset,
uint32_t  byteCount 
)

◆ setDataOffset()

void ccWaveform::setDataOffset ( uint64_t  offset)
inline

Sets the byte offset to waveform data.

References offset.

Referenced by define_ccWaveform().

◆ setDescriptorID()

void ccWaveform::setDescriptorID ( uint8_t  id)
inline

◆ setEchoTime_ps()

void ccWaveform::setEchoTime_ps ( float  time_ps)
inline

Set the echo time (in picoseconds)

Referenced by define_ccWaveform(), LASFWFFilter::loadFile(), and LasWaveformLoader::loadWaveform().

◆ setReturnIndex()

void ccWaveform::setReturnIndex ( uint8_t  index)
inline

◆ toASCII()

bool ccWaveform::toASCII ( const QString &  filename,
const WaveformDescriptor &  descriptor,
const uint8_t *  dataStorage 
) const

◆ ToASCII()

bool ccWaveform::ToASCII ( const QString &  filename,
std::vector< double > &  values,
uint32_t  samplingRate_ps 
)
static

Helper: exports a series of values as an ASCII file.

References QtCompat::endl(), filename, CVLog::Print(), and CVLog::Warning().

Referenced by define_ccWaveform(), and toASCII().

◆ toFile()

bool ccWaveform::toFile ( QFile &  out,
short  dataVersion 
) const
overridevirtual

Saves data to binary stream.

Parameters
outoutput file (already opened)
dataVersiontarget file version (for forward/backward compatibility)
Returns
success

Reimplemented from ccSerializableObject.

Member Data Documentation

◆ m_beamDir

CCVector3f ccWaveform::m_beamDir
protected

Laser beam direction.

Parametric line equation for extrapolating points along the associated waveform: X = X0 + X(t) Y = Y0 + Y(t) Z = Z0 + Z(t)

Referenced by applyRigidTransformation(), and getSamplePos().

◆ m_byteCount

uint32_t ccWaveform::m_byteCount
protected

Waveform packet size in bytes.

Warning
Not necessarily equal to the number of samples!

Referenced by getRawSample(), and setDataDescription().

◆ m_dataOffset

uint64_t ccWaveform::m_dataOffset
protected

Byte offset to waveform data.

Referenced by setDataDescription().

◆ m_descriptorID

uint8_t ccWaveform::m_descriptorID
protected

Wave Packet descriptor index.

Warning
A value of zero indicates that there is no associated waveform data.

◆ m_echoTime_ps

float ccWaveform::m_echoTime_ps
protected

Return Point location (in picoseconds)

The offset in picoseconds from the first digitized value to the location within the waveform packet that the associated return pulse was detected.

Referenced by getSamplePos().

◆ m_returnIndex

uint8_t ccWaveform::m_returnIndex
protected

Return index.

Referenced by minimumFileVersion().


The documentation for this class was generated from the following files: