Commit ac83b71d authored by claustre's avatar claustre

- Fixed a bug with Roi/bin

- changed temperature interface in AndorCamera class
parent c8c3d341
......@@ -116,7 +116,7 @@ namespace lima
void getShutterMode(ShutterMode& mode);
void getPixelSize(double&);
void getPixelSize(double& sizex, double& sizey);
void getStatus(Camera::Status& status);
......@@ -137,6 +137,7 @@ namespace lima
void setShutterLevel(int level);
void getShutterLevel(int& level);
void setTemperatureSP(int temp);
void getTemperatureSP(int& temp);
void getTemperature(int& temp);
void setCooler(bool flag);
void getCooler(bool& flag);
......
......@@ -50,7 +50,7 @@ namespace lima
virtual void getCurrImageType(ImageType& curr_image_type);
virtual void setCurrImageType(ImageType curr_image_type);
virtual void getPixelSize(double& pixel_size);
virtual void getPixelSize(double& xsize, double& ysize);
virtual void getDetectorType(std::string& det_type);
virtual void getDetectorModel(std::string& det_model);
......
......@@ -64,7 +64,7 @@ namespace Andor
void setShutterMode(ShutterMode mode);
void getShutterMode(ShutterMode& mode /Out/);
void getPixelSize(double& /Out/);
void getPixelSize(double& /Out/, double& /Out/);
void getStatus(Andor::Camera::Status& status /Out/);
......@@ -80,6 +80,7 @@ namespace Andor
void setShutterLevel(int level);
void getShutterLevel(int& level /Out/);
void setTemperatureSP(int temp);
void getTemperatureSP(int& temp);
void getTemperature(int& temp /Out/);
void setCooler(bool flag);
void getCooler(bool& flag /Out/);
......
......@@ -77,6 +77,7 @@ Camera::Camera(const std::string& config_path,int camera_number)
m_shutter_level(0),
m_shutter_close_time(0),
m_shutter_open_time(0),
m_temperature_sp(0),
m_exp_time(1.)
{
DEB_CONSTRUCTOR();
......@@ -823,25 +824,43 @@ void Camera::setRoi(const Roi& set_roi)
DEB_PARAM() << DEB_VAR1(set_roi);
Point topleft, size;
int binx, biny;
int hstart, hend, vstart, vend;
Roi hw_roi;
Roi hw_roi, roiMax;
Size sizeMax;
getDetectorImageSize(sizeMax);
roiMax = Roi(0,0, sizeMax.getWidth(), sizeMax.getHeight());
// --- Warning, SetImage() needs coodinates in full image size not with binning
// --- but Lima passes image size with binning applied on
// --- so set a internal binning factor (binx/biny) for size correction.
if(m_roi == set_roi) return;
if(set_roi.isActive()) hw_roi = set_roi;
if(set_roi.isActive() && set_roi != roiMax)
{
// --- a real roi available
hw_roi = set_roi;
binx = m_bin.getX(); biny = m_bin.getY();
}
else
{
// ROI has been reset (0x0)
// --- read back full frame size
Size sizeMax;
getDetectorImageSize(sizeMax);
hw_roi = Roi(0,0, sizeMax.getWidth(), sizeMax.getHeight());
// --- either No roi or roi fit with max size!!!
// --- in that case binning for full size calculation is 1
hw_roi = roiMax;
binx=1; biny=1;
}
// --- Andor sets the ROI by starting coordinates at 1 and not 0 !!!!
// --- Warning, SetImage() needs coodinates in full image size not with binning
// --- but Lima passes here image size with binning applied on
topleft = hw_roi.getTopLeft(); size = hw_roi.getSize();
hstart = topleft.x +1; vstart = topleft.y +1;
hend = hstart + size.x -1; vend = vstart + size.y -1;
hstart = topleft.x*binx +1; vstart = topleft.y*biny +1;
hend = hstart + size.x*binx -1; vend = vstart + size.y*biny -1;
DEB_TRACE() << "bin = " << m_bin.getX() <<"x"<< m_bin.getY();
DEB_TRACE() << "roi = " << hstart << "-" << hend << ", " << vstart << "-" << vend;
//- then fix the new ROI
if (andorError(SetImage(m_bin.getX(), m_bin.getY(), hstart, hend, vstart, vend)))
{
......@@ -891,23 +910,39 @@ void Camera::setBin(const Bin &set_bin)
DEB_MEMBER_FUNCT();
Point topleft, size;
int binx, biny;
int hstart, hend, vstart, vend;
Roi hw_roi, roiMax;
Size sizeMax;
getDetectorImageSize(sizeMax);
roiMax = Roi(0,0, sizeMax.getWidth(), sizeMax.getHeight());
if(m_bin == set_bin) return;
// --- Warning, SetImage() needs coodinates in full image size not with binning
// --- but Lima passes image size with binning applied on
// --- so set a internal binning factor (binx/biny) for size correction.
if(m_roi.isActive())
if(m_roi.isActive() && m_roi != roiMax)
{
topleft = m_roi.getTopLeft(); size = m_roi.getSize();
hstart = topleft.x+1; vstart = topleft.y+1;
hend = hstart + size.x -1; vend = vstart + size.y -1;
//- then fix the new BIN
// --- a real available
binx = set_bin.getX(); biny = set_bin.getY();
hw_roi = m_roi;
}
else
{ Size size;
getDetectorImageSize(size);
hstart = 1; vstart = 1;
hend = size.getHeight(); vend = size.getWidth();
{
// --- either No roi or roi fit with max size!!!
// --- in that case binning for full size calculation is 1
hw_roi = roiMax;
binx = 1; biny = 1;
}
topleft = hw_roi.getTopLeft(); size = hw_roi.getSize();
hstart = topleft.x*binx +1; vstart = topleft.y*biny +1;
hend = hstart + size.x*binx -1; vend = vstart + size.y*biny -1;
DEB_TRACE() << "bin = " << set_bin.getX() <<"x"<< set_bin.getY();
DEB_TRACE() << "roi = " << hstart << "-" << hend << ", " << vstart << "-" << vend;
if (andorError(SetImage(set_bin.getX(), set_bin.getY(), hstart, hend, vstart, vend)))
{
DEB_ERROR() << "Cannot set detector BIN" << " : error code = " << m_camera_error_str;
......@@ -947,7 +982,7 @@ bool Camera::isBinningAvailable()
//-----------------------------------------------------
// @brief return the detector pixel size in meter
//-----------------------------------------------------
void Camera::getPixelSize(double& size)
void Camera::getPixelSize(double& sizex, double& sizey)
{
DEB_MEMBER_FUNCT();
float xsize, ysize;
......@@ -957,12 +992,9 @@ void Camera::getPixelSize(double& size)
DEB_ERROR() << "Cannot pixel sizes" << " : error code = " << m_camera_error_str;
THROW_HW_ERROR(Error) << "Cannot get pixel size";
}
//-- what to do with x and y size when lima on support only one size
//Lima will be modified, with a new SizeUtils class for pixel size
// today just return x size supposing it the the same for y.
// remember standard is metric units so size is in meter
size = xsize * 1e-6;
DEB_RETURN() << DEB_VAR1(size);
sizex = xsize * 1e-6;
sizey = ysize * 1e-6;
DEB_RETURN() << DEB_VAR2(sizex, sizey);
}
......@@ -1457,6 +1489,17 @@ void Camera::setTemperatureSP(int temp)
m_temperature_sp = temp;
}
//-----------------------------------------------------
// @brief return the temperature set-point
// @param temperature in centigrade
//
//-----------------------------------------------------
void Camera::getTemperatureSP(int& temp)
{
DEB_MEMBER_FUNCT();
temp = m_temperature_sp;
}
//-----------------------------------------------------
// @brief Gets the real temperature of the detector sensor
......
......@@ -91,10 +91,10 @@ void DetInfoCtrlObj::setCurrImageType(ImageType image_type)
//-----------------------------------------------------
// @brief
//-----------------------------------------------------
void DetInfoCtrlObj::getPixelSize(double& size)
void DetInfoCtrlObj::getPixelSize(double& xsize, double& ysize)
{
DEB_MEMBER_FUNCT();
m_cam.getPixelSize(size);
m_cam.getPixelSize(xsize, ysize);
}
//-----------------------------------------------------
......
......@@ -27,8 +27,6 @@ using namespace lima::Andor;
using namespace std;
//-----------------------------------------------------
// @brief Ctor
//-----------------------------------------------------
......@@ -60,7 +58,7 @@ Interface::Interface(Camera& cam)
}
//-----------------------------------------------------
//
// @brief Dtor
//-----------------------------------------------------
Interface::~Interface()
{
......@@ -68,7 +66,7 @@ Interface::~Interface()
}
//-----------------------------------------------------
//
// @brief return the capability list
//-----------------------------------------------------
void Interface::getCapList(HwInterface::CapList &cap_list) const
{
......@@ -77,7 +75,7 @@ void Interface::getCapList(HwInterface::CapList &cap_list) const
}
//-----------------------------------------------------
//
// @brief reset the interface, stop the acqisition
//-----------------------------------------------------
void Interface::reset(ResetLevel reset_level)
{
......@@ -90,7 +88,7 @@ void Interface::reset(ResetLevel reset_level)
}
//-----------------------------------------------------
//
// @brief do nothing
//-----------------------------------------------------
void Interface::prepareAcq()
{
......@@ -98,7 +96,7 @@ void Interface::prepareAcq()
}
//-----------------------------------------------------
//
// @brief start the camera acquisition
//-----------------------------------------------------
void Interface::startAcq()
{
......@@ -107,7 +105,7 @@ void Interface::startAcq()
}
//-----------------------------------------------------
//
// @brief stop the camera acquisition
//-----------------------------------------------------
void Interface::stopAcq()
{
......@@ -116,7 +114,7 @@ void Interface::stopAcq()
}
//-----------------------------------------------------
//
// @brief return the status of detector/acquisition
//-----------------------------------------------------
void Interface::getStatus(StatusType& status)
{
......@@ -152,7 +150,7 @@ void Interface::getStatus(StatusType& status)
}
//-----------------------------------------------------
//
// @brief return the hw number of acquired frames
//-----------------------------------------------------
int Interface::getNbHwAcquiredFrames()
{
......@@ -163,7 +161,6 @@ int Interface::getNbHwAcquiredFrames()
}
//-----------------------------------------------------
//-----------------------------------------------------
//
......
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