The same image may look different in AFNI and SPM

2 min read

1 Introduction

It is well known that coordinate systems adopted by different neuroimaging software are different. For example, AFNI uses RAI system (-x = Right, -y = Anterior, -z = Inferior) by default while SPM uses LPI system. However, this could not explain why the same image may look different in AFNI and SPM (or MRIcron). Obliquity is probably the real reason.

AFNI and SPM (or MRIcron) interpret the coordinate system differently when the image is oblique. More specifically, AFNI does not apply the oblique transformation in the header while SPM does. This might cause unexpected results when transfer data from one software to the other.

2 Deal with obliquity

To check whether the image is oblique, simply type 3dinfo command.

# check whether the image is oblique
3dinfo –is_oblique img_name.nii 
# or just use `3dinfo img_name.nii`
# and look at Data Axes Tilt

If you use MRIcron, you can look at the header information (Window -> Information), where non-zero quaternions indicate obliquity.

Replacing the transformation matrix in header with cardinal matrix changes the data axes tilt from oblique to plumb. This can be achieved via 3drefit with the -deoblique option

# replace transformation matrix
3drefit –deoblique img_name.nii 

Then you will see that quaternions become zeros in the header information.

As shown below (the crosshair indicates the origin), the deobliqued image looks same in AFNI and MRIcron. In addition, the deobliqued image looks the same as the original image in AFNI, because AFNI does not apply the oblique transformation.

By the way, 3dresample also replace the transformation matrix automatically with cardinal matrix as 3drefit -deoblique does. However, this does not really deoblique the volume. To do so, you should use 3dwarp with -deoblique option.

3 References

NIfTI header information:

Other problems caused by obliquity: