MrSID Decode SDK for LiDAR Reference Manual 1.1.5.5244
TXTPointReader Class Reference

TXTPointReader reads LiDAR-based Text files. More...

#include <TXTPointReader.h>

Inheritance diagram for TXTPointReader:
Collaboration diagram for TXTPointReader:

Public Member Functions

void init (const char *path, const char *format, size_t header, bool doFullInit)
 Initialize with filename and format string. More...
 
void init (IO *io, const char *format, size_t header, bool doFullInit)
 Initialize with IO object and format string. More...
 
void init (const char *path, const PointInfo &fieldInfo, size_t header, bool doFullInit)
 Initialize with filename and field list. More...
 
void init (IO *io, const PointInfo &fieldInfo, size_t header, bool doFullInit)
 Initialize with IO object and field list. More...
 
void initBoundsAndNumPoints (void)
 Setup the bounds and number of points. More...
 
const char * getFileFormatString (void) const
 Get the file type and version. More...
 
void loadMetadata (Metadata &metadata, bool sanitize) const
 Load the point clouds metadata. More...
 
double getTotalWork (const Bounds &bounds, double fraction) const
 Get the amount of work needed to decode bounds. More...
 
PointIterator * createIterator (const Bounds &bounds, double fraction, const PointInfo &pointInfo, ProgressDelegate *delegate) const
 Get a PointIterator for a given bounds. More...
 
- Public Member Functions inherited from PointReader
const PointInfo & getPointInfo (void) const
 Get the point information. More...
 
count_type getNumPoints (void) const
 Get the number of points. More...
 
const char * getWKT (void) const
 Get the spatial reference system. More...
 
void overrideWKT (const char *wkt)
 
virtual const char * getFileFormatString (void) const =0
 Get the file type and version. More...
 
const Bounds & getBounds (void) const
 Get the bounding box. More...
 
const double * getScale (void) const
 Get the quantization scale. More...
 
const double * getOffset (void) const
 Get the quantization offset. More...
 
char const *const * getClassIdNames (void) const
 Get the classification names. More...
 
size_t getNumClassIdNames (void) const
 Get the number of classification names. More...
 
double getTotalWork (const Bounds &bounds, double fraction) const
 Get the amount of work needed to decode bounds. More...
 
- Public Member Functions inherited from PointSource
virtual const PointInfo & getPointInfo (void) const =0
 Get the point information. More...
 
size_t getNumChannels (void) const
 Get the number of channels. More...
 
bool hasChannel (const char *name) const
 Determine if there is a channel with a given name. More...
 
const ChannelInfo & getChannel (size_t idx) const
 Access the channel info. More...
 
const ChannelInfo * getChannel (const char *name) const
 Access the channel data. More...
 
virtual count_type getNumPoints (void) const =0
 Get the number of points. More...
 
virtual const char * getWKT (void) const =0
 Get the spatial reference system. More...
 
virtual void loadMetadata (Metadata &metadata, bool sanitize) const =0
 Load the point clouds metadata. More...
 
virtual const Bounds & getBounds (void) const =0
 Get the bounding box. More...
 
virtual const double * getScale (void) const =0
 Get the quantization scale. More...
 
virtual const double * getOffset (void) const =0
 Get the quantization offset. More...
 
virtual size_t getNumClassIdNames (void) const =0
 Get the number of classification names. More...
 
virtual char const *const * getClassIdNames (void) const =0
 Get the classification names. More...
 
virtual double getTotalWork (const Bounds &bounds, double fraction) const =0
 Get the amount of work needed to decode bounds. More...
 
virtual PointIterator * createIterator (const Bounds &bounds, double fraction, const PointInfo &pointInfo, ProgressDelegate *delegate) const =0
 Get a PointIterator for a given bounds. More...
 
size_t read (const Bounds &bounds, PointData &points, ProgressDelegate *delegate) const
 Fill the point buffer with the best sample of the point cloud in bounds. More...
 
- Public Member Functions inherited from Object
int retain (void) const
 Increment the reference count by one. More...
 
int release (void) const
 Decrement the reference count by one. More...
 

Static Public Member Functions

static void parseFormat (const char *format, PointInfo &fieldInfo)
 Build a ChannelInfo array form a format string. More...
 
static void parseFormat (const char *format, PointInfo &fieldInfo, const PointInfo &pointInfo)
 Build a ChannelInfo array form a format string. More...
 
