 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
22 "Usage: bar [options] input.img output.img",
23 "-----------------------------------------",
24 "Does simple arithmetic on images.",
25 "Operations are done in the order given on the command line.",
28 "-add -5.78 Add a constant to each voxel.",
29 "-multiply 6.123 Multiply each voxel with a constant.",
30 "-power 0.75 Raise to the power (must be positive).",
33 "-verbose 7 Verbosity of output.",
34 "-datatype u Force writing of a new data type.",
39 int main(
int argc,
char **argv)
44 double multiply[
MAXOP];
48 for ( i=0; i<
MAXOP; i++ ) add[i] = multiply[i] = power[i] = 0;
53 for ( curropt = option; curropt; curropt = curropt->
next ) {
54 if ( curropt->
tag ==
"datatype" )
56 if ( curropt->
tag ==
"add" ) {
57 if ( ( add[n] = curropt->
value.
real() ) == 0 )
58 cerr <<
"-add: A constant must be specified!" << endl;
62 if ( curropt->
tag ==
"multiply" ) {
63 if ( ( multiply[n] = curropt->
value.
real() ) ==0 )
64 cerr <<
"-multiply: A constant must be specified!" << endl;
68 if ( curropt->
tag ==
"power" ) {
69 if ( ( power[n] = curropt->
value.
real() ) == 0 )
70 cerr <<
"-power: A constant must be specified!" << endl;
80 if ( p == NULL )
bexit(-1);
82 if ( optind >= argc )
bexit(0);
86 for ( i=0; i<
MAXOP && i<n; i++ ) {
A class for a command line input option.
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.
int main(int argc, char **argv)
Header file for option handlers.
Bimage * read_img(char *filename, int readdata, int img_select)
General driver function to read multiple image formats.
void multiply(long j, Complex< double > cv)
int write_img(const char *filename, Bimage *p, int compression)
General driver function to write multiple image formats.
void add(long j, double v)
General image parameter class.
Utilities for timing functions.
void power(double v)
Calculates the power of an image.
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
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.
DataType
Base data type specifier.