General Information about AIR

The information on this page is relevant to anyone who plans to use the AIR package.

Synopsis of the programs

The AIR 2.0 package includes one program for automated registration of tomographic images: alignlinear. This program includes all of the functionality of the AIR 1.0 programs alignmritopet, alignpettomri, and alignpettopet which are now included in the oldair subdirectory of the AIR package. All of these programs will compute a set of registration parameters needed to align two tomographic images and will generate an output file (referred to here as a ".air file") that contains these registration parameters.

The program reslice will use the registration parameters in a .air file to resample the reslice file (which is explicitly identified in the .air file) to match the standard file. Nearest neighbor, trilinear, or various forms of sinc interpolation can be used.

The alignment programs depend upon the image headers for certain information about file dimensions and sizes. If you do not already have headers for your images, you can create them using the program makeaheader. The program scanheader will display the relevant information contained within an image header so that you can verify that the information is correct. The program fixheader will allow you to modify the real world sizes that correspond to the voxel sizes of an image if the header information about these sizes is inaccurate.

For use with AIR, individual slices from an image must be concatenated into a single image volume. The programs reunite and separate facilitate conversion between data formats that store each slice in a separate file and the multiimage format required by AIR.

The program scanair allows you to display the information contained in a .air file. Several programs are available to make specific modifications to .air files. The program mv_air will allow you to change the name of the reslice file designated in a preexisting .air file. This feature allows you to use the same reslice parameters to resample multiple files that you know (or assume) to be spatially equivalent to one another. The program cd_air allows you to update a .air file to reflect the fact that the reslice file has been moved to some other directory in the file hierarchy. The same effect could be achieved using mv_air, but cd_air does not require you to keep track of the specific name of the reslice file (which is unmodified) and is therefore well suited to safely changing only the directory name. The program invert_air will exchange the reslice and standard files (adjusting the transformation matrix accordingly) so that you can use parameters originally derived for aligning file A to B to align file B to A instead. The program combine_air allows you to combine multiple .air files into a single .air file that will have the same effect as applying the individual files sequentially to a single data set, but without the accumulation of interpolation errors and loss of data outside the field of view that occurs with sequential resampling.

Because the .air files are stored separately from the image files, an additional level of file identification has been incorporated into the .air file. In addition to the names of the files, a ten digit identifier is computed based on the data in the file. This identifier is displayed along with the other information shown by scanair. In the event that you are unsure that a file is the file used to derive a set of registration parameters, you can use the program identify to compute the ten digit number that corresponds to a given data file.

Several programs are provided to manipulate the size or orientation of files without changing any voxel values. The program reorient allows you to rotate your data 90 degrees or 180 degrees around the x-, y-, or z- axis and also makes it possible to flip the data (effectively converting it to its mirror image) along any of these axes. The program resize will shift, clip or pad your data to achieve any desired matrix size. The program layout will composite multiple slices from an image into a single 2D file to create illustrations, etc.

Other programs reformat data in specified ways that do alter voxel values. The program zoomer will interpolate a study with anisotropic voxel sizes to generate a volume composed of cubic voxels. The program magnify uses Fourier interpolation to increase the number of voxels along a given image dimension. The program gsmooth will apply a Gaussian smoothing filter to a file.

The program manualreslice is the only interactive program in the AIR package. This program requires you to specify values for roll, pitch, yaw, x_shift, y_shift, and z_shift, x-axis_scaling, y-axis_scaling and z-axis_scaling. These values can then be stored in an initialization file for use with the automated alignment programs. Alternatively, these values can be used to manually generate a .air file or to manually reslice a file according to these parameters without generating a .air file. When used together with the capabilities of combine_air, and reslice, manually created .air files make it possible for you to resample your data consistently with a pixel size and interplane distance of your choosing.

The program definecommon_air will average together a series of .air files to define an "average" common space for data analysis. The program reconcile_air will compare various .air files with redundant, potentially conflicting information and will create new .air files that are more internally consistent with one another.

The program softmean will take missing data into account in generating a mean image from resliced data that can be used for additional subsequent automated image registration.

Three programs are provided to manage binary files. These are useful for saving editing information, regions of interest, etc.To create a binary file from a non-binary file, use the program binarize. Binary files can be combined, intersected, subtracted, etc., from one another using the program binarymath. Finally, the program binarymask will apply a binary file to a non-binary file to create a masked non-binary file.

The program setheadermax will change the global maximum value in the header of 16 bit images so that they can be converted to 8 bit images with as many significant figures of precision as possible.

The program sizeof shows the size of various variable types generated by your C compiler and compares them to the corresponding sizes in the AIR development environment.


Quantitation and registration

