19 RegionOfInterest::RegionOfInterest(
const IDetector2D& detector, 
double xlow, 
double ylow,
 
   20                                    double xup, 
double yup)
 
   23     initFrom(detector.getAxis(0), detector.getAxis(1));
 
   26 RegionOfInterest::RegionOfInterest(
const OutputData<double>& data, 
double xlow, 
double ylow,
 
   27                                    double xup, 
double yup)
 
   32                                                 "Data is not two-dimensional.");
 
   37 RegionOfInterest::RegionOfInterest(
double xlow, 
double ylow, 
double xup, 
double yup)
 
   38     : m_rectangle(new 
Rectangle(xlow, ylow, xup, yup)), m_ax1(0), m_ay1(0), m_ax2(0), m_ay2(0),
 
   48 RegionOfInterest::~RegionOfInterest() = 
default;
 
   51     : 
ICloneable(), m_rectangle(other.m_rectangle->clone()), m_ax1(other.m_ax1), m_ay1(other.m_ay1),
 
   52       m_ax2(other.m_ax2), m_ay2(other.m_ay2), m_glob_index0(other.m_glob_index0),
 
   53       m_detector_dims(other.m_detector_dims), m_roi_dims(other.m_roi_dims)
 
   57 double RegionOfInterest::getXlow()
 const 
   59     return m_rectangle->getXlow();
 
   62 double RegionOfInterest::getYlow()
 const 
   64     return m_rectangle->getYlow();
 
   67 double RegionOfInterest::getXup()
 const 
   69     return m_rectangle->getXup();
 
   72 double RegionOfInterest::getYup()
 const 
   74     return m_rectangle->getYup();
 
   79     return m_glob_index0 + ycoord(
roiIndex, m_roi_dims)
 
   80            + xcoord(
roiIndex, m_roi_dims) * m_detector_dims[1];
 
   85     size_t ny = ycoord(globalIndex, m_detector_dims);
 
   86     if (ny < m_ay1 || ny > m_ay2)
 
   89     size_t nx = xcoord(globalIndex, m_detector_dims);
 
   90     if (nx < m_ax1 || nx > m_ax2)
 
   93     return ny - m_ay1 + (nx - m_ax1) * m_roi_dims[1];
 
   98     return m_roi_dims[0] * m_roi_dims[1];
 
  103     return m_detector_dims[0] * m_detector_dims[1];
 
  106 bool RegionOfInterest::isInROI(
size_t detectorIndex)
 const 
  109     if (ny < m_ay1 || ny > m_ay2)
 
  112     if (nx < m_ax1 || nx > m_ax2)
 
  117 std::unique_ptr<IAxis> RegionOfInterest::clipAxisToRoi(
size_t axis_index, 
const IAxis& axis)
 const 
  119     size_t nbin1 = (axis_index == 0 ? m_ax1 : m_ay1);
 
  120     size_t nbin2 = (axis_index == 0 ? m_ax2 : m_ay2);
 
  125 void RegionOfInterest::initFrom(
const IAxis& x_axis, 
const IAxis& y_axis)
 
  127     m_detector_dims.push_back(x_axis.
size());
 
  128     m_detector_dims.push_back(y_axis.
size());
 
  135     m_roi_dims.push_back(m_ax2 - m_ax1 + 1);
 
  136     m_roi_dims.push_back(m_ay2 - m_ay1 + 1);
 
  138     m_glob_index0 = m_ay1 + m_ax1 * m_detector_dims[1];
 
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 getBin(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.
 
size_t getRank() const
Returns number of dimensions.
 
const IAxis & getAxis(size_t serial_number) const
returns axis with given serial number
 
The rectangle shape having its axis aligned to the (non-rotated) coordinate system.
 
Defines rectangular area for the detector which will be simulated/fitted.
 
size_t detectorSize() const
Number of detector bins.
 
size_t detectorIndex(size_t roiIndex) const
Converts roi index to the detector index.
 
size_t roiSize() const
Number of detector bins in ROI area.
 
size_t roiIndex(size_t detectorIndex) const
Converts global detector index to ROI index.
 
double m_upper
upper bound of the bin
 
double m_lower
lower bound of the bin