Next: Handling ``bad'' data
Up: Examples of using IMG from C
Previous: Accessing images using different data types
This example
(proc.c)
shows how IMG can access more than one image per function call:
/* Declare pointers for images. */
float *ip[3], *ipproc, *ipbias, *ipflat, *ipraw ; [1]
int nx, ny, i;
/* Access input images. */
imgIn( "bias,flat,raw", &nx, &ny, ip, istat ); [2]
ipbias = ip[0];
ipflat = ip[1];
ipraw = ip[2];
/* Create a new output image by copying the raw input image. */
imgOut( "raw", "proc", &ipproc, istat );
/* Debias and flatfield data. */
for( i=0; i <nx*ny; i++ ) {
*ipproc++ = ( *ipraw++ - *ipbias++ ) / *ipflat++;
}
/* Free all the images.*/
imgFree( "*", istat );
The following notes refer to the numbered statements:
- 1.
- Note that the variable ip is declared as an array of
pointers to float.
- 2.
- After this call each of the elements of ip is set to
point to a different image. The advantage of such a call is that all
the images are guaranteed to be the same shape and data type.
Next: Handling ``bad'' data
Up: Examples of using IMG from C
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