Skip to content

Read PLY files with ASCII and binary vertices - #78

Open
mahach666 wants to merge 2 commits into
feature/issue-28-pcdfrom
feature/issue-29-ply
Open

mahach666 wants to merge 2 commits into
feature/issue-28-pcdfrom
feature/issue-29-ply

Conversation

@mahach666

Copy link
Copy Markdown
Contributor

Closes #29

Based on #77 (the branch feature/issue-28-pcd); merge the earlier pull requests first.

What changed

  • New PLY reader (PclFileKind.Ply, PlyDocument/PlyScan): ASCII and binary little and big endian files with
    a vertex element. Positions come from x, y and z; 8-bit colour from red, green and blue (with alpha when
    present); intensity; normals from nx, ny and nz — by those conventional names in any numeric type. Faces and
    all other elements are ignored (fixed-size elements before the vertices are skipped). Vertices with
    non-finite coordinates are not returned. PointCount is the declared vertex count.
  • PclFile.Open and DetectKind handle .ply: the ply magic word plus header structure (format line and
    end_header in order) in any extension; an extension alone never suffices.

Files changed

  • src/PclIO/Formats/Ply/PlyDocument.cs: new reader (strict header parser, three storage modes, chunked
    streaming reads, per-type value conversion with range checks).
  • src/PclIO/PclFileKind.cs, src/PclIO/PclFile.cs, src/PclIO/Internal/KindDetector.cs: the Ply kind,
    magic-plus-structure detection (256 KiB probe, position restored) and opening.
  • src/PclIO.Cli/Program.cs: the help text lists PLY as a detected input format.
  • tests/PclIO.Tests/SyntheticFixtures.cs: PlySamplePoint, CreateSyntheticPly (three storages, faces,
    custom properties) and CreatePlyFile for malformed headers.
  • tests/PclIO.Tests/FormatTests.cs: PLY section (open metadata, all three storage round trips, ignored
    faces, NaN skipping, limit/step, Blocks/parallelism ignored, missing positions/vertices, unsupported
    version, skipped/variable preceding elements, ascii/binary truncation, bad value count, unknown type,
    wrong signature).
  • tests/PclIO.Tests/KindDetectionTests.cs, tests/PclIO.Tests/RealFileTests.cs: structure detection and
    the skipped-unless-present .ply invariant test.
  • README.md, docs/public-api.md, docs/getting-started.md, CHANGELOG.md: the new behaviour and limits.

Tests

  • dotnet build — 0 warnings, 0 errors.
  • dotnet test — 794 passed, 13 skipped (private-scan tests), 1 failed on .NET 8 and .NET 10. The single
    failure is RepositoryHygieneTests.Git_History..., which flags the already-pushed issue API: Streaming and parallel decoding for very large files #24 commit 0a78bc6
    for non-UTC dates — outside this PR; fixing it needs a force-push of feature/issue-24-leica-parallel,
    which I did not do without instruction. Every test covering this PR passes (this commit itself uses UTC
    dates and is not flagged).

Limits

  • x/y/z properties are required; files without them (or without a vertex element) are rejected with
    NotSupportedException. Colour needs 8-bit red, green and blue; other shapes stay unread.
  • Only version 1.0 is read; vertex list properties and variable-size elements before the vertices are
    rejected with NotSupportedException.
  • At most 4096 header lines of 1 MiB; 1024 elements of 1024 properties; vertex records at most 1 MiB.
  • Trailing bytes after the vertex data are ignored; Blocks/MaxDegreeOfParallelism are ignored.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant