fMRI Primer

12.6 Batch Processing in FEAT

Section X: Advanced FEAT Skills
RUNNING THE SAME .fsf PROGRAM ON MULTIPLE SUBJECTS QUICKLY

Once you have created a design file in FEAT (.fsf) for analyzing a single subject, you should save it as a template in the AllGenericModels file within /export/data/analyzed/petbrv/AllGenericModels

One annoying way (still vastly better than SPM) to run the same program on every subject is to work your way through the GUI (graphical user interface) and change the subject number each and every place it occurs. Remember, you have cleverly arranged your directory structure so that file names are generic rather than incorporating subject numbers. Subject numbers only occur in the directory title. This allows you to just change the name of the directory into which FEAT looks to find the files it manipulates.

A better way involves x-terminal.
FIRST in a regular terminal window navigate to the .feat folder with your design.fsf file in it.  Conveniently it is called design.fsf. For the purposes of this example, it is subject x201, and you need to run the program on subjects x202-x210.

COPY the .fsf file to the master directory level, eg
> cp design.fsf /export/data/analyzed/petbrv
Then open x terminal
> xterm &
Then open a second one
> xterm &
You will be using both windows to systematically run the same .fsf file on all of your subjects.

In the first xterm type
>vim design.fsf [return]
>:%s/201/202/g [return]
>:w [return]

What does all this mean?  vim is an edit command, vim design.fsf means you are going to edit the .fsf file. % means ‘the whole damn file’ s means ‘substitute’ /201 means ‘everywhere you see 201’ /202 means ‘put 202 instead’ and /g means ‘do it for the whole line as opposed to just the first instance of ‘201’. :w means ‘write this and save it as the same name, eg, design.fsf.  You could of course write w 202design.fsf but that would just waste time, as once the .fsf. file is executed it becomes irrelevant, so you can immediately overwrite it. The .feat directory it immediately creates contains a copy of the design.fsf file. Nice!

Now if you want to check that this really worked, open fsl and load the design.fsf and check it out.
>fsl &
Then load etc…….

Now you are ready to run this program. In your second xterm, which  you cleverly opened at the level of the master folder, you just type
>feat design.fsf &

And it’s running!  It immediately becomes irrelevant, having created a .feat directory within that subject’s folder. So now you go back to the first xterm window and repeat the cycle, eg
>:%s/202/203/g
and then back to the second xterm and just
>feat design.fsf &
and repeat until finished.

SETTING UP A SINGLE-SUBJECT FSL PREPROC GUI

BATCH PROCESSING

In a way the fastest way to analyzes a few subjects is to just change the subject number in the GUI.

But there are two basic scenarios in which you can batch process. The first is when a single subject has done the same experiment multiple times. EG, subject 1 – s1 – has done three identical emotional stroop scans, r1 r2 r3.  Here, after analyzing r1, it might be nice to set up a program to analyze r2 and r3 rapidly.  The second is when multiple subjects have done the same experiment.  Here you want to set up a program to analyze s2 s3 s4 s5 etc…

Above, you created a design file in FEAT (.fsf) for analyzing a single subject, and you saved it as a template in the AllGenericModels file within /export/data/analyzed/petbrv/AllGenericModels

FIRST in a regular terminal window navigate to the .feat folder with your design.fsf file in it.  For the purpose of this tutorial we will call it ‘design.fsf’. For the purposes of this example, it is subject x201, and you need to run the program on subjects x202-x210.

If not done already (eg if it is in a subject’s directory) COPY the .fsf file to the master directory level, eg
> cp design.fsf /export/data/analyzed/petbrv/AllGenericModels

Now Batch processing can begin. Make sure you are within the directory (hopefully AllGenericModels) that contains your .fsf model.

METHOD #1 – Requires a MacIntosh

On Mac, open a text editor (on dock should look like a sheet of paper with a pen, over a yellow folder.)

Navigate to Now if you want to check that this really worked, open fsl and load the design.fsf and check it out.
>fsl &
Then load etc…….

Now you are ready to run this program. In your second xterm, which  you cleverly opened at the level of the master folder, you just type
>feat design.fsf &

And it’s running!  It immediately becomes irrelevant, having created a .feat directory within that subject’s folder. So now you go back to the first xterm window and repeat the cycle, eg
>:%s/202/203/g
and then back to the second xterm and just
>feat design.fsf &
and repeat until finished.

METHOD #2 – More complicated but not requiring a MacIntosh
Open x terminal
> xterm &

To confirm you are in the right folder, look at the top line, it should say something like
– pfreed@nimbus:/export/data/analayzed/petbrv/AllGenericModels
Then open a second one
> xterm &

Check that Place them side by side. You will be using both windows to systematically run the same .fsf file on all of your subjects.

In the first xterm type
>vim design.fsf [return]
>:%s/201/202/g [return]
>:w [return]

What does all this mean?  vim is an edit command, vim design.fsf means you are going to edit the .fsf file. % means ‘the whole damn file’ s means ‘substitute’ /201 means ‘everywhere you see 201’ /202 means ‘put 202 instead’ and /g means ‘do it for the whole line as opposed to just the first instance of ‘201’. :w means ‘write this and save it as the same name, eg, design.fsf.  You could of course write w 202design.fsf but that would just waste time, as once the .fsf. file is executed it becomes irrelevant, so you can immediately overwrite it. The .feat directory it immediately creates contains a copy of the design.fsf file. Nice!

Now if you want to check that this really worked, open fsl and load the design.fsf and check it out.
>fsl &
Then load etc…….

Now you are ready to run this program. In your second xterm, which  you cleverly opened at the level of the master folder, you just type
>feat design.fsf &

And it’s running!  It immediately becomes irrelevant, having created a .feat directory within that subject’s folder. So now you go back to the first xterm window and repeat the cycle, eg
>:%s/202/203/g
and then back to the second xterm and just
>feat design.fsf &
and repeat until finished.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: