Misalignment between nii format file and AFNI format one

Hi all,

I found a very odd problem. I tried two different ways to generate the suma folder for surface based analysis.
One is:
@SUMA_Make_Spec_FS -sid $subj -fspath $SUBJECTS_DIR/$subj/

The other one is:
@SUMA_Make_Spec_FS -fspath $SUBJECTS_DIR/$subj/ -sid $subj -NIFTI

So the only difference here is the -NIFTI option.

Then I compared the files with the same name (they are supposed to be the same file but in different format) like Sub01_TPL_SurfVol+orig.BRIK/HEAD and Sub01_TPL_SurfVol.nii. But a very fantastic thing happened! They are misaligned with each other…
I’m totally confused now. Please could someone help with this question?

Many thanks,
Sarah

When you use the @SUMA_Make_Spec_FS script, be sure to use the “-NIFTI” option. See this post for some more explanation:

https://afni.nimh.nih.gov/afni/community/board/read.php?1,154345,154346#msg-154346

Hi Daniel,

Thanks for those information. It’s very helpful.
But another question is that I need to run @RetinoProc after generating SUMA folder. The problem is something like lh.smoothwm.asc won’t be generated with -NIFTI option. With -NIFTI they are all in .gii format. Should I convert all of the .gii files into .asc using 3dcopy?

Thanks,
Sarah

And I just found this from the help file:

          cd SUMA
          tcsh
          foreach ss (*.gii)
             ConvertSurface  -i $ss -o_gii $ss \
                             -overwrite -xmat_1D NegXY
          end

This method doesn’t help.

And I couldn’t find any options in @RetinoProc about GIFTI/NIFTI

thanks,
Sarah

Are you using a recent version of AFNI? What does “afni -ver” report?

It’s May 21 2017 (Version AFNI_17.1.06).
Is ti too old?

I updated the AFNI to Feb 26 2018 (Version AFNI_18.0.22) and the problem solved … Sorry, I should check and update AFNI regularly.
But I do have another question. I used freesurfer to generate all the surface information and then used afni_proc.py as below to do preprocessing.
afni_proc.py -subj_id $subj.surf
-blocks tshift align volreg surf blur scale
-copy_anat anat+orig
-dsets run_*+orig.HEAD
-surf_anat $suma_dir/FS_templa_SurfVol.nii
-surf_spec $suma_dir/FS_templa_?h.spec
-tcat_remove_first_trs 0
-align_opts_aea -cost lpc+ZZ -partial_coverage
-volreg_align_to MIN_OUTLIER
-volreg_align_e2a
-blur_size $blur_fwhm
-execute

Then I used @RetinoProc to get the retinotopic map.
@RetinoProc
-sid $suma_subj_name
-surf_vol $suma_dir/FS_templa_SurfVol.nii
-spec_left $suma_dir/FS_templa_lh.spec
-spec_right $suma_dir/FS_templa_rh.spec
“-$procType” \

So I suppose the retinotopic epi data will be aligned to FS_templa_SurfVol.nii, right?
But my question is how can I check the alignment. I tried to check the alignment with FS_templa_SurfVol.nii and sub01.surf_SurfVol_Alnd_Exp+orig which is generated by @RetinoProc. They don’t align with each other. I’m quite confused about it. Did I use the wrong files or the alignment is indeed not very well.

Thanks~

I put in a fix for this about a month ago to allow for GIFTI surfaces, so you can try that with an update to your AFNI package. The previous version of the script was expecting datasets in the .asc format. Your ConvertSurface command should work with that version, but you have the input and output reversed.

Yes! I updated the AFNI to Feb 26 2018 (Version AFNI_18.0.22) and the problem solved … Sorry, I should check and update AFNI regularly.

But I do have another question. I used freesurfer to generate all the surface information and then used afni_proc.py as below to do preprocessing.
afni_proc.py -subj_id $subj.surf \
-blocks tshift align volreg surf blur scale \
-copy_anat anat+orig \
-dsets run_*+orig.HEAD \
-surf_anat $suma_dir/FS_templa_SurfVol.nii \
-surf_spec $suma_dir/FS_templa_?h.spec \
-tcat_remove_first_trs 0 \
-align_opts_aea -cost lpc+ZZ -partial_coverage \
-volreg_align_to MIN_OUTLIER \
-volreg_align_e2a \
-blur_size $blur_fwhm \
-execute

Then I used @RetinoProc to get the retinotopic map.
@RetinoProc \
-sid $suma_subj_name \
-surf_vol $suma_dir/FS_templa_SurfVol.nii \
-spec_left $suma_dir/FS_templa_lh.spec \
-spec_right $suma_dir/FS_templa_rh.spec \
“-$procType” \

So I suppose the retinotopic epi data will be aligned to FS_templa_SurfVol.nii, right?
But my question is how can I check the alignment. I tried to check the alignment with FS_templa_SurfVol.nii and sub01.surf_SurfVol_Alnd_Exp+orig which is generated by @RetinoProc. They don’t align with each other. I’m quite confused about it. Did I use the wrong files or the alignment is indeed not very well.

Thanks~

You should probably rerun the @SUMA_Make_Spec_FS script too.

Yes, I rerun this step using @SUMA_Make_Spec_FS -fspath $SUBJECTS_DIR/$templatename -sid $templatename -NIFTI before any further processing steps.

I’m wondering if the file sub01.surf_SurfVol_Alnd_Exp+orig is the right one to check the alignment problem. If yes, it is supposed to be aligned to the template, right?

Thanks,
Sarah

And to double check, I also used 3dAFNItoNIFTI in my code. Is there any update for this function?
I checked the help file and found there is a update today? like 3dAFNItoNIFTI: AFNI version=AFNI_18.0.24 (Mar 6 2018) [64-bit]
So does it mean that I need to rerun everything today?

Thanks,
Sarah

I don’t use the @RetinoProc script, but that one or the @SUMA_AlignToExperiment should both produce anatomical datasets that are aligned to the particular subject data. The datasets are aligned using 3dWarpDrive. You should check that the data is aligned by overlaying the aligned anatomical with the subject’s dataset for that session. Usually with the -nifti option, there would be little need for an extra alignment, and you could potentially skip that step. One somewhat esoteric caveat is if the MRI anatomical dataset used as input for Freesurfer has an odd number of voxels in any direction, then the output MRI dataset is slightly misaligned from the input. In any case, the EPI dataset should be aligned to your subject’s anatomical dataset.

Sorry, but what’s meaning of the extra alignment? do you mean an extra manually alignment if I used the NIFTI option? or just use an extra option for alignment? I checked output generated by @SUMA_AlignToExperiment, there is a misalignment after this step. Should I add something like an extra alignment here?

Thanks,
Sarah