One of the main features of the RTD widget is the ability to display real-time images. These images are typically coming from an aquisition system that controls a CCD camera or other kind of detectors such as the DCS (Detector Control Software). This section describes how programmers providing such real-time images can interface to the RTD and display their images.
As already described in the architecture overview, the real-time image must be provided in shared memory by the aquisition system. This means that the aquisition system is the creator and owner of the shared memory segment (see also shmget(2) , shmctl(2) , shmat(2) ) .
To interface with the RTD widget, the library rtdImgEvt is provided with the following functions:
The basic idea is that an application providing real time images, such as DCS, uses rtdInitImageEvt () to identify itself to the rtdServer, for example.:
#include "rtd/rtdImageEvent.h" rtdIMAGE_EVT_HNDL eventHndl; if (rtdInitImageEvt("myCamera",&eventHndl,NULL) == RTD_ERROR){ printf("Could not initialize image event !\n"); usage(); }
After this call, a camera source named " myCamera " is registered with the rtdServer. The handle returned of type rtdIMAGE_EVT_HNDL is a handle needed for subsequent calls to rtdImgEvt functions.
When the camera source has a new image ready in shared memory, the structure rtdIMAGE_INFO describing the image must be prepared. rtdIMAGE_INFO contains of following fields (Any unused fields should be set to 0, see memset(3)).:
The following fields were added to support World Coordinates Set all fields to 0 if World Coordinates are not supported
The following fields were added to support image synchronization
int semId |
|
int shmNum |
|
int reserved[10] |
These fields were added to support detector " chip " coordinates for real-time images. The chip origin is assumed by be at lower left, as for FITS.
short startx short starty |
First window pixel in the X (Y) direction within the detector physical system. |
The image event is forwarded with the function rtdSendImageInfo to the rtdServer. The fields marked as bold are mandatory and must have a value in order to display the image.
In order for rtd clients (rtd widget applications) to receive the event, they must first attach to the camera source, which in this case is " myCamera ". As an example of an application the rtd demo application can be used, for example :
and from the real time menu select " Attach Camera ". For more information on the functions mentioned above please refer to the man pages. And remember if you program with shared memory images to delete them when they are no longer needed (such as when your aquisition system exits).
The RTD include files and libraries are normally installed in $ prefix /include and $ prefix /lib, which must be added to the path in the Makefile (For the VLT, $ prefix is normally set to /vlt/dflow . The default is /usr/local ). $
RTD_LIB=-L$(PREFIX)/lib -lrtd RTD_INCLUDE=-I$(PREFIX)/include
Please send questions or comments to abrighto@eso.org.
Copyright © 1998 ESO - European Southern Observatory