A script is definitely the easiest way to process quite a few subjects.  You can save some headache by using a recon-all command with an input for your image files.  For example: "recon-all -s sleep_001 -i sleep_001.nii -all" will create a subject folder in the correct location named sleep_001 and begin the entire freesurfer pipeline taking the NIFTI image sleep_001.nii as the input.  You can modify it to just import the files by dropping the "-all".  

I've included a bash script below for simplifying this.  This script takes the NIFTI files you want to process as arguments and then automatically sets the Subject ID and begins processing.  Once it completes a single subject, it will start the next subject.  You can track the progress of subjects by seeing which folders have been created in the SUBJECTS_DIR.  If you have a multiprocessor system, you can run the script with different subjects in multiple terminal windows.  

To execute the script:
1. Save the script as fs_subject.sh
2. chmod +x fs_subject.sh
3. place the script in a folder with all of your NIFTI files (not required but may make your life easier)
4. execute the script with ./fs_subject.sh sleep_001.nii sleep_002.nii sleep_003.nii (don't forget to replace sleep_* with your NIFTI file names)
4a. If your subjects meet a standard naming convention you could do something like: ./fs_subject.sh sleep_*.nii (this would submit all subjects fitting the pattern of having "sleep_" at the beginning of the name.  


#!/bin/bash
# ./fs_subject.sh
# takes nifti files as arguments for submitting into freesurfer pipeline

#setup Freesurfer if not currently loaded on path
export FREESURFER_HOME=/usr/local/freesurfer
#source $FREESURFER_HOME/SetUpFreeSurfer.sh
. $FREESURFER_HOME/SetUpFreeSurfer.sh

for FS in $*
do
   subjectID=$(/bin/echo $FS | /usr/bin/sed 's/.nii//')
   recon-all -s $subjectID -i $FS -all
done

Hope this helps!  Ultimately if you have a lot of computers and a lot of subjects, using Sun Grid Engine (SGE) or Apple's xgrid (if you have Macs) can really expedite the processing of subjects.  

Best,
Peter


Date: Fri, 15 Jul 2011 12:22:38 -0500
From: Freesurfer Local Archive <freesurfer@jonca.org>
Subject: Re: [Freesurfer] how can do ''mri_convert''quickly when there
are too many subjects
To: ??? <wgh0805@126.com>
Cc: freesurfer <freesurfer@nmr.mgh.harvard.edu>
Message-ID:
<CABphhh-ZcMapCqq+0x66d0EXqQgdt-vPVojXt30O0P63kzoLAw@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

I suspect that your subject directory/file names will match some
pattern. You can use combination of a loop and shell "ls" command to
cycle through all the subjects matching provided pattern. For example
if you have data in directories you would do something line this:

#!/bin/tcsh

cd /path/to/native/files

for x in `ls -dA1 name_pattern_*`;
do
mkdir -p $SUBJECTS_DIR/${x}/mri/orig
$FREESURFER_HOME/bin/mri_convert ${x}.nii.gz $SUBJECTS_DIR/${x}/mri/orig/001.mgz
done

If all files are in the same directory substitute '-dA1' for "-A1" and
it should work. Note this assumes that you have nifti files, for DICOM
you will need to modify it further.

Cheers,

Jacek

2011/7/15 ??? <wgh0805@126.com>:
??Hi Bruce,

?????In our research,if there are?100 subjects,how?can I ?process these data
easily.For example?when I want to compare their thickness's difference?at
first?I should do
" mri_convert? bert.nii bert.nii.gz",but when there are too many subjects,is
there a way to do all of these 100 subjects at the same time?

?Many thanks,
?Wang



_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in
error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.