VOL Format

Grammar

The VOL format has two variants: "V1" (version 1), and "V2" (version 2). The V1 style was developed for the 1999 SDSC Orion Nebula visualization work and the original volume scene graph toolkit. It is a very simple, and limited file format. The V2 style adds some features needed for more efficient handling of large data sets.

Both VOL format variatns are supported by the Scalable Visualization Toolkits and the latest volume scene graphs.

V1
The V1 style has three flavors: VOLS (8-bit scalar), VOLB (32-bit RGBa), and VOLC (64-bit RGBab).

For all three flavors, data is always stored in an XYZ axis order, where Z varies the fastest. Integers are always Most-significant-Byte-First (MBF).

VOLS
	[file]   := "VOLS\n" [header] [data]
	[header] := [width] [height] [depth]
[width], [height], and [depth] are 32-bit MBF integers.

[data] is a stream of width*height*depth 8-bit scalar values.

VOLB
	[file]   := "VOLB\n" [header] [data]
	[header] := [width] [height] [depth]
[width], [height], and [depth] are 32-bit MBF integers.

[data] is a stream of width*height*depth*4 8-bit tuples, where each tuple has 8-bits each of red, green, blue, and alpha, in that order.

VOLC
	[file]   := ["VOLC\n" | "#VOLC\n"] [header] [data]
	[header] := [width] [height] [depth]
Two magic numbers "VOLC" and "#VOLC" are recognized for the same file format (an artifact of old code).

[width], [height], and [depth] are 32-bit MBF integers.

[data] is a stream of width*height*depth 64-bit values, where the first 32-bit word contains a 10-bit red, 12-bit green, and 10-bit blue value, in that order from high to low byte. The second word of each 64-bit value contains 16-bits of alpha and 16-bits of beta, in that order from high to low byte.



V2
The V2 (new) variant has three flavors: VOLS (scalar), VOLB (32-bit RGBa), and VOLC (64-bit RGBab).

For all three flavors, data is stored in the mesh's natural (i.e., existing) storage order. The names of the axes are stored in the file header, and default to XYZ. Integers are always Most-significant-Byte-First (MBF).

All three flavors also support a chunk size. If the chunk size is 0 or 1, then the file's data is unchunked and is stored in the natural axis order. If the chunk size is > 1 for all dimensions, then data is stored in chunks of the specified size. The elements within a chunk are stored in the natural axis order. The chunks themselves are also stored in the natural axis order, except that fractional chunks at the borders (when the volume size is not evenly divisible by the chunk size) are stored at the end of the file, again in the natural axis order.

VOLS
	[file]   := "Vols2\n" [header] [chunks] [axes] [data]
	[header] := [width] [height] [depth]
	[chunks] := [chunk_width] [chunk_height] [chunk_depth]
	[axes]   := [width_name] [height_name] [depth_name]
	[width_name]  := [len] [string]
	[height_name] := [len] [string]
	[depth_name]  := [len] [string]
[width], [height], and [depth] are 32-bit MBF integers.

[chunk_width], [chunk_height], and [chunk_depth] are 32-bit MBF integers. If all three are less than or equal to 1, then the format is not chunked.

Axis names are given with a 32-bit MBF integer string length (not including a null terminator) followed by that number of ASCII characters (not including a null terminator).

[data] is a stream of width*height*depth 8-bit scalar values.

VOLB
	[file]   := "Volb2\n" [header] [chunks] [axes] [data]
	[header] := [width] [height] [depth]
	[chunks] := [chunk_width] [chunk_height] [chunk_depth]
	[axes]   := [width_name] [height_name] [depth_name]
	[width_name]  := [len] [string]
	[height_name] := [len] [string]
	[depth_name]  := [len] [string]
[width], [height], and [depth] are 32-bit MBF integers.

[chunk_width], [chunk_height], and [chunk_depth] are 32-bit MBF integers. If all three are less than or equal to 1, then the format is not chunked.

Axis names are given with a 32-bit MBF integer string length (not including a null terminator) followed by that number of ASCII characters (not including a null terminator).

[data] is a stream of width*height*depth*4 8-bit values, where each tuple has 8-bits each of red, green, blue, and alpha, in that order.

VOLC
	[file]   := "Volc2\n" [header] [chunks] [axes] [data]
	[header] := [width] [height] [depth]
	[chunks] := [chunk_width] [chunk_height] [chunk_depth]
	[axes]   := [width_name] [height_name] [depth_name]
	[width_name]  := [len] [string]
	[height_name] := [len] [string]
	[depth_name]  := [len] [string]
[width], [height], and [depth] are 32-bit MBF integers.

[chunk_width], [chunk_height], and [chunk_depth] are 32-bit MBF integers. If all three are less than or equal to 1, then the format is not chunked.

Axis names are given with a 32-bit MBF integer string length (not including a null terminator) followed by that number of ASCII characters (not including a null terminator).

[data] is a stream of width*height*depth 64-bit values, where the first 32-bit word contains a 10-bit red, 12-bit green, and 10-bit blue value, in that order from high to low bits. The second word of each 64-bit value contains 16-bits of alpha and 16-bits of beta, in that order from high to low bits.