 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
21 "Usage: bmontage [options] input.img output.img",
22 "----------------------------------------------",
23 "Generates a montage from a 3D image or a set of 2D images",
26 "-slices 3,4 Montage a 3D image in columns and rows (0,0: automatically calculated).",
27 "-images 3,4 Montage 2D images in columns and rows (0,0: automatically calculated).",
28 "-flip y Flip panel order on the x and/or y axis.",
31 "-verbose 7 Verbosity of output.",
32 "-datatype u Force writing of a new data type.",
33 "-first 12 First slice in 3D or first 2D image (default: 0).",
34 "-skip 2 Number of slices or images to skip (default: 0).",
35 "-pad 5 Padding to add around slices or images (default 0).",
36 "-fill 127 Fill value for padding (default average).",
41 int main(
int argc,
char **argv)
48 long columns(0), rows(0);
57 for ( curropt = option; curropt; curropt = curropt->
next ) {
58 if ( curropt->
tag ==
"slices" ) {
59 if ( curropt->
values(columns, rows) < 2 )
60 cerr <<
"-slices: Columns and rows must be specified!" << endl;
64 if ( curropt->
tag ==
"images" ) {
65 if ( curropt->
values(columns, rows) < 2 )
66 cerr <<
"-images: Columns and rows must be specified!" << endl;
70 if ( curropt->
tag ==
"flip" ) {
74 if ( curropt->
tag ==
"datatype" )
76 if ( curropt->
tag ==
"first" )
78 cerr <<
"-first: A number must be specified!" << endl;
79 if ( curropt->
tag ==
"skip" )
81 cerr <<
"-skip: A number must be specified!" << endl;
82 if ( curropt->
tag ==
"pad" )
84 cerr <<
"-pad: A number of pixels must be specified!" << endl;
85 if ( curropt->
tag ==
"fill" )
86 fill = curropt->
fill(fill_type);
94 while ( optind < argc - 1 )
string_add(&file_list, argv[optind++]);
96 cerr <<
"Error: No image files specified!" << endl;
105 nusize, 0, fill_type, fill, 0, 0);
112 cerr <<
"Error: No input file(s) read!" << endl;
116 if ( !setmontage && first ) {
117 if ( p->
sizeZ() > 1 ) setmontage = 1;
122 if ( setmontage == 2 && skip == 0 ) skip = p->
sizeZ() - 1;
137 p->
resize(nusize, translate, fill_type, fill);
141 pm = p->
montage(first, columns, rows, skip, flip);
148 if ( optind < argc ) {
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.
double background(long nn)
Header file for option handlers.
int calculate_background(long nn, int flag)
Calculates the background for one sub-image.
long values(T1 &v1, T2 &v2)
int write_img(const char *filename, Bimage *p, int compression)
General driver function to write multiple image formats.
General image parameter class.
double average(long cc, double xf, double yf, double zf, long nn, double iscale)
Averages in 3D when scaling is less than 1.
Utilities for timing functions.
Bimage * montage(int first, int cols, int rows, int skip=0, int flipy=0)
Rearranges an image into a montage of 2D slices for display.
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
double fill(int &fill_type)
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.
Header file for combining two images in various ways.
DataType
Base data type specifier.
bool contains(const Bstring &s)
int main(int argc, char **argv)
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
int resize(Vector3< long > nusize, Vector3< long > translate, int fill_type=0, double fill=0)
Resizes without interpolation or rescaling.
Bimage * img_catenate(Bstring *file_list, Bstring &rawstring, DataType newdatatype, Vector3< long > nusize, int setZslices=0, int fill_type=0, double fill=0, double newavg=0, double newstd=0)
Catenates a list of images into a multi-image structure.