The TAG file format is loosely based on the university of Waterloo IM format.
The image file is composed of three sections:
·The header
·the image binary data.
The Header
The header is entirely composed of lines of ASCII text. Each line is terminated by the characters <CR> and <LF> (0x0D and 0x0A). The header is terminated by a <FF> character (0x0C).
Everything on a line following a "*" will be considered as comments and can be disregarded by the program.
The header is composed of a series of keywords value pairs. The keyword and values are separated by ":". Each pair of keyword and values are separated by one or more separation characters. The recognized separators are: " " (space), "," (comma), "\t" (tab) or "\n" (new-line). You can use lowercase or uppercase indifferently in the keywords, the program converts all the keywords characters to uppercase before parsing the header.
The recognized keywords and their permitted values are:
x:256 y:256 z:9 type:BYTE org_x:-204.2221 org_y:-181.8909 org_z:-250.0000 inc_x:0.7105 inc_y:0.7105 epais:5.0000 dir_h_x:1.0000 dir_h_y:0.0000 dir_h_z:0.0000 dir_v_x:0.0000 dir_v_y:1.0000 dir_v_z:0.0000 uid:AFCCCAC6 chksum:09F1588D bin:256 * number of echos: 0 ^L |
The Image Data
The image data is written in binary form. There are X x Y x Z pixels in the image data. The values for X, Y and Z come from the header. Each pixel takes 1 or 2 bytes according to the value associated with the "type" keyword. The pixels are written using the algorithm:
for each image k
for each line j (starting at the top)
for each pixel i (starting at the left)
write pixel [k][j][i] ;