afni proc, issue with -tlrc_NL_warped_dsets from @SSwarper

Hi folks,

Wanted to use @SSwarper outputs with afni_proc, per @SSWarper instructions. Running into an issue during testing. This subjects completes just fine if I run nonlinear warping in the afni_proc pipeline, but when copying from @SSwarper I receive the following error


cat_matvec -ONELINE anatQQ.sub-8035ctbs_WARP.nii anatQQ.sub-8035ctbs.aff12.1D
cat_matvec: malloc.c:2394: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

Fatal Signal 6 (SIGABRT) received
    mri_read_double_ascii
   THD_read_dvecmat
  cat_matvec
 Bottom of Debug Stack
** AFNI version = AFNI_18.1.10  Compile date = May  4 2018
** [[Precompiled binary linux_ubuntu_16_64: May  4 2018]]
** Program Death **
** If you report this crash to the AFNI message board,
** please copy the error messages EXACTLY, and give
** the command line you used to run the program, and
** any other information needed to repeat the problem.
** You may later be asked to upload data to help debug.
** Crash log is appended to file /home/dowdlelt/.afni.crashlog

This was in the warp anat follower datasets (affine) section, specific command called:


# -----------------------------------------
# warp anat follower datasets (affine)

# catenate all transformations
cat_matvec -ONELINE                                                         \
           anatQQ.sub-8035ctbs_WARP.nii                                     \
           anatQQ.sub-8035ctbs.aff12.1D > warp.all.anat.aff12.1D

The application of the warps worked fine on the EPI data, just seemed to hit a snag with the anat_followers and failed at the first step of that section. Any ideas?

I would also like to note that the help for @SSwarper is slightly misleading, in that it states you need to do the following:


-tlrc_NL_warp                                                   \
    -tlrc_NL_warped_dsets                                           \
       anatQQ.${subj}.nii                                           \
       anatQQ.aff12.1D                                              \
       anatQQ.${subj}_WARP.nii

The second dset should also include $subj, as in anatQQ.${subj}.aff12.1D. I note this, because I first copied and pasted this section and it failed because I had incorrectly pointed towards a nonexistent 1D file

To add a bit more, I took a look at the script that completed, that performed nonlinear warping within afni proc rather than importing from @SSwarper.

Seems there is a key difference in that the anat follower block specifiesthat it is non-linear, See this excerpt from the working script:


# -----------------------------------------
# warp anat follower datasets (non-linear)

# first perform any pre-warp erode operations

vs the same section from the @SSwarper import script:


# -----------------------------------------
# warp anat follower datasets (affine)

# catenate all transformations
cat_matvec -ONELINE                                                         \
           anatQQ.sub-8035ctbs_WARP.nii                                     \
           anatQQ.sub-8035ctbs.aff12.1D > warp.all.anat.aff12.1D


# first perform any pre-warp erode operations

To be sure, what is your AFNI version (afni -ver)? This
might be something that was fixed, but I am not sure.

Also, what method did you use for giving afni_proc.py
the NL-warp datasets? There is an example of scripts
that uses @SSwarper and afni_proc.py here for a
recent publication.

In particular, see s.nimh_subject_level_02_ap.tcsh,
where the NL datasets are passed via -tlrc_NL_warped_dsets.

  • rick

AFNI version:
Precompiled binary linux_ubuntu_16_64: May 4 2018 (Version AFNI_18.1.10)

I passed along the NL_warped dsets in an identical manner to the example script you linked, here is the relevant portion from the afni_proc command:


-tlrc_base                                                                                               \
#     /home/dowdlelt/abin/MNI152_T1_2009c+tlrc -tlrc_NL_warp                                                                                \
#     -tlrc_NL_warped_dsets                                                                                                                 \
#     /mnt/data0/freesurfer/sub-8035ctbs/SUMA/anatQQ.sub-8035ctbs.nii                                                                       \
#     /mnt/data0/freesurfer/sub-8035ctbs/SUMA/anatQQ.sub-8035ctbs.aff12.1D                                                                  \
#     /mnt/data0/freesurfer/sub-8035ctbs/SUMA/anatQQ.sub-8035ctbs_WARP.nii        

It looks to be specific to the anat_follower portion - the EPI alignment post warping is as expected.

Would you please mail me the complete proc script?
Maybe I can see where this is coming from.

Thanks,

  • rick

Wow, you are putting a lot of options together!

Hmmm, I am not yet able to reproduce this,
but will look more tomorrow.

Thanks,

  • rick

Apologies for the bulkiness of the afni_proc call - Bootcamp may have been a bad influence. If you notice anything wrong, I’d be delighted to hear about it. If I get a chance, I’ll try and reduce options and cut things down on this side, see if I can trace what is introducing the error with a bit more finesse.

Couid the order of afni_proc flags introduce this problem, or does that matter at all?

Thanks for taking a look.

An update: I cut away options one by one to see if anything would change the ====anat follower==== section of the proc script from affine to non-linear. The only thing that did was removing the -tlrc_NL_warped_dsets flag and the files that go with it.

Here are code snippets that demonstrate this change, this block doesn’t work (fails at the anat follower step)


[code truncated]
anat_follower \
		skull anat /mnt/data0/freesurfer/sub-${subnum}/SUMA/sub-${subnum}_SurfVol.nii      \
    	-tlrc_base /home/dowdlelt/abin/MNI152_T1_2009c+tlrc -tlrc_NL_warp  \
	    -volreg_align_e2a -volreg_tlrc_warp -tlrc_NL_warped_dsets                                           \
	       	/mnt/data0/freesurfer/sub-${subnum}/SUMA/anatQQ.sub-${subnum}.nii                                           \
	       	/mnt/data0/freesurfer/sub-${subnum}/SUMA/anatQQ.sub-${subnum}.aff12.1D                                              \
	       	/mnt/data0/freesurfer/sub-${subnum}/SUMA/anatQQ.sub-${subnum}_WARP.nii \
	    -dsets_me_run  \
[code truncated]

And this works completely fine:


[code truncated]
	-anat_follower \
		skull anat /mnt/data0/freesurfer/sub-${subnum}/SUMA/sub-${subnum}_SurfVol.nii      \
    	-tlrc_base /home/dowdlelt/abin/MNI152_T1_2009c+tlrc -tlrc_NL_warp  \
	    -volreg_align_e2a -volreg_tlrc_warp \
	    -dsets_me_run  \
[code truncated]

This problem is not apparent if anat_followers are not being used - the script works just fine for warping all of the datasets. So, it is only a problem when followers are included & -tlrc_NL_warped_dsets is used with something like @SSwarper output.

No apologies needed, it’s good to see such
advanced usage!

I had a too specific naming expectation for the
warp datasets, which is fixed (plus, it will make
any question clear up front).

Anyway, this is on github now if you want to
cheat and get afni_proc.py and db_mod.py.
Otherwise, I will run a build tonight.

Thanks!

  • rick

Just saw this now, sorry. Anyway, the fix is in.

  • rick

Cheated - and can confirm that it looks like the script is as it should be. Thanks for the quick fix!

Great, thanks!

  • rick