areaDetector PerkinElmer driver

March 29, 2016

Mark Rivers, John Hammonds, Brian Tieman

University of Chicago and Argonne National Laboratory

Table of Contents


This is an EPICS areaDetector driver for the flat-panel amorphous silicon detectors from PerkinElmer.

The driver is based upon the XISL library provided by PerkinElmer. It only runs on Microsoft Windows computers. It supports both 32-bit and 64-bit versions of Windows.

This driver has been tested with the following detectors

This driver inherits from ADDriver. It implements many of the parameters in asynNDArrayDriver.h and in ADArrayDriver.h. It also implements a number of parameters that are specific to the PerkinElmer detectors. The PerkinElmer class documentation describes this class in detail.

Implementation of standard driver parameters

The following table describes how the PerkinElmer driver implements some of the standard driver parameters.

Implementation of Parameters in asynNDArrayDriver.h and ADDriver.h, and EPICS Record Definitions in ADBase.template and NDFile.template
Parameter index variable EPICS record name Description
ADNumImages $(P)$(R)NumImages Controls the number of images to acquire when ADImageMode is Multiple or Average
ADAcquireTime $(P)$(R)AcquireTime
When TriggerMode=Internal or Soft Trigger this value controls the exposure time, both for SynchMode="Framewise" and "DDD No Clear".
When TriggerMode=External and SynchMode="DDD No Clear" this value also controls the exposure time.
When TriggerMode=External and SynchMode="Framewise" the exposure time is determined by the time between trigger pulses, not by AcquireTime.
When TriggerMode=Free Running the AcquireTime is ignored, and the detector runs at the maximum possible frame rate and a fixed exposure time.
ADTriggerMode $(P)$(R)TriggerMode
Sets the trigger mode for the detector. Options are:
  • Internal
  • External
  • Free Running
  • Soft Trigger
See the Synchronization and triggering section below for more details about synchronization and triggering.
ADImageMode $(P)$(R)ImageMode
Sets the trigger mode for the detector. Options are:
  • Single
  • Multiple
  • Continuous
  • Average. This mode is new for the Perkin Elmer. It averages NumImages frames in the hardware frame grabber. It is useful when the total acquisition time is longer than the 5 second maximum allowed in Internal trigger mode, etc.

PerkinElmer specific parameters

The PerkinElmer driver implements the following parameters in addition to those in asynNDArrayDriver.h and ADDriver.h.

Parameter Definitions in PerkinElmer.h and EPICS Record Definitions in PerkinElmer.template
Parameter index variable asyn interface Access Description drvInfo string EPICS record name EPICS record type
PE_NumFrameBuffers asynInt32 r/w Number of software frame buffers to use PE_NUM_FRAME_BUFFERS $(P)$(R)PENumFrameBuffers
PE_Initialize asynInt32 w Initialize the detector PE_INITIALIZE $(P)$(R)PEInitialize bo
PE_Trigger asynInt32 w Trigger record for soft trigger mode PE_TRIGGER $(P)$(R)PETrigger bo
PE_FrameBufferIndex asynInt32 r Frame number from the hardware frame buffer for this image. Values go from 1 to 8. PE_FRAME_BUFFER_INDEX $(P)$(R)PEFrameBuffIndex longin
PE_ImageNumber asynInt32 r Image number for this image in the software frame buffer array. PE_IMAGE_NUMBER $(P)$(R)PEImageNumber longin
PE_Gain asynInt32 r/w Gain selection in units of pF capacitance. Choices are 0.25, 0.5, 1, 2, 4, and 8. PE_GAIN $(P)$(R)PEGain
PE_SyncMode asynInt32 r/w Synchronization mode. Choices are:
  • "DDD Clear" This mode has not been tested and clear documentation on it seems to be missing.
  • "DDD No Clear" This is Data Delivered on Demand mode. It discards the next frame and then starts acquiring a new frame for the specified acquisition time.
  • "Linewise" This is a specialized mode that requires an external timing source. It has not been tested with the EPICS driver. See the manual for details.
  • "Framewise" This is the normal default mode. The next frame delivered from the detector is stored.
  • "AutoTrigger" This mode is only available on the XRPAD. It automatically triggers a readout when the number of x-rays striking the detecotor reaches a defined threashold.
