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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
8.0.x
- run: dotnet restore PclIO.slnx
- run: dotnet build PclIO.slnx -c Release --no-restore
- run: dotnet format PclIO.slnx --verify-no-changes --severity error --no-restore
- run: dotnet test PclIO.slnx -c Release --no-build
- run: dotnet pack PclIO.slnx -c Release --no-build -o artifacts
- uses: actions/upload-artifact@v7
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ on:
- 'docfx.json'
- '.config/dotnet-tools.json'
- 'src/PclIO/**'
- 'src/PclIO.Scene/**'
- '.github/workflows/docs.yml'
pull_request:
paths:
- 'docs/**'
- 'docfx.json'
- '.config/dotnet-tools.json'
- 'src/PclIO/**'
- 'src/PclIO.Scene/**'
- '.github/workflows/docs.yml'
workflow_dispatch:

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
$notes | Set-Content -LiteralPath release-notes.md -Encoding utf8
- run: dotnet restore PclIO.slnx
- run: dotnet build PclIO.slnx -c Release --no-restore
- run: dotnet format PclIO.slnx --verify-no-changes --severity error --no-restore
- run: dotnet test PclIO.slnx -c Release --no-build
- name: Pack release
shell: pwsh
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- `PclIO.Scene` scene adapter: `PclSceneReader.Read` turns a point cloud file or an opened `PclDocument` into an IOScene `SceneDocument` in metres — one model, one element per scan with the engine's scan id as `SourceId`, non-indexed `Points` geometry with normals when every point of a scan has one, and the scan properties as text. `PclSceneOptions` sets the model key, a total point cap (default 1,000,000, the IOScene contract holds small clouds), a subsampling step and a metres-per-unit factor; `PclSceneResult` reports the scene, the counts and diagnostics for what was left out (per-point colour, intensity and classification are not part of IOScene 0.1.0). The engine stays a leaf: only the adapter references IOScene (`[0.1.0, 0.2.0-0.0)`), and it pins the engine exactly because both ship on one tag.
- Command line: `pclio export <input> <output> --format scene` (also inferred from the extension `.scene.json`) writes the IOScene scene JSON, prints the conversion diagnostics on standard error, keeps at most 1,000,000 points unless `--limit` is given and rejects `--no-transform`.
- Read packed CC BIN point normals in file versions 41, 42 and 50.
- CC BIN (`*.bin`, `CCB2`) reader supporting single and multi-cloud entity datasets with 32-bit floating point Cartesian XYZ coordinates, global shift and scale vectors, 8-bit RGB colour arrays, 4x4 coordinate transform matrices, and scalar fields (including intensity). Added `CcBinDocument`, `CcBinScan`, and `PclFileKind.CcBin`.
- Leica PTG (`*.ptg`) gridded point cloud reader supporting binary scan files with `PTG\0` signature, magic number `0x928FA3C7`, a binary TLV metadata header (`%%version`, `%%cols`, `%%rows`, `%%properties`, `%%transform` and name records), a uint64 column offset array, and column validity bitmasks (most significant bit first) with single or double precision Cartesian XYZ coordinates, intensity and RGB colour. The scanner pose matrix is transposed from the PTG row-vector convention on load. Top-level ASCII index files (`.ptg`) referencing binary scan files are aggregated into multi-scan documents. Added `PtgDocument`, `PtgScan`, and `PclFileKind.LeicaPtg`.
Expand Down
5 changes: 5 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="10.0.403" />
</ItemGroup>

<ItemGroup>
<!-- The scene adapter depends on the stable IOScene line; the upper bound keeps out the next breaking line. -->
<PackageVersion Include="IOScene" Version="[0.1.0, 0.2.0-0.0)" />
</ItemGroup>

<ItemGroup>
<!-- Test-only packages, pinned to exact versions (no floating ranges). -->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.12.0" />
Expand Down
2 changes: 2 additions & 0 deletions PclIO.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<Folder Name="/src/">
<Project Path="src/PclIO/PclIO.csproj" />
<Project Path="src/PclIO.Cli/PclIO.Cli.csproj" />
<Project Path="src/PclIO.Scene/PclIO.Scene.csproj" />
</Folder>
<Project Path="tests/PclIO.Tests/PclIO.Tests.csproj" />
<Project Path="tests/PclIO.Scene.Tests/PclIO.Scene.Tests.csproj" />
</Solution>
35 changes: 28 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
<img src="docs/images/pclio-banner.png" alt="PclIO" width="640">
</p>

