swapana - Swap Analyze file endian

blue bar

Analyze files may be either little or big-endian. That is, for data stored in more than one byte, such as integer or floating point values, the information may be ordered from right-to-left, or from left-to-right within these bytes. Typically, PCs write data in the little-endian format and UNIX workstations in big-endian format. Analyze format allows images and headers to be in either, although both the image and header file must have the same endian ordering as each other. Most programs detect whether an Analyze file is big-endian or little-endian but some do not and assume all files are one or the other. In these cases, swapana may be used to swap the endian of an Analyze file to the other case (i.e., swap little to big-endian, or swap big to little-endian).

swapana filename1 [filename2 ...]

The original Analyze files are overwritten by the endian reversed files.

Occasionally, the situation may arise where the endian-ness of the header and image file get out of sync, i.e., a little endian header and a big endian image file. This may be rectified by making a copy of both the header and image files, using swapana to change the endian of the copied files, then copying just the swapped endian image file back to the original image file name, overwriting the original .img file.