Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.2] - 2026-11-26

### Added

- Read checksum-verified E57 image blobs and scanner-aligned FARO RGB panoramas.
Expand All @@ -16,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Leica LGSX version 22 decodes differential Morton positions, native RGB and intensity, retaining duplicate returns.
- FARO FLS distance mode 26 decodes both range-grid halves with optional Morton RGB and intensity.
- ReCap version 3.2 decodes stored point records with RGB, intensity and normals. ReCap project scans report their referenced scan's channels.

## [0.1.1] - 2026-11-25

Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Deterministic>true</Deterministic>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<VersionPrefix>0.1.1</VersionPrefix>
<VersionPrefix>0.1.2</VersionPrefix>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ The library targets .NET 8 and .NET 10. It is managed code with no dependencies
| Format | Extensions | Support level |
| --- | --- | --- |
| ASTM E57 | `.e57` | Points decoded for a defined subset: uncompressed bit-packed streams with single or double precision Cartesian coordinates or scaled-integer coordinates (raw value times scale plus offset), or spherical range, azimuth and elevation converted to Cartesian points, with 8-bit colour and 8-bit intensity, or colour with a wider Integer range from zero and intensity as a wider Integer, a Float or a scaled integer. Pose translation and rotation are applied. Only plain bit-packing is decoded: a scan whose codecs vector names another codec lists normally and fails when its points are read, and the message names it. Per-point validity flags skip invalid points and clear invalid channels when their streams hold one flag byte per record; other shapes are not interpreted. Registered image blobs can be read explicitly through the format API. Page checksums are verified. |
| ReCap scan | `.rcs` | Experimental. The header is read; point decoding covers the node layouts that are described in the code, which is the one of major version 3. A file of another version is listed with its header, but reading its points fails with a message that names the version. A further layout is described only when the files of that version may be used for the tests, so that its offsets can be verified. The channels of the points follow from the size of the payload of the nodes: colour and intensity when the records are long enough, and normals when the node holds the plane of them. A node payload whose byte count is not a whole multiple of a known record size, as in BLK360 exports (container 3.2) whose records are variable-length, is rejected with a message that names the container version instead of being guessed. |
| ReCap project | `.rcp` | Lists the scans of the project manifest and opens the `.rcs` files it finds next to the project. The transform of a scan node places the scan in the project and is applied to its points unless `ApplyTransform` is false; when the manifest states no transform, the transform of the scan file is used. |
| ReCap scan | `.rcs` | Experimental support for container version 3.2. The reader validates section and leaf ranges before returning points. Stored positions use a millimetre grid, with RGB, intensity and normals according to the header flags. `PointCount` reports stored points. The header count is available as `DeclaredPointCount`. When `ApplyTransform` is enabled, the reader applies scale and translation. Rotation values are metadata. |
| ReCap project | `.rcp` | Lists scan nodes and opens referenced `.rcs` files next to the project. Channel availability comes from the referenced scan header. With transforms enabled, the reader uses the node translation and scale when stated, and otherwise uses the scan file's transform. Rotation values are metadata. |
| Leica scan container | `.lgsx`, `.lgs` | Experimental. Version 22 point blocks decode differential Morton coordinates, RGB and intensity. Normals are unavailable for that block version. When the container assigns its points to its setups, there is one scan per setup, named after the setup, with the pose and the bounds of the setup when its record holds them; the pose is applied unless `ApplyTransform` is false. When the container does not assign its points, all points of the container form one scan and a warning says so. The point count is taken from the container when it states one; otherwise it is found by decoding the data, which is slow on large files. `PclReadOptions.Blocks` reads only the blocks of the scan in that file-order range (per scan, so a setup scan ranges over its own blocks); `PclReadOptions.MaxDegreeOfParallelism` above 1 decodes those blocks in parallel and still yields the points in file order with consecutive `Index` values. |
| FARO scan | `.fls`, or a FARO scan folder | Experimental. Single-file containers with distance mode 26 decode both halves of the range grid and their optional RGB and intensity planes. The scan grid and angles are read from the stored parameters and points are projected from the range grid; a file without them fails to open. The point count is the number of valid returns, which is counted on the first access; `FaroScan.GridSize` is the size of the scan grid. For a scan folder the layout of the samples is derived from the size of the data stream and the size of the grid, and the scale of the intensity from the values that are stored; when the sizes do not fit, the layout is assumed and a warning says so. |
| PinPoint project | `.srf`, `.smf`, or a folder with `ScanProject.json` or `.smf`/`.srf` files | Experimental. The manifest (scan names, ids, poses, counts) is read. Points come from the referenced `.bin` files, in either of two layouts: a table of named channels, or numbered sections with a property table and Snappy-compressed channels, which PclIO decodes itself. Colour, intensity and normals are reported only when the file has that channel; in the second layout positions, colours, intensities, normals (`Normals`, three float32 components per point) and the per-point flags (`FilterBits`, one byte per point) are read, while the grid indices stored beside them are not interpreted, so by default every stored point that passes the plausibility rule below is returned. With `PclReadOptions.ExcludeFilteredPoints` the points with a non-zero flag are not returned. A manifest with a scan position list takes the point count from the manifest, else from the data file; a manifest with a data object list takes it from the data file the object refers to, and every location that shares one file reports its full count, because the shares are not recorded. A project shell whose data files are absent lists no scans, and a manifest whose referenced data files are missing reads no points; neither is a readable fixture. |
Expand Down Expand Up @@ -145,7 +145,7 @@ outside the file is fetched.
| --- | --- |
| E57 | XML section 32 MiB, nesting depth 64, 1,000,000 elements; declared record counts up to 2^40; at most 65535 fields in a point prototype; at most 4096 consecutive packets without points. |
| ReCap project | Manifest 64 MiB (declared and real size), nesting depth 64, 1,000,000 elements, 65,536 scan nodes. |
| ReCap scan | 500,000 nodes in the node table, which must fit in the file together with the node payloads. |
| ReCap scan | Up to 64 section entries and 500,000 leaves, with all point blocks inside the declared points section. |
| Leica | 10,000 container entries; per point block at most 64 compressed streams, 10,000,000 compressed bytes per stream, 16 MiB per decompressed stream (checked before allocation) and 128 MiB decompressed in all; over all blocks of one read 1 GiB plus 64 times the file size decompressed. |
| FARO | Parameters 1 MiB; scan grid of at most 2^27 cells (134,217,728); a distance stream too small for the declared grid is refused; each compressed data stream is held in memory (see above) and is inflated in chunks, and must not inflate beyond its grid size plus 64 KiB. Compound file: 65,536 directory entries, depth 16. |
| PinPoint | Manifest 64 MiB and the default nesting depth of `System.Text.Json` (64); 100,000 scans. The parsed manifest needs memory of about 15 times its size, so a manifest at the limit needs about 1 GB. Sectioned data file: at most 16 sections, a property table of at most 1 MiB nested at most 8 levels, copies in a compressed stream at most 8 MiB back with a decoder window of at most 8 MiB per stream; the sections must be contiguous and fill the file, and the `Points`, `RGB8`, `Intensities8`, `Normals` and `FilterBits` streams must decode to exactly 12, 3, 1, 12 and 1 bytes per stored point. |
Expand Down
6 changes: 3 additions & 3 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ reading), `NotSupportedException` (unrecognised format or unsupported feature) o
| Format | Extensions | Support level |
| --- | --- | --- |
| ASTM E57 | `.e57` | Points decoded for a defined subset (uncompressed bit-packed streams, single or double precision Cartesian coordinates, 8-bit colour and intensity). The format API also reads image blobs with checksum verification. |
| ReCap scan | `.rcs` | Experimental; layout of major version 3 only. |
| ReCap project | `.rcp` | Lists scans; opens the `.rcs` files it finds next to the project. Node transforms are not applied. |
| ReCap scan | `.rcs` | Experimental support for container version 3.2. Reads positions, intensity, colour and normals. Rotation values are metadata. |
| ReCap project | `.rcp` | Opens referenced `.rcs` files next to the project. With transforms enabled, uses the node's translation and scale when stated, and otherwise uses the scan file's transform. Rotation values are metadata. |
| Leica scan container | `.lgsx`, `.lgs` | Experimental. Version 22 blocks provide geometry, RGB and intensity. Containers without setup assignments open as one scan in container coordinates. |
| FARO scan | `.fls`, or a FARO scan folder | Experimental. Single-file distance mode 26 reconstructs both halves of the scan grid. A folder scan is read with an assumed layout and carries a warning. |
| PinPoint project | `.srf`, `.smf`, or a folder with `ScanProject.json` or `.smf`/`.srf` files | Experimental; manifest plus point data files in one of two layouts (named channels, or sections with Snappy-compressed channels); a data file in neither layout is not read. |
Expand All @@ -101,7 +101,7 @@ are decided by extension alone, without a content check. A `.pcd` file is recogn
and a `.ply` file by its magic word and header structure. Anything else is `PclFileKind.Unknown`. The rules are in
[Public API](public-api.md#format-detection).
Anything a decoder does not support fails instead of being guessed, apart from the assumptions named in the README (the FARO folder
record layout, the EdgeWise position scale and the ReCap scan channel flags). The sizes and counts a reader accepts are limited; a
record layout and the EdgeWise position scale). The sizes and counts a reader accepts are limited; a
file that exceeds a limit is rejected with `InvalidDataException`, with the exceptions listed in the README.

