how to add -cmass to

AFNI version info (afni -ver): Precompiled binary linux_ubuntu_16_64: Jan 25 2024 (Version AFNI_24.0.02 'Caracalla')


I ran on 170 subjects. The results look great for most of them but for 20 subjects the alignment between the EPI and the anatomical is not good. I am trying to include -cmass into my command because in the output it says:

*+ WARNING: center of mass shifts (-cmass) are turned off, but would be large
*+ WARNING: - at least one is more than 20% of search range

  •    -cmass x y z shifts =   -0.106  -15.850   -6.054
  • shift search range is +/- = 69.517 69.517 51.296
  •                              0.2%    22.8%    11.8%

and further down:

++ ***********************************************************
*+ WARNING: -cmass was turned off, but might have been needed :(

  •       Please check your results - PLEASE PLEASE PLEASE

++ ***********************************************************

but even when including -cmass it shows me the same Warning that cmass was turned off. I read through the documentation of but I guess its still not clear to me how cmass should be added to the command.

The command I use is: -anat ${subj}anat_masked.nii.gz -epi pb00.${subj}.r01.tcat+orig. -epi_base vr_base_min_outlier+orig. -tshift off -cmass cmass  -anat_has_skull no -overwrite

Thank you very much

Typically, I would recommend using -giant_move or -ginormous_move when the datasets are far apart.


Thank you very much for your response. I just tried: -anat {subj}anat_masked.nii.gz -epi pb00.{subj}.r01.tcat+orig. -epi_base vr_base_min_outlier+orig. -tshift off -giant_move -anat_has_skull no -overwrite

and it still gives me the same warning about cmass. I don t think that read the -giant_move option from the command because I don t see anything about giant_move in the output either. This is why I think that it must be an error in how I add the cmass or -giant_move option into the command.


It seems you are using, which is a good idea. You can change options as in the examples:

            -align_opts_aea           -cost lpc+ZZ   -giant_move  -check_flip                            \

The cmass warning may be coming from something else. Try changing the cost function for problematic data to be "nmi", "lpc+ZZ" or "lpa"

I was using for some preprocessing but I did not include the realignment step because I wanted to use ANTs. However it turned out that for this dataset does a better job than ANTs so now I am trying to use only (so after I used to align the anatomical to the EPI.

I tried all 3 cost functions, for example: -anat 0210anat_masked.nii.gz -epi pb00.0210.r01.tcat+orig. -epi_base vr_base_min_outlier+orig. -tshift off -anat_has_skull no -cost lpa -giant_move -check_flip -overwrite

but none of them work. The alignment does not look very bad before running and it looks much worse after. In the output I do see that it uses lpa or lpc+ZZ or nmi and I see that it checks for flip but I don t see anything about giant_move.



Visualization of oblique data in other software may work differently than in the afni GUI. Take a look at the results there and with the QC HTML pages for a better picture of the output. If it's necessary to get the visualization to work in other software, we can address that separately, but first, we should check whether alignment is properly done


As Daniel suggests, obliquity-handling differences might affect things here. To be sure whether that is the case (as well as for efficient review of lots of parts of the processing), we would recommend checking out's QC HTML (the APQC HTML).

See for example the "ve2a" discussions/parts in these papers:



Ha! Yes that was absolutely the case! When I look at the alignment in afni it looks ok. I had no idea that this would differ across software! And it seems to be related to the oblique angle difference.

However, I am confused why I would get a warning that the images have an oblique angle difference when these are the aligned images after running I am looking at. Does it mean that did not manage to correct for that angle difference? But visually the alignment looks OK.

Do I still have to run 3dWarp -deoblique when visually the alignment looks good in AFNI?

Everything looks good here. AFNI uses the "cardinal" coordinates mostly, so you're set for AFNI processing. We do not update the "oblique" coordinates in the anatomical output to match the EPI. You could make a copy of all the input datasets and remove the obliquity with 3drefit -deoblique on the copies. Deobliquing 3dWarp -deoblique adds an interpolation to the dataset but is another way.

Adding on some other ways to handle this.
You can add the original "obliquity" info back into the dataset with this:


Another way is to deoblique by refitting the headers of copies of the final datasets.

Try restructuring your command like this: -anat subj_anat_masked.nii.gz -epi pb00.{subj}.r01.tcat+orig. -epi_base vr_base_min_outlier+orig. -tshift off -giant_move -anat_has_skull no -overwrite

Make sure there are no hidden characters or spaces that could interfere with the command's execution. If the problem persists, check if your version of supports the -giant_move option.

Thanks me later' :sweat_smile: