 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
21 "Usage: bfilwidth [options] img.pif out.pif",
22 "------------------------------------------",
23 "Analyzes the periodicity of a filament from width changes.",
24 "The filament must be aligned with the y axis and with positive contrast.",
27 "-invert Invert density in the image before other operations.",
28 "-rescale -0.1,5.2 Rescale data to average and standard deviation before other operations.",
29 "-average 34,1,1 Moving average window size (voxels).",
30 "-period 100,32,1 Periodic frame size (voxels).",
31 "-width 25 Window to fit a moving line for estimating the filament width.",
32 "-density 30,120 Density with filament width and number of histogram bins.",
35 "-verbose 7 Verbosity of output.",
36 "-datatype u Force writing of a new data type.",
37 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
38 "-origin 0.8,-10,15.7 Set the origin (default from input image).",
39 "-resolution 15.6 Resolution limit for cross-correlation.",
40 "-limits 35,57 Limits on the filament width (default 0 - width of image).",
43 "-reference file.map 2D reference for cross-correlation.",
46 "-Postscript plot.ps Plot of filament widths.",
51 int main(
int argc,
char** argv)
56 double nuavg(0), nustd(0);
63 long filwidth(0), bins(100);
66 int lim_lo(0), lim_hi(0);
73 for ( curropt = option; curropt; curropt = curropt->
next ) {
76 if ( curropt->
tag ==
"invert" )
78 if ( curropt->
tag ==
"rescale" ) {
79 if ( curropt->
values(nuavg, nustd) < 2 )
80 cerr <<
"-rescale: Both average and standard deviation must be specified!" << endl;
82 cerr <<
"-rescale: A positive standard deviation must be specified!" << endl;
84 if ( curropt->
tag ==
"average" )
85 average_window = curropt->
size();
86 if ( curropt->
tag ==
"period" )
87 period = curropt->
size();
88 if ( curropt->
tag ==
"width" )
90 cerr <<
"-width: A window size must be specified!" << endl;
91 if ( curropt->
tag ==
"density" )
92 if ( curropt->
values(filwidth, bins) < 1 )
93 cerr <<
"-density: A filament width must be specified!" << endl;
94 if ( curropt->
tag ==
"sampling" )
95 sam = curropt->
scale();
96 if ( curropt->
tag ==
"origin" ) {
97 if ( curropt->
value[0] ==
'c' ) {
100 origin = curropt->
origin();
104 if ( curropt->
tag ==
"resolution" )
105 if ( ( res_hi = curropt->
value.
real() ) < 0.001 )
106 cerr <<
"-resolution: A resolution limit must be specified!" << endl;
107 if ( curropt->
tag ==
"limits" )
108 if ( curropt->
values(lim_lo, lim_hi) < 2 )
109 cerr <<
"-limits: Both low and high limits must be specified!" << endl;
110 if ( curropt->
tag ==
"reference" )
112 if ( curropt->
tag ==
"Postscript" )
120 if ( p == NULL )
bexit(-1);
129 if ( setinvert ) p->
invert();
143 if ( ref_file.
length() ) {
145 if ( !pref )
bexit(-1);
148 cout <<
"New origin = " << p->
image->
origin() << endl;
157 else if ( filwidth ) {
165 if ( psfile.
length() && plot )
168 if ( argc > optind ) {
A class for a command line input option.
int ps_plot(Bstring filename, Bplot *plot)
Generates postscript graphs.
Vector3< double > scale()
int bexit(int value)
Exit function for cleanup and debugging.
Vector3< double > default_origin()
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 shift_wrap(Vector3< double > vec)
Shifts an image.
int find_shift(Bimage *pref, Bimage *pmask, double hires, double lores, double radius, double sigma, int refine_flag)
Calculates a cross-correlation map to find the shift for the pair of images.
Vector3< double > origin()
double standard_deviation()
Bimage * filament_density(double width)
Estimates the density per pixel length of a filament.
long values(T1 &v1, T2 &v2)
Bimage * read_img(char *filename, int readdata, int img_select)
General driver function to read multiple image formats.
void origin(double x, double y, double z)
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.
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 origin(double ox, double oy, double oz)
Bplot * histogram_gauss_plot(long bins, long ngauss=1)
Fits a gaussian function to a histogram of an image.
Header file for 2D and 3D image I/O.
int filter_average(long kernel_size)
Applies an averaging filter to an image.
Bimage * periodic_averaging(Vector3< double > period)
Calculates an average within a periodic frame.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
void invert()
Inverts the data in the image.
int main(int argc, char **argv)
void sampling(long nn, Vector3< double > u)
Bplot * filament_width(long width, long lim_lo, long lim_hi)
Estimates the width of a filament.
int rescale_to_avg_std(double nuavg, double nustd)
Rescales the image data to a given average and standard deviation.