With the AIR package, you should be able to reorient tomographic images of the same subject to match one another. If both images were acquired using the same modality, it is likely that you will want to perform a quantitative comparison of the two images to see if there has been any change between the two images. In making such comparisons, you should be aware of the fact that there are a number of issues that may arise when comparing a pair of reoriented images that do not arise when comparing a pair of images that were acquired in identical positions:
  1. Any errors in normalization of values from different imaging planes will lead to artifacts.
  2. Any spatial distortions in your imaging system will lead to artifacts.
  3. Any errors in measurement of voxel sizes will lead to artifacts.
  4. In PET scanning, misalignment of one of the emission studies relative to the transmission study will lead to artifacts.
  5. Unless you have truly isotropic image resolution in all three dimensions, the process of reorienting the images will misalign the axes of best and worst resolution leading to artifacts.
  6. Differences in partial volume effects related to discrete sampling of the signal will lead to artifacts.
  7. Post-reconstruction resampling of the data in the process of reslicing will lead to interpolation artifacts.
  8. Reorienting only one of the images can produce systematic biases in your data. If you always reslice condition B to match condition A and then perform some statistical test on the difference, a statistically significant finding could merely reflect the fact that the image from condition B was always reoriented rather than the fact that condition B was truly different from condition A.
Problems 1-3 are particularly amenable to quantitative analysis using phantoms, and it is strongly recommended that you perform such studies and fix the problems if you suspect that they are leading to errors in quantitation. Problems 4-7 are more difficult to deal with, and in some cases may be unavoidable. A particularly difficult situation can arise if some state or task of interest is significantly associated with a systematic variation in head position. In this case, it may not always be possible to separate the errors in quantitation due to problems 4-7 from true changes. For band-limited data, the use of sinc interpolation in AIR 2.0 may help to minimize resampling interpolation artifacts, but most tomographic data is not fully band-limited in three dimensions at present. Problem 8 can generally be avoided by randomizing or pseudorandomizing which image is to be resliced.

