20 double xup,
double yup)
27 double xup,
double yup)
31 throw std::runtime_error(
"RegionOfInterest::RegionOfInterest() -> Error. "
32 "Data is not two-dimensional.");
38 : m_rectangle(new
Rectangle(xlow, ylow, xup, yup))
56 , m_rectangle(other.m_rectangle->clone())
61 , m_glob_index0(other.m_glob_index0)
62 , m_detector_dims(other.m_detector_dims)
63 , m_roi_dims(other.m_roi_dims)
96 if (ny < m_ay1 || ny >
m_ay2)
97 throw std::runtime_error(
"RegionOfInterest::roiIndex() -> Error.");
100 if (nx < m_ax1 || nx >
m_ax2)
101 throw std::runtime_error(
"RegionOfInterest::roiIndex() -> Error.");
119 if (ny < m_ay1 || ny >
m_ay2)
122 if (nx < m_ax1 || nx >
m_ax2)
129 size_t nbin1 = (axis_index == 0 ?
m_ax1 :
m_ay1);
130 size_t nbin2 = (axis_index == 0 ?
m_ax2 :
m_ay2);
Defines interface IDetector2D.
Defines class RegionOfInterest.
Axis with fixed bin size.
Interface for one-dimensional axes.
virtual size_t findClosestIndex(double value) const =0
find bin index which is best match for given value
virtual Bin1D bin(size_t index) const =0
retrieve a 1d bin for the given index
virtual size_t size() const =0
retrieve the number of bins
std::string getName() const
retrieve the label of the axis
Interface for polymorphic classes that should not be copied, except by explicit cloning.
Abstract 2D detector interface.
const IAxis & axis(size_t index) const
size_t rank() const
Returns number of dimensions.
const IAxis & axis(size_t serial_number) const
returns axis with given serial number
A rectangle, for use in detector masks.
Defines rectangular area for the detector which will be simulated/fitted.
size_t detectorSize() const
Number of detector bins.
bool isInROI(size_t detectorIndex) const
std::unique_ptr< IAxis > clipAxisToRoi(size_t axis_index, const IAxis &axis) const
size_t xcoord(size_t index, const std::vector< size_t > &dims) const
size_t detectorIndex(size_t roiIndex) const
Converts roi index to the detector index.
void initFrom(const IAxis &x_axis, const IAxis &y_axis)
size_t m_ax1
Number of bins on detector axes corresponding to roi-rectangle.
size_t ycoord(size_t index, const std::vector< size_t > &dims) const
std::vector< size_t > m_detector_dims
size_t roiSize() const
Number of detector bins in ROI area.
std::vector< size_t > m_roi_dims
size_t roiIndex(size_t detectorIndex) const
Converts global detector index to ROI index.
RegionOfInterest * clone() const
std::unique_ptr< Rectangle > m_rectangle
size_t m_glob_index0
Detector global index corresponding to the lower left corner of ROI.
RegionOfInterest(const IDetector2D &detector, double xlow, double ylow, double xup, double yup)
double m_upper
upper bound of the bin
double m_lower
lower bound of the bin