Does it differs to use nii.gz or AFNI format ?

Hi ,

I try to use some dataset which is at Nifti format but when i look pre-processing results saw that epi set and anatomic set is not fitting each other. How can it be happen ? How can i fix this ?



When asking a question, please please please include specific information:

  • your version of AFNI (“afni -ver”)
  • what command(s) you ran (copy+pasted)
  • what error message(s) you received, if any
  • what differences you are observing-- specifically
  • what you are trying to accomplish
    [+ you can upload image(s), too, if necessary]

Otherwise, there is no way to possibly try to reply meaningfully.


Of course

I try

#!/usr/bin/env tcsh
# created by version 1.2 (April 5, 2018)
# creation date: Tue Jul 24 21:58:36 2018

# set subject and group identifiers
set subj  = female
set gname = peking

# set data directories
set top_dir = /mnt/e/SemraHoca/Peking/Gr1/${subj}/1860323/session_1
set anat_dir  = $top_dir/anat_1
set epi_dir   = $top_dir/rest_1

# run to create a single subject processing script -subj_id $subj                                        \
        -script proc.$subj -scr_overwrite                          \
        -blocks despike tshift align tlrc volreg blur mask regress \
        -copy_anat $anat_dir/mprage_noface.nii.gz                  \
        -dsets $epi_dir/rest.nii.gz                                \
        -tcat_remove_first_trs 5                                   \
        -volreg_align_to MIN_OUTLIER                               \
        -volreg_align_e2a                                          \
        -volreg_tlrc_warp                                          \
        -blur_size 6.0                                             \
        -regress_censor_motion 0.2                                 \
        -regress_bandpass 0.01 0.1                                 \
        -regress_apply_mot_types demean deriv                      \
        -regress_motion_per_run                                    \

My errors or warnings

43 -e[7m*+ WARNING:e[0m Input dataset is not 3D+time; assuming TR=1.0
set ovals = ( -set_run_lengths $tr_counts -index_to_run_tr $minindex )

82-e[7m*+ WARNING:e[0m dataset is already aligned in time!
83-e[7m*+ WARNING:e[0m ==>> output dataset is just a copy of input dataset

242-*********** Warning *************
Dataset centers are 42.224525 mm
apart. If registration fails, or if
parts of the original anatomy gets
cropped, try adding option
-init_xform AUTO_CENTER
to your @auto_tlrc command.

++ Processing AFNI dataset __ats_tmp___upad40_dset_ns+orig
308-e[7m*+ WARNING:e[0m Changing the space of an ORIG view dataset may cause confusion!
309-e[7m*+ WARNING:e[0m NIFTI copies will be interpreted as TLRC view (not TLRC space).
310-e[7m*+ WARNING:e[0m Consider changing the view of the dataset to TLRC view also

356-e[7m*+ WARNING:e[0m input ‘a’ is not used in the expression

My version is

Precompiled binary linux_openmp_64: Jul 6 2018 (Version AFNI_18.2.04)


Everything you show there is just a warning, most are
expected or at least okay (“okay” is the one about the
data being already aligned in time - I guess that EPI
is missing its slice timing information).

However the one that says the data centers are 42+ mm
suggests one of your datasets does not have accurate
coordinates. It might help to show the output of 3dinfo
on both the anat and EPI.

It seems likely that you would want to run @Align_Centers
on one or both datasets, before running

Also, consider applying the option set:

-align_opts_aea -cost lpc+ZZ -giant_move

  • rick


After using giant_move some of the pre-processing output’s fitting errors has gone but some of them have a new error which is data lose from epi set. You can see and understand from the below images.

Here is my again -subj_id female4 -script proc.female4 -scr_overwrite -blocks \
     despike tshift align tlrc volreg blur mask regress -copy_anat         \
    /mnt/e/SemraHoca/Gr1/female/sub26183/anat/mprage_skullstripped.nii.gz \
    -anat_has_skull no -dsets                                             \
    /mnt/e/SemraHoca/Gr1/female/sub26183/func_1/rest.nii                  \
     -tcat_remove_first_trs 5 -align_opts_aea -giant_move -volreg_align_to \
     first -volreg_align_e2a -volreg_tlrc_warp -blur_size 4.0              \
     -regress_censor_motion 0.2 -regress_bandpass 0.01 0.1                 \
     -regress_apply_mot_types demean deriv -regress_est_blur_errts

There is not any new warnings or any errors. And it’s output is below

This is my code for align after pre-process
@Align_Centers -base anat_final.Gr1+tlrc. -dset final_epi_vr_base+tlrc. -prefix PREFIX -cm
and is output is below

And when I use this code below; -infile dfile_rall.1D -quick_censor_count 0.2
it gives 2 by the way is this 0.2 refers for 0.2mm ?


Hi Abdullah,

The first image there looks great.

You should never run @Align_Centers after the
pre-processing, run it before, instead. The
purpose of that is to help the alignment step,
before it happens.

In this case, @Align_Centers is not needed,
since the alignment looks very good. -quick_censor_count will output the
number of time points that would be censored at
the given level (0.2 mm (approximately mm)), in
this case.

See -help for details.

  • rick
  • Hi,

My is here again for @Align performed run -subj_id $subj
-script proc.$subj -scr_overwrite
-blocks despike tshift align tlrc volreg blur mask regress
-copy_anat $top_dir/mprage+orig
-dsets $top_dir/rest2N+orig.HEAD
-tcat_remove_first_trs 0
-align_opts_aea -giant_move
-volreg_align_to MIN_OUTLIER
-blur_size 4.0
-regress_censor_motion 2.0
-regress_bandpass 0.01 0.1
-regress_apply_mot_types demean deriv
-regress_run_clustsim no

and it gives that output below

and my that @Align not performed run. -subj_id $subj
-script proc.$subj -scr_overwrite
-blocks despike tshift align tlrc volreg blur mask regress
-copy_anat $top_dir/mprage_skullstripped.nii
-dsets $top_dir/rest.nii
-tcat_remove_first_trs 0
-align_opts_aea -giant_move
-volreg_align_to MIN_OUTLIER
-blur_size 4.0
-regress_censor_motion 2.0
-regress_bandpass 0.01 0.1
-regress_apply_mot_types demean deriv
-regress_run_clustsim no
and it’s output is below;

Now you can see that when I perform just giant_move it lose values from epi set but when I use @Align and giant_move it is not aligned. what can i do now ?


Exactly what is wrong with the second image?
It looks good to me.

Be specific, what do you think is wrong with
the alignment?

  • rick


Sure. You’re right align was good there but it has lost information although it has that information at raw dataset. Also, the first image in my last post has that information but not properly aligned.I marked it at the image below. Is it because of the dataset or am I doing something wrong?



The parts that you circled were surely never in the
original dataset. The parts that are cut off on top and
on bottom show where the original EPI dataset ends
inside the anatomical dataset. Notice that the EPI is
like a diagonal box inside the anatomical box.

That was not lost, but did not exist in the first place.

  • rick


Thanks for all your help I will not use that subjects than.