## Limitations
Expand Down
9 changes: 4 additions & 5 deletions docs/public-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ drop points that fail a plausibility rule (see the README), so a scan can yield
| Reader | `PointCount` |
|---|---|
| E57 | Declared by the file. It is not checked against the point data until the points are read. Points that the validity flags mark as invalid are skipped, so a read can yield fewer points. |
| ReCap scan | Declared in the header. It is not checked against the node table. The node layout of major version 3 is decoded; a file of another version is listed but its points cannot be read (`RcsScanDocument.DecodedNodeLayoutVersions` names the decoded versions). |
| ReCap scan | Stored point count for container version 3.2. For other versions the header count is available and reading points reports the unsupported version. |
| ReCap project | Declared by the project manifest; 0 when the manifest states none. |
| Leica | The number of points the container states, when it states one; otherwise it is computed. The computed value needs the first access to decode all of the point data and caches the result, which can be slow on large files; the access throws `InvalidDataException` for corrupt data. A container that assigns its points to its setups has one scan per setup, each with the id and the name of its setup; otherwise the container is one scan with the id `unified-cloud`. The `Transform` and the `Bounds` of a setup are read from its record and are empty when the record does not hold them. `Blocks` applies per scan in file order; a truncated read (fewer points yielded than selected, via `MaxPoints`) reports no incomplete-data warning. |
| FARO | The number of valid returns, which is counted on the first access by reading the distance data of the scan; `FaroScan.GridSize` is the size of the scan grid (rows times columns). For a folder scan the grid size is limited by the size of the data stream, and `FaroScan.RecordSize` is the size of one sample in bytes. |
Expand All @@ -96,10 +96,9 @@ drop points that fail a plausibility rule (see the README), so a scan can yield
| Leica PTG | Total valid returns across all gridded scans, determined by decoding the column validity bitmasks. |
| CC BIN | The point count declared for the entity. The reader rejects files with a truncated XYZ block or a point count that exceeds the available XYZ data. Points with non-finite coordinates are skipped. Packed point normals are decoded in file versions 41, 42 and 50. A stored zero direction is returned as `PclVector3.Zero`. |