PclIO is a .NET library and command line tool that reads point cloud files from several scanner and project formats and exports the points to LAS, XYZ, PTS and JSON, without the software that wrote the files.
PclIO is a .NET library and command line tool that reads point cloud files from several scanner and project formats and exports the points to LAS, XYZ, PTS and JSON, without the software that wrote the files. The `PclIO.Scene` adapter turns a cloud into an [IOScene](https://github.com/IOExtend/IOScene) scene for viewers and coordination tools.

## What it does

- Detects the format of a file or folder from its content, extension or layout (`PclFile.DetectKind`).
- Opens a file as a `PclDocument` with its scans, bounds, transforms, metadata and warnings, and streams the points (`ReadAllPoints`, `PclScan.ReadPoints`) with a point limit, a subsampling step and an optional scan transform. Leica scans additionally read a block range with opt-in parallel decoding.
- Exports to ASPRS LAS 1.2 (point format 2) and 1.4 (point formats 6 to 8), ASCII XYZ, ASCII PTS and JSON.
- Converts a document into an IOScene `SceneDocument` in metres (`PclIO.Scene`, see [scene adapter](docs/scene.md)).
- Ships the command line tool `pclio` with `info`, `scans`, `points` and `export`.

## Install

PclIO is a preview (0.x). The packages are published on nuget.org, not on GitHub Packages, so the Packages box of this repository stays empty.

[![PclIO on NuGet](https://img.shields.io/nuget/v/PclIO?label=PclIO)](https://www.nuget.org/packages/PclIO) [![PclIO.Cli on NuGet](https://img.shields.io/nuget/v/PclIO.Cli?label=PclIO.Cli)](https://www.nuget.org/packages/PclIO.Cli)
[![PclIO on NuGet](https://img.shields.io/nuget/v/PclIO?label=PclIO)](https://www.nuget.org/packages/PclIO) [![PclIO.Cli on NuGet](https://img.shields.io/nuget/v/PclIO.Cli?label=PclIO.Cli)](https://www.nuget.org/packages/PclIO.Cli) [![PclIO.Scene on NuGet](https://img.shields.io/nuget/v/PclIO.Scene?label=PclIO.Scene)](https://www.nuget.org/packages/PclIO.Scene)

Install the command line tool:

Expand All @@ -29,7 +30,13 @@ Add the library to a .NET project:
dotnet add package PclIO
```

The library targets .NET 8 and .NET 10. It is managed code with no dependencies on other packages (see [third-party notices](THIRD-PARTY-NOTICES.md)), has no native dependencies or Windows-only APIs, and is tested on Windows, Linux and macOS. It does not contact the network and writes nothing to the console.
Add the scene adapter (depends on `PclIO` and `IOScene`):

```sh
dotnet add package PclIO.Scene
```

The library targets .NET 8 and .NET 10. It is managed code with no dependencies on other packages (see [third-party notices](THIRD-PARTY-NOTICES.md)), has no native dependencies or Windows-only APIs, and is tested on Windows, Linux and macOS. It does not contact the network and writes nothing to the console. The engine stays a leaf: only the `PclIO.Scene` adapter references IOScene, and only the command line tool combines the two.

## Supported formats

Expand Down Expand Up @@ -165,22 +172,36 @@ outside the file is fetched.

XYZ and PTS output is culture independent (`.` decimal separator) and ends lines with `\n`. JSON output is culture independent; its line ends are those of the platform. Points with a NaN or infinite coordinate are skipped; the overloads with `out long skippedPoints` report how many, and the command line prints `warning: skipped N points with a NaN or infinite coordinate` on standard error when N is not zero. The exception is `pclio points --format json`, which skips nothing and writes such a coordinate as the string `"NaN"`, `"Infinity"` or `"-Infinity"`. Files written by `export` are UTF-8 without a BOM; `info`, `scans` and `points` write to the console with the platform's own line ends and encoding, and control characters in names and messages are printed as `\uXXXX`.

## Scene adapter

`PclIO.Scene` converts a point cloud document into an IOScene `SceneDocument`: one model, one element per scan, non-indexed `Points` geometry in metres, and the scan properties as text. It follows the [IOScene contract](https://github.com/IOExtend/IOScene/blob/main/docs/contract.md); large clouds are outside that model, so the reader caps the scene at 1,000,000 points by default and reports what it left out. Per-point colour, intensity and classification are not part of IOScene 0.1.0 and are reported as dropped; normals are kept when every point of a scan has one. See [docs/scene.md](docs/scene.md) for the mapping, diagnostics and limits.

```csharp
using IOScene;
using PclIO.Scene;

PclSceneResult result = PclSceneReader.Read("site.e57");
SceneJson.Save(result.Document, "site.scene.json");
```

The command line writes the same scene: `pclio export site.e57 site.scene.json`.

## Command line

```text
pclio info <file> [--json]
pclio scans <file> [--json]
pclio points <file> [--scan <id>] [--limit <n>] [--step <s>] [--format <xyz|pts|json>] [--no-transform]
pclio export <input> <output> [--format <las|xyz|pts|json>] [--limit <n>] [--step <s>] [--no-transform] [--force]
pclio export <input> <output> [--format <las|xyz|pts|json|scene>] [--limit <n>] [--step <s>] [--no-transform] [--force]
pclio <input> [--json] same as 'info'
pclio <input> <output> [options] same as 'export'
```

- `info` prints the format, file size, scans, point count, bounds, coordinate system, metadata and warnings.
- `scans` lists the scans with their point counts, channels, bounds and translation.
- `points` prints points to standard output, at most 1000 unless `--limit` is given. `--scan` selects one scan by 0-based index, id or name. `--format xyz` and `--format pts` print the same lines as the exporters (PTS starts with its count line); `--format json` prints one JSON object per line.
- `export` writes a file. The format comes from `--format` or from the output extension (`.las`, `.xyz`, `.pts`, `.json`); any other extension needs `--format`. The output is written to a temporary file next to the target and moved into place when complete. Export refuses to write to the input (compared after following links and junctions, and on Windows by file identity, so the verbatim and device prefixes and administrative shares are caught too; hard links are not detected elsewhere), to a path inside an input folder, to a missing folder or to a directory, and refuses to replace an existing file unless `--force` is given.
- `--limit` and `--step` take integers of at least 1. `--no-transform` returns coordinates as stored. A JSON export rejects `--step` and `--no-transform`, and `--limit` for it is the number of sample points.
- `export` writes a file. The format comes from `--format` or from the output extension (`.las`, `.xyz`, `.pts`, `.json`, `.scene.json`); any other extension needs `--format`. The output is written to a temporary file next to the target and moved into place when complete. Export refuses to write to the input (compared after following links and junctions, and on Windows by file identity, so the verbatim and device prefixes and administrative shares are caught too; hard links are not detected elsewhere), to a path inside an input folder, to a missing folder or to a directory, and refuses to replace an existing file unless `--force` is given.
- `--limit` and `--step` take integers of at least 1. `--no-transform` returns coordinates as stored. A JSON export rejects `--step` and `--no-transform`, and `--limit` for it is the number of sample points. A scene export rejects `--no-transform`, keeps at most 1,000,000 points unless `--limit` is given, and prints the conversion diagnostics on standard error.
- `--help`, `-h` and `help`, and `--version`, `-v` and `version`, print and exit with code 0.

Errors are one line on standard error, with no stack trace for any exit code.
Expand Down Expand Up @@ -226,7 +247,7 @@ See the [public API](docs/public-api.md) for the supported surface and [dependen

## Documentation

[Getting started](docs/getting-started.md), the [public API](docs/public-api.md), [dependencies](docs/dependencies.md) and [private test fixtures](docs/test-fixtures.md) are in `docs/`. The documentation site with the API reference is at <https://ioextend.github.io/PclIO/>, built from them with DocFX (`docfx.json`). [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/IOExtend/PclIO) offers an automatically generated overview of the repository.
[Getting started](docs/getting-started.md), the [public API](docs/public-api.md), the [scene adapter](docs/scene.md), [dependencies](docs/dependencies.md) and [private test fixtures](docs/test-fixtures.md) are in `docs/`. The documentation site with the API reference is at <https://ioextend.github.io/PclIO/>, built from them with DocFX (`docfx.json`). [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/IOExtend/PclIO) offers an automatically generated overview of the repository.

## Limitations

Expand Down
4 changes: 3 additions & 1 deletion THIRD-PARTY-NOTICES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Third-party notices

PclIO has no third-party runtime components: the published packages depend on no other package, and no third-party source code or binaries are included. The Zstandard and Snappy decoders it needs are its own code, written from the public format specifications (RFC 8878 for Zstandard, including its XXH64 content checksum, and the Snappy format description).
The PclIO engine has no third-party runtime components: the `PclIO` package depends on no other package, and no third-party source code or binaries are included. The Zstandard and Snappy decoders it needs are its own code, written from the public format specifications (RFC 8878 for Zstandard, including its XXH64 content checksum, and the Snappy format description).

The `PclIO.Scene` adapter depends on [IOScene](https://github.com/IOExtend/IOScene), the neutral scene model of the IOExtend ecosystem, released under the same MIT license by the same author. It is a first-party package, not a third-party component; the command line tool carries it through the adapter.

Development and build-time packages (xunit, xunit.runner.visualstudio, Microsoft.NET.Test.Sdk, Microsoft.SourceLink.GitHub,
and ZstdSharp.Port, a test-only benchmark reference for the Zstandard decoder) are not part of the published packages.
Expand Down
3 changes: 2 additions & 1 deletion docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"metadata": [
{
"src": [
{ "src": "src/PclIO", "files": ["PclIO.csproj"] }
{ "src": "src/PclIO", "files": ["PclIO.csproj"] },
{ "src": "src/PclIO.Scene", "files": ["PclIO.Scene.csproj"] }
],
"dest": "docs/api",
"properties": { "TargetFramework": "net10.0", "TargetFrameworks": "net10.0" },
Expand Down
20 changes: 13 additions & 7 deletions docs/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@ All package versions live in `Directory.Packages.props` (central package managem
Build settings shared by every project live in `Directory.Build.props`; the SDK is pinned in `global.json`
(`10.0.100`, `rollForward: latestFeature`, no prereleases).

## Runtime packages (library)
## Runtime packages

None. The library and the command line tool depend on the .NET base class library only (`System.IO.Compression`, `System.Xml`,
`System.Text.Json`) and reference no native code. A test checks that neither project file references a package.
The engine (`PclIO`) and the command line tool (`PclIO.Cli`) depend on the .NET base class library only (`System.IO.Compression`,
`System.Xml`, `System.Text.Json`) and reference no native code and no package. A test checks that neither project file references a package.

The scene adapter (`PclIO.Scene`) is the only shipped project with a package dependency: `IOScene` `[0.1.0, 0.2.0-0.0)`, the neutral
scene contract of the IOExtend ecosystem. The upper bound keeps out the next breaking line; the adapter pins the engine as an exact
`[X.Y.Z]` dependency because both ship on one tag. The CLI references the adapter as a project, so the tool carries IOScene too.

### Decisions

- **No dependencies on other packages.** The Zstandard decoder for the point blocks of Leica containers and the Snappy decoder for
the channels of PinPoint data files are part of the library, written from the public format specifications.
- **The engine is a leaf.** No engine code references IOScene or another IOExtend package; the Zstandard decoder for the point blocks
of Leica containers and the Snappy decoder for the channels of PinPoint data files are part of the library, written from the public
format specifications.
- **Decompression bound.** The Zstandard decoder takes an explicit maximum size, so a frame that declares more than the limit is
rejected before memory is allocated. The Snappy decoder is streaming; memory use does not depend on the size of the data.

Expand All @@ -28,7 +33,8 @@ The 11.x line is not used because it pulls `System.IO.Hashing` 11, which does no
## Test packages

Pinned to exact versions: Microsoft.NET.Test.Sdk 18.12.0, xunit 2.9.3 and xunit.runner.visualstudio 4.0.1.
The test project references the library and the CLI project.
The test project references the library and the CLI project; the adapter test project (`PclIO.Scene.Tests`) references the adapter
and links the temporary-directory helper of the main test project.

## Auditing

Expand All @@ -46,4 +52,4 @@ Re-run the audit when changing dependencies.
`EmbedUntrackedSources` true, `PublishRepositoryUrl` true, `VersionPrefix` 0.1.0, the package icon (`icon.png` in each packable project folder), symbol packages (`snupkg`),
`DeterministicSourcePaths` true and a `PathMap` that maps the repository folder to `/_/` (so a local pack contains no local
absolute path), and `ContinuousIntegrationBuild` true when `CI`, `GITHUB_ACTIONS` or `TF_BUILD` is set. `src/Directory.Build.props` turns
warnings into errors for the library and the CLI. The library, the CLI and the tests target `net8.0` and `net10.0`.
warnings into errors for every project under `src`. The library, the adapter, the CLI and the tests target `net8.0` and `net10.0`.
9 changes: 6 additions & 3 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ pclio scans scan.e57
pclio points scan.e57 --limit 20 --format xyz
pclio export scan.e57 scan.xyz --step 10
pclio export scan.e57 scan.json --limit 100 --force
pclio export scan.e57 scan.scene.json --limit 100000
```

The output format of `export` comes from `--format` or from the extension of the output file (`.las`, `.xyz`, `.pts`, `.json`);
any other extension needs `--format`. The output is written to a temporary file next to the target and moved into place when
The output format of `export` comes from `--format` or from the extension of the output file (`.las`, `.xyz`, `.pts`, `.json`,
`.scene.json`); any other extension needs `--format`. The output is written to a temporary file next to the target and moved into place when
it is complete. Export refuses to write to the input (compared after following links and junctions; hard links are not detected),
to a path inside an input folder, to a missing folder or to a directory, and refuses to replace an existing file unless `--force`
is given. `points --format xyz` and `--format pts` print the same lines as the exporters. When points with a NaN or infinite
coordinate are skipped, one `warning: skipped N points ...` line goes to standard error. Run `pclio --help` for all options.
coordinate are skipped, one `warning: skipped N points ...` line goes to standard error. A scene export (`--format scene`) writes
an IOScene scene JSON, keeps at most 1,000,000 points unless `--limit` is given, rejects `--no-transform` and prints the
conversion diagnostics on standard error; see [Scene adapter](scene.md). Run `pclio --help` for all options.

### Exit codes

Expand Down
Loading
Loading