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

* Force shutter mode to ShutterAutoFrame in Frelon::Interface::reset

* Added Frelon::E2VCorrection for compensating columns 1023,1024
  (currently a factor 2 is applied for easier validation).
* Created Frelon::Bin/RoiChangedCallback, used in E2VCorrectionUpdate to
  automatically set the hw parameters needed by the correction code.
* Moved Frelon control code from FrelonTacoAcq to FrelonAcq.
* Refactored LimaConvertor.h to simplify management of SIP ctrl objs.
  Macro 'domains' were defined to implement different interface classes:
  HwInterface (HW domain), Frelon::Interface (FRELON domain).
* Implemented SIP Frelon::Interface::getHwCtrlObj
* Fixed bug in CtControl::newFrameReady adding an empty TaskMgr to the
  process queue of the PoolThread.
* Added CtImage::setFlip to SIP interface
* Make Frelon::Camera::getInputChanModeName a static member function
* Removed extra Copyright/License header from:
  LimaConvertor.h, global.inc and espia.inc
parent 561d1fb6
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#ifndef FRELONCORRECTION_H
#define FRELONCORRECTION_H
#include "LinkTask.h"
#include "SizeUtils.h"
namespace lima
{
namespace Frelon
{
class E2VCorrection : public LinkTask
{
public:
static const int FirstCol, LastCol;
static const double CorrFactor;
explicit E2VCorrection();
E2VCorrection(const E2VCorrection& o);
~E2VCorrection();
void setHwBin(const Bin& hw_bin);
void getHwBin(Bin& hw_bin);
void setHwRoi(const Roi& hw_roi);
void getHwRoi(Roi& hw_roi);
virtual Data process(Data& data);
private:
Bin m_hw_bin;
Roi m_hw_roi;
};
} // namespace Frelon
} // namespace lima
#endif // FRELONCORRECTION_H
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
namespace Frelon
{
class E2VCorrection : LinkTask
{
%TypeHeaderCode
#include "FrelonCorrection.h"
using namespace lima;
%End
public:
explicit E2VCorrection();
E2VCorrection(const Frelon::E2VCorrection& o);
~E2VCorrection();
void setHwBin(const Bin& hw_bin);
void getHwBin(Bin& hw_bin /Out/);
void setHwRoi(const Roi& hw_roi);
void getHwRoi(Roi& hw_roi /Out/);
virtual Data process(Data& data);
};
}; // namespace Frelon
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#include "FrelonCorrection.h"
using namespace lima;
using namespace lima::Frelon;
using namespace std;
const int E2VCorrection::FirstCol = 1023;
const int E2VCorrection::LastCol = 1024;
const double E2VCorrection::CorrFactor = 2.004;
E2VCorrection::E2VCorrection()
{
}
E2VCorrection::~E2VCorrection()
{
}
E2VCorrection::E2VCorrection(const E2VCorrection& o)
{
}
void E2VCorrection::setHwBin(const Bin& hw_bin)
{
m_hw_bin = hw_bin;
}
void E2VCorrection::getHwBin(Bin& hw_bin)
{
hw_bin = m_hw_bin;
}
void E2VCorrection::setHwRoi(const Roi& hw_roi)
{
m_hw_roi = hw_roi;
}
void E2VCorrection::getHwRoi(Roi& hw_roi)
{
hw_roi = m_hw_roi;
}
Data E2VCorrection::process(Data& data)
{
Data ret = data;
if (!_processingInPlaceFlag) {
int size = data.size();
Buffer *buffer = new Buffer(size);
memcpy(buffer->data, data.data(), size);
ret.setBuffer(buffer);
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 roi_width = m_hw_roi.getSize().getWidth();
if ((corr_offset + corr_width <= 0) || (corr_offset >= roi_width))
return ret;
if (corr_offset + corr_width > roi_width)
corr_width = roi_width - corr_offset;
if (corr_offset < 0) {
corr_width += corr_offset;
corr_offset = 0;
}
typedef unsigned short T;
T *ptr = (T *) ret.data();
ptr += corr_offset;
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);
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