EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: PVs controlling image size in AreaDetector
From: Mark Rivers <[email protected]>
To: 'Iain Marcuson' <[email protected]>, "[email protected] >> EPICS Tech Talk" <[email protected]>
Date: Thu, 17 Aug 2017 21:36:37 +0000
Hi Iain,

When your driver's writeInt32() function receives new values for SizeX and SizeY it needs to do something that actually causes the image size to change.  This is typically a call to the vendor SDK to set the readout area of the detector.  Does your detector have this capability?  If not, you could implement it in software in your driver, but I would not recommend that.  Rather I would suggest that you use the NDPluginROI plugin to select the desired sub-region.

Here is how it is handled in the ADProsilica driver.  When the writeInt32() function receives new values for ADBin[X,Y], ADMin[X,Y] , or ADSize[X,Y] it calls setGeometry which makes the calls to the vendor API to set the readout region of the camera.

************************************
asynStatus prosilica::writeInt32(asynUser *pasynUser, epicsInt32 value)
{
    int function = pasynUser->reason;
    int status = asynSuccess;
    tPvUint32 syncs;
    static const char *functionName = "writeInt32";

    /* Set the parameter and readback in the parameter library.  This may be overwritten when we read back the
     * status at the end, but that's OK */
    status |= setIntegerParam(function, value);

    if ((function == ADBinX) ||
        (function == ADBinY) ||
        (function == ADMinX) ||
        (function == ADSizeX) ||
        (function == ADMinY) ||
        (function == ADSizeY)) {
        /* These commands change the chip readout geometry.  We need to cache them and apply them in the
         * correct order */
        status |= setGeometry();
...

asynStatus prosilica::setGeometry()
{
    int status = asynSuccess;
    int s;
    int binX, binY, minY, minX, sizeX, sizeY, maxSizeX, maxSizeY;
    static const char *functionName = "setGeometry";
    
    /* Get all of the current geometry parameters from the parameter library */
    status |= getIntegerParam(ADBinX, &binX);
    if (binX < 1) binX = 1;
    status |= getIntegerParam(ADBinY, &binY);
    if (binY < 1) binY = 1;
    status |= getIntegerParam(ADMinX, &minX);
    status |= getIntegerParam(ADMinY, &minY);
    status |= getIntegerParam(ADSizeX, &sizeX);
    status |= getIntegerParam(ADSizeY, &sizeY);
    status |= getIntegerParam(ADMaxSizeX, &maxSizeX);
    status |= getIntegerParam(ADMaxSizeY, &maxSizeY);

    if (minX + sizeX > maxSizeX) {
        sizeX = maxSizeX - minX;
        setIntegerParam(ADSizeX, sizeX);
    }
    if (minY + sizeY > maxSizeY) {
        sizeY = maxSizeY - minY;
        setIntegerParam(ADSizeY, sizeY);
    }
    
    /* CMOS cameras don't support binning, so ignore ePvErrNotFound errors */
    s = PvAttrUint32Set(this->PvHandle, "BinningX", binX);
    if (s != ePvErrNotFound) status |= s;
    s = PvAttrUint32Set(this->PvHandle, "BinningY", binY);
    if (s != ePvErrNotFound) status |= s;

    if(!status){
      status |= PvAttrUint32Set(this->PvHandle, "RegionX", minX/binX);
      status |= PvAttrUint32Set(this->PvHandle, "RegionY", minY/binY);
      status |= PvAttrUint32Set(this->PvHandle, "Width",   sizeX/binX);
      status |= PvAttrUint32Set(this->PvHandle, "Height",  sizeY/binY);
    }
    
    if (status) asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, 
                      "%s:%s: error, status=%d\n", 
                      driverName, functionName, status);
    return((asynStatus)status);
}
************************************

Mark


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Iain Marcuson
Sent: Thursday, August 17, 2017 3:56 PM
To: [email protected] >> EPICS Tech Talk
Subject: PVs controlling image size in AreaDetector

I am expanding on options for an AreaDetector driver I wrote.  The feature I am trying to add is a variable image size.  I have set ADMaxSizeX and ADMaxSizeY to the maximum for this sensor type.  To change the image size, I am writing to SizeX and SizeY with dbPutField and setIntegerParam followed by callParamCallbacks().  However, the image that comes to the AreaDetector plugin seems to be at the maximum size I specify.  What parameters do I change to change the output image size?

Thank you,

Iain Marcuson.

Replies:
RE: PVs controlling image size in AreaDetector Iain Marcuson
References:
PVs controlling image size in AreaDetector Iain Marcuson

Navigate by Date:
Prev: PVs controlling image size in AreaDetector Iain Marcuson
Next: Location of plugin attributes in HDF5 Hinko Kocevar
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: PVs controlling image size in AreaDetector Iain Marcuson
Next: RE: PVs controlling image size in AreaDetector Iain Marcuson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024