Skip to content

Honour the per-point validity flags of E57 scans and wider colour and intensity - #70

Open
mahach666 wants to merge 2 commits into
feature/issue-18-e57-sphericalfrom
feature/issue-19-e57-validity
Open

mahach666 wants to merge 2 commits into
feature/issue-18-e57-sphericalfrom
feature/issue-19-e57-validity

Conversation

@mahach666

Copy link
Copy Markdown
Contributor

Closes #19

Based on #69 (the branch feature/issue-18-e57-spherical); merge the earlier pull requests first.

What changed

  • Points that the E57 validity flags mark as invalid are now skipped: cartesianInvalidState / sphericalInvalidState
    (matching the representation) drop the point, isColorInvalid / isIntensityInvalid leave the point without that
    channel. A non-zero flag means invalid. Only one-byte flag streams are honoured; any other shape stays unread like an
    unknown field, so files the reader cannot interpret keep today's behaviour instead of failing.
  • Colour with a wider Integer range from zero (16 or 32 bits per component) is decoded to 8 bits; all three channels
    must share one encoding or colour is reported absent, as before.
  • Intensity as a Float (used as-is), a ScaledInteger (raw times scale plus offset) or a wider Integer from zero
    (normalized by its maximum) is decoded. Malformed auxiliary fields leave the channel unread instead of failing the file.
  • HasColors / HasIntensities report the new encodings. Images are still not read.

Files changed

  • src/PclIO/Formats/E57/E57Document.cs: layout for validity streams, wider colour and intensity encodings, skipping and
    channel clearing in ReadPoints, record-size agreement for the new widths, updated documentation.
  • tests/PclIO.Tests/FormatTests.cs: new tests for skipped points and cleared channels, spherical validity, 16-bit colour,
    float and scaled intensity, mixed colour encodings, uninterpretted validity shapes and a partial colour record.
  • README.md, docs/public-api.md, CHANGELOG.md: the new behaviour.

Tests

  • dotnet build — 0 warnings, 0 errors.
  • dotnet test — 653 passed, 0 failed, 10 skipped (the tests that need private scan files) on .NET 8 and .NET 10.

Limits

  • No public specification available here pins down sub-byte packing or a minimum-bias for these fields, so the reader keeps
    the byte model of the rest of the E57 code: validity streams must hold one flag byte per record to be honoured, colour
    stays Integer-from-zero, and scaled colour / float colour stay unsupported. Files outside that keep working as before.
  • Validity mismatches never fail a read; the flags are auxiliary metadata, like unknown fields and grid indices elsewhere.
  • Images and 2D data are still not read: a scan with them lists and reads its points.
  • 8-bit colour and 8-bit intensity decode exactly as before (all existing round-trip tests pass unchanged).

@mahach666
mahach666 force-pushed the feature/issue-18-e57-spherical branch from 7350d6a to ee38a26 Compare November 17, 2026 15:01
@mahach666
mahach666 force-pushed the feature/issue-19-e57-validity branch from 6c003d6 to 1dbdf82 Compare November 17, 2026 15:02

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