Developer Guide (2.6) - The Format of VMR Files
- Details
- Category: File Formats
- Last Updated: 17 April 2018
- Published: 17 April 2018
- Hits: 6358
VMR files contain high-resolution anatomical 3D data sets, typically containing the whole brain (head) of subjects. The intensity values are stored as a series of bytes. See the V16 format for a version storing each intensity value with two bytes (short integers). The VMR format contains a small header followed by the actual data followed by a second, more extensive, header. The current version of VMR files is "4", which is only slightly different from version 3 (as indicated below). Version 3 added offset values to format 2 in order to represent large data sets efficiently, e.g. in the context of advanced segmentation processing. Compared to the original file version "1", file versions 2 and higher contain additional header information after the actual data ("post-data header"). This allows to read VMR data sets with minimal header checking if the extended information is not needed. The information in the post-data header contains position information (if available) and stores a series of spatial transformations, which might have been performed to the original data set ("history record"). The post-header data can be probably ignored for custom routines, but is important in BrainVoyager QX for spatial transformation and coregistration routines as well as for proper visualization.
VMR Pre-Data Header
BYTES | DATA TYPE | DEFAULT | DESCRIPTION |
2 | unsigned short | 4 | File version |
2 | unsigned short | 256 | DimX, dimension of X axis |
2 | unsigned short | 256 | DimY, dimension of Y axis |
2 | unsigned short | 256 | DimZ, dimension of Z axis |
VMR Data
Each data element (intensity value) is represented in 1 byte. The data is organized in three loops:
DimZ DimY DimX
Note that the axes terminology follows the internal BrainVoyager (BV) format. The mapping to Talairach axes is as follows:
BV X front -> back = Y in Tal space BV Y top -> bottom = Z in Tal space BV Z left -> right = X in Tal space
VMR Post-Data Header
The first four entries of the post-data header are new since file version "3" and contain offset values for each dimension as well as a value indicating the size of a cube with iso-dimensions to which the data set will be internally "expanded" for certain operations. The axes labels are in terms of BrainVoyager's internal format. These four entries are followed by scan position information from the original file headers, e.g. from DICOM files. The coordinate axes labels in these entries are not in terms of BrainVoyager's internal conventions but follow the DICOM standard. Then follows eventually a section listing spatial transformations which have been eventually performed to create the current VMR (e.g. ACPC transformation). Finally, additional information further descries the data set, including the assumed left-right convention, the reference space (e.g. Talairach after normalization) and voxel resolution.
BYTES DATA TYPE DEFAULT DESCRIPTION 2 short int 0 X offset (*1) 2 short int 0 Y offset (*1) 2 short int 0 Z offset (*1) 2 short int 256 Framing cube dimensions (*1) 4 int "PosInfosVerified" flag indicating whether info could be read from original file headers 4 int 1 Coordinate system entry, "1" = DICOM 4 float X coordinate of center of first slice 4 float Y coordinate of center of first slice 4 float Z coordinate of center of first slice 4 float X coordinate of center of last slice 4 float Y coordinate of center of last slice 4 float Z coordinate of center of last slice 4 float Slice row direction vector, x component 4 float Slice row direction vector, y component 4 float Slice row direction vector, z component 4 float Slice column direction vector, x component 4 float Slice column direction vector, y component 4 float Slice column direction vector, z component 4 int Nr of rows of slice image matrix 4 int Nr of columns of slice image matrix 4 float Extent of field of view (FoV) in row direction [mm] 4 float Extent of field of view (FoV) in column direction [mm] 4 float Slice thickness in mm 4 float Gap thickness in mm 4 int 0 NrOfPastSpatialTransformations IF (NrOfPastSpatialTransformations > 0) list of past spatial transformations (*2) 1 byte 1 Left-right convention (*3) (modified in v4) 1 byte Reference space flag (*4) (new in v4) 4 float Voxel resolution along x axis 4 float Voxel resolution along y axis 4 float Voxel resolution along z axis 1 byte flag (0, 1) indicating whether voxel resolution is verified 1 byte flag (0, 1) indicating whether Talairach space mm 4 int Min intensity value in original 16-bit data 4 int Mean intensity value in original 16-bit data 4 int Max intensity value in original 16-bit data
(*1) These four entries have been added in file version "3" with BrainVoyager QX 1.7. All other entries are identical to file version "2".
(*2) For each past transformation, the information specified in the following table is stored. The "type of transformation" is a value determining how many subsequent values define the transformation: value "1" - rigid body+scale (3 translation, 3 rotation and 3 scale values), value "2" - affine transformation (4x4 matrix), "4" - Talairach transformation, "5" Un-Talairach transformation.