Apologies, absolutely correct. My code would give the sum of all voxels values regardless of value (in contrast to what I claimed), using capital -M and -V would give sum all non-zero voxels and Tibor's code would actually solve the problem as stated rather than something else entirely! 2011/7/28 Auer, Tibor MD. Ph.D. <[log in to unmask]> > You need the threshold, if you want only the POSITIVE voxels. > > > > Auer, Tibor M.D. Ph.D. > > Biomedizinische NMR Forschungs GmbH > > am Max-Planck Institut für Biophysikalische Chemie > > Am Fassberg 11 > > 37077 Göttingen > > Germany > > Phone/Work: +49-(0)551-201-1725 > > Mobile: +49-(0)176-8012-7921 > > E-Mail: [log in to unmask] <[log in to unmask]> > > > > *From:* FSL - FMRIB's Software Library [mailto:[log in to unmask]] *On > Behalf Of *Andrew Lawrence > *Sent:* Thursday, July 28, 2011 5:20 PM > > *To:* [log in to unmask] > *Subject:* Re: [FSL] fsl_tools > > > > > > Here's the same in csh using dc in case you prefer your calculations > reverse polish :) > > lowercase -m and -v give stats for non-zero voxels without setting the > threshold. > > > > set a = `fslstats image.nii.gz -m` > > set b = `fslstats image.nii.gz -v` > > set sum = `echo "${a} ${b[1]} * p" | dc` > > > > > > On 28 July 2011 16:12, Auer, Tibor MD. Ph.D. <[log in to unmask]> wrote: > > Sorry, there is one more modification (the previous will give you the sum > of non-zeros): > > voxmean=$(fslstats img -l 0 -M); > voxnum=$(fslstats img -l 0 -V | awk '{print $1}'); > > > voxsum=$(echo "$voxmean*$voxnum" | bc); > > Auer, Tibor M.D. Ph.D. > Biomedizinische NMR Forschungs GmbH > am Max-Planck Institut für Biophysikalische Chemie > Am Fassberg 11 > 37077 Göttingen > Germany > Phone/Work: +49-(0)551-201-1725 > Mobile: +49-(0)176-8012-7921 > E-Mail: [log in to unmask] > > > -----Original Message----- > From: FSL - FMRIB's Software Library [mailto:[log in to unmask]] On Behalf > Of Gabor Perlaki > > Sent: Thursday, July 28, 2011 5:11 PM > To: [log in to unmask] > > Subject: Re: [FSL] fsl_tools > > Thank you! > > >