diff --git a/common/ROIBox.cpp b/common/ROIBox.cpp index 88bfb1e1..0d8cbc7e 100644 --- a/common/ROIBox.cpp +++ b/common/ROIBox.cpp @@ -5,6 +5,7 @@ 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) { + if (in_x_max < in_x_min) { x_min = in_x_max; x_max = in_x_min; @@ -21,10 +22,19 @@ ROIBox::ROIBox(const std::string &in_name, int64_t in_x_min, int64_t in_x_max, i y_max = in_y_max; } - if (x_min < 0) + if (x_max < 0) { x_min = 0; - if (y_min < 0) + x_max = -1; + } else if (x_min < 0) { + x_min = 0; + } + + if (y_max < 0) { y_min = 0; + y_max = -1; + } else if (y_min < 0) { + y_min = 0; + } } int64_t ROIBox::GetXMin() const {