From ec0b73ffd44b62e5bf265cd791a013f9d5573185 Mon Sep 17 00:00:00 2001
From: Filip Leonarski
Date: Mon, 1 Dec 2025 10:37:42 +0100
Subject: [PATCH 01/29] ScanResult: Add rotation angle for each image
---
broker/OpenAPIConvert.cpp | 3 +-
broker/gen/model/Scan_result_images_inner.cpp | 31 ++++++++++++++++++-
broker/gen/model/Scan_result_images_inner.h | 9 ++++++
broker/jfjoch_api.yaml | 4 +++
broker/redoc-static.html | 4 +--
common/ScanResult.h | 1 +
common/ScanResultGenerator.cpp | 3 ++
common/ScanResultGenerator.h | 2 ++
.../docs/ScanResultImagesInner.md | 1 +
frontend/src/openapi/models/scan_result.ts | 4 +++
10 files changed, 58 insertions(+), 4 deletions(-)
diff --git a/broker/OpenAPIConvert.cpp b/broker/OpenAPIConvert.cpp
index 9af4ec12..e04169bd 100644
--- a/broker/OpenAPIConvert.cpp
+++ b/broker/OpenAPIConvert.cpp
@@ -987,7 +987,8 @@ org::openapitools::server::model::Scan_result Convert(const ScanResult& input) {
if (i.bkg.has_value())
tmp.setBkg(i.bkg.value());
- std::optional pixel_sum;
+ if (i.angle_deg.has_value())
+ tmp.setAngle(i.angle_deg.value());
if (i.pixel_sum.has_value())
tmp.setPixelSum(i.pixel_sum.value());
if (i.max_viable_pixel.has_value())
diff --git a/broker/gen/model/Scan_result_images_inner.cpp b/broker/gen/model/Scan_result_images_inner.cpp
index 4e327e7d..4014d3c8 100644
--- a/broker/gen/model/Scan_result_images_inner.cpp
+++ b/broker/gen/model/Scan_result_images_inner.cpp
@@ -27,6 +27,8 @@ Scan_result_images_inner::Scan_result_images_inner()
m_NxIsSet = false;
m_Ny = 0L;
m_NyIsSet = false;
+ m_Angle = 0.0f;
+ m_AngleIsSet = false;
m_Bkg = 0.0f;
m_BkgIsSet = false;
m_Spots = 0L;
@@ -78,7 +80,7 @@ bool Scan_result_images_inner::validate(std::stringstream& msg, const std::strin
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Scan_result_images_inner" : pathPrefix;
-
+
return success;
}
@@ -100,6 +102,9 @@ bool Scan_result_images_inner::operator==(const Scan_result_images_inner& rhs) c
((!nyIsSet() && !rhs.nyIsSet()) || (nyIsSet() && rhs.nyIsSet() && getNy() == rhs.getNy())) &&
+ ((!angleIsSet() && !rhs.angleIsSet()) || (angleIsSet() && rhs.angleIsSet() && getAngle() == rhs.getAngle())) &&
+
+
((!bkgIsSet() && !rhs.bkgIsSet()) || (bkgIsSet() && rhs.bkgIsSet() && getBkg() == rhs.getBkg())) &&
@@ -161,6 +166,8 @@ void to_json(nlohmann::json& j, const Scan_result_images_inner& o)
j["nx"] = o.m_Nx;
if(o.nyIsSet())
j["ny"] = o.m_Ny;
+ if(o.angleIsSet())
+ j["angle"] = o.m_Angle;
if(o.bkgIsSet())
j["bkg"] = o.m_Bkg;
if(o.spotsIsSet())
@@ -208,6 +215,11 @@ void from_json(const nlohmann::json& j, Scan_result_images_inner& o)
j.at("ny").get_to(o.m_Ny);
o.m_NyIsSet = true;
}
+ if(j.find("angle") != j.end())
+ {
+ j.at("angle").get_to(o.m_Angle);
+ o.m_AngleIsSet = true;
+ }
if(j.find("bkg") != j.end())
{
j.at("bkg").get_to(o.m_Bkg);
@@ -336,6 +348,23 @@ void Scan_result_images_inner::unsetNy()
{
m_NyIsSet = false;
}
+float Scan_result_images_inner::getAngle() const
+{
+ return m_Angle;
+}
+void Scan_result_images_inner::setAngle(float const value)
+{
+ m_Angle = value;
+ m_AngleIsSet = true;
+}
+bool Scan_result_images_inner::angleIsSet() const
+{
+ return m_AngleIsSet;
+}
+void Scan_result_images_inner::unsetAngle()
+{
+ m_AngleIsSet = false;
+}
float Scan_result_images_inner::getBkg() const
{
return m_Bkg;
diff --git a/broker/gen/model/Scan_result_images_inner.h b/broker/gen/model/Scan_result_images_inner.h
index 60698e27..324137d4 100644
--- a/broker/gen/model/Scan_result_images_inner.h
+++ b/broker/gen/model/Scan_result_images_inner.h
@@ -83,6 +83,13 @@ public:
bool nyIsSet() const;
void unsetNy();
///
+ /// Rotation angle associated with the image
+ ///
+ float getAngle() const;
+ void setAngle(float const value);
+ bool angleIsSet() const;
+ void unsetAngle();
+ ///
/// Background estimate
///
float getBkg() const;
@@ -199,6 +206,8 @@ protected:
bool m_NxIsSet;
int64_t m_Ny;
bool m_NyIsSet;
+ float m_Angle;
+ bool m_AngleIsSet;
float m_Bkg;
bool m_BkgIsSet;
int64_t m_Spots;
diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml
index 14127db3..0778a2b6 100644
--- a/broker/jfjoch_api.yaml
+++ b/broker/jfjoch_api.yaml
@@ -1388,6 +1388,10 @@ components:
type: integer
format: int64
description: Cell position in Y for grid scan
+ angle:
+ type: number
+ format: float
+ description: Rotation angle associated with the image
bkg:
type: number
format: float
diff --git a/broker/redoc-static.html b/broker/redoc-static.html
index abeea7dd..ff7fcb6d 100644
--- a/broker/redoc-static.html
+++ b/broker/redoc-static.html
@@ -1319,7 +1319,7 @@ For still measurement the number is ignored
" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">Error within Jungfraujoch code - see output message.
Test Jungfraujoch system
-
http://localhost:5232/result/scan
Response samples
Content typeapplication/json
{"file_prefix": "string",
"images":
[{"efficiency": 0.1,
"number": 0,
"nx": 0,
"ny": 0,
"bkg": 0.1,
"spots": 0,
"spots_low_res": 0,
"spots_indexed": 0,
"spots_ice": 0,
"index": 0,
"pr": 0.1,
"b": 0.1,
"uc":
{"a": 37,
"b": 37,
"c": 78,
"alpha": 90,
"beta": 90,
"gamma": 90
}, "xfel_pulseid": 0,
"pixel_sum": 0,
"max": 0,
"sat": 0,
"err": 0,
"res": 0.1
}
]
}Get Start message in CBOR format
http://localhost:5232/result/scan
Response samples
Content typeapplication/json
{"file_prefix": "string",
"images":
[{"efficiency": 0.1,
"number": 0,
"nx": 0,
"ny": 0,
"angle": 0.1,
"bkg": 0.1,
"spots": 0,
"spots_low_res": 0,
"spots_indexed": 0,
"spots_ice": 0,
"index": 0,
"pr": 0.1,
"b": 0.1,
"uc":
{"a": 37,
"b": 37,
"c": 78,
"alpha": 90,
"beta": 90,
"gamma": 90
}, "xfel_pulseid": 0,
"pixel_sum": 0,
"max": 0,
"sat": 0,
"err": 0,
"res": 0.1
}
]
}Get Start message in CBOR format
Contains metadata for a dataset (e.g., experimental geometry)
Responses