areaDetector  3-14
EPICS areaDetector framework
NDPluginBadPixel.h
Go to the documentation of this file.
1 #ifndef NDPluginProcess_H
2 #define NDPluginProcess_H
3 
4 #include <vector>
5 
6 #include "NDPluginDriver.h"
7 
8 // We use epicsInt64 rather than size_t in these structs because we need to do signed arithmetic on these values
9 typedef struct {
10  epicsInt64 x;
11  epicsInt64 y;
13 
14 typedef enum {
19 
20 class badPixel {
21  public:
23  coordinate = coord;
24  }
25  friend bool operator<(const badPixel& lhs, const badPixel& rhs) {
26  if (lhs.coordinate.y != rhs.coordinate.y)
27  return (lhs.coordinate.y < rhs.coordinate.y);
28  else
29  return (lhs.coordinate.x < rhs.coordinate.x);
30  }
34  double setValue;
36  private:
37  badPixel(); // Default constructor is private so objects cannot be constructed without arguments
38 };
39 
40 typedef struct {
41  epicsInt64 sizeX;
42  epicsInt64 sizeY;
43  epicsInt64 offsetX;
44  epicsInt64 offsetY;
45  int binX;
46  int binY;
48 
49 typedef std::set<badPixel> badPixelList_t;
50 /* Bad pixel file*/
51 #define NDPluginBadPixelFileNameString "BAD_PIXEL_FILE_NAME" /* (asynOctet, r/w) Name of the bad pixel file */
52 
54 public:
55  NDPluginBadPixel(const char *portName, int queueSize, int blockingCallbacks,
56  const char *NDArrayPort, int NDArrayAddr,
57  int maxBuffers, size_t maxMemory,
58  int priority, int stackSize, int maxThreads);
59  /* These methods override the virtual methods in the base class */
60  void processCallbacks(NDArray *pArray);
61  asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t nChars, size_t *nActual);
62  void report(FILE *fp, int details);
63 
64 protected:
65  /* Background array subtraction */
67  #define FIRST_NDPLUGIN_BAD_PIXEL_PARAM NDPluginBadPixelFileName
68 
69 private:
70  template <typename epicsType> void fixBadPixelsT(NDArray *pArray, badPixelList_t &badPixels, NDArrayInfo_t *pArrayInfo);
71  int fixBadPixels(NDArray *pArray, badPixelList_t &badPixels, NDArrayInfo_t *pArrayInfo);
72  asynStatus readBadPixelFile(const char* fileName);
73  epicsInt64 computePixelOffset(pixelCoordinate coord, badPixDimInfo_t& dimInfo, NDArrayInfo_t *pArrayInfo);
74  badPixelList_t badPixelList;
75 };
76 
77 #endif
#define NDPLUGIN_API
Definition: NDPluginAPI.h:41
badPixelMode
Definition: NDPluginBadPixel.h:14
@ badPixelModeSet
Definition: NDPluginBadPixel.h:15
@ badPixelModeMedian
Definition: NDPluginBadPixel.h:17
@ badPixelModeReplace
Definition: NDPluginBadPixel.h:16
std::set< badPixel > badPixelList_t
Definition: NDPluginBadPixel.h:49
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:99
Definition: NDPluginBadPixel.h:53
int NDPluginBadPixelFileName
Definition: NDPluginBadPixel.h:66
Class from which actual plugin drivers are derived; derived from asynNDArrayDriver.
Definition: NDPluginDriver.h:57
virtual void processCallbacks(NDArray *pArray)=0
virtual asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t maxChars, size_t *nActual)
Called when asyn clients call pasynOctet->write().
Definition: NDPluginDriver.cpp:804
virtual void report(FILE *fp, int details)
Report status of the driver.
Definition: asynNDArrayDriver.cpp:753
Bad pixel structure for Pilatus detector.
Definition: NDPluginBadPixel.h:20
badPixel(pixelCoordinate coord)
Definition: NDPluginBadPixel.h:22
pixelCoordinate coordinate
Definition: NDPluginBadPixel.h:31
badPixelMode mode
Definition: NDPluginBadPixel.h:32
friend bool operator<(const badPixel &lhs, const badPixel &rhs)
Definition: NDPluginBadPixel.h:25
double setValue
Definition: NDPluginBadPixel.h:34
pixelCoordinate medianCoordinate
Definition: NDPluginBadPixel.h:35
pixelCoordinate replaceCoordinate
Definition: NDPluginBadPixel.h:33
list value
Definition: makeDbAndEdl.py:234
Structure returned by NDArray::getInfo.
Definition: NDArray.h:78
Definition: NDPluginBadPixel.h:40
epicsInt64 offsetY
Definition: NDPluginBadPixel.h:44
epicsInt64 sizeX
Definition: NDPluginBadPixel.h:41
epicsInt64 sizeY
Definition: NDPluginBadPixel.h:42
int binX
Definition: NDPluginBadPixel.h:45
epicsInt64 offsetX
Definition: NDPluginBadPixel.h:43
int binY
Definition: NDPluginBadPixel.h:46
Definition: NDPluginBadPixel.h:9
epicsInt64 x
Definition: NDPluginBadPixel.h:10
epicsInt64 y
Definition: NDPluginBadPixel.h:11