You should note that quantitative errors above are equally applicable to any method of analyzing misregistered data (e.g., the use of regions of interest) but that they are particularly evident when the images are analyzed on a pixel-by-pixel basis (which essentially amounts to extremely tiny ROI's).

With the exception of sinc interpolation for band-limited data, the AIR package does not incorporate any features intrinsically designed to deal with the quantitation problems described above. In some situations, on-line registration, which is not discussed or supported in this release but is discussed in the first paper describing the PET-PET registration method, minimizes many of these quantitative errors.

Note that the AIR package completely separates the derivation of the registration parameters from the final resampling of the data. Consequently, you are able to apply the spatial information contained in the .air files at any point in the data analysis that you like. On-line registration is one extreme, with the information being used to make modification even before data is acquired. However, it should also be possible to apply this information post acquisition, but prereconstruction, etc.


Method of interpolation

The AIR package now supports nearest neighbor, trilinear, and various forms of sinc interpolation.


The problem of missing data

If two images are misregistered and you reslice one to match the other, there will generally be a portion of the resliced image for which no data is available because this region lies outside of the field of view of the original data acquisition. If the original field of view did not include the entire brain (particularly likely with PET images), the missing data will include brain regions. The AIR package deals with missing data by assigning a voxel value of zero in these regions. However, when registering images, the AIR package does not assume that voxel values of zero correspond to missing data. Consequently, except in special situations, images to be registered with the AIR package cannot have missing data. One exception to this rule is that MRI images can (indeed must) be edited before registering them to PET images. Although you generally should not edit away brain structures, doing so will not disrupt the registration process in any fundamental way. The second exception is that it is possible to perform a unidirectional fit using the alignlinear algorithm with the -p1 0 or -p2 0 flag. This feature allows one of the PET images to be edited to exclude areas that should not be included when deriving the registration parameters. The intent of this feature is to allow you to deal with situations where brain pathology has led to extreme focal changes that would otherwise disrupt the registration process. If used when not needed, this feature will lead to less accurate registration of your images, and should be used only as a last resort as a means of dealing with data missing because it was outside the scanner field of view.

In general, the best approach to dealing with a limited field of view is to always use the original data when registering images. When performing registration, the AIR package always treats data that is outside the boundaries of the image as truly missing data, not as zeros. One exception to this rule of always using the original data is that it is often desirable to align and average together many noisy PET images before registering them to an MRI image from the same subject. A special averaging program, softmean, is provided specifically for this purpose. If all of the PET images are resliced to match any one of the original PET images, softmean will average only the nonzero data at any given point to generate a complete averaged image with no missing data (assuming that at least one of the images being averaged has data at each point).

If you have software originally developed for analyzing images that did not require realignment, you will need to review the behavior of the software when data is missing and assigned a value of zero.


Preferred image orientation

There is no preferred or required image orientation for the AIR 2.0 package, so long as you are consistent (or at least able to keep track of your inconsistencies and consistently take them into account when using the programs). The package should never be expected to reorient an image more than 45 degrees from its initialization parameters, and an increasing failure rate should be anticipated as the necessary alignment approaches this value. The package is absolutely incapable of recognizing and accounting for the fact that two images are mirror image versions of one another, a problem that is particularly likely to go unrecognized when the two images being registered start out in different formats. Don't forget that two data sets can be three dimensional mirror images of one another by virtue of having their planes ordered in opposite directions (top to bottom versus bottom to top). A utility program called reorient is provided to allow you to perform repositioning and mirror imaging as needed to get the images oriented for automated registration. Additional fine tuning of the initial registration can be provided when necessary by using an initialization file with the program alignlinear.


Constraints for image dimensions and voxel sizes

AIR 2.0 does not require voxel sizes to be isotropic along any dimension. This is a change from AIR 1.0 which required isotropic x- and y- pixel sizes. You should now be able to reorient a coronally or sagitally acquired MRI scan and align it to a PET study without having to worry about the fact that the resulting pixel sizes are anistropic.

The AIR package is designed to be extremely flexible with regard to the dimensions of your image. For practical purposes, you are limited only by the amount of contiguous RAM that is available for loading an image into memory. It is recommended that you not interpolate your original data to generate cubic (or approximately cubic) voxels prior to using the AIR package. The package has internal interpolation capabilities that are quite fast, avoiding the need to use extra disk space to save what is actually redundant information. You will also avoid the quantitation errors introduced by repeatedly reinterpolating the same data. The one exception to this recommendation is that if you are averaging together multiple realigned images with the intent of using the averaged value for subsequent registration, there may be some advantage to reslicing the realigned images to cubic voxels and averaging them as cubic voxels.


Preferred number of bits/pixel

The AIR package can be compiled to use either 8 or 16 bits/pixel for internal representation of voxels. Regardless of its internal representation, the AIR package will load images that are 8 bits/pixel or 16 bits/pixel. A bit shifting process is used to convert images into the specified internal representation. The AIR package will only generate images with the number of bits/pixel that it uses for internal representation. For example, if the AIR package is compiled for 8 bits/pixel, it can register two images that have 16 bits/pixel and generate an appropriate .air file. If this .air file is used by the program reslice compiled for 8 bits/pixel, the original 16 bit file will be loaded and resliced, but the output image will be saved as 8 bits/pixel. Note however, that the same .air file that was generated by an 8 bits/pixel registration program can be utilized by a 16-bit version of reslice to generate a 16 bits/pixel resliced image. You should be aware of the fact that this process will remap the absolute pixel values (in a systematic way). If you are doing absolute quantitation, you will need to take this remapping of pixel values into account. Issues related to 16 bit images are discussed in detail in the technical notes.

The interconversion between different data formats is handled exclusively by the data loading subroutines, and the other components of the package generally do not have any way of determining what the format of the original data actually was. For 16 bit data, an additional complication is imposed by the fact that there are three different ways that 16 bit data may be represented externally. The AIR package uses the header global maximum and global minimum values to determine which of the three data types is being used. This issue is discussed in detail in the technical notes.


Preferred image resolution

This is an extremely complicated issue, and most of what is said here consists of empirical guidelines that should be adjusted by your own practical experience.

Extremely noisy high resolution PET images generally take longer to register than smoother, lower resolution images. Furthermore, slight (subpixel size) misregistration of data that is actually already perfectly aligned can result in a small amount of additional smoothing due to the trilinear interpolation process used in the AIR package. This additional smoothing may make the slightly misregistered images "look" better aligned to the AIR package than the registered images. This effect is minimized when the images are already fairly smooth (see 1992 reference for further discussion of this problem). Finally, there are some theoretical reasons to suspect that registration may be particularly robust when the image smoothness is isotropic in all three dimensions.

With these generalizations in mind, we currently reconstruct our PET H215O images with the highest possible resolution (~6mm in-plane, 10 mm axially) and smooth them to isotropic resolution (10mm in all directions) either using gsmooth or using the internal smoothing capabilities of the program alignlinear before registering them to each other.

For intermodality (e.g. MRI to PET) registration, there are theoretical arguments that the PET scans should have the highest possible resolution (assuming that the MRI resolution will be even higher still). Consequently, we realign our 6mm resolution PET images (using the registration parameters derived by smoothing them) to match one another and then average them all together using the program softmean to generate a high resolution, moderately noisy mean image which is then registered to the edited MRI scan. Using somewhat smoother images (e.g., FWHM 7-8 mm) still provides excellent results for MRI to PET registration (see 1993 reference).


Overwriting of files

In general, the programs in the AIR package will not overwrite existing files unless you have explicitly granted permission to do so. However, there is an exception to this rule. The program alignlinear will always overwrite a preexisting file with the same name as the output file--practical experience has shown that the annoyance of having the program refuse to save the results of many minutes or even tens of minutes of iterative computation because a file with that name already existed outweighs the risk of losing data. A few safeguards have been built in: the program will announce the fact that it intends to overwrite an existing file before starting the iterations, hopefully giving you sufficient time to type control-C to terminate the program if you want. Also the program will reject any file name containing ".img" or ".hdr" as an output file name. To avoid any possibility of data loss, it is recommended that you always make a copy of data that could not be easily replaced if overwritten and that you store the data in a safe location in your directory where it cannot be accidentally overwritten by these programs.


Modified: January 7, 1996

© 1995-96 Roger P. Woods, M.D.(rwoods@ucla.edu)