ROIElement: toString() function
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <cmath>
|
||||
#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());
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -21,6 +21,7 @@ public:
|
||||
[[nodiscard]] virtual bool CheckROI(int64_t x, int64_t y, float resolution) const = 0;
|
||||
void MarkROI(std::vector<uint16_t> &v, uint16_t value_to_mark, int64_t xpixel, int64_t ypixel,
|
||||
const std::vector<float> &resolution_map) const;
|
||||
[[nodiscard]] virtual std::string toString() const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user