00001 #ifndef NDPluginProcess_H 00002 #define NDPluginProcess_H 00003 00004 #include <epicsTypes.h> 00005 #include <asynStandardInterfaces.h> 00006 00007 #include "NDPluginDriver.h" 00008 00009 /* Background array subtraction */ 00010 #define NDPluginProcessSaveBackgroundString "SAVE_BACKGROUND" /* (asynInt32, r/w) Save the current frame as background */ 00011 #define NDPluginProcessEnableBackgroundString "ENABLE_BACKGROUND" /* (asynInt32, r/w) Enable background subtraction? */ 00012 #define NDPluginProcessValidBackgroundString "VALID_BACKGROUND" /* (asynInt32, r/o) Is there a valid background */ 00013 00014 /* Flat field normalization */ 00015 #define NDPluginProcessSaveFlatFieldString "SAVE_FLAT_FIELD" /* (asynInt32, r/w) Save the current frame as flat field */ 00016 #define NDPluginProcessEnableFlatFieldString "ENABLE_FLAT_FIELD" /* (asynInt32, r/w) Enable flat field normalization? */ 00017 #define NDPluginProcessValidFlatFieldString "VALID_FLAT_FIELD" /* (asynInt32, r/o) Is there a valid flat field */ 00018 #define NDPluginProcessScaleFlatFieldString "SCALE_FLAT_FIELD" /* (asynInt32, r/o) Scale factor after dividing by flat field */ 00019 00020 /* Offset and scaling */ 00021 #define NDPluginProcessEnableOffsetScaleString "ENABLE_OFFSET_SCALE" /* (asynInt32, r/w) Enable offset and scale? */ 00022 #define NDPluginProcessScaleString "SCALE" /* (asynFloat64, r/w) Scale value */ 00023 #define NDPluginProcessOffsetString "OFFSET" /* (asynFloat64, r/w) Offset value */ 00024 00025 /* High and low clipping */ 00026 #define NDPluginProcessLowClipString "LOW_CLIP" /* (asynFloat64, r/w) Low clip value */ 00027 #define NDPluginProcessEnableLowClipString "ENABLE_LOW_CLIP" /* (asynInt32, r/w) Enable low clipping? */ 00028 #define NDPluginProcessHighClipString "HIGH_CLIP" /* (asynFloat64, r/w) High clip value */ 00029 #define NDPluginProcessEnableHighClipString "ENABLE_HIGH_CLIP" /* (asynInt32, r/w) Enable high clipping? */ 00030 00031 /* Recursive filter */ 00032 #define NDPluginProcessEnableFilterString "ENABLE_FILTER" /* (asynInt32, r/w) Enable frame filtering? */ 00033 #define NDPluginProcessResetFilterString "RESET_FILTER" /* (asynInt32, r/w) Reset frame filtering when 1 */ 00034 #define NDPluginProcessNumFilterString "NUM_FILTER" /* (asynInt32, r/w) Number of frames to filter */ 00035 #define NDPluginProcessNumFilteredString "NUM_FILTERED" /* (asynInt32, r/o) Number of frames filtered */ 00036 #define NDPluginProcessOOffsetString "FILTER_OOFFSET" /* (asynFloat64, r/w) Output offset */ 00037 #define NDPluginProcessOScaleString "FILTER_OSCALE" /* (asynFloat64, r/w) Output scale */ 00038 #define NDPluginProcessOC1String "FILTER_OC1" /* (asynFloat64, r/w) Output coefficient 1 */ 00039 #define NDPluginProcessOC2String "FILTER_OC2" /* (asynFloat64, r/w) Output coefficient 2 */ 00040 #define NDPluginProcessOC3String "FILTER_OC3" /* (asynFloat64, r/w) Output coefficient 3 */ 00041 #define NDPluginProcessOC4String "FILTER_OC4" /* (asynFloat64, r/w) Output coefficient 4 */ 00042 #define NDPluginProcessFOffsetString "FILTER_FOFFSET" /* (asynFloat64, r/w) Filter offset */ 00043 #define NDPluginProcessFScaleString "FILTER_FSCALE" /* (asynFloat64, r/w) Filter scale */ 00044 #define NDPluginProcessFC1String "FILTER_FC1" /* (asynFloat64, r/w) Filter coefficient 1 */ 00045 #define NDPluginProcessFC2String "FILTER_FC2" /* (asynFloat64, r/w) Filter coefficient 2 */ 00046 #define NDPluginProcessFC3String "FILTER_FC3" /* (asynFloat64, r/w) Filter coefficient 3 */ 00047 #define NDPluginProcessFC4String "FILTER_FC4" /* (asynFloat64, r/w) Filter coefficient 4 */ 00048 #define NDPluginProcessROffsetString "FILTER_ROFFSET" /* (asynFloat64, r/w) Reset offset */ 00049 #define NDPluginProcessRC1String "FILTER_RC1" /* (asynFloat64, r/w) Reset coefficient 1 */ 00050 #define NDPluginProcessRC2String "FILTER_RC2" /* (asynFloat64, r/w) Reset coefficient 2 */ 00051 00052 /* Output data type */ 00053 #define NDPluginProcessDataTypeString "PROCESS_DATA_TYPE" /* (asynInt32, r/w) Output type. -1 means automatic. */ 00054 00055 00062 class NDPluginProcess : public NDPluginDriver { 00063 public: 00064 NDPluginProcess(const char *portName, int queueSize, int blockingCallbacks, 00065 const char *NDArrayPort, int NDArrayAddr, 00066 int maxBuffers, size_t maxMemory, 00067 int priority, int stackSize); 00068 /* These methods override the virtual methods in the base class */ 00069 void processCallbacks(NDArray *pArray); 00070 00071 protected: 00072 /* Background array subtraction */ 00073 int NDPluginProcessSaveBackground; 00074 #define FIRST_NDPLUGIN_PROCESS_PARAM NDPluginProcessSaveBackground 00075 int NDPluginProcessEnableBackground; 00076 int NDPluginProcessValidBackground; 00077 00078 /* Flat field normalization */ 00079 int NDPluginProcessSaveFlatField; 00080 int NDPluginProcessEnableFlatField; 00081 int NDPluginProcessValidFlatField; 00082 int NDPluginProcessScaleFlatField; 00083 00084 /* Scale and offset */ 00085 int NDPluginProcessEnableOffsetScale; 00086 int NDPluginProcessScale; 00087 int NDPluginProcessOffset; 00088 00089 /* High and low clipping */ 00090 int NDPluginProcessLowClip; 00091 int NDPluginProcessEnableLowClip; 00092 int NDPluginProcessHighClip; 00093 int NDPluginProcessEnableHighClip; 00094 00095 /* Frame filtering */ 00096 int NDPluginProcessEnableFilter; 00097 int NDPluginProcessResetFilter; 00098 int NDPluginProcessNumFilter; 00099 int NDPluginProcessNumFiltered; 00100 int NDPluginProcessOOffset; 00101 int NDPluginProcessOScale; 00102 int NDPluginProcessOC1; 00103 int NDPluginProcessOC2; 00104 int NDPluginProcessOC3; 00105 int NDPluginProcessOC4; 00106 int NDPluginProcessFOffset; 00107 int NDPluginProcessFScale; 00108 int NDPluginProcessFC1; 00109 int NDPluginProcessFC2; 00110 int NDPluginProcessFC3; 00111 int NDPluginProcessFC4; 00112 int NDPluginProcessROffset; 00113 int NDPluginProcessRC1; 00114 int NDPluginProcessRC2; 00115 00116 /* Output data type */ 00117 int NDPluginProcessDataType; 00118 00119 #define LAST_NDPLUGIN_PROCESS_PARAM NDPluginProcessDataType 00120 00121 private: 00122 NDArray *pBackground; 00123 int nBackgroundElements; 00124 NDArray *pFlatField; 00125 int nFlatFieldElements; 00126 NDArray *pFilter; 00127 int numFiltered; 00128 }; 00129 #define NUM_NDPLUGIN_PROCESS_PARAMS (&LAST_NDPLUGIN_PROCESS_PARAM - &FIRST_NDPLUGIN_PROCESS_PARAM + 1) 00130 00131 #endif