Did some more digging:
I used one of my older scripts (with the same proc-settings) and it worked. I started to look some more into it.
1. Without @Align_Centers prior to afni_proc the analysis fails at the anat_w_skull warping
2. It does seem to matter if I give @Align_Centers the input files as .nii or as BRIK and HEAD. For example when first doing
3dcopy data.nii .
I get the data as data+tlrc.BRIK and data+tlrc.HEAD. I then use this as inputting @Align_Centers and then I run the analysis.
During the analysis auto_warp.py also seem to run @Align_Centers since the output says:
Preforming center alignment with @Align_Centers
When I use the .BRIK and .HEAD format from 3dcopy it says distance between centers is 0.00000 mm and it finishes in 12/137 itterations.
When I instead put the raw data in .nii format as input to the @Align_Centers function prior to the afni_proc the same section in the afni_proc output says:
Center distance is 0.00000024 mm
And it needs all 137 itteratins and extra itterations making it 275/274 itterations.
The script still finishes though without error but there is one extra difference. The part where it crashed before (3dNapply_Warp for anat_w_scull) takes much longer in the latter (.nii) case and gives a:
++ Warping .[R]................................Z
Where the other case (.BRIK/HEAD) only gives a
++Warping .Z
The output in the latter case (anat.final / anat_w_scull / epi.volreg) is totally messed up. The warping has failed but the script did not crash.
Why this difference between .nii and the output of 3dcopy .nii as inputs?
So. To fix my script I had to add:
#!/bin/bash
datapath=/data/study1
T1=$datapath/T1.nii
fmri=$datapath/epi.nii
3dcopy $T1 newT1
3dcopy $fmri newfmri
@Align_Centers -base ~/abin/TT_N27+tlrc. -dsets newT1 -child newfmri
T1=T1_shft+orig.
fmri=epi_shft+orig.
#use these as input in afni_proc
This is all very confusing. Why would it matter if I use data.nii or the output of 3dcopy data.nii outputfile (outputfile+orig.HEAD/BRIK) as input to @Align_Centers? Also, I think I did try this as a first trouble shooting and that did not work that time...