Character code | Fortran-77 data type | Description |
R | REAL | Single precision |
D | DOUBLE PRECISION | Double precision |
I | INTEGER | Integer |
W | INTEGER*2 | Word |
UW | INTEGER*2 | Unsigned word |
B | BYTE | Byte |
UB | BYTE | Unsigned byte |
CALL IMG_IND( 'IMAGE', NX, NY, IP, ISTAT ) [1] CALL IMG_INI( 'IMAGE', NX, NY, IP, ISTAT ) [2] CALL IMG_INR( 'IMAGE', NX, NY, IP, ISTAT ) [3]The following notes refer to the numbered statements:
You should declare the image array in your program to have the corresponding Fortran data type, as in the following example that accesses and modifies an image using INTEGER format:
* Access an input image, allowing it to be modified. CALL IMG_MODI( 'IN', NX, NY, IP, ISTAT ) [1] * Fill the array with zeros. CALL DOZERO( %VAL( IP ), NX, NY, ISTAT ) * Free the image. CALL IMG_FREE( 'IN', ISTAT ) END SUBROUTINE DOZERO( IMAGE, NX, NY, ISTAT ) INCLUDE 'SAE_PAR' INTEGER IMAGE( NX, NY ) [2] IF ( ISTAT .NE. SAI__OK ) RETURN DO 1 J = 1, NY DO 2 I = 1, NX IMAGE( I, J ) = 0 2 CONTINUE 1 CONTINUE ENDThe following notes refer to the numbered statements:
All IMG subroutines that access images have variants that allow you to use different data types. There are also versions that allow these to be mixed with different numbers of data dimensions. Some possibilities are:
CALL IMG_IN1D( 'SPECTRUM', NX, IP, ISTAT ) [1] CALL IMG_MOD2I( 'IMAGE', NX, NY, IP, ISTAT ) [2] CALL IMG_NEW3W( 'CUBE', NX, NY, NZ, IP, ISTAT ) [3] CALL IMG_IN2R( 'IMAGE', NX, NY, IP, ISTAT ) [4]The following notes refer to the numbered statements:
If your image isn't stored with the type that you ask for, then it will be converted from the stored type (if possible). If you modify the data it will be re-converted to the storage type when the image is freed. New images are stored using the data type you ask for.
The data types unsigned word (UW), signed byte (B) and unsigned byte (UB) are less commonly used. Indeed, the unsigned data types have no equivalents in Fortran and should be manipulated using the PRIMDAT library (SUN/39).
IMG Simple Image Data Access