try this fsladd average_image -m image{1..38} or fsl5.0-fsladd average_image -m image{1..38} outputs average of the 38 images On Tue, Dec 19, 2017 at 3:51 PM, Noelia Martinez-Molina < [log in to unmask]> wrote: > Hi Saad, > > Thank you for your help. I tried using fsladd but the terminal shows > "command not found". I'm not sure about what the problem is. > > Best, > Noelia > > 2017-12-19 10:51 GMT+01:00 Saad Jbabdi <[log in to unmask]>: > >> You can use fsladd (no need for loops) >> >> Cheers >> Saad >> >> >> >> > On 19 Dec 2017, at 09:49, Noelia Martinez Molina < >> [log in to unmask]> wrote: >> > >> > Dear FSL experts, >> > >> > I need to average images from 38 subjects using fslmaths. The command >> would be something like this: >> > >> > fslmaths image1 -add image2 -add image3 ... -add image38 -div 38 >> average_image >> > >> > However, I was wondering if you could tell me how to use a loop to >> create a string with all the -add arguments in order to avoid the tedious >> of having to write manually all the filenames for each image. >> > >> > Thank you in advance for your help. >> > >> > Best, >> > Noelia >> > > > > -- > > Noelia MartÃnez-Molina > Cognition and Brain Plasticity Group > Department of Cognition, Development and Educational Psychology > Universitat de Barcelona > Campus Mundet, Edifici de Ponent > Passeig de la Vall d > <https://maps.google.com/?q=Passeig+de+la+Vall+d'Hebron+17108035+Barcelona,+Spain+Office:+(34&entry=gmail&source=g> > 'Hebron 171 > <https://maps.google.com/?q=Passeig+de+la+Vall+d'Hebron+17108035+Barcelona,+Spain+Office:+(34&entry=gmail&source=g> > 08035 Barcelona, Spain > <https://maps.google.com/?q=Passeig+de+la+Vall+d'Hebron+17108035+Barcelona,+Spain+Office:+(34&entry=gmail&source=g> > > Office: (34 > <https://maps.google.com/?q=Passeig+de+la+Vall+d'Hebron+17108035+Barcelona,+Spain+Office:+(34&entry=gmail&source=g>) > 93 403 47 68 > http://brainvitge.org/member/martinez_n/ > twitter:@NoeliaMrtnez > > ------------------------------------------------------------ > -------------------------------------------- > > "Where words fail, music speaks." > > > * Hans > Christian Andersen* > ------------------------------------------------------------ > --------------------------------------------- > >