- Specifying image filenames on the command line
Take the bet_vol script and modify it so that it applies BET to the image filename passed in as the first command line argument.
That is, if you type: ./bet_vol im2
then it should apply BET to the image im2 and save
the result as im2_brain
- Testing
Try running the script with im2 as the input.
Check that the resulting image has the correct name and that the
image itself looks right.
Note: the argument should not include the .nii.gz part of the filename
- Passing arguments to BET (Advanced)
You can pass any additional arguments of the script onto BET (e.g -f 0.4 -g 0.1) using
the $@ variable.
However, as you do not want to repeat the input filename this
can be removed from the argument list using shift
Once the command shift is executed inside a script
the first argument $1 is removed and all others shuffle
down one number.
  That is, $2 becomes $1 , while
$3 becomes $2 etc.
Using shift and $@ pass the extra arguments
as following options to the BET command line call.
Look here for the cheat.
|
|