areaDetector Plugin NDPluginColorConvert

January 19, 2009

Mark Rivers

University of Chicago

Contents

Overview

This plugin is a tool for converting the color mode of NDArray data.

NDPluginColorConvert inherits from NDPluginDriver. NDPluginColorConvert receives an input NDArray with one color mode and outputs another NDArray with a (potentially) different color mode. All other attributes of the array are preserved. The NDPluginStdArrays public interface is defined in NDPluginColorConvert.h as follows:

class NDPluginColorConvert : public NDPluginDriver {
public:
    NDPluginColorConvert(const char *portName, int queueSize, int blockingCallbacks,
                         const char *NDArrayPort, int NDArrayAddr,
                         size_t maxMemory);

    /* These methods override the virtual methods in the base class */
    void processCallbacks(NDArray *pArray);
    asynStatus drvUserCreate(asynUser *pasynUser, const char *drvInfo,
                             const char **pptypeName, size_t *psize);

    /* These methods are just for this class */
    template < typename epicstype > void convertColor(NDArray *pArray);
};
...
}

NDPluginStdArrays defines the following parameters. It also implements all of the standard plugin parameters from NDPluginDriver . The EPICS database NDColorConvert.template provides access to these parameters, listed in the following table.

Parameter Definitions in NDPluginColorConvert.h and EPICS Record Definitions in NDColorConvert.template
Enum name asyn interface Access Description drvUser string EPICS record name EPICS record type
NDPluginColorConvertColorModeOut asynInt32 r/w The output color mode. COLOR_MODE_OUT $(P)$(R)ColorModeOut
$(P)$(R)ColorModeOut_RBV
mbbo
mbbi

NDPluginColorConvert currently supports the following conversions:

If the input color mode and output color mode are not one of these supported conversion combinations then the output array is simply a copy of the input array and no conversion is performed.

Configuration

The NDPluginColorConvert plugin is created with the following command, either from C/C++ or from the EPICS IOC shell.

drvNDColorConvertConfigure(const char *portName, int queueSize, int blockingCallbacks, 
                        const char *NDArrayPort, int NDArrayAddr, size_t maxMemory)
  
Argument Description
portName The name of the asyn port for this plugin.
queueSize The maximum number of NDArray objects that can be queued for processing. Passed to the NDPluginDriver base class constructor.
blockingCallbacks Flag controlling whether callbacks block. Passed to the NDPluginDriver base class constructor.
NDArrayPort The name of the asyn port of the driver that will provide the NDArray data. Passed to the NDPluginDriver base class constructor.
NDArrayAddr The asyn addr of the asyn port of the driver that will provide the NDArray data. Passed to the NDPluginDriver base class constructor.
maxMemory Maximum number of bytes of memory to be allocated from the NDArrayPool. Passed to the constructor for the NDPluginDriver base class. The NDStdArrays plugin allocates 2 NDArray objects, so this should be at least twice the size of the largest NDArray to be used.

Screen shots

The following is the MEDM screen that provides access to the parameters in NDPluginDriver.h and NDPluginStdArrays.h through records in NDPluginBase.template and NDStdArrays.template. This is the MEDM screen that is normally used to control the display of images via EPICS channel access.

NDStdArrays.adl

NDStdArrays.png

IDL Image Display Client

There is an IDL procedure called epics_ad_display that can be used to display 2-dimensional array data that the NDStdArrays plugin sends to EPICS. This IDL client is available as source code (which requires an IDL license), and also as a pre-built IDL .sav file that can be run for free under the IDL Virtual Machine. This IDL program can run on any machine that IDL runs on, and that has the ezcaIDL shareable library built for it. This includes Windows, Linux, Solaris, and Mac. epics_ad_display is included in the CARS IDL imaging software.

The control window for epics_ad_display is shown below. It has a field to input the base name of the EPICS PVs with the image data. It also has fields to enable/display the IDL display update, to change the display mode, to autoscale the intensity, and to invert the image in the Y direction. If autoscale is set to No then manual scaling can be entered in the Min and Max fields. The number of frames per second actually being displayed by IDL is shown. There is a status window that shows whether the EPICS PVs are connected and the time the last was array received, updated once per second.

Main window for IDL epics_ad_display

IDL_epics_ad_display.png

epics_ad_display can use the simple IDL routine tv to display the images. This is the fastest mode, and results in a non-scalable unadorned window.

IDL epics_ad_display using the IDL tv routine.

IDL_epics_ad_display_tv.jpg

epics_ad_display can also use the routine image_display.pro to display the images. This routine displays row and column profiles as the cursor is moved. It allows changing the color lookup tables, and zooming in (right mouse click) and out (left mouse click). The following is an example of image_display displaying an image from the simulation detector.

epics_ad_display using the image_display routine

simDetector_image_display.png

Future plans

Stephen Mudie at the Australian Synchrotron has written a very nice IDL client to display the EPICS images from the Flea Firewire cameras. This client should be converted to display the data from this areaDetector plugin.