From ac7e0e5145ff304b1cc9ee93f0c93d972c1a78ad Mon Sep 17 00:00:00 2001 From: leonarski_f Date: Fri, 5 Jun 2026 16:36:18 +0200 Subject: [PATCH] CBOR: Fixes --- docs/CBOR.md | 5 ++--- frame_serialize/CBORStream2Deserializer.cpp | 6 ++---- frame_serialize/CBORStream2Serializer.cpp | 5 ++--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/docs/CBOR.md b/docs/CBOR.md index 2c4c8869..bdca03d4 100644 --- a/docs/CBOR.md +++ b/docs/CBOR.md @@ -163,9 +163,8 @@ See [DECTRIS documentation](https://github.com/dectris/documentation/tree/main/s | az_int_std | Array(float) | Standard deviation for azimuthal integration. (NaN for less than 2 samples) | | | | az_int_count | Array(uint64) | Number of pixels contributing to azimuthal bin | | | | indexing_result | bool | Indexing successful | | | -| indexing_lattice_count | uint64 | Number of lattices found in indexing | | X | | indexing_lattice | Array(9 * float) | Indexing result real lattice; present only if indexed | | X | -| extra_lattices | Array(Array(9*float)) | Additional indexed lattices (orientation variants); present only if found | | | +| indexing_extra_lattices | Array(Array(9*float)) | Additional indexed lattices (orientation variants); present only if found | | | | indexing_unit_cell | object | Indexing result unit cell: a, b, c \[angstrom\] and alpha, beta, gamma \[degree\]; present only if indexed | | X | | | | Unit cell is redundant to lattice - yet to simplify downstream programs to analyze results, both are provided | | | | profile_radius | float | Profile radius of the image - describes distance of observed reflections from the Ewald sphere \[Angstrom^-1\] | | | @@ -288,7 +287,7 @@ See [DECTRIS documentation](https://github.com/dectris/documentation/tree/main/s | - niggli_class | int64 | Integer identifier for the Niggli-reduced Bravais class | | | - system | string | Crystal system: triclinic, monoclinic, orthorhombic, tetragonal, trigonal, hexagonal, cubic | | | rotation_lattice | Array(9 * float) | Real-space lattice basis, flattened 3x3 in row-major order | | -| extra_lattices | Array(Array(9*float)) | Additional indexed lattices (orientation variants); present only if found | | +| rotation_extra_lattices | Array(Array(9*float)) | Additional indexed lattices (orientation variants); present only if found | | | data_collection_efficiency_image | Array(float) | Per-image data collection efficiency. Missing values are encoded as 0 or 1 depending on producer context | | | spot_count | Array(int32) | Per-image spot count | | | spot_count_ice_ring | Array(int32) | Per-image number of spots within identified ice-ring resolution ranges | | diff --git a/frame_serialize/CBORStream2Deserializer.cpp b/frame_serialize/CBORStream2Deserializer.cpp index 6c26151d..ac8bcdd8 100644 --- a/frame_serialize/CBORStream2Deserializer.cpp +++ b/frame_serialize/CBORStream2Deserializer.cpp @@ -719,13 +719,11 @@ namespace { GetCBORUInt64Array(value, message.az_int_profile_count); else if (key == "indexing_result") message.indexing_result = GetCBORBool(value); - else if (key == "indexing_lattice_count") - message.indexing_lattice_count = GetCBORUInt(value); else if (key == "indexing_lattice") { std::vector tmp; GetCBORFloatArray(value, tmp); message.indexing_lattice = CrystalLattice(tmp); - } else if (key == "extra_lattices") { + } else if (key == "indexing_extra_lattices") { size_t array_len = GetCBORArrayLen(value); CborValue array_value; cborErr(cbor_value_enter_container(&value, &array_value)); @@ -1421,7 +1419,7 @@ namespace { message.rotation_lattice = CrystalLattice(tmp); } else if (key == "rotation_lattice_type") message.rotation_lattice_type = GetCBORLatticeMessage(value); - else if (key == "extra_lattices") { + else if (key == "rotation_extra_lattices") { size_t array_len = GetCBORArrayLen(value); CborValue array_value; cborErr(cbor_value_enter_container(&value, &array_value)); diff --git a/frame_serialize/CBORStream2Serializer.cpp b/frame_serialize/CBORStream2Serializer.cpp index 8b636427..5312ab08 100644 --- a/frame_serialize/CBORStream2Serializer.cpp +++ b/frame_serialize/CBORStream2Serializer.cpp @@ -724,7 +724,7 @@ void CBORStream2Serializer::SerializeSequenceEnd(const EndMessage& message) { CBOR_ENC(mapEncoder, "rotation_lattice", message.rotation_lattice->GetVector()); if (!message.rotation_extra_lattices.empty()) { CborEncoder arrayEncoder; - cborErr(cbor_encode_text_stringz(&mapEncoder, "extra_lattices")); + cborErr(cbor_encode_text_stringz(&mapEncoder, "rotation_extra_lattices")); cborErr(cbor_encoder_create_array(&mapEncoder, &arrayEncoder, message.rotation_extra_lattices.size())); for (const auto &el : message.rotation_extra_lattices) CBOR_ENC_FLOAT_ARRAY_NOKEY(arrayEncoder, el.GetVector()); @@ -778,12 +778,11 @@ void CBORStream2Serializer::SerializeImageInternal(CborEncoder &mapEncoder, cons CBOR_ENC(mapEncoder, "az_int_profile_count", message.az_int_profile_count); CBOR_ENC(mapEncoder, "indexing_result", message.indexing_result); - CBOR_ENC(mapEncoder, "indexing_lattice_count", message.indexing_lattice_count); if (message.indexing_lattice) CBOR_ENC(mapEncoder, "indexing_lattice", message.indexing_lattice->GetVector()); if (!message.indexing_extra_lattices.empty()) { CborEncoder arrayEncoder; - cborErr(cbor_encode_text_stringz(&mapEncoder, "extra_lattices")); + cborErr(cbor_encode_text_stringz(&mapEncoder, "indexing_extra_lattices")); cborErr(cbor_encoder_create_array(&mapEncoder, &arrayEncoder, message.indexing_extra_lattices.size())); for (const auto &el : message.indexing_extra_lattices) CBOR_ENC_FLOAT_ARRAY_NOKEY(arrayEncoder, el.GetVector());