Data Format
Overview
DTI-TK is designed to work with DTI volumes. It does not directly work with diffusion-weight image (DWI) volumes, which are the raw image data acquired from MRI scanners. The DTI volumes that DTI-TK takes as inputs are calculated from their corresponding DWI volumes in a process known as tensor reconstruction. As an example, in a typical diffusion imaging protocol, at least 6 DWI volumes together with 1 minimally diffusion-weighted volume, commonly known as the b=0 image, are acquired for a single subject. Then for this subject, a single DTI volume is then computed from these DWI volumes. The relationship between DWI and DTI is illustrated pictorially in these slides.
This tensor reconstruction process can be accomplished by many excellent software packages including AFNI, Camino, DTIStudio and FSL, to name a few. In this section, we describe the DTI volume format that DTI-TK supports natively. A separate page describing the tools for converting the DTI volumes reconstructed by most of the popular DTI tools can be found here.
NIfTI Standard
DTI-TK uses the NIfTI standard to store DTI volumes by default. The NIfTI standard has a specific category for symmetric matrices specified with the intent code "NIFTI_INTENT_SYMMATRIX". The complete information about NIfTI standard can be found at the NIfTI website. The specific information about how symmetric matrices are stored in NIfTI can be found in the following pdf. The website also has a link to the public domain implementation of the NIfTI IO that is used in DTI-TK. NIfTI is also the chosen format for scalar and vectorial volumes in DTI-TK.
The NIfTI volume includes
- a header portion that specifies important details about the volume, such as the dimensions, voxel dimensions, and the type of data stored, etc.,
- a data portion that stores the actual data. The NIfTI format, which is designed to be backward compatible to the Analyze format, can store the header and the data in two separate files.
Both files should share the identical prefix. The header file should have the suffix hdr, while the data file should have the suffix img or img.gz when the data is compressed. Alternatively, the NIfTI standard also supports the header and the data being stored in a single file, in which case, the appropriate file name should use the suffix nii or nii.gz for compressed data.
Some examples of valid NIfTI filenames are tensor.nii or tensor.nii.gz or tensor.hdr/img. An example data set is available for download here. You can see for yourself what a typical DTI volume in NIfTI format looks like.
Multivolume Analyze Format
For compatibility purposes, DTI-TK also supports the reading and writing of multivolume Analyze formatted DTI volumes. One advantage of using the multivolume Analyze format is that the popular volumetric image viewer MRIcro allows you to view any one of the multiple scalar volumes. When the volume is stored using NIfTI, MRIcro only allows you to look at the first volume.
The multivolume Analyze format stores the header information in a header file with the suffix hdr and the data in a data file with the suffix "img" or img.gz for compressed data. Since the multivolume Analyze Format is just a general way of storing data that are multi-dimensional, there is no specification on how the component volumes should be ordered in the data file and we have to decide on an agreeable order. DTI-TK requires that the volumes of the six tensor components should be stored in the lower triangular order, i.e., Dxx, Dyx, Dyy, Dzx, Dzy, and Dzz. This is chosen because it is the same order as the one specified by the NIfTI standard. In doing so, if the volume is saved using the dual file NIfTI format, the data file will be identical to the one written in the multivolume Analyze format.
DTI-TK can automatically recognize and read a multivolume Analyze formatted volume based on the header file. A warning will be issued however to indicate to the users that the data is not stored in the NIfTI format. To instruct any of the program in DTI-TK to output the DTI volumes in the multivolume Analyze format, a special mechanism has to be introduced, because the multivolume Analyze format shares the same prefix/suffix as the dual file NIfTI format. This is done by giving the output volume a filename with the suffix nhdr rather than hdr. As an example, to convert a NIfTI formatted volume to the multivolume Analyze format, you can use the following command
TVtool -in ${file} -out ${prefix}.nhdr
The command will convert the input volume specified with ${file} to ${prefix}.hdr.