areaDetector  3-13
EPICS areaDetector framework
NDPluginROIStat.h
Go to the documentation of this file.
1 
5 #ifndef NDPluginROIStat_H
6 #define NDPluginROIStat_H
7 
8 #include <epicsTypes.h>
9 
10 #include "NDPluginDriver.h"
11 
12 /* ROI general parameters */
13 #define NDPluginROIStatFirstString "ROISTAT_FIRST"
14 #define NDPluginROIStatLastString "ROISTAT_LAST"
15 #define NDPluginROIStatNameString "ROISTAT_NAME" /* (asynOctet, r/w) Name of this ROI */
16 #define NDPluginROIStatResetAllString "ROISTAT_RESETALL" /* (asynInt32, r/w) Reset ROI data for all ROIs. */
17 
18 /* ROI definition */
19 #define NDPluginROIStatUseString "ROISTAT_USE" /* (asynInt32, r/w) Use this ROI? */
20 #define NDPluginROIStatResetString "ROISTAT_RESET" /* (asynInt32, r/w) Reset ROI data. */
21 #define NDPluginROIStatBgdWidthString "ROISTAT_BGD_WIDTH" /* (asynInt32, r/w) Width of background region when computing net */
22 #define NDPluginROIStatDim0MinString "ROISTAT_DIM0_MIN" /* (asynInt32, r/w) Starting element of ROI in X dimension */
23 #define NDPluginROIStatDim0SizeString "ROISTAT_DIM0_SIZE" /* (asynInt32, r/w) Size of ROI in X dimension */
24 #define NDPluginROIStatDim0MaxSizeString "ROISTAT_DIM0_MAX_SIZE" /* (asynInt32, r/o) Maximum size of ROI in X dimension */
25 #define NDPluginROIStatDim1MinString "ROISTAT_DIM1_MIN" /* (asynInt32, r/w) Starting element of ROI in Y dimension */
26 #define NDPluginROIStatDim1SizeString "ROISTAT_DIM1_SIZE" /* (asynInt32, r/w) Size of ROI in Y dimension */
27 #define NDPluginROIStatDim1MaxSizeString "ROISTAT_DIM1_MAX_SIZE" /* (asynInt32, r/o) Maximum size of ROI in Y dimension */
28 #define NDPluginROIStatDim2MinString "ROISTAT_DIM2_MIN" /* (asynInt32, r/w) Starting element of ROI in Z dimension */
29 #define NDPluginROIStatDim2SizeString "ROISTAT_DIM2_SIZE" /* (asynInt32, r/w) Size of ROI in Z dimension */
30 #define NDPluginROIStatDim2MaxSizeString "ROISTAT_DIM2_MAX_SIZE" /* (asynInt32, r/o) Maximum size of ROI in Z dimension */
31 
32 /* ROI statistics */
33 #define NDPluginROIStatMinValueString "ROISTAT_MIN_VALUE" /* (asynFloat64, r/o) Minimum counts in any element */
34 #define NDPluginROIStatMaxValueString "ROISTAT_MAX_VALUE" /* (asynFloat64, r/o) Maximum counts in any element */
35 #define NDPluginROIStatMeanValueString "ROISTAT_MEAN_VALUE" /* (asynFloat64, r/o) Mean counts of all elements */
36 #define NDPluginROIStatTotalString "ROISTAT_TOTAL" /* (asynFloat64, r/o) Sum of all elements */
37 #define NDPluginROIStatNetString "ROISTAT_NET" /* (asynFloat64, r/o) Sum of all elements minus background */
38 
39 /* Time series of statistics */
40 #define NDPluginROIStatTSControlString "ROISTAT_TS_CONTROL" /* (asynInt32, r/w) Erase/start, stop, start */
41 #define NDPluginROIStatTSNumPointsString "ROISTAT_TS_NUM_POINTS" /* (asynInt32, r/w) Number of time series points to use */
42 #define NDPluginROIStatTSCurrentPointString "ROISTAT_TS_CURRENT_POINT" /* (asynInt32, r/o) Current point in time series */
43 #define NDPluginROIStatTSAcquiringString "ROISTAT_TS_ACQUIRING" /* (asynInt32, r/o) Acquiring time series */
44 #define NDPluginROIStatTSMinValueString "ROISTAT_TS_MIN_VALUE" /* (asynFloat64Array, r/o) Series of minimum counts */
45 #define NDPluginROIStatTSMaxValueString "ROISTAT_TS_MAX_VALUE" /* (asynFloat64Array, r/o) Series of maximum counts */
46 #define NDPluginROIStatTSMeanValueString "ROISTAT_TS_MEAN_VALUE" /* (asynFloat64Array, r/o) Series of mean counts */
47 #define NDPluginROIStatTSTotalString "ROISTAT_TS_TOTAL" /* (asynFloat64Array, r/o) Series of total */
48 #define NDPluginROIStatTSNetString "ROISTAT_TS_NET" /* (asynFloat64Array, r/o) Series of net */
49 #define NDPluginROIStatTSTimestampString "ROISTAT_TS_TIMESTAMP" /* (asynFloat64Array, r/o) Series of timestamps */
50 
51 typedef enum {
60 
61 typedef enum {
66  TSErase
68 
70 typedef struct NDROI {
71  int use;
72  size_t offset[2];
73  size_t size[2];
74  size_t bgdWidth;
75  double total;
76  double mean;
77  double min;
78  double max;
79  double net;
80  size_t arraySize[2];
82 
83 
86 public:
87  NDPluginROIStat(const char *portName, int queueSize, int blockingCallbacks,
88  const char *NDArrayPort, int NDArrayAddr, int maxROIs,
89  int maxBuffers, size_t maxMemory,
90  int priority, int stackSize, int maxThreads);
91 
92  //These methods override the virtual methods in the base class
93  void processCallbacks(NDArray *pArray);
94  asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
95 
96 protected:
97 
98  //ROI general parameters
100  #define FIRST_NDPLUGIN_ROISTAT_PARAM NDPluginROIStatFirst
106 
107  //ROI definition
117 
118  //ROI statistics
124 
125  // Time Series
136 
138 
139 private:
140 
141  template <typename epicsType> asynStatus doComputeStatisticsT(NDArray *pArray, NDROI_t *pROI);
142  asynStatus doComputeStatistics(NDArray *pArray, NDROI_t *pStats);
143  asynStatus clear(epicsUInt32 roi);
144  void clearTimeSeries();
145  void doTimeSeriesCallbacks();
146 
147  int maxROIs_;
148  int numTSPoints_;
149  int currentTSPoint_;
150  double *timeSeries_;
151 };
152 
153 #endif //NDPluginROIStat_H
154 
155 
#define NDPLUGIN_API
Definition: NDPluginAPI.h:41
NDPluginROIStatsTSControl_t
Definition: NDPluginROIStat.h:61
@ TSRead
Definition: NDPluginROIStat.h:65
@ TSStart
Definition: NDPluginROIStat.h:63
@ TSStop
Definition: NDPluginROIStat.h:64
@ TSEraseStart
Definition: NDPluginROIStat.h:62
@ TSErase
Definition: NDPluginROIStat.h:66
struct NDROI NDROI_t
Structure defining a Region-Of-Interest and Stats.
NDPluginROIStatTSType
Definition: NDPluginROIStat.h:51
@ TSMinValue
Definition: NDPluginROIStat.h:52
@ TSNet
Definition: NDPluginROIStat.h:56
@ TSMaxValue
Definition: NDPluginROIStat.h:53
@ TSTotal
Definition: NDPluginROIStat.h:55
@ TSTimestamp
Definition: NDPluginROIStat.h:57
@ TSMeanValue
Definition: NDPluginROIStat.h:54
@ MAX_TIME_SERIES_TYPES
Definition: NDPluginROIStat.h:58
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:99
Class from which actual plugin drivers are derived; derived from asynNDArrayDriver.
Definition: NDPluginDriver.h:57
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value)
Called when asyn clients call pasynInt32->write().
Definition: NDPluginDriver.cpp:678
virtual void processCallbacks(NDArray *pArray)=0
Compute statistics on ROIs in an array.
Definition: NDPluginROIStat.h:85
int NDPluginROIStatName
Definition: NDPluginROIStat.h:101
int NDPluginROIStatDim0Min
Definition: NDPluginROIStat.h:108
int NDPluginROIStatTSControl
Definition: NDPluginROIStat.h:126
int NDPluginROIStatDim1Min
Definition: NDPluginROIStat.h:111
int NDPluginROIStatMaxValue
Definition: NDPluginROIStat.h:120
int NDPluginROIStatTSTotal
Definition: NDPluginROIStat.h:133
int NDPluginROIStatMeanValue
Definition: NDPluginROIStat.h:121
int NDPluginROIStatTSMaxValue
Definition: NDPluginROIStat.h:131
int NDPluginROIStatTSNumPoints
Definition: NDPluginROIStat.h:127
int NDPluginROIStatTSMinValue
Definition: NDPluginROIStat.h:130
int NDPluginROIStatDim0MaxSize
Definition: NDPluginROIStat.h:110
int NDPluginROIStatLast
Definition: NDPluginROIStat.h:137
int NDPluginROIStatTSCurrentPoint
Definition: NDPluginROIStat.h:128
int NDPluginROIStatTSAcquiring
Definition: NDPluginROIStat.h:129
int NDPluginROIStatTSNet
Definition: NDPluginROIStat.h:134
int NDPluginROIStatNet
Definition: NDPluginROIStat.h:123
int NDPluginROIStatDim1Size
Definition: NDPluginROIStat.h:112
int NDPluginROIStatReset
Definition: NDPluginROIStat.h:103
int NDPluginROIStatTSTimestamp
Definition: NDPluginROIStat.h:135
int NDPluginROIStatBgdWidth
Definition: NDPluginROIStat.h:104
int NDPluginROIStatUse
Definition: NDPluginROIStat.h:102
int NDPluginROIStatDim2Min
Definition: NDPluginROIStat.h:114
int NDPluginROIStatMinValue
Definition: NDPluginROIStat.h:119
int NDPluginROIStatFirst
Definition: NDPluginROIStat.h:99
int NDPluginROIStatTotal
Definition: NDPluginROIStat.h:122
int NDPluginROIStatDim1MaxSize
Definition: NDPluginROIStat.h:113
int NDPluginROIStatDim2MaxSize
Definition: NDPluginROIStat.h:116
int NDPluginROIStatDim2Size
Definition: NDPluginROIStat.h:115
int NDPluginROIStatTSMeanValue
Definition: NDPluginROIStat.h:132
int NDPluginROIStatResetAll
Definition: NDPluginROIStat.h:105
int NDPluginROIStatDim0Size
Definition: NDPluginROIStat.h:109
list value
Definition: makeDbAndEdl.py:234
Structure defining a Region-Of-Interest and Stats.
Definition: NDPluginROIStat.h:70
double mean
Definition: NDPluginROIStat.h:76
size_t size[2]
Definition: NDPluginROIStat.h:73
size_t bgdWidth
Definition: NDPluginROIStat.h:74
double net
Definition: NDPluginROIStat.h:79
size_t arraySize[2]
Definition: NDPluginROIStat.h:80
double max
Definition: NDPluginROIStat.h:78
int use
Definition: NDPluginROIStat.h:71
size_t offset[2]
Definition: NDPluginROIStat.h:72
double total
Definition: NDPluginROIStat.h:75
double min
Definition: NDPluginROIStat.h:77