Hi Mudathir,

The fslmaths  command can only be used on one image at a time, so you will need to use a loop, e.g.:

for f in *.nii.gz; do
  name = $(basename $f .nii.gz)
  fslmaths $(name) -thr 0.25 -bin $(name)_bin
done

I would recommend spending some time going through some tutorials on unix and scripting, e.g.:

- https://www.youtube.com/playlist?list=PLvgasosJnUVnnFifxecbyEno7jnqrl8fQ
- https://people.ischool.berkeley.edu/~kevin/unix-tutorial/toc.html
- http://www.ee.surrey.ac.uk/Teaching/Unix/index.html
- https://www.shellscript.sh

Paul

On Oct 27 2019, at 5:51 am, Mudathir Bakhit <[log in to unmask]> wrote:
Dear FSL experts,

I'm new to scripting and I'm trying to generate a script that may allow me to run fslmaths on multiple images in one directory something near to this:

fslmaths *.nii.gz -thr 0.25 -bin *_ bin.nii.gz

the aim is to binarize a list of threshold images.

Can someone show me how to do this, please?

Best regards,

Mudathir

########################################################################

To unsubscribe from the FSL list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=FSL&A=1


To unsubscribe from the FSL list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=FSL&A=1