// 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 { 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-bit available for ROI"); for (int64_t y = 0; y < ypixel; y++) { for (int64_t x = 0; x < xpixel; x++) { if (CheckROI(x, y, resolution_map[y * xpixel + x])) v[y * xpixel + x] |= (1<