// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #include "ROIElement.h" #include "JFJochException.h" ROIElement::ROIElement(const std::string &in_name) : name(in_name) {} std::string ROIElement::GetName() const { return name; } void ROIElement::MarkROI(std::vector &v, uint16_t value_to_mark, int64_t xpixel, int64_t ypixel, const std::vector &resolution_map, const std::vector &phi_map) const { if (resolution_map.size() != xpixel * ypixel) throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "ROIRectangle: MarkROI mismatch in resolution array size"); if (v.size() < xpixel * ypixel) throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "ROICircle::MarkROI mismatch in input array size"); if (value_to_mark >= 16) throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "ROICircle: Only 16 selections available for ROI"); // phi_map is only supplied (and only consulted by azimuthal ROIs) when an // azimuthal ROI is present; an empty map means the angle is unconstrained. for (int64_t y = 0; y < ypixel; y++) { for (int64_t x = 0; x < xpixel; x++) { int64_t idx = y * xpixel + x; float phi = phi_map.empty() ? 0.0f : phi_map[idx]; if (CheckROI(x, y, resolution_map[idx], phi)) v[idx] |= (1<