I’m new to AFNI and want to run the preprocessing afni_proc.py.
I cannot figure out why it has problems with volreg.
The error message is below:
++ applying anaticor without label, using 3dSeg mask
– applying input view as +tlrc
– will use min outlier volume as motion base
** already in tlrc space: -volreg_tlrc_* is not allowed
** invalid block : volreg
Indeed, your input EPI should be in native space, not a standard space, before processing starts.
There are 2 ways it might appear to be in standard space:
It is actually in standard space.
It is a NIFTI file, and it has an qform_code and/or sform_code value in its header that is the dreaded “ambiguous space” one that was somehow allowed in the NIFTI standard. From here, we can see what allowed [qs]form_code values there are (and a new one exists now, code=5, which represents “other” templates than those in code=3,4):
Name Code Description
unknown 0 Arbitrary coordinates. Use Method 1.
scanner_anat 1 Scanner-based anatomical coordinates.
aligned_anat 2 Coordinates aligned to another file, or to the “truth” (with an arbitrary coordinate center).
talairach 3 Coordinates aligned to the Talairach space.
mni_152 4 Coordinates aligned to the mni space.
The dreaded ambiguous coding is code=2; if your NIFTI dataset has that, AFNI has to choose whether to consider that in ‘original’ or ‘standard’ space, which is controlled with an environment variable AFNI_NIFTI_VIEW.
So, first let’s check what the [qs]form_code values are in your dataset, to see if we are in case #1 or case #2 from above. What is the output of the following, where DSET_EPI is your input EPI time series dataset (/group/…/1002002_V001_DMSRun1.nii)?
EDIT: Oh my, Paul has gotten me back… maybe this post is moot.
Different software has created NIFTI datasets with different intentions in the sform/qform_code fields, making a value of 2 there ambiguous. It is generally applied incorrectly even.
If those fields are equal to 2 AND if the EPI has not been registered to anything (in which case they should not be 2), then set the AFNI_NIFTI_VIEW environment variable to orig. This can be done in your $HOME/.afnirc file, in your shell environment or just in the script, as you prefer. For example, edit your ~/.afnirc file to have a line like:
Indeed, you can see that the sform_code values are shown as 2, which is the ambiguous or likely incorrect case.
Try setting AFNI_NIFTI_VIEW = orig either in your environment or in your ~/.afnirc file. Then test by running ‘3dinfo’ on the NIFTI input and verify that without the variable, the space is +tlrc, but with it, the space is +orig.
For example, even before setting the variable in a more permanent place, consider:
Unfortunately, I’m using AFNI on a common server of our institute and I cannot easily change the /.afnirc file.
Would there be the possibility of including something in the afni_proc.py?
The .afnirc file is in your home directory, ~/.afnirc or equivalently $HOME/.afnirc.
Alternatively, you can set that using an environment variable, though your ~/.afnirc file is probably a better place to do it.
To be sure, do you have a $HOME/.afnirc file?
Note that if you run the system check, it will suggest how to copy one to your $HOME directory in the final “please fix” section (IF you do not already have such a file):
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.