 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
23 "Usage: bmissing [options] input.img/mg.star output.img",
24 "------------------------------------------------------",
25 "Generates binary masks corresponding to reciprocal space regions.",
26 "The selected regions have value 1 and the omitted regions 0.",
27 "The default is a blank mask created of the same size as the input image.",
29 "Actions for mask creation:",
30 "-create 20,60,30 Create a new mask of this size in place of input image",
31 " or using the micrograph orientations in the parameter file.",
32 "-find wedge Find the missing regions and create a new mask.",
34 "Actions for mask modification:",
35 "-wedge 45,-70,65 Missing wedge mask: tilt axis angle, first and last tilt angles.",
36 "-pyramid 40,-60,60,130,-55,60 Missing pyramid mask: 2 sets of tilt axis angle, first and last tilt angles.",
37 "-cone 65 Missing cone mask: one tilt angle.",
38 "-invert Invert mask just before writing the image.",
39 "-dilate 2 Dilate mask a number of times.",
42 "-verbose 1 Verbosity of output.",
43 "-datatype u Force writing of a new data type.",
44 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
45 "-origin 110,50,44 Origin for the mask (default 0,0,0).",
47 "-wrap Flag to wrap around image boundaries (default not).",
48 "-resolution 20 Resolution limit (angstrom, default Nyquist).",
50 "Parameters for micrograph orientations:",
51 "-scale 1.2 Scale or magnification of mask compared to original images (default 1).",
54 "1. Creating a new mask:",
55 " bmissing -v 7 -create 100,100,50 -wedge 45,-60,65 -origin 50,50,25 mask.mrc",
57 "2. Generating a mask from an image:",
58 " bmissing -v 7 -pyramid 30,-30,70,120,-60,50 -wrap input.map mask.mrc",
60 "3. Generating a mask from micrograph orientations:",
61 " bmissing -v 7 -create 100,100,50 -wrap mg.star mask.pif",
66 int main(
int argc,
char **argv)
94 for ( curropt = option; curropt; curropt = curropt->
next ) {
95 if ( curropt->
tag ==
"create" )
96 nusize = curropt->
size();
97 if ( curropt->
tag ==
"find" )
98 find = curropt->
value;
99 if ( curropt->
tag ==
"datatype" )
101 if ( curropt->
tag ==
"sampling" )
102 sam = curropt->
scale();
103 if ( curropt->
tag ==
"wedge" ) {
104 if ( ( i = curropt->
values(tilt_axis, tilt_neg, tilt_pos) ) < 2 )
105 cerr <<
"-wedge: At least the tilt axis and one angle must be specified" << endl;
107 tilt_axis *=
M_PI/180.0;
108 tilt_neg *=
M_PI/180.0;
109 tilt_pos *=
M_PI/180.0;
110 if ( i < 3 ) tilt_pos = tilt_neg;
113 if ( curropt->
tag ==
"pyramid" ) {
116 cerr <<
"-pyramid: At least the four angles must be specified" << endl;
118 tilt_axis = d[0] *
M_PI/180.0;
119 tilt_neg = d[1] *
M_PI/180.0;
120 tilt_pos = d[2] *
M_PI/180.0;
121 tilt_axis2 = d[3] *
M_PI/180.0;
122 if ( d.size() < 5 ) tilt_neg2 = tilt_neg;
123 else tilt_neg2 = d[4] *
M_PI/180.0;
124 if ( d.size() < 6 ) tilt_pos2 = tilt_pos;
125 else tilt_pos2 = d[5] *
M_PI/180.0;
128 if ( curropt->
tag ==
"cone" ) {
129 if ( ( tilt_cone = curropt->
value.
real() ) < 1 )
130 cerr <<
"-cone: A tilt angle must be specified" << endl;
132 tilt_cone *=
M_PI/180.0;
134 if ( curropt->
tag ==
"dilate" )
136 cerr <<
"-dilate: A number of times to dilate must be specified!" << endl;
137 if ( curropt->
tag ==
"origin" ) {
138 if ( curropt->
value[0] ==
'c' ) {
148 if ( curropt->
tag ==
"invert" ) invert = 1;
155 if ( curropt->
tag ==
"resolution" )
156 if ( ( resolution = curropt->
value.
real() ) < 0.001 )
157 cerr <<
"-resolution: A resolution limit must be specified!" << endl;
158 if ( curropt->
tag ==
"scale" )
159 if ( ( scale = curropt->
value.
real() ) < 0.0001 )
160 cerr <<
"-scale: A scale must be specified!" << endl;
168 Bstring filename(argv[optind++]);
172 if ( p == NULL )
bexit(-1);
173 filename = argv[optind];
178 if ( nusize.
volume() > 0 )
181 filename = argv[optind];
182 }
else if ( nusize.
volume() > 0 ) {
187 if ( p == NULL )
bexit(-1);
190 cout <<
"Creating a mask of size: " << nusize << endl;
233 else if ( tilt_pos2 )
235 tilt_neg, tilt_pos, tilt_neg2, tilt_pos2, resolution);
238 else if ( tilt_cone )
249 if ( filename.
length() ) {
A class for a command line input option.
long mask_missing_pyramid(Vector3< double > origin, double tilt_axis1, double tilt_axis2, double tilt_neg1, double tilt_pos1, double tilt_neg2, double tilt_pos2, double resolution)
Generates a mask with a missing pyramid.
Vector3< double > scale()
long mask_dilate(long times=1)
Dilates a binary mask.
Header file for file checking functions.
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.
long mask_missing_find(Vector3< double > ori, double resolution, Bstring &mis_type)
Generates a missing mask from an example image.
Header file for option handlers.
Vector3< double > origin()
long values(T1 &v1, T2 &v2)
Bimage * read_img(char *filename, int readdata, int img_select)
General driver function to read multiple image formats.
Header file for reading and writing micrograph parameters.
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.
long mask_stats()
Calculates statistics for a mask.
General image parameter class.
Bimage * project_missing_mask(Bproject *project, Vector3< long > size, Vector3< double > origin, double hi_res, double scale)
Creates a reciprocal space mask from the tilt series orientations.
Utilities for timing functions.
vector< double > split_into_doubles(const Bstring &delim)
double timer_start()
Starts timer and prints the time.
Bproject * read_project(const char *filename, int flags=0)
Reading micrograph parameters from files.
Header file for general utilities.
long mask_missing_wedge(Vector3< double > origin, double tilt_axis, double tilt_neg, double tilt_pos, double resolution)
Generates a mask with a missing wedge.
double timer_report(double lasttime)
Reports the time elapsed since a given time.
void origin(double ox, double oy, double oz)
long mask_invert()
Inverts a mask.
int project_set_particle_box_size(Bproject *project, Vector3< long > box_size)
Sets particle box size to the given value.
void change_type(char letter)
Get the data type indicated by a single letter code.
Functions to do a tomographic reconstruction.
Header file for 2D and 3D image I/O.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
void sampling(long nn, Vector3< double > u)
DataType
Base data type specifier.
long mask_missing_cone(Vector3< double > origin, double mis_ang, double resolution)
Generates a mask with a missing cone.
int main(int argc, char **argv)
FileType file_type(const char *filename)
Checks the file type using the extension and contents.