 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
20 "Usage: bmedian [options] input.img output.img",
21 "---------------------------------------------",
25 "-rescale -0.1,5.2 Rescale data to average and standard deviation after filtering.",
28 "-verbose 1 Verbosity of output.",
29 "-datatype u Force writing of a new data type.",
30 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; default from input file; a single value can be given).",
31 "-kernel 5 Median filter kernel edge size (default 3).",
32 "-iterations 5 Number of iterations (default 1).",
37 int main(
int argc,
char **argv)
42 double nuavg(0), nustd(0);
49 for ( curropt = option; curropt; curropt = curropt->
next ) {
50 if ( curropt->
tag ==
"datatype" )
52 if ( curropt->
tag ==
"sampling" )
53 sam = curropt->
scale();
54 if ( curropt->
tag ==
"rescale" ) {
55 if ( curropt->
values(nuavg, nustd) < 2 )
56 cerr <<
"-rescale: Both average and standard deviation must be specified!" << endl;
57 else if ( nustd <= 0 )
58 cerr <<
"-rescale: A positive standard deviation must be specified!" << endl;
60 if ( curropt->
tag ==
"kernel" )
62 cerr <<
"-kernel: The kernel edge size must be specified!" << endl;
63 if ( curropt->
tag ==
"iterations" )
65 cerr <<
"-iterations: A number of iterations must be specified!" << endl;
73 if ( optind < argc - 1 ) dataflag = 1;
75 if ( p == NULL )
bexit(-1);
86 cout <<
"Iteration\tStDev" << endl;
87 for ( i=0; i<iterations; i++ ) {
95 if ( optind < argc ) {
A class for a command line input option.
Vector3< double > scale()
int bexit(int value)
Exit function for cleanup and debugging.
Boption * get_option_list(const char *use[], int argc, char *argv[], int &optind)
Parses command line arguments based on a template.
Header file for option handlers.
int filter_rank(long kernel_size, double rank)
Applies a median filter to an image.
double standard_deviation()
long values(T1 &v1, T2 &v2)
Bimage * read_img(char *filename, int readdata, int img_select)
General driver function to read multiple image formats.
int write_img(const char *filename, Bimage *p, int compression)
General driver function to write multiple image formats.
General image parameter class.
Utilities for timing functions.
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
ostream & tab(ostream &out)
double timer_report(double lasttime)
Reports the time elapsed since a given time.
void change_type(char letter)
Get the data type indicated by a single letter code.
Header file for 2D and 3D image I/O.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
void sampling(long nn, Vector3< double > u)
DataType
Base data type specifier.
int rescale_to_avg_std(double nuavg, double nustd)
Rescales the image data to a given average and standard deviation.