-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmake_hist.in
executable file
·70 lines (55 loc) · 1.34 KB
/
make_hist.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!@PERL@ -w
$volume = shift;
$output = shift;
$s = 1;
$out = `/nil/david/Source/Batch_processing/gradient_histogram $volume $s $s $s 200 1000 | grep -v Reading`;
@out = split( /\s+/, $out );
$n_points = @out / 2;
print( "N points: $n_points\n" );
for( $i = 0; $i < $n_points; ++$i )
{
$x = $out[2*$i];
$y = $out[2*$i+1];
if( $y == 0 )
{ next; }
if( $i == 0 )
{
$x_min = $x;
$x_max = $x;
$y_min = $y;
$y_max = $y;
}
else
{
if( $x < $x_min )
{
$x_min = $x;
}
elsif( $x > $x_max )
{
$x_max = $x;
}
if( $y < $y_min )
{
$y_min = $y;
}
elsif( $y > $y_max )
{
$y_max = $y;
}
}
}
$tmp_out = "/tmp/out_${$}.values";
open( OUT, ">$tmp_out" ) || die;
for( $i = 0; $i < $n_points; ++$i )
{
$x = $out[2*$i];
$y = $out[2*$i+1];
if( $y > 0 )
{
print( OUT "$x $y\n" );
}
}
close( OUT );
system( "plot.pl $output $tmp_out 0 $x_max 0 $y_max Value Avg-GradMag Avg-GradMag-vs-Value 1 2 -" );
unlink( $tmp_out );