Commit c5449bf5 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron

* Support horiz. binning in Frelon::E2VCorrection.

  Set final Error Factor to 0.004, giving good correction in lab.
parent 1d9a54d1
......@@ -35,7 +35,7 @@ class E2VCorrection : public LinkTask
{
public:
static const int FirstCol, LastCol;
static const double CorrFactor;
static const double ErrorFactor;
explicit E2VCorrection();
E2VCorrection(const E2VCorrection& o);
......
......@@ -106,9 +106,8 @@ class FrelonAcq:
if hw_roi.isEmpty():
deb.Trace('Empty Roi, getting MaxImageSize')
max_size = self.m_det_info_ctrl_obj.getMaxImageSize()
w = max_size.getWidth() / self.m_hw_bin.getX()
h = max_size.getHeight() / self.m_hw_bin.getY()
hw_roi = Roi(Point(0, 0), Size(w, h))
unbinned_roi = Roi(Point(0), max_size)
hw_roi = unbinned_roi.getBinned(self.m_hw_bin)
deb.Trace('hw_roi=%s' % hw_roi)
self.m_e2v_corr.setHwRoi(hw_roi);
......
......@@ -28,7 +28,7 @@ using namespace std;
const int E2VCorrection::FirstCol = 1023;
const int E2VCorrection::LastCol = 1024;
const double E2VCorrection::CorrFactor = 2.004;
const double E2VCorrection::ErrorFactor = 0.004;
E2VCorrection::E2VCorrection()
{
......@@ -74,11 +74,9 @@ Data E2VCorrection::process(Data& data)
buffer->unref();
}
if (m_hw_bin.getX() > 1)
return ret;
int corr_offset = FirstCol - m_hw_roi.getTopLeft().x;
int corr_width = LastCol - FirstCol + 1;
int bin_x = m_hw_bin.getX();
int corr_offset = FirstCol / bin_x - m_hw_roi.getTopLeft().x;
int corr_width = LastCol / bin_x - FirstCol / bin_x + 1;
int roi_width = m_hw_roi.getSize().getWidth();
if ((corr_offset + corr_width <= 0) || (corr_offset >= roi_width))
return ret;
......@@ -94,10 +92,11 @@ Data E2VCorrection::process(Data& data)
T *ptr = (T *) ret.data();
ptr += corr_offset;
double corr_factor = 1 + ErrorFactor / bin_x;
int roi_height = m_hw_roi.getSize().getHeight();
for (int y = 0; y < roi_height; ++y, ptr += roi_width)
for (int x = 0; x < corr_width; ++x)
ptr[x] = T(ptr[x] * CorrFactor);
ptr[x] = T(ptr[x] * corr_factor);
return ret;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment