afni_proc.py Error Using Warped Anatomical Datasets Post-sswarper2

AFNI version info (afni -ver): (Version AFNI_25.0.11 'Severus Alexander')

Good afternoon,

I ran my data through sswarper2, and it seemed to work - all the relevant files were created, and I can open them. However, when I run the following afni_proc.py code:

afni_proc.py                                                                 \
    -subj_id                  sub01018                                       \
    -copy_anat                $topdir/sub01018/anat/anatQQ.sub01018.nii.gz   \
    -anat_has_skull           no                                             \
    -dsets                    $topdir/sub01018/func/rest.nii.gz              \
    -blocks                   tshift align tlrc volreg mask blur scale       \
                              regress                                        \
    -tshift_opts_ts           -tpattern alt+z                                \
    -align_unifize_epi        local                                          \
    -align_opts_aea           -cost lpc+ZZ                                   \
                              -giant_move                                    \
                              -check_flip                                    \
    -volreg_align_to          MIN_OUTLIER                                    \
    -volreg_align_e2a                                                        \
    -volreg_tlrc_warp                                                        \
    -tlrc_base                $basedset                                      \
    -volreg_compute_tsnr      yes                                            \
    -tlrc_NL_warp                                                            \
    -tlrc_NL_warped_dsets     anatQQ.sub01018.nii.gz                         \
                              anatQQ.sub01018.aff12.1D                       \
                              anatQQ.sub01018_WARP.nii                       \
    -mask_epi_anat            yes                                            \
    -blur_size                4.0                                            \
    -regress_apply_mot_types  demean deriv                                   \
    -regress_motion_per_run                                                  \
    -regress_censor_motion    0.2                                            \
    -regress_censor_outliers  0.05                                           \
    -regress_est_blur_epits                                                  \
    -regress_est_blur_errts                                                  \
    -html_review_style        pythonic

I get the following error message:

** Failed "3dnvals -all /Users/katrinazmavc/anatQQ.sub01018.nii.gz"
** error in -tlrc_NL_warped_dsets p1: tlrc anat should be 1 volume,
   but dataset anatQQ.sub01018.nii.gz shows -1
** invalid block : tlrc

I'm able to open anatQQ.sub01018.nii in the AFNI GUI, so I don't think it's corrupted. I tried g-zipping the file to see if that would fix things and it didn't. The code was working with the original NIFTI files - I only started having these issues when I tried to use the files created by sswarper2.

Has this happened to anybody else? Is there a fix for this?

Thanks,
KZ

Hi, KZ-

OK, sure.

Some comments/suggestions:

  • I think you want to make the -copy_anat .. file to be the anatSS*${subj}.nii* one--the skullstripped one in the input/original space---not the anatQQ*${sub}.nii* one, which is the one that has been warped and is then in standard space.
  • I think you still need to put the -tlrc_base .. option in, to say what is the final space of your data from alignment---in your case, I believe it is MNI152_2009_template.nii.gz
  • Based on the other dset names from sswarper2 output, and what you mention about opening the file in the GUI, I am going to guess that your anatQQ* file is not a zipped nifti (and so ending with .nii.gz) but an unzipped one (and so ending with .nii).

So, I think the following AP command applies those fixes, can you please try this and let us know how it goes?

afni_proc.py                                                                 \
    -subj_id                  sub01018                                       \
    -copy_anat                $topdir/sub01018/anat/anatSS.sub01018.nii.gz   \
    -anat_has_skull           no                                             \
    -dsets                    $topdir/sub01018/func/rest.nii.gz              \
    -blocks                   tshift align tlrc volreg mask blur scale       \
                              regress                                        \
    -tshift_opts_ts           -tpattern alt+z                                \
    -align_unifize_epi        local                                          \
    -align_opts_aea           -cost lpc+ZZ                                   \
                              -giant_move                                    \
                              -check_flip                                    \
    -volreg_align_to          MIN_OUTLIER                                    \
    -volreg_align_e2a                                                        \
    -volreg_tlrc_warp                                                        \
    -tlrc_base                $basedset                                      \
    -volreg_compute_tsnr      yes                                            \
    -tlrc_base                MNI152_2009_template.nii.gz                    \
    -tlrc_NL_warp                                                            \
    -tlrc_NL_warped_dsets     anatQQ.sub01018.nii                            \
                              anatQQ.sub01018.aff12.1D                       \
                              anatQQ.sub01018_WARP.nii                       \
    -mask_epi_anat            yes                                            \
    -blur_size                4.0                                            \
    -regress_apply_mot_types  demean deriv                                   \
    -regress_motion_per_run                                                  \
    -regress_censor_motion    0.2                                            \
    -regress_censor_outliers  0.05                                           \
    -regress_est_blur_epits                                                  \
    -regress_est_blur_errts                                                  \
    -html_review_style        pythonic

--pt