Next: Creating multiple images
Up: More advanced image access
Previous: Accessing images using different data types
IMG can access more than one image at a time using a single subroutine
call. An example of this is:
* Declare pointers.
INTEGER IP( 3 )
* Access images.
CALL IMG_IN( 'BIAS,FLAT,RAW', NX, NY, IP, ISTAT ) [1]
* Create a new output image by copying the RAW input image.
CALL IMG_OUT( 'RAW', 'PROC', IPPROC, ISTAT ) [2]
* Debias and flatfield data.
CALL DOPROC( %VAL( IP( 1 ) ), %VAL( IP( 2 ) ), [3]
: %VAL( IP( 3 ) ), NX, NY, %VAL( IPPROC ),
: ISTAT )
* Free all the images.
CALL IMG_FREE( '*', ISTAT )
END
SUBROUTINE DOPROC( BIAS, FLAT, RAW, NX, NY, PROC, ISTAT )
INCLUDE 'SAE_PAR'
REAL BIAS( NX, NY ), FLAT( NX, NY ), RAW( NX, NY ), [4]
: PROC( NX, NY )
IF ( ISTAT .NE. SAI__OK ) RETURN
DO 1 J = 1, NY
DO 2 I = 1, NX
PROC( I, J ) = ( RAW( I, J ) - BIAS( I, J ) ) / FLAT( I, J )
2 CONTINUE
1 CONTINUE
END
The following notes refer to the numbered statements:
- 1.
- This call accesses three images 'BIAS', 'FLAT' and
'RAW'. Prompts for the actual image files will be made for
each of these names and pointers to the image data will returned in IP,
which should now be an array of size 3.
- 2.
- The image 'RAW' is copied to a new file. This also copies any
header information, so is usually preferred to using IMG_NEW.
- 3.
- The individual pointers are now passed to a subroutine so that the
'BIAS', 'FLAT' and 'RAW' images together
with the copy of 'RAW' can be accessed.
- 4.
- The image arrays are declared as normal.
There are two advantages to accessing multiple images in one call in
this way:
- 1.
- All the images are made available to the program as if they were the
same size, regardless of their actual sizes (the largest region that
is common to all the images is selected).
- 2.
- All the images are made available with the same data type
(REAL in this case).
This means that corresponding values in each of the images can be
directly inter-compared by your program, even if the images themselves
have different sizes or data types.
Next: Creating multiple images
Up: More advanced image access
Previous: Accessing images using different data types
IMG Simple Image Data Access
Starlink User Note 160
P.W. Draper
R.F. Warren-Smith
3 March 2003
E-mail:P.W.Draper@durham.ac.uk
Copyright © 2000-2003 Council for the Central Laboratory of the Research Councils