This first exercise will create a script that applies BET to an image
prior to registering it with another image.
- Editing a text file
Create a new file called
bet_vol using the nano text editor.
To do this just type (in a terminal):
- Feel free to use any other text editor that you prefer
- Making the script
In this file write a script (one command) which
applies BET to a volume called
vol and saves the result
That is use the same command as you would use in the terminal:
bet vol vol_brain
Remember that the first line must be
- Running the script
Save the script
Copy the image
(with the .nii.gz extensions)
Remember to make the script executable with:
chmod a+x bet_vol
Run the script by typing
./bet_vol (you need the "./"
because the current directory (".") may not be in your PATH)
- Testing the script
Check that the script wrote out the image
that the result is sensible (do a visual check with
- Commenting the script
Add a comment to the script that explains what it does.
A comment is any line (except the first) which starts with
If you are stuck you can look at the cheat.