static void parseQuantization (const char *format, PointInfo &fieldInfo)
 Update the quantization values of a PointInfo. More...
 

Protected Member Functions

void setBoundsAndNumPoints (bool doFullInit)
 
- Protected Member Functions inherited from PointReader
void setPointInfo (const PointInfo &pointInfo)
 Set the point information. More...
 
void setNumPoints (count_type numPoints)
 Set the number of points in the point cloud. More...
 
void setBounds (const Bounds &bounds)
 Set the bounding box of the point cloud. More...
 
void setWKT (const char *wkt)
 Set the spatial reference system. More...
 
void setQuantization (const double scale[3], const double offset[3])
 Set the quantization scale and offset. More...
 
- Protected Member Functions inherited from Object
 Object (void)
 
virtual ~Object (void)
 

Protected Attributes

IO * m_io
 
size_t m_header
 
PointInfo m_fieldInfo
 
double m_totalWork
 
- Protected Attributes inherited from PointReader
bool m_ignoreNativeWKTMetadata
 

Additional Inherited Members

- Public Types inherited from PointSource
typedef lt_int64 count_type
 

Detailed Description

The TXTPointReader class reads point clouds from text files. Each line of the text file is point with the fields delimited by white space.

Definition at line 22 of file TXTPointReader.h.

Member Function Documentation

◆ createIterator()

PointIterator * TXTPointReader::createIterator ( const Bounds &  bounds,
double  fraction,
const PointInfo &  pointInfo,
ProgressDelegate *  delegate 
) const
virtual

This methods returns a PointIterator for the given bounds.

Parameters
boundsthe region of interest (HUGE_VAL are handled)
fractionthe fraction of the points you want (use 1.0 for all the points and use 0.1 to keep every tenth point)
channelInfothe list of channels to be extracted
numChannelsthe number of channels to be extracted
delegatea ProgressDelegate for feedback (can be nullptr)

Implements PointSource.

◆ getFileFormatString()

const char * TXTPointReader::getFileFormatString ( void  ) const
virtual

This method returns a string the contains the File Type and version of the PointReader. For example for a MrSID file this will will return "MG4 4.0.0.1".

Implements PointReader.

◆ getTotalWork()

double TXTPointReader::getTotalWork ( const Bounds &  bounds,
double  fraction 
) const
virtual

This method returns the amount of work needed to decode the points in bounds. getTotalWork() is used with ProgressDelegate to track the progress of a decode or encode.

Parameters
boundsthe region of interest
fractionthe fraction of the points you want (use 1.0 for all the points and use 0.1 to keep every tenth point)
Returns
the work needed to decode bounds

Reimplemented from PointReader.

◆ init() [1/4]

void TXTPointReader::init ( const char *  path,
const char *  format,
size_t  header,
bool  doFullInit 
)

This method initializes the reader with a filename and format string.

Parameters
paththe filename
formatthe channel layout format string, see TXTPointReader::parseString().
headerthe number of header lines to skip
doFullInitif true call initBoundsAndNumPoints()

◆ init() [2/4]

void TXTPointReader::init ( const char *  path,
const PointInfo &  fieldInfo,
size_t  header,
bool  doFullInit 
)

This method initializes the reader with a filename and field list.

Parameters
paththe filename
fieldInfoa ChannelInfo array describing the column layout
headerthe number of header lines to skip
doFullInitif true call initBoundsAndNumPoints()
Note
Use CHANNEL_NAME_Skip to skip a column.

◆ init() [3/4]

void TXTPointReader::init ( IO *  io,
const char *  format,
size_t  header,
bool  doFullInit 
)

This method initializes the reader with a IO object and format string.

Parameters
iothe data source
formatthe channel layout format string, see TXTPointReader::parseString().
headerthe number of header lines to skip
doFullInitif true call initBoundsAndNumPoints()

◆ init() [4/4]

void TXTPointReader::init ( IO *  io,
const PointInfo &  fieldInfo,
size_t  header,
bool  doFullInit 
)

This method initializes the reader with IO object and field list.

Parameters
iothe data source
fieldInfoa ChannelInfo array describing the column layout
headerthe number of header lines to skip
doFullInitif true call initBoundsAndNumPoints()
Note
Use CHANNEL_NAME_Skip to skip a column.

◆ initBoundsAndNumPoints()

void TXTPointReader::initBoundsAndNumPoints ( void  )

This method reads the input text file to figures out the number of points and the bounding box. This method can take some time. If the method has not be called getBounds() will return Bounds::Huge() and getNumPoints() will return 2**64 - 1.

