Describing via filename

Sometimes it is helpful to be able to describe the entire layout of a raw imagery filename via the filename. This allows any GDB based utility to work with the raw image, whether it has interactive dialogs for raw describing the file or not. This also avoids the need to write an associated .aux file, which is impossible if the raw file is in a read-only directory, such as on a CDROM.

However, describing raw files via this filenaming syntax is not generally intended for interactive use. It is mainly useful in a scripting environment.

The naming convention for raw files is:

 RAW:::filename xsize ysize bands [offset {8U/16U/16S/32R} {PIXEL/LINE/BAND}]
   [*CHANNEL chan_num {8U/16U/16S/32R} offset pixel_off line_off
                                               [swapped/unswapped]]*

The absolute simplest file description would describe a band sequential file of 8-bit data that is tightly packed with no header. For example, the following would describe the file "raw.dat" as being three bands, 512 pixels by 512 lines.

 RAW:::raw.dat 512 512 3

A slightly more complex form can be used to define any file that could be read with IMAGERD. This adds the offset to the first byte of imagery, the data type and the interleaving mode. The following description defines the same file as the previous one, but it explicitly states that the offset to the first byte of imagery is zero; the data is 8-bit unsigned, band interleaved.

 RAW:::raw.dat 512 512 3 0 8U BAND

Many file organizations cannot be described this way. For instance, files with more than one data type, or files with spaces between bands or byte swapped multi-byte data, cannot be described this way. In these cases, it is possible to describe the layout of each channel. The following description defines the same raw.dat files as in the previous two descriptions. For each channel a data type, image offset, and swapping capability is provided.

 RAW:::raw.dat 512 512 3 *Channel 1 8U 0      1 512 unswapped
                         *Channel 2 8U 262144 1 512 unswapped
                         *Channel 3 8U 524288 1 512 unswapped

The offset is to the first byte of data in the channel, therefore channel two data starts at byte 262144 in the file. The second offset is from one pixel of data on the same scanline to the next pixel of data on the same scanline. The third offset is the offset from the beginning of one scanline to the beginning of the next. The swap flag indicates whether the data is in little endian order or not. Little endian byte order has the least significant byte of the word first, and is found on Intel and VAX machines. This is considered `swapped'. Big endian machines such as the Motorola and Sun are considered `unswapped'. The default is the native byte order of the current machine.

A more interesting example might be a 300x400 one-band file with little endian 16-bit unsigned data starting after a one block (512-byte) header.

 RAW:::testi2.dat 300 400 1 *Channel 1 16U 512 2 1024 swapped

© PCI Geomatics Enterprises, Inc.®, 2024. All rights reserved.