1. Remove all header information contained within each slice data file and convert the slice data to either 8 bit or 16 bit integer values. The AIR package does not include file format converters for removing header information or otherwise converting proprietary formats. Some file format converts refer to the desired format as "raw" format. You can verify that the file does not contain any extra header information by computing the single slice data file's size in bytes as (x_dimension*y_dimension*bits/pixel)/8 and comparing this with the actual size of the file in bytes.
2. Change the name of each slice data file so that it contains only a single period followed by img at the end of the file name (e.g., mri01.img).
3. Use the program makeaheader to create a .hdr file corresponding to each .img slice data file. You need to know the x and y dimensions of each image (use a z-dimension of one for single slice data). You also need to specify the voxel sizes along each dimension (the z-dimension should be the interslice distance, which is not necessarily the same as the slice thickness). Finally, you must know the number of bits per pixel, and, for 16 bit data, how the data is stored. All of the files that are to be converted into a single volume must have identical dimensions and voxel sizes, so you can make one .hdr file and just copy it for the other images if you like.
Example:
makeaheader mri01 3 256 256 1 0.8 0.8 3.0
will create a file called mri1.hdr for a 256x256 plane of type 3 16 bit data with voxel dimensions of 0.8 mm (i.e., FOV=204.8) and an interslice distance of 3.0 mm.
4. Use the program reunite to combine the individual slices into a single volume.
Example:
reunite mrivolume y mri01 mri02 mri03 mri04 mri05 mri06 mri07 mri08 mri09 mri10
will create files called mrivolume.hdr and mrivolume.img containing the data from the 10 specified slices, mri01.img, mri02.img ... mri10.img. Note that the order in which the file names are entered dictates the ordering of the planes.
1. Use the program scanheader to review the header information that the AIR package will use to align and manipulate your studies.
Example:
scanheader mri01
will display the header information for the study mri01.img
The AIR package provides a means for directly modifying voxel sizes (see program fixheader) If the values for the file dimensions or bits/pixel are incorrect, the program makeaheader can be used to make a new, corrected header.
1. Verify the voxel sizes and file dimensions of the studies
2. Decide which study you want to reslice--this study will be called "mri2" in this example. The other study will be called "mri1"
3. Identify a voxel value in the studies that will reliably distinguish areas outside the body from values in the brain. In this example, a 16 bit value of 7000 will be used for both files.
4. Use alignlinear to derive a registration parameter file (called mri2.airmri1 in this example).
If you want to use the default smoothing and pre-alignment interpolation:
alignlinear mri1 mri2 mri2.airmri1 -m 6 -x 3 -c 0.1 -t1 7000 -t2 7000
If your MRI images have voxels that are extremely anisotropic
alignlinear mri1 mri2 mri2.airmri1 -m 6 -x 3 -c 0.1 -t1 7000 -t2 7000 -z
If you want the registration to be based on slightly smoothed versions of the data:
alignlinear mri1 mri2 mri2.airmri1 -m 6 -x 3 -c 0.1 -t1 7000 -t2 7000 -b1 2.0 2.0 2.0 -b2 2.0 2.0 2.0
If you have data where the scalp and skull are prominent and there is substantial initial misregistration you can do a two stage registration with heavy initial smoothing followed by normal smoothing:
alignlinear mri1 mri2 mri2.airmri1 -m 6 -x 3 -c 0.1 -t1 7000 -t2 7000 -b1 8.0 8.0 8.0 -b2 8.0 8.0 8.0 -g mri2.init -gs mri2.inits
alignlinear mri1 mri2 mri2.airmri1 -m 6 -x 3 -c 0.1 -t1 7000 -t2 7000 -b1 2.0 2.0 2.0 -b2 2.0 2.0 2.0 -f mri2.init -fs mri2.inits
5. Use reslice to reslice one file to match the other. The resliced file will be called rmri2 (or crmri2 if you want it interpolated to cubic voxels).
If you want the reslice file to have the same voxel z_size and number of planes as the standard_mri file:
reslice mri2.airmri1 rmri2 -k
If you want the reslice file interpolated to cubic voxels in addition to being resliced:
reslice mri2.airmri1 crmri2
1. Use zoomer to interpolate the standard mri to cubic voxels. The resulting file in this example will be called cmri1
zoomer mri1 cmri1
1. To review the contents of .air file mri2.airmri1, use scanair:
scanair mri2.airmri1
1. Review the contents of the .air file you want to invert
2. Use invert_air to create a new .air file
invert_air mri2.airmri1 mri1.airmri2
3. Use reslice to create the desired file
reslice mri1.airmri2 rmri1 -k
1. Use the program separate:
separate mrivolume smri y
This command will take the volume "mrivolume.img" and create a series of images "smri001.img", "smri002.img", "smri003.img" ... which are raw format data files containing one slice of data per file.
1. Use your display package to decide what needs to be done.
2. Use reorient to create a new MRI file in the position you want. In this example, the original upside-down and backwards MRI (ubmri) will be rotated 180° around the x-axis to create a properly oriented MRI (mri ):
reorient ubmri mri xx