Skip to content

Commit

Permalink
[e57] fixed parsing fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanmaierhofer committed Aug 27, 2024
1 parent d68be62 commit 0e470bb
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 6 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 5.5.2
- [e57] fixed parsing fix (cherrypicked from v53 branch)

### 5.5.1
- [e57] fix parsing of classifications that would be encoded with 0 bits per value (see e57 spec 9.7.4.2 (3))

Expand Down
19 changes: 15 additions & 4 deletions src/Aardvark.Algodat.Tests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2792,20 +2792,31 @@ static void Test_Parse_Regression()
var basedir = @"W:\Datasets\pointclouds\tests";
foreach (var file in Directory.GetFiles(basedir, "*.e57"))
{
ParsePointCloudFile(file, verbose: false);
try
{
ParsePointCloudFile(file, verbose: false);
}
catch (Exception e)
{
WriteLine(e);
}
}
}

public static async Task Main(string[] _)
{
await Task.CompletedTask; // avoid warning if no async methods are called here ...

Test_Parse_Regression();

//Test_Import_Regression();

ParsePointCloudFile(@"E:\Villa Vaduz gesamt.e57", verbose: false);
//ParsePointCloudFile(@"W:\Datasets\pointclouds\tests\KOE1 OG7.e57", verbose: false);
//ParsePointCloudFile(
// @"E:\Villa Vaduz gesamt.e57",
// //@"W:\Datasets\pointclouds\tests\6562-alle-Scans.e57",
// verbose: false
// );

//Test_Parse_Regression();

//await CreateStore(
// @"E:\Villa Vaduz gesamt.e57",
Expand Down
29 changes: 27 additions & 2 deletions src/Aardvark.Data.E57/ASTM_E57.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1326,11 +1326,36 @@ ImmutableHashSet<PointPropertySemantics> exclude

if (prototype is E57Integer x0 && x0.NumberOfBitsForBitPack == 0)
{
if (semantic == PointPropertySemantics.Classification)
if (
semantic == PointPropertySemantics.CartesianInvalidState ||
semantic == PointPropertySemantics.Classification ||
semantic == PointPropertySemantics.ColumnIndex ||
semantic == PointPropertySemantics.IsColorInvalid ||
semantic == PointPropertySemantics.IsIntensityInvalid ||
semantic == PointPropertySemantics.IsTimeStampInvalid ||
semantic == PointPropertySemantics.ReturnCount ||
semantic == PointPropertySemantics.ReturnIndex ||
semantic == PointPropertySemantics.RowIndex ||
semantic == PointPropertySemantics.SphericalInvalidState
)
{
if (x0.Value >= int.MinValue && x0.Value <= int.MaxValue)
{
chunk = chunk.Add(PointPropertySemantics.Classification, new int[ps.Length].Set((int)x0.Value));
var xs = new int[ps.Length].Set((int)x0.Value);
chunk = semantic switch
{
PointPropertySemantics.CartesianInvalidState => chunk.Add(PointPropertySemantics.CartesianInvalidState , xs),
PointPropertySemantics.Classification => chunk.Add(PointPropertySemantics.Classification , xs),
PointPropertySemantics.ColumnIndex => chunk.Add(PointPropertySemantics.ColumnIndex , xs),
PointPropertySemantics.IsColorInvalid => chunk.Add(PointPropertySemantics.IsColorInvalid , xs),
PointPropertySemantics.IsIntensityInvalid => chunk.Add(PointPropertySemantics.IsIntensityInvalid , xs),
PointPropertySemantics.IsTimeStampInvalid => chunk.Add(PointPropertySemantics.IsTimeStampInvalid , xs),
PointPropertySemantics.ReturnCount => chunk.Add(PointPropertySemantics.ReturnCount , xs),
PointPropertySemantics.ReturnIndex => chunk.Add(PointPropertySemantics.ReturnIndex , xs),
PointPropertySemantics.RowIndex => chunk.Add(PointPropertySemantics.RowIndex , xs),
PointPropertySemantics.SphericalInvalidState => chunk.Add(PointPropertySemantics.SphericalInvalidState , xs),
_ => throw new Exception($"Semantic {semantic} with 0 bits per value not supported. Error 81cbccee-1147-4695-82e5-54a3d05bf118.")
};
}
else
{
Expand Down

0 comments on commit 0e470bb

Please sign in to comment.