See the Synchronization and triggering section below for more details about synchronization and triggering.
Offset corrections
PE_NumOffsetFrames asynInt32 r/w Number of frames to collect and average when collecting offset frames PE_NUM_OFFSET_FRAMES $(P)$(R)PENumOffsetFrames longout
PE_CurrentOffsetFrame asynInt32 r Current offset frame being collected when collecting offset frames PE_CURRENT_OFFSET_FRAMEs $(P)$(R)PECurrentOffsetFrame longin
PE_AcquireOffset asynInt32 r/w Acquire offset frames PE_ACQUIRE_OFFSET $(P)$(R)PEAcquireOffset busy
PE_UseOffset asynInt32 r/w Set whether offset image is to be used. Choices are "Disable" (0) and "Enable" (1). PE_USE_OFFSET $(P)$(R)PEUseOffset bo
PE_OffsetAvailable asynInt32 r Report whether offset image has been collected and is available for use. Choices are "Not available" (0) and "Available" (1). PE_OFFSET_AVAILABLE $(P)$(R)PEOffsetAvailable bi
PE_OffsetConstant asynInt32 r/w An offset that is added to the image when the offset correction is performed. CorrectedImage = RawImage - OffsetImage + OffsetConstant. This constant should be used to prevent the CorrectedImage from having any negative pixel values, which would otherwise be clipped to 0. For efficiency this value is actually subtracted from the offset image as soon as it is collected, so it is then effectively added to each image when offset correction is done. This results in 2 restrictions:
  1. PEOffsetConstant must be specified before the offset images are collected. If it is changed then the offset images must be collected again.
  2. The value must be less than the minimum value of the offset image, or else negative values will result. In practice this should not be a problem, since an offset of 100 should be sufficient to prevent negative values during offset correction, and the offset images are always greater than 100.
Gain corrections
PE_NumGainFrames asynInt32 r/w Number of frames to collect and average when collecting gain frames PE_NUM_GAIN_FRAMES $(P)$(R)PENumGainFrames longout
PE_CurrentGainFrame asynInt32 r Current gain frame being collected when collecting gain frames PE_CURRENT_GAIN_FRAMEs $(P)$(R)PECurrentGainFrame longin
PE_AcquireGain asynInt32 w Acquire gain frames PE_ACQUIRE_GAIN $(P)$(R)PEAcquireGain busy
PE_UseGain asynInt32 w Set whether gain image is to be used. Choices are "Disable" (0) and "Enable" (1). PE_USE_GAIN $(P)$(R)PEUseGain bo
PE_GainAvailable asynInt32 r Report whether offset image has been collected and is available for use. Choices are "Not available" (0) and "Available" (1). PE_GAIN_AVAILABLE $(P)$(R)PEGainAvailable bi
PE_GainFile asynOctetWrite w File name for gain correction file PE_GAIN_FILE $(P)$(R)PEGainFile waveform
PE_SaveGainFile asynInt32 w Save gain corrections to a file PE_SAVE_GAIN_FILE $(P)$(R)PESaveGainFile bo
PE_LoadGainFile asynInt32 w Load gain corrections from a file PE_LOAD_GAIN_FILE $(P)$(R)PELoadGainFile bo
Bad pixel corrections
PE_UsePixelCorrections asynInt32 w Set whether bad pixel correction is to be used PE_USE_PIXEL_CORRECTION $(P)$(R)PEUsePixelCorrection bo
PE_PixelCorrectionAvailable asynInt32 r Report whether pixel correction file has been set and is available for use PE_PIXEL_CORRECTION_AVAILABLE $(P)$(R)PEPixelCorrectionAvailable bi
PE_PixelCorrectionFile asynOctetWrite w File name for pixel correction file PE_PIXEL_CORRECTION_FILE $(P)$(R)PEPixelFile waveform
PE_CorrectionsDirectory asynOctetWrite r/w Directory where gain and pixel correction files should be stored PE_CORRECTIONS_DIRECTORY $(P)$(R)PECorrectionsDir waveform
PE_LoadPixelCorrectionFile asynInt32 w Load pixel corrections from a file for use PE_LOAD_PIXEL_CORRECTION_FILE $(P)$(R)PELoadPixelCorrections bo
Skip frames settings
PE_SkipFrames asynInt32 r/w Set whether to skip initial PENumFramesToSkip frames from the detector on each acquisition. This can be used to discard the first frame which may contain data from before acquisition was started. PE_SKIP_FRAMES $(P)$(R)PESkipFrames
PE_NumFramesToSkip asynInt32 r/w Sets the number of initial frames from the detector to skip on each acquisition if PESkipFrames=1. PE_NUM_FRAMES_TO_SKIP $(P)$(R)PENumFramesToSkip

