From bf6edd6602337473e56f187e808d97ca8a7cd369 Mon Sep 17 00:00:00 2001
From: Mark Jenkinson <mark@fmrib.ox.ac.uk>
Date: Thu, 10 Jan 2008 17:36:06 +0000
Subject: [PATCH] Added a short output option

---
 fslsize | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/fslsize b/fslsize
index c551044..90b2eb5 100755
--- a/fslsize
+++ b/fslsize
@@ -9,10 +9,21 @@
 #   SHCOPYRIGHT
 
 if [ $# -lt 1 ] ; then
-  echo "Usage: $0 <filename>" ;
+  echo "Usage: `basename $0` <filename> [-s]" ;
+  echo "  -s  output using short format (one line)"
   exit 1 ;
 fi
 
-fslhd $1 | cat -v | grep dim[1-4]
+short=no;
+if [ X$2 = X-s ] ; then
+  short=yes;
+fi
+
+if [ $short = no ] ; then
+  $FSLDIR/bin/fslhd $1 | cat -v | grep dim[1-4]
+else
+  sz=`$FSLDIR/bin/fslhd $1 | cat -v | grep dim[1-4] | sed 's/pixdim4.*//' | sed 's/pixdim1/ : Dims = /' | sed 's/^dim1/Size = /' | sed 's/[pix]*dim.[         ]*/ x /'`;
+  echo $sz
+fi
 
 
-- 
GitLab