]> Creatis software - clitk.git/blob - scripts/pts_to_landmarks.sh
Red and blue were swapped (different order between VTK and CxImage)
[clitk.git] / scripts / pts_to_landmarks.sh
1 #! /bin/sh
2
3 ###############################################################################
4 #
5 # FILE: pts_to_landmarks
6 # AUTHOR: Vivien Delmon
7 #
8 # Conversion from landmarks in the format used in clitkCalculateTRE (.pts) 
9 # to the format used in VV (.txt).
10 #
11 ###############################################################################
12
13 if [ $# -ne 2 ]; then
14   echo "Usage: $0 input.pts output.txt" 1>&2
15   exit 1
16 fi
17
18 to_append=`mktemp`
19 to_prepend=`mktemp`
20 pts_file_spaced=`mktemp`
21
22 for i in $(seq 0 $((`cat $1 | wc -l` - 1)));
23 do
24   echo "0 0" >> $to_append
25   echo $i >> $to_prepend
26 done
27
28 echo "LANDMARKS1" > $2
29 cat $1 | sed -e 's/\s/ /g' >> $pts_file_spaced  
30 paste -d ' ' $to_prepend $pts_file_spaced $to_append >> $2
31
32 rm $to_append $to_prepend $pts_file_spaced