1.5 Pixel
Type Declarations
All
pixel buffers in an application must be declared using the standard pixel type
declarations. See
Table 6: FORTRAN declarations for pixel types
for
the standard FORTRAN declarations, and See
Table 4: C Declarations for Pixel Types
for the standard C declarations.
1.5.1 Pixel
Sizes
Don’t
assume that FULL (integer) is 4 bytes, DOUB is 8 bytes, HALF is 2 bytes, etc..
A given machine may have data types of different sizes, such as 64-bit (8 byte)
integers.
Pixel
sizes must be determined both for files and internal program buffers (arrays).
A file could be written on a machine with pixel sizes different from the
machine it will be read on. Use one of the RTL pixel size routines,
x/zvpixsize,
x/zvpixsizeu,
or
x/zvpixsizeb
to determine the size as written. These routines return the size of a pixel in
bytes, given the data type and machine formats.
x/zvpixsizeu
and
x/zvpixsizeb
retrieve the machine formats from an image label.
Buffers
used within a program must also be sized correctly. Since internal buffers are
almost always in native format for the machine you are running on, you can use
the C function
sizeof()
to get the size of an element in bytes. Use the proper data type for the pixel.
See
Table 4: C Declarations for Pixel Types.
FORTRAN has no
sizeof()
operator or equivalent; use
x/zvpixsize
with machine formats of “NATIVE” or “LOCAL” instead.