X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=vv%2Fscripts%2Fcreate_mhd_4D.sh;h=238e26aa9b4e68f649fc13af46003d098ced77c3;hb=ff1d5b8af965e75ecdbc1b0cbff0dad6f3b3c511;hp=8eac7828fc0799d3e4940104e4a95a6f25c61d2e;hpb=931a42358442f4ee4f314613c991c838d4b4e3b7;p=clitk.git diff --git a/vv/scripts/create_mhd_4D.sh b/vv/scripts/create_mhd_4D.sh index 8eac782..238e26a 100755 --- a/vv/scripts/create_mhd_4D.sh +++ b/vv/scripts/create_mhd_4D.sh @@ -1,16 +1,22 @@ #!/bin/sh -############################################### -# create_mhd_4D argument : repertoire # -############################################### + +##################################################################### +# create_mhd_4D argument : repertoire nom_fichier_de_sortie # +##################################################################### if [ $# -lt 1 ] then - echo "Usage: create_mhd_4D directory" + echo "Usage: create_mhd_4D.sh directory output_file_name(without path)" exit 1 fi cd $1 -nbph=`ls -l *0.mhd | wc -l` +nbph=`find . -iname "*0.mhd" | wc -l` +if [ $nbph = 0 ] +then + echo "Error: no phase found" + exit 1 +fi orig=`ls -1 *0.mhd | head -n 1` cat $orig | sed "s/NDims = .*/NDims = 4/ @@ -20,7 +26,7 @@ cat $orig | sed "s/NDims = .*/NDims = 4/ s/AnatomicalOrientation = .*/AnatomicalOrientation = ????/ /ElementSpacing/ s/.*/& 1/ /DimSize/ s/.*/& $nbph/ - s/ElementDataFile = .*/ElementDataFile = LIST/" > CT_4D.mhd + s/ElementDataFile = .*/ElementDataFile = LIST/" > $2 -ls -1 *0.raw >> CT_4D.mhd +ls -1 *0.raw >> $2 cd ..