Nifti-1 MRI unknown orientation

Missing or incorrect coordinate information is an important and all too common problem in FMRI/MRI data. With this kind of problem you have posted here, I typically do something that’s a combination of jsein’s and Chris_Rorden’s approaches. If you know the storage orientation, then you can skip most of these steps and just use 3drefit, but most of the time, I’ve found that is not the case. If the data is viewable but in a weird, wrong direction (orientation is upside down for instance), then follow these steps:

  1. copy data to an uncompressed format
    3dcopy mydata.nii.gz mydata

  2. Note data type and number of voxels in i,j,k (columns, rows, slices) directions.
    3dinfo mydata+orig

  3. Read data with to3d
    to3d ‘3D:-1:0:128:128:33:mydata+orig.BRIK’

  4. In to3d GUI, preview images to show slices as they are stored on disk. The slider at the bottom of the image window shows each slice in the stored volume.

  5. In upper left of GUI, note directions across screen, down screen, increasing slices. Each of the first letters of those directions from start to end direction gives the orientation in AFNI terminology. For example, if the image goes from Right-to-left across the image, Anterior-to-posterior down the image and Inferior-to-posterior with increasing slices, then the orientation is “RAI”. Note the orientation and leave the GUI without saving.

  6. Refit the orientation of the data or the copy.
    3drefit -orient RAI mydata.niii.gz

What this procedure does not do is preserve any oblique information in the data. We have also pointed out in the past that the left and right are typically not easy to distinguish because most brains are symmetric enough to make generalizations difficult to establish. This is unfortunately common (see link below). We do have a test for left-right flipping as a check_flip option in align_epi_anat.py that we typically recommend calling through afni_proc.py. This test works by comparing two datasets, typically EPI and anatomical datasets, to see if there is an inconsistency.

If I can find some time, I’ll try to make a short video of the to3d method to determine orientation.

2 Likes