1 |
#!/bin/csh -f |
2 |
# RCSid $Id: ra_pfm.csh,v 2.1 2004/11/25 14:47:03 greg Exp $ |
3 |
# |
4 |
# Convert to/from Poskanzer Float Map image format using pvalue |
5 |
# |
6 |
if (`uname -p` == powerpc) then |
7 |
set format="-dF" |
8 |
else |
9 |
set format="-df" |
10 |
endif |
11 |
while ($#argv > 0) |
12 |
if ("$argv[1]" == "-r") then |
13 |
set reverse |
14 |
else |
15 |
set inp="$argv[1]" |
16 |
endif |
17 |
shift argv |
18 |
end |
19 |
if ($?reverse) then |
20 |
if (! $?inp) then |
21 |
goto userr |
22 |
endif |
23 |
set hl="`head -3 $inp:q`" |
24 |
if ("$hl[1]" != "PF") then |
25 |
echo "Input not a Poskanzer Float Map" |
26 |
exit 1 |
27 |
endif |
28 |
set res=($hl[2]) |
29 |
tail +4 $inp:q | pvalue -r -h -y $res[2] +x $res[1] $format |
30 |
exit $status |
31 |
endif |
32 |
if (! $?inp) then |
33 |
goto userr |
34 |
endif |
35 |
set res=(`getinfo -d < $inp:q`) |
36 |
echo PF |
37 |
echo $res[4] $res[2] |
38 |
echo "-1.000000" |
39 |
pvalue -h -H $format $inp:q |
40 |
exit $status |
41 |
userr: |
42 |
echo "Usage: $0 input.pfm > output.hdr" |
43 |
echo " or: $0 -r input.hdr > output.pfm" |
44 |
exit 1 |