areaDetector  3-5-0
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 {
67 
69 typedef struct NDROI {
70  int use;
71  size_t offset[2];
72  size_t size[2];
73  size_t bgdWidth;
74  double total;
75  double mean;
76  double min;
77  double max;
78  double net;
79  size_t arraySize[2];
80 } NDROI_t;
81 
82 
84 class epicsShareClass NDPluginROIStat : public NDPluginDriver {
85 public:
86  NDPluginROIStat(const char *portName, int queueSize, int blockingCallbacks,
87  const char *NDArrayPort, int NDArrayAddr, int maxROIs,
88  int maxBuffers, size_t maxMemory,
89  int priority, int stackSize, int maxThreads);
90 
91  //These methods override the virtual methods in the base class
92  void processCallbacks(NDArray *pArray);
93  asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
94 
95 protected:
96 
97  //ROI general parameters
99  #define FIRST_NDPLUGIN_ROISTAT_PARAM NDPluginROIStatFirst
105 
106  //ROI definition
116 
117  //ROI statistics
123 
124  // Time Series
135 
137 
138 private:
139 
140  template <typename epicsType> asynStatus doComputeStatisticsT(NDArray *pArray, NDROI_t *pROI);
141  asynStatus doComputeStatistics(NDArray *pArray, NDROI_t *pStats);
142  asynStatus clear(epicsUInt32 roi);
143  void doTimeSeriesCallbacks();
144 
145  int maxROIs_;
146  int numTSPoints_;
147  int currentTSPoint_;
148  double *timeSeries_;
149 };
150 
151 #endif //NDPluginROIStat_H
Class from which actual plugin drivers are derived; derived from asynNDArrayDriver.
Definition: NDPluginDriver.h:56
int NDPluginROIStatUse
Definition: NDPluginROIStat.h:101
int NDPluginROIStatTSNumPoints
Definition: NDPluginROIStat.h:126
Definition: NDPluginROIStat.h:63
struct NDROI NDROI_t
Structure defining a Region-Of-Interest and Stats.
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value)
Called when asyn clients call pasynInt32->write().
Definition: NDPluginDriver.cpp:684
int NDPluginROIStatLast
Definition: NDPluginROIStat.h:136
int NDPluginROIStatDim2Min
Definition: NDPluginROIStat.h:113
Definition: NDPluginROIStat.h:64
int NDPluginROIStatNet
Definition: NDPluginROIStat.h:122
int NDPluginROIStatReset
Definition: NDPluginROIStat.h:102
int NDPluginROIStatTSMinValue
Definition: NDPluginROIStat.h:129
double mean
Definition: NDPluginROIStat.h:75
Compute statistics on ROIs in an array.
Definition: NDPluginROIStat.h:84
int NDPluginROIStatTSNet
Definition: NDPluginROIStat.h:133
int NDPluginROIStatDim1MaxSize
Definition: NDPluginROIStat.h:112
Definition: NDPluginROIStat.h:56
list value
Definition: makeDbAndEdl.py:234
Definition: NDPluginROIStat.h:52
double min
Definition: NDPluginROIStat.h:76
int NDPluginROIStatDim1Size
Definition: NDPluginROIStat.h:111
Definition: NDPluginROIStat.h:65
int NDPluginROIStatMeanValue
Definition: NDPluginROIStat.h:120
int NDPluginROIStatName
Definition: NDPluginROIStat.h:100
int NDPluginROIStatTSAcquiring
Definition: NDPluginROIStat.h:128
Definition: NDPluginROIStat.h:62
int NDPluginROIStatDim2Size
Definition: NDPluginROIStat.h:114
int NDPluginROIStatBgdWidth
Definition: NDPluginROIStat.h:103
Definition: NDPluginROIStat.h:55
int NDPluginROIStatDim2MaxSize
Definition: NDPluginROIStat.h:115
NDPluginROIStatTSType
Definition: NDPluginROIStat.h:51
int NDPluginROIStatTotal
Definition: NDPluginROIStat.h:121
int NDPluginROIStatTSTimestamp
Definition: NDPluginROIStat.h:134
int NDPluginROIStatMinValue
Definition: NDPluginROIStat.h:118
int NDPluginROIStatTSMaxValue
Definition: NDPluginROIStat.h:130
size_t bgdWidth
Definition: NDPluginROIStat.h:73
Structure defining a Region-Of-Interest and Stats.
Definition: NDPluginROIStat.h:69
size_t size[2]
Definition: NDPluginROIStat.h:72
size_t offset[2]
Definition: NDPluginROIStat.h:71
Definition: NDPluginROIStat.h:57
double max
Definition: NDPluginROIStat.h:77
int NDPluginROIStatDim0MaxSize
Definition: NDPluginROIStat.h:109
double net
Definition: NDPluginROIStat.h:78
virtual void processCallbacks(NDArray *pArray)=0
int NDPluginROIStatDim0Min
Definition: NDPluginROIStat.h:107
int NDPluginROIStatMaxValue
Definition: NDPluginROIStat.h:119
int NDPluginROIStatTSCurrentPoint
Definition: NDPluginROIStat.h:127
int NDPluginROIStatFirst
Definition: NDPluginROIStat.h:98
int NDPluginROIStatDim1Min
Definition: NDPluginROIStat.h:110
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:92
int NDPluginROIStatDim0Size
Definition: NDPluginROIStat.h:108
NDPluginROIStatsTSControl_t
Definition: NDPluginROIStat.h:61
Definition: NDPluginROIStat.h:58
int NDPluginROIStatTSMeanValue
Definition: NDPluginROIStat.h:131
size_t arraySize[2]
Definition: NDPluginROIStat.h:79
Definition: NDPluginROIStat.h:54
int NDPluginROIStatTSTotal
Definition: NDPluginROIStat.h:132
int NDPluginROIStatResetAll
Definition: NDPluginROIStat.h:104
int use
Definition: NDPluginROIStat.h:70
int NDPluginROIStatTSControl
Definition: NDPluginROIStat.h:125
Definition: NDPluginROIStat.h:53
double total
Definition: NDPluginROIStat.h:74