 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
21 "Usage: bdens [options] input.img output.img",
22 "-------------------------------------------",
23 "Calculate density in selected regions of a map.",
26 "-box 12,34,2,45,34,25 Calculate statistics within this box (start and size).",
27 "-oval 5,10,28,50,22,89 Calculate statistics within this oval (start and size).",
30 "-verbose 7 Verbose output.",
31 "-datatype u Force writing of a new data type.",
32 "-select 1 Select an image (first image = 0; default: 0).",
35 "-Mask mask.map Calculate statistics with a mask with any number of levels.",
40 int main(
int argc,
char* argv[])
52 for ( curropt = option; curropt; curropt = curropt->
next ) {
53 if ( curropt->
tag ==
"box" ) {
54 if ( curropt->
box(start, size) < 6 )
55 cerr <<
"-box: A starting position and size must be specified!" << endl;
59 if ( curropt->
tag ==
"oval" ) {
60 if ( curropt->
box(start, size) < 6 )
61 cerr <<
"-oval: A starting position and size must be specified!" << endl;
65 if ( curropt->
tag ==
"datatype" )
67 if ( curropt->
tag ==
"select" )
69 cerr <<
"-select: An image number must be specified!" << endl;
70 if ( curropt->
tag ==
"Mask" )
81 double avg(0), std(0);
87 }
else if ( stat_type > 0 ) {
88 num = p->
stats_in_shape(setimg, stat_type, start, start+size, avg, std);
89 cout <<
"Number of voxels: " << num << endl;
90 cout <<
"Average density: " << avg << endl;
91 cout <<
"Standard deviation: " << std << endl << endl;
95 if ( optind < argc ) {
A class for a command line input option.
int main(int argc, char *argv[])
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.
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.
long box(Vector3< T1 > &st, Vector3< T2 > &sz)
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.
long stats_in_mask(long nn, Bimage *pmask)
Calculates the statistics for an image for each level in a mask.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
DataType
Base data type specifier.
long stats_in_shape(long nn, int type, Vector3< long > start, Vector3< long > end, double &vavg, double &vstd)
Calculates the statistics for an image within the given box.