next up previous 231
Next: HDR C functions
Up: USING IMG FROM C
Previous: USING IMG FROM C

IMG C functions


  void imgCancl(char *param, int *status) 
     Cancel an image/parameter association 

  void imgDelet(char *param, int *status) 
     Delete an image 

  void imgFree(char *param, int *status) 
     Free an image 

  void imgIn[N][X](char *param, int *nx, [int *ny,] [int *nz,] TYPE **ip, int *status) 
     Access an existing image for reading 

  void imgIndf(char *param, int *indf, int *status) 
     Obtain an NDF identifier for an image 

  void imgMod[N][X](char *param, int *nx, [int *ny,] [int nz,] TYPE **ip, int *status) 
     Access an image for modification 

  void imgNew[N][X](char *param, int nx, [int ny,] [int nz,] TYPE **ip, int *status) 
     Create a new image 

  void imgName(char *param, char *value, int value_length, int *status) 
     Return the image name

  void imgOut[X](char *param1, char *param2, TYPE **ip, int *status) 
     Create an output image 

  void imgTmp[N][X](char *param, int nx, [int ny,] [int nz,] TYPE **ip, int *status) 
     Create a temporary image 

Where the parts in "[]" are optional or not always available. [N] indicates the number of dimensions of the data you want to access and the necessary nx, ny and nz arguments should be passed.

Number of dimensions [N] nx, ny & nz required
1 nx
2 nx & ny
3 nx, ny & nz
The default number of dimensions are two (in which case do not replace [N] by anything).

The ordering of array dimensions is different in C to Fortran, so for instance the Fortran array ARRAY(NX,NY,NZ) is equivalent to the C array ARRAY[NZ][NY][NX], but usually this is of little importance since images are not of fixed sizes (so you're unlikely to hard code any array dimensions) and you're far more likely to use the data via a pointer to the first element. Since C arrays also always start at 0 (rather than 1 as is the default in Fortran) the index of an element say [y][x] is nx  x  y + x. In 3-D this becomes [z][y][x] -- nx  x  ny  x  z + nx  x  y + x.

The data type of the image is specified by replacing the [X] part of the name by one of the following character codes:

Character code [X] C data type (TYPE) Description
F float
D double
I int
S short
US unsigned short
B signed char Signed byte
UB unsigned char Unsigned byte
You will also need to replace TYPE by the related data type. The default data type is float (in which case do not replace [X] by anything and set TYPE to float).



next up previous 231
Next: HDR C functions
Up: USING IMG FROM C
Previous: USING IMG FROM C

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