AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
July 09, 2019 02:47PM
AFNI gurujis--

My goal is use the -tpattern @filename option within afni_proc to do slice-time correction using the slice timings provided in a BIDS .json file. I've managed to confound my efforts in two easy steps:

First, read slicenums lines from a BIDS format .json file to get the slice-timing for the EPI data. Dump it into the 1D file slicetimes.1D

# first set a variable indicating the number of slices
set slicenums="`3dinfo -nk rest.nii`"
# next, read slicenums of slice-timing info from the .json
set slicetimes = "`less rest.json | grep -A ${slicenums} SliceTiming | grep -Eo '[0-9.]{1,}'`"
echo ${slicetimes} > slicetimes.1D

Second, call up afni_proc and, among several other things, ask it to read the slice-timing from slicetimes.1D

afni_proc.py -subj_id ${subID} \
-dsets rest.nii \
-copy_anat T1.nii \
-blocks despike tshift align tlrc volreg mask regress \
-tshift_opts_ts -tpattern @slicetimes.1D \
-mask_segment_anat yes \
-mask_segment_erode yes \
-align_opts_aea -ginormous_move -deoblique on -cost lpc+ZZ \
-tcat_remove_first_trs 4 \
-tlrc_NL_warp \
-tlrc_base MNI152_2009_template.nii.gz \
-volreg_align_to MIN_OUTLIER \
-volreg_tlrc_warp \
-volreg_warp_dxyz 3.0 \
-regress_motion_per_run \
-regress_censor_motion 0.3 \
-regress_censor_outliers 0.1 \
-regress_apply_mot_types demean deriv \
-regress_compute_tsnr yes \
-regress_anaticor_fast \
-regress_bandpass 0.001 0.198 \
-execute

The following error results:
** ERROR: mri_read_ascii: couldn't open file slicetimes.1D
** FATAL ERROR: Can't read tpattern file slicetimes.1D

The file is, indeed, readable in other contexts, though. I can 1dplot it and if I use 3dTshift the old-fashioned way, it works fine:
3dTshift -prefix foo -tpattern @slicetimes.1D rest.nii

Something with how the afni_proc wrapper wants to read the file, perhaps? Sorry. Hope I'm not doing something ridiculous but I'm at the bottom of my debug stack...

Oh, and: Precompiled binary linux_ubuntu_16_64: Jun 18 2019 (Version AFNI_19.1.21 'Caligula')

Thanks!
Subject Author Posted

mri_read_ascii error when opening @file for 3dTshift -tpattern

paul.hamilton July 09, 2019 02:47PM

Re: mri_read_ascii error when opening @file for 3dTshift -tpattern

Peter Molfese July 09, 2019 03:12PM

Re: mri_read_ascii error when opening @file for 3dTshift -tpattern

paul.hamilton July 09, 2019 06:16PM

Re: mri_read_ascii error when opening @file for 3dTshift -tpattern

paul.hamilton July 10, 2019 02:50AM