Re: Alignment Issues

Hi,

I ran across a alignment issue as well between epi and anatomical. I don’t have much experience with brain imaging, in fact this is one of my first projects, so I would totally appreciate some help. I ran the afni proc with the lpc+ZZ cost function and giant move and saw the following results:

https://drive.google.com/file/d/1QiEzrZJxUqKs7EK79honD6NIfbeW2Jp_/view?usp=sharing

After looking at the epi and anatomical raw data, I noticed that they have different orientations. Would that cause a problem? Otherwise, I’m not very sure about how to resolve this.

Thanks,
Daniel

If you would like, I can take a look. I will PM you with instructions.

The data started out with the wrong orientations here, I believe. So even before alignment. This is usually caused by passing the data through another software package, PACS servers, or otherwise defective DICOM data. This is more or less obvious by looking at the EPI data over the anatomical dataset before doing anything all to it and seeing one or the other doesn’t match the orientation of the slice viewers, i.e. sagittal isn’t sagittal. coronal isn’t coronal, axial isn’t axial, or the directions are flipped upside down or backwards, i.e. superior and inferior are upside down.

When I saw the backwards, upside-down dataset, I copied the dataset to a new file. 3dinfo tells me how many voxels across and how many voxels down and how many slices there are in the dataset. Then I used to3d to help me figure out what orientation it has.

make a copy of just the 0th sub-brick

3dTcat -prefix pb01_test pb01.sub_id.r01.despike+orig.‘[0]’

show some things about our data, like if it’s floating point or not,

and number of rows, columns and slices

3dinfo pb01_test+orig

run the to3d GUI here to assess orientation

we don’t actually need the file

to3d ‘3Df:0:0:70:70:30:pb01_test+orig.BRIK’

in the GUI’s lower right, select “View Images”

Now select the directions in the upper left, starting with direction across the image

then down the screen image,

then across the slices by dragging the slider at the bottom of the image

the left-right is typically difficult to determine by eye, so just guess here for now.

I found this to be either RPI or LPI. I’ll assume RPI for now

report the original orientation

3dinfo -orient pb01.sub_id.r01.despike+orig.
ALI

reset the orientation in the header to one of the two possibilities found with to3d’s GUI

3drefit -orient RPI pb01.sub_id.r01.despike+orig.

This command aligns and check for flipping

align_epi_anat.py -anat anatSS.sub_id+orig. -epi pb01.sub_id.r01.despike+orig. -epi_base 0 -dset1_strip None -dset2_strip 3dAutomask -suffix _al2epi_gm_flip -giant_move -flip_giant -check_flip

this alignment produced this output!

No flip cost is -0.120521 for lpc cost function
Flip cost is -0.344886 for lpc cost function
WARNING: ************ flipped data aligns better than original data
Check for left - right flipping in the GUI ************************

#The flip options reveal the flipped data aligns better than the RPI assumed data, so I’ll change the orientation from RPI to LPI with this:
3drefit -orient LPI pb01.sub_id.r01.despike+orig.

Reorient your original dataset to be correct with a similar 3drefit command. Also use -giant_move for align_epi_anat.py when calling it through afni_proc.py on the refitted dataset. Also note that this method using the flipping check only makes the datasets consistent. For all we know, the anatomical dataset may have left and right flipped too! Without a marker or clinical manifestations of left/right lesions, surgical evidence, a Vitamin E capsule, or even a head tilt to one side, it’s difficult to know what is left and right.

Thanks Daniel!

I’ll follow through what you’ve done, check out the results, and come back if I have any other concerns. The different orientations was my original intuition as well - awesome that I know how to fix it now.