diff --git a/common/ROIAzimuthal.cpp b/common/ROIAzimuthal.cpp index 76392bc8..1a6794d3 100644 --- a/common/ROIAzimuthal.cpp +++ b/common/ROIAzimuthal.cpp @@ -4,6 +4,7 @@ #include #include "ROIAzimuthal.h" #include "JFJochException.h" +#include "spdlog/fmt/bundled/format.h" ROIAzimuthal::ROIAzimuthal(const std::string &in_name, float in_d_min_A, float in_d_max_A) : ROIElement(in_name) { @@ -48,3 +49,7 @@ ROIConfig ROIAzimuthal::ExportMetadata() const { .azim = ROIConfigAzim{.qmin = qmin, .qmax = qmax} }; } + +std::string ROIAzimuthal::toString() const { + return fmt::format("Azim Q {:.02f} - {:.02f} A", GetQMin_recipA(), GetQMax_recipA()); +} diff --git a/common/ROIAzimuthal.h b/common/ROIAzimuthal.h index 5e648c40..9b17fd65 100644 --- a/common/ROIAzimuthal.h +++ b/common/ROIAzimuthal.h @@ -18,6 +18,7 @@ public: bool CheckROI(int64_t x, int64_t y, float resolution) const override; ROIConfig ExportMetadata() const override; + [[nodiscard]] std::string toString() const override; }; diff --git a/common/ROIBox.cpp b/common/ROIBox.cpp index 3fae8e3c..37ee441f 100644 --- a/common/ROIBox.cpp +++ b/common/ROIBox.cpp @@ -2,8 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only #include "ROIBox.h" -#include "JFJochException.h" -#include "../fpga/pcie_driver/jfjoch_fpga.h" +#include "spdlog/fmt/bundled/format.h" ROIBox::ROIBox(const std::string &in_name, int64_t in_x_min, int64_t in_x_max, int64_t in_y_min, int64_t in_y_max) : ROIElement(in_name) { @@ -68,3 +67,7 @@ ROIConfig ROIBox::ExportMetadata() const { .box = ROIConfigBox{.xmin = x_min, .xmax = x_max, .ymin = y_min, .ymax = y_max} }; } + +std::string ROIBox::toString() const { + return fmt::format("Box x: {} - {} y: {} - {} pxl", x_min, x_max, y_min, y_max); +} \ No newline at end of file diff --git a/common/ROIBox.h b/common/ROIBox.h index 91aa2f53..e5c0dded 100644 --- a/common/ROIBox.h +++ b/common/ROIBox.h @@ -24,6 +24,7 @@ public: bool CheckROI(int64_t x, int64_t y, float resolution) const override; ROIConfig ExportMetadata() const override; + [[nodiscard]] std::string toString() const override; }; #endif //JUNGFRAUJOCH_ROIBOX_H diff --git a/common/ROICircle.cpp b/common/ROICircle.cpp index 42d4b1ac..2edb629b 100644 --- a/common/ROICircle.cpp +++ b/common/ROICircle.cpp @@ -5,6 +5,7 @@ #include "ROICircle.h" #include "JFJochException.h" +#include "spdlog/fmt/bundled/format.h" ROICircle::ROICircle(const std::string &name, float in_x, float in_y, float in_r_pxl) : ROIElement(name), center_x(in_x), center_y(in_y), r_pxl(in_r_pxl), r_pxl_2(in_r_pxl * in_r_pxl) { @@ -39,3 +40,8 @@ bool ROICircle::CheckROI(int64_t x, int64_t y, float resolution) const { float dist_from_center_sq = x_fl * x_fl + y_fl * y_fl; return (dist_from_center_sq <= r_pxl_2); } + +std::string ROICircle::toString() const { + return fmt::format("Circle x: {:.1f} y: {:.1f} r: {:.01f} pxl", center_x, center_y, r_pxl); +} + diff --git a/common/ROICircle.h b/common/ROICircle.h index 316b6550..86d85506 100644 --- a/common/ROICircle.h +++ b/common/ROICircle.h @@ -20,6 +20,7 @@ public: [[nodiscard]] float GetRadius_pxl() const; bool CheckROI(int64_t x, int64_t y, float resolution) const override; ROIConfig ExportMetadata() const override; + [[nodiscard]] std::string toString() const override; }; #endif //JUNGFRAUJOCH_ROICIRCLE_H diff --git a/common/ROIElement.h b/common/ROIElement.h index 13336f9f..a46b0e48 100644 --- a/common/ROIElement.h +++ b/common/ROIElement.h @@ -21,6 +21,7 @@ public: [[nodiscard]] virtual bool CheckROI(int64_t x, int64_t y, float resolution) const = 0; void MarkROI(std::vector &v, uint16_t value_to_mark, int64_t xpixel, int64_t ypixel, const std::vector &resolution_map) const; + [[nodiscard]] virtual std::string toString() const = 0; };