Changeset 11837 for trunk/ippScripts/scripts/detrend_norm_apply.pl
- Timestamp:
- Feb 15, 2007, 2:23:33 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_norm_apply.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_norm_apply.pl
r11830 r11837 39 39 $dbname, # Database name 40 40 $workdir, # Working directory, for output files 41 $no_update # Don't update the database 41 $no_update, # Don't update the database 42 $no_op, # Don't do any operations 42 43 ); 43 44 GetOptions( … … 51 52 'dbname|d=s' => \$dbname, 52 53 'workdir|w=s' => \$workdir, # Working directory, for output files 53 'no-update' => \$no_update 54 'no-update' => \$no_update, 55 'no-op' => \$no_op, 54 56 ) or pod2usage( 2 ); 55 57 … … 100 102 101 103 # Run normalisation 102 { 104 my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser 105 unless ($no_op) { 103 106 my $command = "$ppImage -file $input $outputRoot -norm $value -stat $statsName -recipe PPIMAGE " . RECIPE(); # Command to run 104 107 $command .= ' -isfringe' if lc($det_type) eq 'fringe'; … … 113 116 &my_die("Can't find expected output file: $b2name", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -e $b2name; 114 117 &my_die("Can't find expected output file: $statsName", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -e $statsName; 115 } 116 117 # Get the statistics on the normalised image 118 my $stats; # Statistics from ppImage 119 { 118 119 # Get the statistics on the normalised image 120 120 my $statsFile; # File handle 121 121 open $statsFile, $statsName or &my_die("Can't open statistics file $statsName: $!\n", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR); … … 124 124 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 125 125 my $metadata = $mdcParser->parse(join "", @contents) 126 or &my_die("Unable to parse metadata config", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR); 127 $stats = PS::IPP::Metadata::Stats->new(); # Stats parser 126 or &my_die("Unable to parse metadata config", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR); 128 127 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR); 129 } 128 } 130 129 131 130 # Update the database … … 133 132 $b1name = $ipprc->convert_filename_relative( $b1name ); 134 133 $b2name = $ipprc->convert_filename_relative( $b2name ); 134 135 my $bg = ($stats->bg_mean() or 'NAN'); 136 my $bg_stdev = ($stats->bg_stdev() or 'NAN'); 137 my $bg_mean_stdev = ($stats->bg_mean_stdev() or 'NAN'); 138 135 139 unless ($no_update) { 136 140 my $command = "$dettool -addnormalizedimfile -det_id $det_id -iteration $iter -class_id $class_id ". 137 141 "-uri $output -b1_uri $outputRoot"; # Command to run 138 # Add the statistics triplet 139 $command .= " -bg " . $stats->bg_mean(); 140 if (defined($stats->bg_mean_stdev())) { 141 $command .= " -bg_mean_stdev " . $stats->bg_mean_stdev(); 142 } else { 143 # May be undefined if there's only a single imfile 144 $command .= " -bg_mean_stdev 0"; 145 } 146 $command .= " -bg_stdev " . $stats->bg_stdev(); 147 142 $command .= " -bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev"; 148 143 $command .= " -dbname $dbname" if defined $dbname; 149 144
Note:
See TracChangeset
for help on using the changeset viewer.
