source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/vrippack-0.31/src/pvrip/vripsubvollist @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

  • Property svn:executable set to *
File size: 2.8 KB
Line 
1#!/usr/bin/perl
2#
3# vripsubvollist: This program, given a list of subvol .conf
4# files, will generate the commands to vrip each of them.
5
6
7sub printUsage {
8    print STDERR "\n";
9    print STDERR "Usage:\n";
10    print STDERR "vripsubvollist [-crunch] [-rampscale s] voxelsize *subvol*.conf > outcommands\n";
11    print STDERR "\n";
12    print STDERR "  -crunch  Will generate plycrunched .set files...\n";
13    print STDERR "  -rampscale <s> Will tell vrip to use rampscale s.\n";
14    print STDERR "  -passtovrip \"X\" will pass X to vrip.\n";
15    print STDERR "  -passtovripsurf \"X\" will pass X to vripsurf.\n";
16    print STDERR "\n";
17    print STDERR "and it will generate a list of the commands necessary\n";
18    print STDERR "to run vripnew, vripsurf, and plycull on the volumes.\n";
19    print STDERR "\n";
20    exit(-1);
21}
22
23if ($#ARGV < 1 || substr($ARGV[0], 0, 2) eq "-h") {
24    &printUsage();
25}
26
27# Extract the options, if present
28$DOCRUNCH = 0;
29while (substr($ARGV[0], 0,1) eq "-") {
30    if ($ARGV[0] eq "-crunch") {
31        $DOCRUNCH=1;
32        splice(@ARGV, 0, 1);
33    } elsif ($ARGV[0] eq "-rampscale") {
34        $RAMPSCALE = $ARGV[1];
35        if ($RAMPSCALE eq "") {
36            print STDERR "Error: no rampscale???\n\n";
37            &printUsage;
38        }
39        splice(@ARGV, 0, 2);
40    } elsif ($ARGV[0] eq "-passtovrip") {
41        $PASSTOVRIP = $ARGV[1];
42        splice(@ARGV, 0, 2);
43    } elsif ($ARGV[0] eq "-passtovripsurf") {
44        $PASSTOVRIPSURF = $ARGV[1];
45        splice(@ARGV, 0, 2);
46    } else {
47        print STDERR "Error: unhandled arg $ARGV[0]...\n";
48        &printUsage();
49        exit(-1);
50    }
51}
52
53       
54   
55# Get and check voxel size
56$voxelsize = 0.0+$ARGV[0];
57if ($voxelsize <= 0) {
58    die("Error, voxelsize not greater than zero...\n");
59}
60
61# Get directory
62$cwd = `pwd`;
63chop $cwd;
64
65#Generate the command for each file name...
66for ($n=1; $n <= $#ARGV; $n++) {
67    $conf = $ARGV[$n];
68    $bbox = $conf;
69    $bbox =~ s/.conf/.bbox.ply/g;
70    $vri = $conf;
71    $vri =~ s/.conf/.vri/g;
72    $plyv = $conf;
73    $plyv =~ s/.conf/_beyondbbox.ply/g;
74    $ply = $conf;
75    $ply =~ s/.conf/.ply/g;
76    # Generate the command.  Include "npri -h 250", which sets
77    # its priority really low...
78    if ($DOCRUNCH) {
79        $crunchstr = " ply2crunchset -l 5 $ply;";
80    }
81    if (defined($RAMPSCALE)) {
82        $rampscalestr = " -rampscale $RAMPSCALE "; 
83    } else {
84        $rampscalestr = "";
85    }
86
87    # Remove the plyv (overlapping ply files?)
88    $rm_plyv = "";
89    # $rm_plyv = "/bin/rm $plyv;";
90
91    # Amount of safety in plyculling triangles
92    $epsilon = 2.1 * $voxelsize;
93
94    print STDOUT "cd $cwd; ".
95        "time vripnew $vri $conf $bbox $voxelsize $rampscalestr $PASSTOVRIP -noui; ".
96            "time vripsurf -no_remove_slivers $vri $plyv $PASSTOVRIPSURF -noui; ".
97                "time plycull $bbox $plyv $ply $epsilon; ".
98                    "$rm_plyv $crunchstr\n";
99    $plys = $plys . " $ply";
100}
101
102# print STDOUT "echo plymerge $plys > all_unshared.ply\n";
103# print STDOUT "echo plyshared < all_unshared.ply > all.ply\n";
Note: See TracBrowser for help on using the repository browser.