Unsupported standard driver parameters

The PerkinElmer driver does not support the following standard driver parameters because they are not supported in the PerkinElmer library:

Synchronization and triggering

The Perkin Elmer detectors support a number of acquisition modes which are controlled by the TriggerMode, SyncMode, and AcquireTime records. This is a simplified discussion, and the reader should consult the XIS software manual and the detector hardware manuals (e.g. 1621 hardware manual) for details.

The number of frames to be acquired is always controlled by the ImageMode=(Single, Multiple, or Continuous) and NumImages (if ImageMode=Multiple) records, regardless of the values of the TriggerMode, SyncMode, and AcquireTime records.

It is important to realize that the detector hardware is constantly acquiring a stream of frames even when the EPICS Acquire record is 0. The rate of this frame stream depends on the value of the TriggerMode:

When SyncMode=Framewise and acquisition is started by setting Acquire=1 then the first frame that the EPICS driver collects is the next frame in that frame stream. NOTE: this means that this frame probably started exposing before Acquire was set to 1. This may not be desirable since motors may have still been moving, or a shutter not yet opened. When acquiring a sequence of images (ImageMode=Multiple) this would only affect the first image in the sequence, which might be acceptable. However, if doing a step-scan with ImageMode=Single it would affect every image in the scan. There are two ways to handle this. One is to use SyncMode=Framewise and set PENumFramesToSkip=1. This is quite inefficient since on average it will have an overhead of AcquireTime/2, and a worst case overhead of AcquireTime. A better approach is to set FrameSync="DDD No Clear", which adds a small overhead to each frame (~0.1-0.2 seconds), but ensures that the exposure is started after Acquire is set to 1.

TriggerMode=Free Running

In this mode the AcquireTime is ignored, and the detector runs at the maximum possible frame rate and a fixed minimum exposure time. SyncMode should be set to Framewise in this mode.


In this mode the behavior depends on the setting of SyncMode.


In this mode the behavior also depends on the setting of SyncMode.

TriggerMode="Soft Trigger"

In this mode the behavior also depends on the setting of SyncMode.

It is important that the offset images are collected with the same SyncMode as the data. If the offset images are collected with SyncMode=Framewise and the data are collected with SyncMode="DDD No Clear" then the offset correction will not be correct, even if both are collected with the same AcquireTime. When using SyncMode="DDD No Clear" it is fine to collect the offset and data images with different values of TriggerMode. For example the offset images could be collected with TriggerMode=Internal and the data images collected with TriggerMode=External.


The PerkinElmer driver is created with the perkinElmerConfig command, either from C/C++ or from the EPICS IOC shell.

int PerkinElmerConfig(const char *portName, int IDType, const char* IDValue,
                      int maxBuffers, size_t maxMemory,
                      int priority, int stackSize )

For details on the meaning of the parameters to this function refer to the detailed documentation on the PerkinElmerConfig function in the PerkinElmer.cpp documentation and in the documentation for the constructor for the PerkinElmer class.

There an example IOC boot directory and startup script (iocBoot/iocPerkinElmer/st.cmd) provided with areaDetector.

MEDM screens

The following show the MEDM screens that are used to control the PerkinElmer detector. Note that the general purpose screen ADBase.adl can be used, but it exposes many controls that are not applicable to the PerkinElmer, and lacks some fields that are important for the PerkinElmer driver.

PerkinElmer.adl is the main screen used to control the PerkinElmer driver.



Performance measurements

The following measurements were done to demonstrate the performance that can be obtained with the areaDetector PerkinElmer driver.


The following are some current restrictions of the PerkinElmer driver: