ERROR: EDIT_full_copy: can't malloc -856702976 bytes for new sub-brick 0

AFNI version info (afni -ver): linux_ubuntu_16_64: Feb 25 2021 (Version AFNI_21.0.12 'Titus')

Hi AFNI experts,

When I used afni_proc.py to preprocess the Monkey fMRI data, the following error came up:

  3dNwarpApply -nwarp "./anat.aff.qw_WARP.nii anat.aff.Xat.1D" -master ./base.nii -source /media/psy0615/HJR3/Data/Anes_macaque/afni_preproc/site_oxford/sub-032163/sub-032163.results/sub-032163_anat_nsu+orig -prefix ./sub-032163_anat_nsu.aw.nii 
++ 3dNwarpApply: AFNI version=AFNI_21.0.12 (Feb 25 2021) [64-bit]
++ Authored by: Zhark the Warped
++ -master dataset is './base.nii'
++ opened source dataset '/media/psy0615/HJR3/Data/Anes_macaque/afni_preproc/site_oxford/sub-032163/sub-032163.results/sub-032163_anat_nsu+orig'
++ Processing -nwarp 
++ Warping:** ERROR: EDIT_full_copy: can't malloc -856702976 bytes for new sub-brick 0
 +    Dataset ./Nwarp#02+orig.HEAD

Fatal Signal 11 (SIGSEGV) received
     THD_nwarp_regrid
    IW3D_set_geometry_nwarp_catlist
   IW3D_read_nwarp_catlist
  3dNwarpApply
 Bottom of Debug Stack
** AFNI version = AFNI_21.0.12  Compile date = Feb 25 2021
** [[Precompiled binary linux_ubuntu_16_64: Feb 25 2021]]
** 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/psy0615/.afni.crashlog
AFNI filename:
   initial : ./sub-032163_anat_nsu.aw.nii
   prefix  : sub-032163_anat_nsu.aw
   view    : 
   exten.  : .nii
   type    : NIFTI
   On Disk : 0
   Row Sel : 
   Col Sel : 
   Node Sel: 
   RangeSel: 
#**ERROR Failed in warping step
** ERROR - script failed
3dbucket: No match.
++ FINISHED AP: site_oxford sub-032163

The RAM of my computer is 126G, and it shoud be enough for the wrapping. I can't figure out the cause for this error. The script of afni_proc.py is shown in the following:

afni_proc.py                                                                \
    -subj_id                   sub-032163                                       \
    -blocks      despike tshift align tlrc volreg blur mask scale regress   \
    -dsets                     sub-032163*task-rest*run-1*.nii.gz                                  \
    -copy_anat                 sub-032163_anat_nsu.nii.gz                                    \
    -anat_has_skull           no                                            \
    -anat_uniform_method      none                                          \
    -radial_correlate_blocks  tcat volreg                                   \
    -radial_correlate_opts    -sphere_rad 14                                \
    -tcat_remove_first_trs    3                                     \
    -volreg_align_to          MIN_OUTLIER                                   \
    -volreg_align_e2a                                                       \
    -volreg_tlrc_warp                                                       \
    -volreg_warp_dxyz        1                                \
    -volreg_compute_tsnr      yes                                           \
    -align_opts_aea           -cost lpc+ZZ -ginormous_move           \
                              -cmass cmass -feature_size 0.5   \
    -tlrc_base                D99_template.nii.gz                                   \
    -tlrc_NL_warp                                                           \
    -blur_size                2                                  \
    -mask_segment_anat yes                                                  \
    -mask_segment_erode yes                                                 \
    -regress_motion_per_run                                                 \
    -regress_apply_mot_types  demean deriv                                  \
    -regress_censor_motion    0.2                                \
    -regress_censor_outliers  0.05                               \
    -regress_bandpass 0.01 0.1                                              \
    -regress_ROI_PC CSFe 5                                                  \
	-regress_ROI_PC WMe 5                                                   \
    -regress_est_blur_errts                                                 \
    -regress_est_blur_epits                                                 \
    -regress_run_clustsim     no                                            \
    -html_review_style        pythonic                                      \
    -execute

The warps are padded to cover the space from the original to the native space. If the datasets are very far part, then 3dNwarpApply can require a lot of memory. The workaround here is to run @Align_Centers to move the center of your anatomical dataset over the template before the alignment with @animal_warper.

@Align_Centers -base mytemplatedset -dset myanatdset -dset_followers myepidsets_r*.nii.gz
@animal_warper -base mytemplatedset -dset myanatdset_shft+orig ...

Thanks again for your help. The 3dNwarpApply works well after runing @Align_Centers.

1 Like