From: Romulo Pinho Date: Thu, 26 Jan 2012 12:46:11 +0000 (+0100) Subject: accepts suffix for 4D mhd creation X-Git-Tag: v1.3.0~113 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=d959a9ad92f360947d857261b8ebd758abf4992e;p=clitk.git accepts suffix for 4D mhd creation --- diff --git a/scripts/create_mhd_4D_pattern.sh b/scripts/create_mhd_4D_pattern.sh index 4d64347..2fa41d4 100755 --- a/scripts/create_mhd_4D_pattern.sh +++ b/scripts/create_mhd_4D_pattern.sh @@ -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"