`HasColors`, `HasIntensities` and `HasNormals` follow what the file contains, except for the scans of a ReCap project, where all three
are true when the `.rcs` file was found and false otherwise, without the file being opened. A ReCap scan reads the channels
from the node table, so they are known after the node table has been read; a node whose points hold no colour gives its points
no colour.
ReCap scans with container version 3.2 report stored point counts from their leaf records. `DeclaredPointCount` holds the count in the file header.
The channel flags in the scan header determine `HasColors`, `HasIntensities` and `HasNormals`. ReCap project scans read and cache those flags on the first successful
request. An unresolved reference reports false for the channel properties. A resolved reference with a damaged or inaccessible header reports a read error.

## Format documents

Expand Down
21 changes: 15 additions & 6 deletions src/PclIO/Formats/Recap/RcpProjectDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ public sealed class RcpScan : PclScan
{
// True when the project states a transform for the node; it then places the scan.
private readonly bool _transformStated;
private readonly Lazy<(bool Colors, bool Intensities, bool Normals)>? _channels;

/// <inheritdoc />
public override string Id { get; }
Expand All @@ -298,14 +299,14 @@ public sealed class RcpScan : PclScan
/// <summary>Resolved .rcs file next to the project, or null when it was not found.</summary>
public string? RcsFilePath { get; }

/// <inheritdoc />
public override bool HasColors => RcsFilePath != null;
/// <summary>True when the referenced scan's header declares colour.</summary>
public override bool HasColors => _channels?.Value.Colors == true;

/// <inheritdoc />
public override bool HasNormals => RcsFilePath != null;
/// <summary>True when the referenced scan's header declares normals.</summary>
public override bool HasNormals => _channels?.Value.Normals == true;

/// <inheritdoc />
public override bool HasIntensities => RcsFilePath != null;
/// <summary>True when the referenced scan's header declares intensity.</summary>
public override bool HasIntensities => _channels?.Value.Intensities == true;

internal RcpScan(string id, string name, long pointCount, PclTransform transform, string? rcsFilePath, bool transformStated)
{
Expand All @@ -315,6 +316,14 @@ internal RcpScan(string id, string name, long pointCount, PclTransform transform
Transform = transform;
RcsFilePath = rcsFilePath;
_transformStated = transformStated;
if (rcsFilePath != null)
{
_channels = new(() =>
{
using var scan = RcsScanDocument.Open(rcsFilePath);
return (scan.HasColorData, scan.HasIntensityData, scan.HasNormalData);
}, LazyThreadSafetyMode.PublicationOnly);
}
}

/// <summary>
Expand Down
Loading
Loading