Mcflirt : apply transform matrices from first echo to all other echos

Hello everyone,

I have been struggling with registration and my multi-echo datasets.
So I understood that motion correction should be done on one echo then applied to all other echos before using tedana to combine them.
So far so good. I tried two ways to preprocess, but no good results are coming out.

First attempt :
I tried using afni_proc.py, but the anat and epi are not aligned :
afni_proc.py
-subj_id subject2
-blocks despike tshift align tlrc volreg mask combine
-copy_anat anat.nii.gz
-dsets_me_run ECHO*.nii.gz
-echo_times 9.1 25 39.6 54.3
-volreg_align_to MIN_OUTLIER \

This doesn’t align anat to epi properly, maybe you have some advice ?

Second attempt through bash (which does register correctly, but I need to do a correct motion correction with mcflirt)
on first echo :
3dDespike -prefix Despiked_ECHO1.nii.gz ECHO1.nii.gz
mcflirt -mats /ECHO1.mat -in Despiked_ECHO1.nii.gz -out Realigned_ECHO1.nii.gz

The output is a folder with as many MAT_xxxx files as I have TRs.
Maybe someone has a bash simple command to apply these transforms to the 3 other ECHOX.nii.gz ?

Thanks for any tips or info.

I would suggest adding -align_opts_aea -giant_move to your afni_proc.py command if your EPI and anatomical volumes start off far apart.

Also you likely want to add a -combine_method, and likely one that uses the new Tedana like m_tedana_OC.

Hello,
thanks for you reply.
This sounds like a good idea. I relaunched the program, and it seems to converge towards tlrc space. There are some area of the brains of the different subjects that are not covered, so I will try to add giant move.
Concerning tedana, isn’t OC the default option ?
I had a look, and it doesn’t explain fully what is going on :
m_tedana_OC : tedana OC from MEICA group (ts_OC.nii.gz)
OC must stand for optimal combination I guess. Then I don’t really understand the nuance.

Thanks

You have multiple options in afni_proc for both combine methods and which package you want to use for the combination. There’s the original Meica package and now the newer tedana package.

https://afni.nimh.nih.gov/pub/dist/doc/program_help/afni_proc.py.html

            ---- basic combine methods (that do not use any tedana) ----

                methods
                -------
                mean             : simple mean of echoes
                OC               : optimally combined (via @compute_OC_weights)
                                   (current default is OC_A)
                OC_A             : original log(mean()) regression method
                OC_B             : newer log() time series regression method
                                   (there is little difference between OC_A
                                   and OC_B)

            ---- combine methods that use Prantik's "original" tedana.py ----

               Prantik's tedana.py is run using the 'tedana*' combine methods.

                  Prantik's tedana.py requires python 2.7.

                  By default, tedana.py will be applied from the AFNI
                  installation directory.

                  Alternatively, one can specify the location of a different
                  tedana.py using -combine_tedana_path.  And if it is
                  preferable to run it as an executable (as opposed to running
                  it via 'python PATH/TO/tedana.py'), one can tell this to
                  tedana_wrapper.py by applying:
                         -combine_opts_tedwrap -tedana_is_exec

                methods
                -------
                OC_tedort        : OC, and pass tedana orts to regression
                tedana           : run tedana.py, using output dn_ts_OC.nii
                tedana_OC        : run tedana.py, using output ts_OC.nii
                                   (i.e. use tedana.py for optimally combined)
                tedana_OC_tedort : tedana_OC, and include tedana orts


            ---- combine methods that use tedana from the MEICA group ----

               The MEICA group tedana is specified with 'm_tedana*' methods.

                  This tedana requires python 3.6+.

                  AFNI does not distribute this version of tedana, so it must
                  be in the PATH.  For installation details, please see:

                     https://tedana.readthedocs.io/en/stable/installation.html

                methods
                -------
                m_tedana         : tedana from MEICA group (dn_ts_OC.nii.gz)
                m_tedana_OC      : tedana OC from MEICA group (ts_OC.nii.gz)
                m_tedana_m_tedort: tedana from MEICA group (dn_ts_OC.nii.gz)
                                   "tedort" from MEICA group
                                   (--tedort: "good" projected from "bad")


            The OC/OC_A combine method is from Posse et. al., 1999, and then
            applied by Kundu et. al., 2011 and presented by Javier in a 2017
            summer course.

            The 'tedort' methods for Prantik's tedana.py are applied using
            @extract_meica_ortvec, which projects the 'good' MEICA components
            out of the 'bad' ones, and saves those as regressors to be applied
            later.  Otherwise, some of the 'good' components are removed with
            the 'bad.  The tedort method can be applied with either AFNI OC or
            tedana OC (meaning the respective OC method would be applied to
            combine the echoes, and the tedort components will be passed on to
            the regress block).

            The 'm_tedanam_m_tedort' method for the MEICA group's passes
            option --tedort to 'tedana', and tedana does the "good" from "bad"
            projection before projecting the modified "bad" components from the
            time series.

            Please see '@compute_OC_weights -help' for more information.
            Please see '@extract_meica_ortvec -help' for more information.
            See also -combine_tedana_path.
1 Like