next up previous contents index
Next: Adapting MIDAS to your Up: Catalogs in MIDAS Previous: Catalogs in MIDAS

   
Using Catalogs in MIDAS Procedures

Assume we have written a specific application program, pearl, within the MIDAS environment, that processes an input image and produces some numbers as a result. We would like this program also to work on a sequence of images, not just on one input image:

!+
! Example 20, MIDAS procedure exa20.prg
!+
DEFINE/LOCAL CATAL/I/1/1 0
! define local key CATAL
!
LOOP:
STORE/FRAME IN_A
$\{$P1$\}$! fill key IN_A with parameter 1
RUN pearl
! run our application
GOTO LOOP
If P1 contains the name of an image, the command STORE/FRAME works exactly
like WRITE/KEYWORD. The keyword CATAL is not modified.
However, if P1 contains the name of a catalog of the form file.cat, this catalog is opened and the first entry in the catalog is stored into the keyword IN_A.
The number of the next entry is saved in the keyword CATAL (so this name is fixed!). In the loop, the entry number is taken from CATAL and the corresponding frame name put into keyword IN_A (in our example). If there are no more entries in the catalog, control is either transferred to a label which may be specified in the command line of STORE/FRAME or if not given, the procedure is terminated.   
So @@ exa20 myframe will work on the single frame myframe,
whereas @@ exa20 mycatal.cat works on all frames with entries in the image catalog mycatal.cat.
  
If the program pearl produces also output frames, you should not have the catalog enabled (cf. SET/ICAT command). Because each new frame gets added to the enabled catalog and you would end up with an infinite loop!
  
Furthermore you may write your application and procedure just to work on single frames and then execute this procedure on all frames in a catalog via the command EXECUTE/CATALOG. Note, that you have to set up some special keywords in advance for that via
WRITE/SETUP CATALOG; for details see the HELP of EXECUTE/CATALOG.


next up previous contents index
Next: Adapting MIDAS to your Up: Catalogs in MIDAS Previous: Catalogs in MIDAS
http://www.eso.org/midas/midas-support.html
1999-06-09