| 65 | } |
| 66 | |
| 67 | inline void ParseRoi(HQResizeRoiF &parsedRoi, const Roi &roi, int ndim) |
| 68 | { |
| 69 | assert(ndim == 2 || ndim == 3); |
| 70 | auto roiSize = roi.size(); |
| 71 | if (roiSize != static_cast<decltype(roiSize)>(2 * ndim)) |
| 72 | { |
| 73 | if (ndim == 2) |
| 74 | { |
| 75 | throw std::runtime_error( |
| 76 | "Got wrong number of ROI components. For image resize, 4 integers are expected: " |
| 77 | "low_height, low_width, high_height, high_width describing the bounding box for " |
| 78 | "the input."); |
| 79 | } |
| 80 | else |
| 81 | { |
| 82 | throw std::runtime_error( |
| 83 | "Got wrong number of ROI components. For volumetric data, 6 integers are expected: " |
| 84 | "low_depth, low_height, low_width, high_depth, high_height, high_width " |
| 85 | "describing the bounding box for the input."); |
| 86 | } |
| 87 | } |
| 88 | for (int d = 0; d < ndim; d++) |
| 89 | { |
| 90 | parsedRoi.lo[d] = roi[d].cast<float>(); |
| 91 | } |
| 92 | for (int d = 0; d < ndim; d++) |
| 93 | { |
| 94 | parsedRoi.hi[d] = roi[ndim + d].cast<float>(); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | class RoiHelper |
| 99 | { |