From 9cff0dc6f731c64dc404e5953f803d032b97eea7 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Mon, 8 Apr 2024 20:56:53 +0200 Subject: [PATCH] OpenAPI: Add spot finding enable/disable option --- broker/JFJochBrokerHttp.cpp | 4 ++- broker/gen/model/Spot_finding_settings.cpp | 16 +++++++++- broker/gen/model/Spot_finding_settings.h | 7 +++++ broker/jfjoch_api.yaml | 4 +++ broker/redoc-static.html | 8 ++--- common/DiffractionExperiment.cpp | 9 +----- .../src/components/DataProcessingSettings.tsx | 29 +++++++++++++++---- .../src/openapi/models/dataset_settings.ts | 4 +-- .../openapi/models/spot_finding_settings.ts | 1 + image_analysis/MXAnalyzer.cpp | 4 +-- image_analysis/SpotFindingSettings.h | 15 +++++----- 11 files changed, 70 insertions(+), 31 deletions(-) diff --git a/broker/JFJochBrokerHttp.cpp b/broker/JFJochBrokerHttp.cpp index 7d7171c4..bc5aa5ae 100644 --- a/broker/JFJochBrokerHttp.cpp +++ b/broker/JFJochBrokerHttp.cpp @@ -19,7 +19,8 @@ inline SpotFindingSettings Convert(const org::openapitools::server::model::Spot_ ret.max_pix_per_spot = input.getMaxPixPerSpot(); ret.high_resolution_limit = input.getHighResolutionLimit(); ret.low_resolution_limit = input.getLowResolutionLimit(); - ret.preview_indexed_only = input.previewIndexedOnlyIsSet() ? input.isPreviewIndexedOnly() : false; + ret.preview_indexed_only = input.isPreviewIndexedOnly(); + ret.enable = input.isEnable(); return ret; } @@ -32,6 +33,7 @@ inline org::openapitools::server::model::Spot_finding_settings Convert(const Spo ret.setHighResolutionLimit(input.high_resolution_limit); ret.setLowResolutionLimit(input.low_resolution_limit); ret.setPreviewIndexedOnly(input.preview_indexed_only); + ret.setEnable(input.enable); return ret; } diff --git a/broker/gen/model/Spot_finding_settings.cpp b/broker/gen/model/Spot_finding_settings.cpp index b0f4501e..dbd70994 100644 --- a/broker/gen/model/Spot_finding_settings.cpp +++ b/broker/gen/model/Spot_finding_settings.cpp @@ -21,6 +21,7 @@ namespace org::openapitools::server::model Spot_finding_settings::Spot_finding_settings() { + m_Enable = true; m_Signal_to_noise_threshold = 0.0f; m_Photon_count_threshold = 0L; m_Min_pix_per_spot = 0L; @@ -51,7 +52,7 @@ bool Spot_finding_settings::validate(std::stringstream& msg, const std::string& bool success = true; const std::string _pathPrefix = pathPrefix.empty() ? "Spot_finding_settings" : pathPrefix; - + /* Signal_to_noise_threshold */ { const float& value = m_Signal_to_noise_threshold; @@ -116,6 +117,9 @@ bool Spot_finding_settings::operator==(const Spot_finding_settings& rhs) const return + (isEnable() == rhs.isEnable()) + && + (getSignalToNoiseThreshold() == rhs.getSignalToNoiseThreshold()) && @@ -148,6 +152,7 @@ bool Spot_finding_settings::operator!=(const Spot_finding_settings& rhs) const void to_json(nlohmann::json& j, const Spot_finding_settings& o) { j = nlohmann::json(); + j["enable"] = o.m_Enable; j["signal_to_noise_threshold"] = o.m_Signal_to_noise_threshold; j["photon_count_threshold"] = o.m_Photon_count_threshold; j["min_pix_per_spot"] = o.m_Min_pix_per_spot; @@ -161,6 +166,7 @@ void to_json(nlohmann::json& j, const Spot_finding_settings& o) void from_json(const nlohmann::json& j, Spot_finding_settings& o) { + j.at("enable").get_to(o.m_Enable); j.at("signal_to_noise_threshold").get_to(o.m_Signal_to_noise_threshold); j.at("photon_count_threshold").get_to(o.m_Photon_count_threshold); j.at("min_pix_per_spot").get_to(o.m_Min_pix_per_spot); @@ -175,6 +181,14 @@ void from_json(const nlohmann::json& j, Spot_finding_settings& o) } +bool Spot_finding_settings::isEnable() const +{ + return m_Enable; +} +void Spot_finding_settings::setEnable(bool const value) +{ + m_Enable = value; +} float Spot_finding_settings::getSignalToNoiseThreshold() const { return m_Signal_to_noise_threshold; diff --git a/broker/gen/model/Spot_finding_settings.h b/broker/gen/model/Spot_finding_settings.h index 70f47538..7b42a728 100644 --- a/broker/gen/model/Spot_finding_settings.h +++ b/broker/gen/model/Spot_finding_settings.h @@ -57,6 +57,11 @@ public: ///////////////////////////////////////////// /// Spot_finding_settings members + /// + /// + /// + bool isEnable() const; + void setEnable(bool const value); /// /// /// @@ -98,6 +103,8 @@ public: friend void to_json(nlohmann::json& j, const Spot_finding_settings& o); friend void from_json(const nlohmann::json& j, Spot_finding_settings& o); protected: + bool m_Enable; + float m_Signal_to_noise_threshold; int64_t m_Photon_count_threshold; diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 8cd7d170..3f29883f 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -311,6 +311,7 @@ components: spot_finding_settings: type: object required: + - enable - signal_to_noise_threshold - photon_count_threshold - max_pix_per_spot @@ -318,6 +319,9 @@ components: - high_resolution_limit - low_resolution_limit properties: + enable: + type: boolean + default: true signal_to_noise_threshold: type: number format: float diff --git a/broker/redoc-static.html b/broker/redoc-static.html index b9960588..c13a34a6 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -535,15 +535,15 @@ If detector is in Inactive or Error states, new settin " class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS sc-ckdEwu LxEPk">

Everything OK

Response samples

Content type
application/json
{
  • "frame_time_us": 450,
  • "count_time_us": 0,
  • "storage_cell_count": 1,
  • "internal_frame_generator": false,
  • "internal_frame_generator_images": 1,
  • "collect_raw_data": false,
  • "pedestal_g0_frames": 0,
  • "pedestal_g1_frames": 0,
  • "pedestal_g2_frames": 0,
  • "storage_cell_delay_us": 0.1,
  • "detector_trigger_delay_us": 0.1,
  • "fixed_gain_g1": false,
  • "use_gain_hg0": false
}

Configure spot finding

Can be done anytime, also while data collection is running

-
Request Body schema: application/json
signal_to_noise_threshold
required
number <float> >= 0
photon_count_threshold
required
integer <int64> >= 0
min_pix_per_spot
required
integer <int64> >= 1
max_pix_per_spot
required
integer <int64> >= 1
high_resolution_limit
required
number <float>
low_resolution_limit
required
number <float>
preview_indexed_only
boolean
Default: false

Responses

Request samples

Content type
application/json
{
  • "signal_to_noise_threshold": 0.1,
  • "photon_count_threshold": 0,
  • "min_pix_per_spot": 1,
  • "max_pix_per_spot": 1,
  • "high_resolution_limit": 0.1,
  • "low_resolution_limit": 0.1,
  • "preview_indexed_only": false
}

Get data processing configuration

Request samples

Content type
application/json
{
  • "enable": true,
  • "signal_to_noise_threshold": 0.1,
  • "photon_count_threshold": 0,
  • "min_pix_per_spot": 1,
  • "max_pix_per_spot": 1,
  • "high_resolution_limit": 0.1,
  • "low_resolution_limit": 0.1,
  • "preview_indexed_only": false
}

Get data processing configuration

Can be done anytime

Responses

Response samples

Content type
application/json
{
  • "signal_to_noise_threshold": 0.1,
  • "photon_count_threshold": 0,
  • "min_pix_per_spot": 1,
  • "max_pix_per_spot": 1,
  • "high_resolution_limit": 0.1,
  • "low_resolution_limit": 0.1,
  • "preview_indexed_only": false
}

Configure radial integration

Response samples

Content type
application/json
{
  • "enable": true,
  • "signal_to_noise_threshold": 0.1,
  • "photon_count_threshold": 0,
  • "min_pix_per_spot": 1,
  • "max_pix_per_spot": 1,
  • "high_resolution_limit": 0.1,
  • "low_resolution_limit": 0.1,
  • "preview_indexed_only": false
}

Configure radial integration

Can be done when detector is Inactive or Idle

Request Body schema: application/json
polarization_factor
number <float> [ -1 .. 1 ]

If polarization factor is provided, than polarization correction is enabled.

@@ -749,7 +749,7 @@ Changing detector will set detector to Inactive state and will requ " class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS sc-ckdEwu LxEPk">

No preview image recorded so far