Leica does not publish a specification for PTS. The only Leica text found, the
Cyclone REGISTER 360 “Third-Party File Export” page, says: “PTS: The user can create a
single file containing the final published cloud. It consists of the total number of
points in the point cloud, followed by a stream of XYZ coordinates and the intensity
value of the points.” That is a count and four values per point. The layout with
colour (seven values) comes from PDAL’s reader comment (“X Y Z Intensity R G B”),
Paul Bourke’s description and MicroSurvey’s help page, not from a Leica document, and
“total number of points in the point cloud” sits against the user report below that
the first number is “the number of points following”. This page follows
PDAL’s reader (io/PtsReader.cpp) and Open3D’s reader and writer
(FilePTS.cpp), and CloudCompare’s generic text loader
(AsciiFilter.cpp); the sources are linked under Links.
The file
| Line | Contents |
|---|---|
| 1 | The number of points that follow, as a whole number |
| 2 onwards | One point per line, values separated by spaces |
- Text with one point per line. No source read says what encoding a Cyclone file uses, and none of the three readers checks the encoding. Line ends: the sample files below use LF and Open3D writes CR LF; PDAL splits lines at LF and so leaves a CR on the last field, which is harmless because reading that field as a number stops at it; CloudCompare’s loader reads a file that has CR line ends and no LF (old Mac style) by turning each CR into an LF, and warns.
- Numbers use a full stop as decimal separator.
- The number of values on the first point line sets the layout for the whole file.
- The count is the number of points that follow, not necessarily of the whole file. One user of a 30 GB Cyclone .pts file with about 555 million points reports that its first line was 514795 and that after those points “there may be another count, followed by count points, followed by count, followed by count points” (Peter Dean, August 2018, LAStools discussion group, “Cyclone PTS files to LAS”; Martin Isenburg, the author of txt2las, answered that he had not known blocks could be appended this way and had never found a specification that says so). In another thread (“Split Cyclone PTS/PTX files into individual scans”, February 2016) a user exports Cyclone 5.1 scans to PTS and PTX and says each file holds several scans. These are experience reports, not a specification or a file: no Leica document and no public sample file with a second count line was found (Leica’s Cyclone REGISTER 360 export page describes PTS as one file of the final published cloud, a count, then XYZ and intensity), and nothing says what, if anything, lies between the blocks, so no per-scan header (transformation lines, a matrix) is documented here and that part is unknown. PDAL and Open3D read only the first block (they stop after the first count’s points); CloudCompare’s generic loader skips the other count lines as corrupted lines and reads all points as one cloud.
- Variant: a file with no count line. The readers differ. PDAL and
Open3D fail without it; CloudCompare does not use it and its own writer leaves it out
unless asked, so a count-less file (
x y z …lines only) is what such tools produce. Leica’s export page and MicroSurvey’s help page (“<number of points>” first) both put the count first. A count-less file is a variant written by other programs, and only generic text readers accept it. - Units and coordinate system are not recorded in the file.
Column layouts
| Values | Layout | Readers |
|---|---|---|
| 3 | x y z | PDAL, Open3D |
| 4 | x y z intensity | PDAL, Open3D |
| 6 | x y z r g b | Open3D only; PDAL rejects it |
| 7 | x y z intensity r g b | PDAL, Open3D; the commonest layout |
| Field | Type | Meaning |
|---|---|---|
x, y, z | decimal | Position |
intensity | whole number, −2048 to 2047 (Cyclone, as PDAL reads it); some files use 0 to 255 | Return strength. PDAL treats it as −2048 to 2047 and adds 2048 to give 0 to 4095; Open3D ignores it and writes 0. Paul Bourke’s description of the format has the intensity as an estimate of the fraction of incident radiation reflected, from 0 (a very poor return) to 255 (a very strong return), the same range as the colours. The range is not stated in the file, so a reader cannot tell which convention a file uses except from its values (a negative value means the −2048 to 2047 range). |
r, g, b | whole numbers, 0 to 255 | Colour, usually taken from the scanner’s camera |
Variants of the intensity range. Each source gives its own range. The PDAL comment says “Intensity field in PTS is -2048 to 2047, we map to 0 4095”. Bourke’s description gives 0 to 255. MicroSurvey’s PointCloud CAD help gives a short integer in the range (−4096, 4095) or a decimal-point number from 0.0 to 1.0, and says that if there is no intensity it should be written as 0.0. nanoCAD’s 3DScan help says “The PTS format does not allow storing negative point intensity values”, and adds an import option to choose the source intensity format for conversion to its standard range (0…65535). None of the sample files below uses 0 to 255. The range is not recorded in the file, so these are variants that the reading program has to know about.
Variant: columns beyond seven. MicroSurvey’s help page also allows
x y z i nx ny nz and x y z i r g b nx ny nz, where the
normals have a decimal point and the colours are integers 0 to 255; its fields
x y z i are mandatory, and it says the format is space or tab delimited.
None of the three readers above reads normals. These layouts are not in PDAL’s or
Open3D’s code.
PDAL logs and skips a line with the wrong number of fields and sets a value it cannot read to 0; Open3D stops at such a line.
How readers differ
Read from the source of each program in this session.
| Rule | PDAL (PtsReader.cpp) | Open3D (FilePTS.cpp) | CloudCompare (AsciiFilter.cpp) |
|---|---|---|---|
| Count line | Required: the trimmed first line must be a number, else the reader fails | Required: read with %zu; a count of 0 or an unreadable first line fails (“unable to read header”) | Not required and not used: there is no PTS-specific loader. .pts goes through the generic ASCII loader, in which the user (or the automatic detection) chooses the columns and separator; a count line with too few fields is warned about as a corrupted line and skipped, or the user can set a number of lines to skip. It writes a count line only if the “save point count header” option is on (off by default) |
| Separator | Splits at the space character only, and drops the empty pieces (Utils::split2), so a run of spaces, or spaces at the start or end of the line, count as one separator; a tab is not a separator, so a line separated by tabs has one field and is skipped (or, as the second line, fails the read) | Splits the first point line on a space; reads the values with sscanf, which accepts any white space | Space, comma or semicolon, the best being found automatically; runs of white space are collapsed |
| Layout from | The second line; 3, 4 or 7 fields, otherwise it fails (6 is rejected) | The second line; 3, 4, 6 or 7 fields, otherwise it fails | Whatever columns the user assigns |
| Empty lines | Skipped without a message, and not counted as a point. The line after the count is not skipped: it sets the layout, so an empty second line fails with “Invalid number of fields for the first point”. A line holding only a CR is not empty and is skipped as a line with the wrong field count | Not handled specially: a line that does not scan as the layout’s values fails the read | Skipped, as are lines starting // |
| Point lines beyond the count | Reading stops after the count of accepted points (cnt < m_PointCount); an empty line or a skipped line is not counted, so with such lines in the block PDAL reads on past the block’s nominal last line, into whatever follows | Ignored (reading stops after the count’s points; a line that fails stops the read first) | Read: the count plays no part |
| Fewer points than the count | Warning “Expected N points but only M were found” | The arrays are sized to the count and the reader leaves the unfilled entries unset; the read still reports success | Nothing to compare with |
| Wrong field count or non-numeric value on a line | A wrong field count: the line is logged and skipped, and not counted. A value that cannot be read is logged and set to 0. See the next row for what counts as readable | The read fails | Line warned about as corrupted and skipped |
Values: nan, trailing characters | The text nan or NaN exactly is read as NaN. Otherwise the value is read with a C++ stream extraction, which takes the leading number and ignores what follows: 12abc reads as 12, not 0; only a field with no leading number is set to 0. The count line is stricter: characters after the number make the read fail (“Found … after valid integral value”), after the line is trimmed | Each line is read with sscanf (%lf for positions, intensity and %d for colours), which stops at the first value that does not scan, and the read fails. The count line is read with %zu and anything after the number is ignored. The Open3D source does not decide which spellings of a number the C library accepts, so whether nan or inf reads is not settled by it | Each coordinate is converted with QLocale::toDouble (English locale, or French with a comma as decimal if the user chooses it); a coordinate it cannot convert makes the line corrupted (“non numerical value found”) and the line is skipped. Only the position columns are checked this way in that loop |
| Writing | No PTS writer found: io/PtsWriter.cpp does not exist in PDAL’s source tree (its raw address gives “not found”); the other writers were not listed | CR LF line ends; 3 columns %.10f, or, if the cloud has colours, 7 columns with intensity always 0.0 and colour 0 to 255; no 4- or 6-column output | As set in its save dialog |
Worked example
3
1.204 0.551 2.010 -1024 128 120 110
1.206 0.553 2.011 -980 131 122 112
1.209 0.552 2.013 -1012 129 121 111
Real sample files
PDAL’s test data (test/data/pts, BSD licence) has four real files, read
in this session: autzen.pts (count 10, 7 values, intensities
−1998 to 602), test.pts (count 19, 7 values), site_56_8.pts
(count 8, 4 values) and bunny_8.pts (count 8, 3 values). The first three
have exactly as many point lines as their count; bunny_8.pts has nine
point lines under a count of 8, so a count that disagrees with the lines that follow
occurs in real files. All four use LF line ends (no CR in any); only
bunny_8.pts lacks a final newline, and the other three end with one. None has a second count line, so no multi-block file was available
to read.
Related: PTX
Leica’s PTX export is a different text format: each scan starts with a header giving the grid size, the scanner position and axes, and transformation matrices, followed by the points in scan-grid order. It is not covered here.
Links
Developers
- PDAL PtsReader.cpp – the PDAL PTS reader this page follows, with
Utils.hppfor its splitting and number reading (C++) - PDAL test data – the four real sample files read for this page (BSD licence)
- Open3D FilePTS.cpp – the Open3D PTS reader and writer (C++)
- CloudCompare AsciiFilter.cpp – the generic text loader CloudCompare uses for
.ptsfiles (C++)
Reference
- Third-Party File Export – Leica Cyclone REGISTER 360 help, with its one-paragraph description of PTS
- pts – Laser scan plain data format – Paul Bourke’s description, October 2014
- Cannot access data error when opening a PTS format pointcloud – MicroSurvey help article quoting the PTS format from the PointCloud CAD help
- nanoCAD 3DScan Help: point clouds data formats – nanoCAD’s note on PTS intensity
- Cyclone PTS files to LAS – LAStools discussion group thread, August 2018, on a count followed by further counts
- Split Cyclone PTS/PTX files into individual scans – LAStools discussion group thread, February 2016
- readers.pts – PDAL’s documentation of its PTS reader