diff --git a/documentation/areaDetectorDoc.html b/documentation/areaDetectorDoc.html index d0fc018..48b0ade 100755 --- a/documentation/areaDetectorDoc.html +++ b/documentation/areaDetectorDoc.html @@ -7,7 +7,7 @@

areaDetector: EPICS Area Detector Support

- December 7, 2008

+ January 20, 2009

Mark Rivers

@@ -35,6 +35,7 @@
  • NDPluginStdArrays
  • NDPluginFile
  • NDPluginROI
  • +
  • NDPluginColorConvert
  • Detector drivers @@ -45,6 +46,8 @@
  • ADSC driver
  • MarCCD driver
  • Roper driver
  • +
  • + Firewire driver
  • @@ -103,9 +106,10 @@
  • Layer 3. Code running at this level is called a "plug-in". This code registers with a driver for a callback whenever there is a new data array. The existing plugins implement file saving (NDPluginFile), region-of-interest (ROI) calculations (NDPluginROI), - and conversion of detector data to standard EPICS array types for use by Channel - Access clients (NDPluginStdArrays). Plugins are normally written in C++ and inherit - from NDPluginDriver. Existing plugins range from 280 to 650 lines of code.
  • + color mode conversion (NDPluginColorConvert), and conversion of detector data to + standard EPICS array types for use by Channel Access clients (NDPluginStdArrays). + Plugins are normally written in C++ and inherit from NDPluginDriver. Existing plugins + range from 300 to 700 lines of code.
  • Layer 4. This is standard asyn device support that comes with the EPICS asyn module.
  • Layer 5. These are standard EPICS records, and EPICS database (template) files that define records to communicate with drivers at Layer 2 and plugins at Layer @@ -120,7 +124,7 @@ dependencies in this code.

      -
    1. libCom. +
    2. libCom. libCom from EPICS base provides operating-system independent functions for threads, mutexes, etc.
    3. asyn. asyn is a module @@ -143,7 +147,10 @@ Access clients connected to the NDPluginStdArrays driver will automatically switch to displaying this subregion. Similarly, the NDPluginFile plugin can be switched at run-time from saving the entire image to saving a selected ROI, just by changing - its input source. + its input source. Plugins can be used to form an image processing pipeline, for + example with a detector providing data to a color convert plugin, which feed an + ROI plugin, which feeds a file saving plugin. Each plugin can run in its own thread, + and hence in its own core on a modern multi-core CPU.

      The use of plugins is optional, and it is only plugins that require the driver to @@ -449,6 +456,8 @@ public: data from drivers to plugins. The NDArray class is defined as follows:

      #define ND_ARRAY_MAX_DIMS 10
      +#define ND_SUCCESS 0
      +#define ND_ERROR -1
       
       /* Enumeration of array data types */
       typedef enum
      @@ -463,6 +472,26 @@ typedef enum
           NDFloat64
       } NDDataType_t;
       
      +/* Enumeration of color modes */
      +typedef enum
      +{
      +    NDColorModeMono,
      +    NDColorModeBayer,
      +    NDColorModeRGB1,
      +    NDColorModeRGB2,
      +    NDColorModeRGB3,
      +    NDColorModeYUV444,
      +    NDColorModeYUV422,
      +    NDColorModeYUV421
      +} NDColorMode_t;
      +
      +typedef enum
      +{
      +    NDBayerRGGB        = 0,    /* First line RGRG, second line GBGB... */
      +    NDBayerGBRG        = 1,    /* First line GBGB, second line RGRG... */
      +    NDBayerGRBG        = 2,    /* First line GRGR, second line BGBG... */
      +    NDBayerBGGR        = 3     /* First line BGBG, second line GRGR... */
      +} NDBayerPattern_t;
       
       typedef struct NDDimension {
           int size;
      @@ -491,6 +520,8 @@ public:
           int ndims;
           NDDimension_t dims[ND_ARRAY_MAX_DIMS];
           NDDataType_t dataType;
      +    NDColorMode_t colorMode;
      +    NDBayerPattern_t bayerPattern;
           int dataSize;
           void *pData;
       
      @@ -498,12 +529,9 @@ public:
           NDArray();
           int          initDimension   (NDDimension_t *pDimension, int size);
           int          getInfo         (NDArrayInfo_t *pInfo);
      -    int          copy            (NDArray *pOut);
           int          reserve(); 
           int          release();
       };
      -
      -
       

      An NDArray is a general purpose class for handling array data. An NDArray object @@ -554,6 +582,41 @@ public:

    4. dataType The data type of this array, one of the NDDataType_t enum values. The data types supported are signed and unsigned 8, 16, and 32-bit integers, and 32 and 64-bit floats.
    5. +
    6. colorMode The color mode this array, one of the NDColorMode_t enum + values. The following are the supported color modes: +
        +
      • NDColorModeMono: Monochromatic data, i.e. a single value at each + pixel.
      • +
      • NDColorModeBayer: Bayer color. There is a single value at each pixel, + but the pixels have a color filter array in front of them. The supported Bayer filter + is the most common one, a repeating 2x2 array of +
        +           Blue  Green
        +           Green Red
        +           
        + Transmitting data from the camera using the Bayer format consumes 3 times less bandwidth + than transmitting one of the RGB formats. However, it requires more computation + on the host to convert the data to an RGB format that most clients can display.
      • +
      • NDColorModeRGB1: Red, green, blue data with pixel interlace, i.e. + the data array is [3, NX, NY], with the color being the fastest varying array index.
      • +
      • NDColorModeRGB2: Red, green, blue data with row interlace, i.e. the + data array is [NX, 3, NY], with the color being the second fastest varying array + index.
      • +
      • NDColorModeRGB3: Red, green, blue data with planar interlace, i.e. + the data array is [NX, NY, 3], with the color being the slowest varying array index.
      • +
      • NDColorModeYUV444: YUV data with 96 bits for 4 pixels, or 24 bits + per pixel. This is the same number of bits as 8-bit RGB.
      • +
      • NDColorModeYUV422: YUV data with 64 bits for 4 pixels, or 16 bits + per pixel. This is 2/3 of the number of bits required for 8-bit RGB.
      • +
      • NDColorModeYUV421: YUV data with 48 bits for 4 pixels, or 12 bits + per pixel. This is 1/2 of the number of bits required for 8-bit RGB.
      • +
      +
    7. +
    8. bayerPattern The Bayer pattern for this array, one of the NDBayerPattern_t + enum values. This value is only meaningful if colorMode is NDColorModeBayer. The + Bayer pattern values are explained in the comments above. This value is needed because + the Bayer pattern will change when reading out a subset of the chip, for example + if the X or Y offset values are not even numbers.
    9. dataSize The size of the memory buffer pointed to by pData in bytes. This may be larger than the amount actually required to hold the data for this array.
    10. @@ -570,10 +633,6 @@ public:
    11. getInfo. This convenience method returns information about an NDArray, including the total number of elements, the number of byte per element, and the total number of bytes in the array.
    12. -
    13. copy. This method makes a copy of an NDArray object. If the output - array pointer is NULL then it is first allocated. If the output array object already - exists (pOut!=NULL) then it must have sufficient memory allocated to it to hold - the data.
    14. reserve. This method calls NDArrayPool->reserve() for this object. It increases the reference count for this array.
    15. release. This method calls NDArrayPool->release() for this object. @@ -594,13 +653,14 @@ public: public: NDArrayPool (int maxBuffers, size_t maxMemory); NDArray* alloc (int ndims, int *dims, NDDataType_t dataType, int dataSize, void *pData); + NDArray* copy (NDArray *pIn, NDArray *pOut, int copyData); int reserve (NDArray *pArray); int release (NDArray *pArray); int convert (NDArray *pIn, NDArray **ppOut, NDDataType_t dataTypeOut, NDDimension_t *outDims); - int report (int details); + int report (int details);

      The methods of the NDArrayPool class are: @@ -608,8 +668,10 @@ public:

      • NDArrayPool This is the constructor for the class. The maxBuffers argument is the maximum number of NDArray objects that the pool is allowed to contain. + If this value is negative then there is no limit on the number of NDArray objects. The maxMemory argument is the maxiumum number of bytes of memory the the pool is - allowed to use, summed over all of the NDArray objects.
      • + allowed to use, summed over all of the NDArray objects. If this value is negative + then there is no limit on the amount of memory in the pool.
      • alloc This method allocates a new NDArray object. The first 3 arguments are required. ndims is the number of dimensions in the NDArray. dims is an array of dimensions, whose size must be at least ndims. dataType is the data type of the @@ -625,6 +687,12 @@ public: NDArray would cause the cumulative memory allocated for the pool to exceed maxMemory then an error will be returned. alloc() sets the reference count for the returned NDArray to 1.
      • +
      • copy. This method makes a copy of an NDArray object. If the output + array pointer is NULL then it is first allocated. If the output array object already + exists (pOut!=NULL) then it must have sufficient memory allocated to it to hold + the data. If the copyData flag is 1 then the array data is copied. If the copyData + flag is 0 then all array fields except the data itself are copied, and the data + will be initialized to 0.
      • reserve. This method increases the reference count for the NDArray object. Plugins must call reserve() when an NDArray is placed on a queue for later processing.
      • @@ -714,8 +782,8 @@ public: file name in the ADFullFileName parameter from the ADFilePath, ADFileName, ADFileNumber, and ADFileTemplate parameters.
      • setShutter This method will open (1) or close (0) the shutter if - ADShutterMode==ADShutterModeEPICS. Drivers will implement setShutter if they support - ADShutterModeDetector. If ADShutterMode=ADShutterModeDetector they will control + ADShutterMode==ADShutterModeEPICS. Drivers will implement setShutter if they support + ADShutterModeDetector. If ADShutterMode=ADShutterModeDetector they will control the shutter directly, else they will call this method.

      @@ -1162,6 +1230,28 @@ typedef enum { mbbo
      mbbi + + + Color mode + + + + ADColorMode + + asynInt32 + + r/w + + Color mode (NDColorMode_t). + + COLOR_MODE + + $(P)$(R)ColorMode
      + $(P)$(R)ColorMode_RBV + + mbbo
      + mbbi + Frame type @@ -1220,6 +1310,22 @@ typedef enum { longin + + + ADImageSizeZ + + asynInt32 + + r/o + + Size of the image data in the Z direction + + IMAGE_SIZE_Z + + $(P)$(R)ImageSizeZ_RBV + + longin + ADImageSize @@ -2083,6 +2189,7 @@ epicsSnprintf(
    16. NDPluginStdArrays
    17. NDPluginFile
    18. NDPluginROI
    19. +
    20. NDPluginColorConvert
    21. Detector drivers

      @@ -2097,11 +2204,12 @@ epicsSnprintf(
    22. ADSC driver
    23. MarCCD driver
    24. Roper driver
    25. +
    26. + Firewire driver
    27. In addition to these drivers, Brian Tieman from the APS is writing a driver for - the Perkin-Elmer flat-panel amorphous silicon detector. Ulrik Pedersen from Diamond - is writing a driver for the Flea Firewire cameras. I plan to write a driver for - the MAR-345 online image plate.

      + the Perkin-Elmer flat-panel amorphous silicon detector. I plan to write a driver + for the MAR-345 online image plate.