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  

|
February 25, 2019 04:47PM
Hello,

I feel I am abusing of this message board but I tried to create my batch file to loop through all my participants without success.
My script does create the new output directories and creates in the subject output directory the run.afni_proc.py for the first participant and then stops.

I am copying here the first part and the last part omitting part of the preprocessing to make the reading easier. The preprocessing does work on its own for a single subject. That should not be the problem.

Also if you know of any text editor that helps with coding syntax, I'd appreciate it!

Again, thank you to for the help!

#!/bin/tcsh

# --------------------------------------------------
# note fixed top-level directories such as  /main/location/of/all/data
  set data_root = /Users/nens.lab/Documents/PEN802_Spring2019/Scans
 
  set input_root = $data_root/
  set output_root = $data_root/subject_preprocessing

# --------------------------------------------------
# chose one of the two options and comment unwanted option
# get a list of subjects, or just use one (consider $argv)
  cd $input_root
  set subjects = ( sub-* )
  cd -

# or perhaps just process one subject?
# set subjects = ( sub-017 )

# --------------------------------------------------
# process all subjects
  foreach subj_id ( $subjects )
     	  
     	  cd $input_root/$subj_id
          set session = (ses-T1) #change here for T1 and T2
	  # --------------------------------------------------
          # note input and output directories
          set subj_indir = $input_root/$subj_id/$session
          set subj_outdir = $output_root/$subj_id/$session

          # --------------------------------------------------
          # if output dir exists, this subject has already been processed
          if ( -d $subj_outdir ) then
             echo "** results dir already exists, skipping subject $subj_id"
             continue
          endif

          # --------------------------------------------------
          # otherwise create the output directory, write an afni_proc.py
          # command to it, and fire it up

          mkdir -p $subj_outdir
          cd $subj_outdir

          # create a run.afni_proc script in the directory where this script is saved
          cat > run.afni_proc << EOF

		  afni_proc.py -subj_id $subj_id                          \
              -blocks tshift align tlrc volreg blur mask scale 	  \
              regress 											  \
              -copy_anat $data_root/$subj_id/$session/anat/sub-0??_ses-T?_T1w.nii.gz \
              -dsets                                              \
                  $data_root/$subj_id/$session/func/sub-0??_ses-T?_task-Sub_run-0?_bold.nii.gz \
             ......  			                  \
              -regress_stim_times                                 \
                  $data_root/$subj_id/$session/stim/ETrue.*       \
                  $data_root/$subj_id/$session/stim/HTrue.*       \
                  $data_root/$subj_id/$session/stim/EFalse.*      \
                  $data_root/$subj_id/$session/stim/HFalse.*      \
                  $data_root/$subj_id/$session/stim/control_s.*   \
             ..... 
             -prefix stats.MoreContrasts               \
              -execute

          EOF
          # EOF denotes the end of the run.afni_proc command

          # now run the analysis (generate proc and execute)
          tcsh run.afni_proc

# end loop over subjects
  end

Subject Author Posted

run.arni_proc.py not looping

Ilaria February 25, 2019 04:47PM

Re: run.arni_proc.py not looping

ptaylor February 25, 2019 04:58PM

Re: run.arni_proc.py not looping

Ilaria February 26, 2019 08:38PM

Re: run.arni_proc.py not looping

Daniel Glen February 26, 2019 06:03PM