]> Creatis software - clitk.git/blob - vv/scripts/create_mhd_4D.sh
Removed unused vvs.cxx
[clitk.git] / vv / scripts / create_mhd_4D.sh
1 #!/bin/sh
2
3
4 #####################################################################
5 # create_mhd_4D         argument : repertoire nom_fichier_de_sortie #
6 #####################################################################
7 if [ $# -lt 1 ]
8 then
9     echo "Usage: create_mhd_4D.sh directory output_file_name(without path)"
10     exit 1
11 fi
12
13 cd $1
14 nbph=`find . -iname "*0.mhd" | wc -l`
15 if [ $nbph = 0 ]
16 then
17     echo "Error: no phase found"
18     exit 1
19 fi
20 orig=`ls -1 *0.mhd | head -n 1`
21
22 cat $orig | sed "s/NDims = .*/NDims = 4/
23                  s/TransformMatrix = .*/TransformMatrix = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1/
24                  /Offset/ s/.*/& 0/
25                  /CenterOfRotation/ s/.*/& 0/
26                  s/AnatomicalOrientation = .*/AnatomicalOrientation = ????/
27                  /ElementSpacing/ s/.*/& 1/
28                  /DimSize/ s/.*/& $nbph/
29                  s/ElementDataFile = .*/ElementDataFile = LIST/" > $2
30
31 ls -1 *0.raw >> $2
32 cd ..