 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
21 "Usage: bampweigh [options] input.img output.img",
22 "-----------------------------------------------",
23 "Weighs the amplitudes of a map using a reference map's amplitudes.",
26 "-invert Invert density in the image.",
27 "-rescale -0.1,5.2 Rescale data to average and standard deviation after filtering.",
28 "-dose 2.5 Weigh the amplitudes by accumulated dose using the given dose/frame (e/Å2).",
29 "-normalize 2 Normalize amplitudes (1:amplitude; 2:power).",
30 "-root Weigh by the square root of the amplitudes.",
31 "-square Weigh by the squares of the amplitudes.",
34 "-verbose 7 Verbosity of output.",
35 "-datatype u Force writing of a new data type.",
36 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; default from input file; a single value can be given).",
37 "-resolution 15 Resolution limit (angstrom)",
40 "-RPS file.txt Radial power spectrum.",
41 "-FSC file.xml FSC curve.",
42 "-Reference file.map Reference map.",
43 "-Mask mask.tif Mask file to exclude regions in reciprocal space.",
44 "-mask mask.mrc Real space mask to apply before weighing.",
52 cout <<
"# Reading radial power spectrum: " << filename << endl;
55 f.open(filename.
c_str());
56 if ( f.fail() )
return NULL;
58 int i, j, ncol(2), nrow(0);
61 vector<double> vs, vp;
96 for ( i=0, j=nrow; i<nrow; ++i, ++j ) {
100 cout << vs[i] <<
tab << vp[i] << endl;
106 int main(
int argc,
char **argv)
110 double weigh_dose(0);
116 double resolution(0);
117 double nuavg(0), nustd(0);
127 for ( curropt = option; curropt; curropt = curropt->
next ) {
128 if ( curropt->
tag ==
"invert" ) setinvert = 1;
129 if ( curropt->
tag ==
"dose" )
130 if ( ( weigh_dose = curropt->
value.
real() ) < 0.001 )
131 cerr <<
"-dose: The dose per frame must be specified!" << endl;
132 if ( curropt->
tag ==
"normalize" )
134 cerr <<
"-normalize: A normalization option must be specified!" << endl;
135 if ( curropt->
tag ==
"root" ) root = 1;
136 if ( curropt->
tag ==
"square" ) square = 1;
137 if ( curropt->
tag ==
"datatype" )
139 if ( curropt->
tag ==
"sampling" )
140 sam = curropt->
scale();
141 if ( curropt->
tag ==
"resolution" )
142 if ( ( resolution = curropt->
value.
real() ) < 0.1 )
143 cerr <<
"-resolution: A resolution must be specified!" << endl;
144 if ( curropt->
tag ==
"rescale" ) {
145 if ( curropt->
values(nuavg, nustd) < 2 )
146 cerr <<
"-rescale: Both average and standard deviation must be specified!" << endl;
147 else if ( nustd <= 0 )
148 cerr <<
"-rescale: A positive standard deviation must be specified!" << endl;
150 if ( curropt->
tag ==
"RPS" )
152 if ( curropt->
tag ==
"FSC" )
154 if ( curropt->
tag ==
"Reference" )
156 if ( curropt->
tag ==
"Mask" )
158 if ( curropt->
tag ==
"mask" )
166 fftwf_init_threads();
174 if ( p == NULL )
bexit(-1);
181 if ( setinvert ) p->
invert();
187 cerr <<
"Error: The FSC file " << fscfile <<
" was not read!" << endl;
190 }
else if ( rpsfile.
length() ) {
193 cerr <<
"Error: The RPS file " << rpsfile <<
" was not read!" << endl;
206 if ( realmask.
length() ) {
207 prealmask =
read_img(realmask, 1, -1);
220 else if ( rpsfile.
length() )
222 }
else if ( weigh_dose ) {
224 }
else if ( normalize > 0 ) {
228 }
else if ( square ) {
234 if ( plot )
delete plot;
235 if ( pmask )
delete pmask;
239 if ( optind < argc ) {
247 fftwf_cleanup_threads();
A class for a command line input option.
Vector3< double > scale()
size_t system_processors()
Returns the number of processors.
int bexit(int value)
Exit function for cleanup and debugging.
int fspace_weigh_dose(long nn, double dose_per_frame, vector< double > critdose)
int fspace_square_amp()
Change the amlitudes to their squares.
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 fspace_weigh_FSC_curve(Bplot *plot, double resolution=0)
Weighs an image's amplitudes with a given FSC curve.
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 multiply(long j, Complex< double > cv)
int write_img(const char *filename, Bimage *p, int compression)
General driver function to write multiple image formats.
Bplot * xml_read_fsc(Bstring &filename, Bstring &xsdfile)
Function prototypes.
int fspace_weigh_C_curve(double resolution=0)
Weighs an image's amplitudes with the carbon scattering curve.
General image parameter class.
Utilities for timing functions.
int fspace_weigh(long maxrad, double *curve, int flag=0)
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
ostream & tab(ostream &out)
int fspace_normalize_radial(Bimage *pmask, double resolution=0, int flag=0)
Normalizes an image's amplitudes.
Bplot * read_rps(Bstring &filename)
double timer_report(double lasttime)
Reports the time elapsed since a given time.
int main(int argc, char **argv)
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 fspace_sqrt_amp()
Change the amlitudes to their square roots.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
void invert()
Inverts the data in the image.
void sampling(long nn, Vector3< double > u)
int fspace_weigh_RPS_curve(Bplot *plot, double resolution=0)
Weighs an image's amplitudes with a given RPS curve.
DataType
Base data type specifier.
Library routines to read and write FSC curves.
int rescale_to_avg_std(double nuavg, double nustd)
Rescales the image data to a given average and standard deviation.