]> Creatis software - clitk.git/commitdiff
accepts suffix for 4D mhd creation
authorRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Thu, 26 Jan 2012 12:46:11 +0000 (13:46 +0100)
committerRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Thu, 26 Jan 2012 12:46:11 +0000 (13:46 +0100)
scripts/create_mhd_4D_pattern.sh

index 4d64347ae3db227a370679a5fe6acf74371a78c7..2fa41d4fa548a87fd49e92837bb03aaa31f12de3 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh +x
+#!/bin/sh
 
 ###############################################################################
 #
@@ -35,15 +35,18 @@ write_mhd_4D()
 #################################################
 if [ $# -lt 1 ]
 then
-  echo "Usage: $0 PATTERN"
+  echo "Usage: $0 PREFIX [SUFFIX]"
   exit 1
 fi
 
+prefix=$1
+suffix=$2
+
 dirname=`dirname $1`
 pattern=`basename $1`
 
-list_phase_file=`ls -1 $1*[0-9].mhd`
-nb_phase_file=`ls -1 $1*[0-9].mhd | wc -l`
+list_phase_file=`ls -1 $prefix*[0-9]*$suffix.mhd`
+nb_phase_file=`ls -1 $prefix*[0-9]*$suffix.mhd | wc -l`
 if [ $nb_phase_file = 0 ]
 then
   echo "Error: no phase found"
@@ -54,7 +57,7 @@ nbph=$nb_phase_file
 orig=`echo $list_phase_file | cut -f 1 -d ' '`
 listph=`echo $list_phase_file | sed 's:\.mhd:\.raw:g'`
 
-file_name_4D=`echo "${pattern}4D.mhd"`
+file_name_4D=`echo "${prefix}4D${suffix}.mhd"`
 
 write_mhd_4D $dirname
 echo "$dirname/$file_name_4D"