Para leer sólo la cabecera se procede así. Mi código interconecta el resultado con el lenguaje R, así que no te sorprendas por el List
o CharacterVector
. Puedes cambiarlo para adaptarlo a tus necesidades. Puede recuperar todo el código fuente aquí .
std::string filestd = as<std::string>(file);
LASreadOpener lasreadopener;
lasreadopener.set_file_name(filestd.c_str());
LASreader* lasreader = lasreadopener.open();
LASheader* lasheader = &lasreader->header;
if((0 == lasreader) || (NULL == lasreader))
throw std::runtime_error("LASlib internal error. See message above.");
char cguid[38];
sprintf(cguid, "%08x-%04x-%04x-%04x-%04x%08x",
lasheader->project_ID_GUID_data_1,
lasheader->project_ID_GUID_data_2,
lasheader->project_ID_GUID_data_3,
*((U16*)(lasheader->project_ID_GUID_data_4)),
*((U16*)(lasheader->project_ID_GUID_data_4+2)),
*((U32*)(lasheader->project_ID_GUID_data_4+4)));
CharacterVector guid(cguid);
List head(0);
head.push_back(lasheader->file_signature);
head.push_back(lasheader->file_source_ID);
head.push_back(globalencodingreader(lasheader));
head.push_back(guid);
head.push_back((int)lasheader->version_major);
head.push_back((int)lasheader->version_minor);
head.push_back(lasheader->system_identifier);
head.push_back(lasheader->generating_software);
head.push_back(lasheader->file_creation_day);
head.push_back(lasheader->file_creation_year);
head.push_back(lasheader->header_size);
head.push_back(lasheader->offset_to_point_data);
head.push_back(lasheader->number_of_variable_length_records);
head.push_back((int)lasheader->point_data_format);
head.push_back(lasheader->point_data_record_length);
// [...]
Para descomprimir selectivamente algún atributo LASzip
define algunas cosas pero no sé dónde y cómo usarlas. El código fuente es aquí . Hay algo en LASreadOpener llamado void set_decompress_selective(U32);
. Pero parece que sólo se aplica a LAS 1.4 según el comentario L326 // optional selective decompression (compressed new LAS 1.4 point types only)
#define LASZIP_DECOMPRESS_SELECTIVE_ALL 0xFFFFFFFF
#define LASZIP_DECOMPRESS_SELECTIVE_CHANNEL_RETURNS_XY 0x00000000
#define LASZIP_DECOMPRESS_SELECTIVE_Z 0x00000001
#define LASZIP_DECOMPRESS_SELECTIVE_CLASSIFICATION 0x00000002
#define LASZIP_DECOMPRESS_SELECTIVE_FLAGS 0x00000004
#define LASZIP_DECOMPRESS_SELECTIVE_INTENSITY 0x00000008
#define LASZIP_DECOMPRESS_SELECTIVE_SCAN_ANGLE 0x00000010
#define LASZIP_DECOMPRESS_SELECTIVE_USER_DATA 0x00000020
#define LASZIP_DECOMPRESS_SELECTIVE_POINT_SOURCE 0x00000040
#define LASZIP_DECOMPRESS_SELECTIVE_GPS_TIME 0x00000080
#define LASZIP_DECOMPRESS_SELECTIVE_RGB 0x00000100
#define LASZIP_DECOMPRESS_SELECTIVE_NIR 0x00000200
#define LASZIP_DECOMPRESS_SELECTIVE_WAVEPACKET 0x00000400
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE0 0x00010000
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE1 0x00020000
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE2 0x00040000
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE3 0x00080000
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE4 0x00100000
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE5 0x00200000
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE6 0x00400000
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE7 0x00800000
#define LASZIP_DECOMPRESS_SELECTIVE_EXTRA_BYTES 0xFFFF0000