Skip to content

Derive the layout of a FARO scan folder from its files - #59

Open
mahach666 wants to merge 1 commit into
feature/issue-7-faro-point-countfrom
feature/issue-8-faro-folder-layout
Open

mahach666 wants to merge 1 commit into
feature/issue-7-faro-point-countfrom
feature/issue-8-faro-folder-layout

Conversation

@mahach666

Copy link
Copy Markdown
Contributor

Closes #8

Based on #58 (the branch feature/issue-7-faro-point-count); merge the earlier pull requests first.

What changed

  • The layout of the samples of a FARO scan folder is no longer assumed: the data stream holds one record per cell of the
    grid, so its size must be a multiple of the size of the grid, and the number of bytes per sample follows from it. The
    result is available as FaroScan.RecordSize and in the metadata of the document.
  • The scale of the intensity follows from the values that are stored: values that fit in 12 bits are the 12-bit
    intensities of the scanner (scaled by 2048, as before), wider values are 16-bit intensities (scaled by 65535).
  • The warning that named an assumed layout is only made when the sizes of the files do not fit the grid; otherwise the
    document says which layout was derived.

Files changed

  • src/PclIO/Formats/Faro/FaroFlsDocument.cs: the layout is derived when the folder is opened, the scale of the intensity is
    read from the data, and RecordSize is a new property.
  • tests/PclIO.Tests/SyntheticFixtures.cs: the synthetic folder scan can hold samples of another size, other intensity values,
    extra bytes or fewer samples than the grid.
  • tests/PclIO.Tests/FormatTests.cs: new tests for the derived layout, for the 16-bit intensity, for sizes that do not fit and
    for a truncated stream.
  • README.md, docs/public-api.md, CHANGELOG.md: the new behaviour.

Tests

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

Limits

  • The record layout is derived from the sizes of the files only: the distance is the first 16-bit value of a sample and the
    intensity the second one. A format that stores them in another order is not detected.
  • The scale of the intensity is decided by the largest value of the stream, so a stream that holds only small intensities is
    read with the 12-bit scale even when the format stores 16-bit values.
  • The scale is known after the data has been read once, so the first read of the points reads the stream twice.

@mahach666
mahach666 force-pushed the feature/issue-7-faro-point-count branch from ba421d1 to 3b6b1b9 Compare November 17, 2026 15:01
@mahach666
mahach666 force-pushed the feature/issue-8-faro-folder-layout branch from d7a2b38 to 85e0f53 Compare November 17, 2026 15:01

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