areaDetector Plugin NDPluginROIStat

Nov, 2014

Matt Pearson

Oak Ridge National Lab

Contents

Overview

This plugin provides multiple regions-of-interest (ROIs) on 1-D and 2-D data and calculates basic statistics (min, max, mean and total counts). The asyn address parameter is used to identify the ROIs, and so a very high number of ROIs can be dealt with in a single thread. The purpose of this plugin is to make it easy for IOC application developers to do simple ROI calculations, without having to use multiple traditional ROI and separate statistics plugins. The plugin can optionally do callbacks on an NDArray object, appending an attribute list. This makes it possible to append the ROI statistic data to the output NDArray.

Several database template files are provided:

Template File Name Description
NDROIStat.template This needs to be instantiated once for each instance of the plugin. It provides records that apply to the whole plugin or to all ROIs.
NDROIStatN.template This needs to be instantiated once for each ROI in the plugin (the number must equal the number of ROIs specified in the IOC shell function). The template provides records that apply to each ROI.
NDROIStat8.template This is provided as a convenience. It instantiates 8 ROIs by including NDROIStat.template once and NDROIStatN.template 8 times.

NDPluginROIStat inherits from NDPluginDriver.

NDPluginROIStat defines the following parameters. It also implements all of the standard plugin parameters from NDPluginDriver. The template files listed above provide access to these parameters, listed in the following tables.

Parameter Definitions in NDPluginROIStat.h and EPICS Record Definitions in NDROIStat.template
Parameter index variable asyn interface Access Description drvInfo string EPICS record name EPICS record type
NDPluginROIStatName asynOctet r/w The name of the plugin. ROISTAT_NAME $(P)$(R)Name
$(P)$(R)Name_RBV
waveform
NDPluginROIStatResetAll asynInt32 r/w Reset the statistics data for all the configured ROIs. ROISTAT_RESETALL $(P)$(R)ResetAll bo
NDPluginROIStatNDArrayCallbacks asynInt32 r/w Set this to 1 to enable output NDArray callbacks. ROISTAT_NDARRAY_CALLBACKS $(P)$(R)NDArrayCallbacks
$(P)$(R)NDArrayCallbacks_RBV
bo
bi
NDArraySizeX asynInt32 r/o The X size of the output NDArray object. ARRAY_SIZE_X $(P)$(R)ArraySizeX_RBV longin
NDArraySizeY asynInt32 r/o The Y size of the output NDArray object. ARRAY_SIZE_Y $(P)$(R)ArraySizeY_RBV longin
NDArraySizeZ asynInt32 r/o The Z size of the output NDArray object. ARRAY_SIZE_Z $(P)$(R)ArraySizeZ_RBV longin
ROI Specific Parameters.
Parameter Definitions in NDPluginROIStat.h and EPICS Record Definitions in NDROIStatN.template
Parameter index variable asyn interface Access Description drvInfo string EPICS record name EPICS record type
NDPluginROIStatUse asynInt32 r/w Set this to 1 to use this ROI, which will mean the statistics will be calculated for this ROI. ROISTAT_USE $(P)$(R)Use
$(P)$(R)Use_RBV
bo
bi
NDPluginROIStatReset asynInt32 r/w Reset the statistics data for this ROI. ROISTAT_RESET $(P)$(R)Reset bo
NDPluginROIStatDim0Min asynInt32 r/w Start element in the X dimension. ROISTAT_DIM0_MIN $(P)$(R)MinX
$(P)$(R)MinX_RBV
longout
longin
NDPluginROIStatDim0Size asynInt32 r/w The ROI size in the X dimension. ROISTAT_DIM0_SIZE $(P)$(R)SizeX
$(P)$(R)SizeX_RBV
longout
longin
NDPluginROIStatDim0MaxSize asynInt32 r/o Max size of the ROI in the X dimension. ROISTAT_DIM0_MAX_SIZE $(P)$(R)MaxSizeX
$(P)$(R)MaxSizeX_RBV
longin
NDPluginROIStatDim1Min asynInt32 r/w Start element in the Y dimension. ROISTAT_DIM1_MIN $(P)$(R)MinY
$(P)$(R)MinY_RBV
longout
longin
NDPluginROIStatDim1Size asynInt32 r/w The ROI size in the Y dimension. ROISTAT_DIM1_SIZE $(P)$(R)SizeY
$(P)$(R)SizeY_RBV
longout
longin
NDPluginROIStatDim1MaxSize asynInt32 r/o Max size of the ROI in the Y dimension. ROISTAT_DIM1_MAX_SIZE $(P)$(R)MaxSizeY
$(P)$(R)MaxSizeY_RBV
longin
NDPluginROIStatDim2Min asynInt32 r/w Start element in the Z dimension. ROISTAT_DIM2_MIN $(P)$(R)MinZ
$(P)$(R)MinZ_RBV
longout
longin
NDPluginROIStatDim2Size asynInt32 r/w The ROI size in the Z dimension. ROISTAT_DIM2_SIZE $(P)$(R)SizeZ
$(P)$(R)SizeZ_RBV
longout
longin
NDPluginROIStatDim2MaxSize asynInt32 r/o Max size of the ROI in the Z dimension. ROISTAT_DIM2_MAX_SIZE $(P)$(R)MaxSizeZ
$(P)$(R)MaxSizeZ_RBV
longin
NDPluginROIStatMinValue asynFloat64 r/o Minimum count value in the ROI. ROISTAT_MIN_VALUE $(P)$(R)MinValue_RBV ai
NDPluginROIStatMaxValue asynFloat64 r/o Maximum count value in the ROI. ROISTAT_MAX_VALUE $(P)$(R)MaxValue_RBV ai
NDPluginROIStatMeanValue asynFloat64 r/o Mean counts value in the ROI. ROISTAT_MEAN_VALUE $(P)$(R)MeanValue_RBV ai
NDPluginROIStatTotal asynFloat64 r/o Total counts in the ROI. ROISTAT_TOTAL $(P)$(R)Total_RBV ai

Configuration

The NDPluginROIStat plugin is created with the NDROIStatConfigure function, either from C/C++ or from the EPICS IOC shell.

NDROIStatConfigure(const char *portName, int queueSize, int blockingCallbacks, 
                          const char *NDArrayPort, int NDArrayAddr, int maxROIs, int maxBuffers,  
                          size_t maxMemory, int priority, int stackSize)
  

All but the maxROIs parameter are common to all plugins. This defines how many ROIs this plugin will deal with. Usually this will match the number of NDROIStatN templates have been instantiated. For example:
NDROIStatConfigure("DET1.ROI", 100, 0, "DET1", 0, 8, -1, -1, 0, 0)

Notes

The EPICS database interface supports 3-D ROIs, but the driver only supports 1-D and 2-D at the moment.