cat_matvec error during volreg with SSwarper output

We used @SSwarper to skull-strip and warp prior to running The @SSwarper finished with no errors and EPI was able to be transformed during the volreg step of, however we get the following error that we think comes from applying the warp to the structural scan. We copied the cat_matvec line where the error occurred from the generated subject proc file. Attached is a snapshot of the setup where we called in the output of @SSwarper. Do you have a suggestion to fix this error? Thanks, Bari

cat_matvec -ONELINE anatQQ.101A_WARP.nii.gz anatQQ.101A.aff12.1D
cat_matvec(12932,0x7fff71899000) malloc: *** mach_vm_map(size=18446744056529735680) failed (error code=3)
*** error: can’t allocate region
*** set a breakpoint in malloc_error_break to debug

catenate all transformations

cat_matvec -ONELINE
anatQQ.101A.aff12.1D > warp.all.anat.aff12.1D

Hi, Bari-

The nonlinear warp information of the @SSwarper script (which is just calling 3dQwarp) is stored in a file called anatQQ.*_WARP.nii. Note that this is a volumetric nifti file-- it tells each voxel individually how to move to its final location. It cannot be put into cat_matvec for concatenation/inversion-- cat_matvec is for dealing with linear/affine transforms, that are 12 numbers (3x translation, 3x rotation, 3x shear, 3x scale).

To concatenate transforms when one is a WARP nifti file from 3dQwarp, you can use 3dNwarpApply:

Note that, indeed, at present @SSwarper at the end does run 3dAllineate to make a 12DOF transform (anatQQ.“${SubID}”.aff12.1D) and then runs 3dWarp separately to go from that result to the ‘base’ using nonlinear warps for refinement, generating anatQQ.“${SubID}”_WARP.nii, so that it might make sense to concatenate these separate pieces of the transform. (This should not be confused with just running “3dQwarp -allineate …” directly, in which case the separate *aff12.1D and *WARP.nii transforms should not be concatenated with 3dNwarpApply, because the *WARP.nii file already includes the affine transform-- see the 3dQwarp help for more about this.)


And also, if you want to combine running @SSwarper with, please see an example for doing so in the “s.nimh_subject_level_01_qwarp.tcsh” script here:

NOTE: this is being pointed out for the syntax of the combo of @SSwarper with not all features of the rest of this command are recommended-- please see the accompanying bioRxiv article for more comments on that. You should look at teh That command script was in reply to a comparison, where we were recommending many steps but had to leave some settings as “non-ideal” (e.g., large upsampling) for the purposes of comparing wtih the original results of those authors.

Hopefully this makes sense-- these are the relevant parts of that command to include the outputs of @SSwarper (I have used ellipses “…” to skip over other parts; $basedset of the MNI152_2009_template.nii.gz file, and the $ss, $subj, $path_anat, etc. variables refer to subject ID, label and paths…):


set ss = SOMETHING

# run @SSwarper
@SSwarper sub-${ss}_T1w.nii.gz sub-${ss}                                                                \
    -copy_anat ${path_anat}/anatSS.${subj}.nii                              \
          -anat_has_skull no                                                \
    -tlrc_base $basedset                                                    \
    -tlrc_NL_warp                                                           \
    -tlrc_NL_warped_dsets                                                   \
         $path_anat/anatQQ.${subj}.nii                                      \
         $path_anat/anatQQ.${subj}.aff12.1D                                 \
         $path_anat/anatQQ.${subj}_WARP.nii                                 \



Prior to May 8, was not consistently
recognizing the WARP datasets as being non-linear.

What AFNI version are you running? (afni -ver)
Assuming it pre-dates 5/8, is updating an option?

  • rick

Hi, thanks for your reply and for the example. We originally had the other components but had left out the ‘anat_has_skull no’ option. Once we added that to the script we were able to run the generated script without errors. When we added that option, it removed the following lines from the subject proc script which seemed to be causing the error.

warp anat follower datasets (affine)

catenate all transformations

cat_matvec -ONELINE


3dAllineate -source anatSS.101A+orig
anatQQ.101A.aff12.1D > warp.all.anat.aff12.1D
\ \
-master anat_final.$subj+tlrc
-final wsinc5 -1Dmatrix_apply warp.all.anat.aff12.1D
-prefix anat_w_skull_warped

Thanks again!

Hi Rick,
Thanks for your reply. We are running a post-5/8 version; the issue ended up not being the version but a missing option in our script.