◆ loadMetadata()

void TXTPointReader::loadMetadata ( Metadata &  metadata,
bool  sanitize 
) const
virtual

This method loads the metadata for the point cloud. PointSource only load metadata on demand to reduce memory usage.

Parameters
metadataThe metadata object to fill.
sanitizeIf true remove vendor-specific metadata that we don't understand for example, Merrick::102 ("Index to page of point records")

Implements PointSource.

◆ parseFormat() [1/2]

static void TXTPointReader::parseFormat ( const char *  format,
PointInfo &  fieldInfo 
)
static

The function builds a ChannelInfo array based on the format string.

Format syntax:

  • 'x' => CHANNEL_NAME_X, DATATYPE_FLOAT64
  • 'y' => CHANNEL_NAME_Y, DATATYPE_FLOAT64
  • 'z' => CHANNEL_NAME_Z, DATATYPE_FLOAT64
  • 'i' => CHANNEL_NAME_Intensity, DATATYPE_UINT16
  • 'r' => CHANNEL_NAME_ReturnNum, DATATYPE_UINT8
  • 'n' => CHANNEL_NAME_NumReturns, DATATYPE_UINT8
  • 'd' => CHANNEL_NAME_ScanDir, DATATYPE_UINT8
  • 'e' => CHANNEL_NAME_EdgeFlightLine, DATATYPE_UINT8
  • 'c' => CHANNEL_NAME_ClassId, DATATYPE_UINT8
  • 'a' => CHANNEL_NAME_ScanAngle, DATATYPE_SINT8
  • 'u' => CHANNEL_NAME_UserData, DATATYPE_UINT8
  • 'p' => CHANNEL_NAME_SourceId, DATATYPE_UINT16
  • 't' => CHANNEL_NAME_GPSTime_Week, DATATYPE_FLOAT64
  • 'T' => CHANNEL_NAME_GPSTime_Adjusted, DATATYPE_FLOAT64
  • 'R' => CHANNEL_NAME_Red, DATATYPE_UINT16
  • 'G' => CHANNEL_NAME_Green, DATATYPE_UINT16
  • 'B' => CHANNEL_NAME_Blue, DATATYPE_UINT16
  • 's' => CHANNEL_NAME_Skip, Skip this field
Parameters
formatthe format string
fieldInfothe ouptut ChannelInfo array

◆ parseFormat() [2/2]

static void TXTPointReader::parseFormat ( const char *  format,
PointInfo &  fieldInfo,
const PointInfo &  pointInfo 
)
static

The function builds a ChannelInfo array based on the format string and the use the given ChannelInfo array's data types.

Parameters
formatthe format string
fieldInfothe ouptut ChannelInfo array
pointInfothe input ChannelInfo array

◆ parseQuantization()

static void TXTPointReader::parseQuantization ( const char *  format,
PointInfo &  fieldInfo 
)
static

The function updates the quantization values of the PointInfo based on the format string.

Format syntax: <channel ids><quantization scale>[,<channel ids><quantization scale>]*

Where: <channel ids> is one or more of the following values:

  • 'x' => CHANNEL_NAME_X
  • 'y' => CHANNEL_NAME_Y
  • 'z' => CHANNEL_NAME_Z
  • 't' => CHANNEL_NAME_GPSTime_Week | CHANNEL_NAME_GPSTime_Adjusted <quantization scale> is a non-zero number

Example: xyz@0.nosp@m..01,t@0.0.nosp@m.0000.nosp@m.01 x@0.0.nosp@m.1,y@0.0.nosp@m.1,z@0.0.nosp@m.1,t@0.0.nosp@m.0000.nosp@m.01 (both have the same effect)

Parameters
formatthe format string
fieldInfothe PointInfo for updating

◆ setBoundsAndNumPoints()

void TXTPointReader::setBoundsAndNumPoints ( bool  doFullInit)
protected

Member Data Documentation

◆ m_fieldInfo

PointInfo TXTPointReader::m_fieldInfo
protected

Definition at line 183 of file TXTPointReader.h.

◆ m_header

size_t TXTPointReader::m_header
protected

Definition at line 182 of file TXTPointReader.h.

◆ m_io

IO* TXTPointReader::m_io
protected

Definition at line 181 of file TXTPointReader.h.

◆ m_totalWork

double TXTPointReader::m_totalWork
protected

Definition at line 184 of file TXTPointReader.h.


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

Extensis