 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
23 "Usage: bmodmask [options] in1.star [in2.star...]",
24 "------------------------------------------------",
25 "Generates a mask from a model if an output image is specified.",
28 "-type hull Mask type: model, hull, shell, level.",
29 "-invert Invert the mask after creation.",
30 "-project 2.5,D3 Projected masks at the angular step size and symmetry.",
33 "-verbose 7 Verbose output.",
34 "-componentradius 8.4 Set display radius for all components.",
35 "-linkradius 5.1 Set display radius for all links.",
37 "Parameters for mask creation:",
38 "-datatype u Force writing of a new data type (default float).",
39 "-size 100,120,80 Mask size (default from model).",
40 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
41 "-origin 0.8,-10,15.7 Set the origin for the mask.",
42 "-edge 1.5 Edge width for model mask (default 1 angstrom).",
43 "-width 34.8 Shell mask width (default 1 angstrom).",
44 "-curved Flag to indicate curved hull or shell surface (default not).",
45 "-fast Use fast but less comprehensive algorithm for shell and hull masks.",
46 "-smooth 2 Edge smoothing in pixels (default 0).",
49 "-parameters param.star Input parameter file.",
52 "-output file.star Output model file.",
53 "-mask mask.map Output mask image.",
58 int main(
int argc,
char **argv)
69 double shell_width(1);
83 for ( curropt = option; curropt; curropt = curropt->
next ) {
84 if ( curropt->
tag ==
"type" ) {
85 if ( curropt->
value[0] ==
'm' ) mask_type = 0;
86 if ( curropt->
value[0] ==
'h' ) mask_type = 1;
87 if ( curropt->
value[0] ==
's' ) mask_type = 2;
88 if ( curropt->
value[0] ==
'l' ) mask_type = 3;
90 if ( curropt->
tag ==
"project" ) {
91 if ( ( dang = curropt->
value.
real() ) < 0.5 )
92 cerr <<
"-project: An angular step size must be specified!" << endl;
102 if ( curropt->
tag ==
"componentradius" )
103 if ( ( comprad = curropt->
value.
real() ) < 1 )
104 cerr <<
"-componentradius: A radius must be specified!" << endl;
105 if ( curropt->
tag ==
"linkradius" )
106 if ( ( linkrad = curropt->
value.
real() ) < 1 )
107 cerr <<
"-linkradius: A radius must be specified!" << endl;
108 if ( curropt->
tag ==
"invert" ) invert = 1;
109 if ( curropt->
tag ==
"datatype" )
111 if ( curropt->
tag ==
"size" )
112 mask_size = curropt->
size();
113 if ( curropt->
tag ==
"sampling" )
114 sam = curropt->
scale();
115 if ( curropt->
tag ==
"origin" )
116 origin = curropt->
origin();
117 if ( curropt->
tag ==
"edge" )
118 if ( ( edge = curropt->
value.
real() ) < 0.001 )
119 cerr <<
"-edge: The edge width must be specified!" << endl;
120 if ( curropt->
tag ==
"width" )
121 if ( ( shell_width = curropt->
value.
real() ) < 1 )
122 cerr <<
"-width: The shell width must be specified!" << endl;
123 if ( curropt->
tag ==
"curved" ) curv_flag = 1;
124 if ( curropt->
tag ==
"smooth" )
126 cerr <<
"-smooth: The number of smoothing pixels must be specified!" << endl;
127 if ( curropt->
tag ==
"fast" ) fast = 1;
128 if ( curropt->
tag ==
"parameters" )
130 if ( curropt->
tag ==
"output" )
132 if ( curropt->
tag ==
"mask" )
141 while ( optind < argc )
string_add(&file_list, argv[optind++]);
143 cerr <<
"Error: No parameter or image files specified!" << endl;
151 cerr <<
"Error: Input file not read!" << endl;
160 if ( maskfile.
length() && mask_size.
volume() && mask_type >= 0 ) {
161 switch ( mask_type ) {
Bimage * model_create_mask(Bmodel *model, Vector3< long > size, Vector3< double > origin, Vector3< double > sam, double edge)
Calculates a mask of the components and links of a model structure.
A class for a command line input option.
Vector3< double > scale()
int string_kill(Bstring *list)
Kills a string linked list.
Header file for reading and writing atomic model files.
long model_set_link_radius(Bmodel *model, double linkrad)
Set the display radius for all links to a specific value.
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.
Header file for option handlers.
Vector3< double > origin()
Library routines used for model link processing.
long models_process(Bmodel *model, long(modfunc)(Bmodel *))
Process a list of models using the specified function.
int write_img(const char *filename, Bimage *p, int compression)
General driver function to write multiple image formats.
int model_kill(Bmodel *model)
Deallocates all memory in the list.
int main(int argc, char **argv)
General image parameter class.
Utilities for timing functions.
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
int write_model(Bstring &filename, Bmodel *model)
Writes model parameters.
Bimage * model_create_level_mask(Bmodel *model, Vector3< long > size, Vector3< double > origin, Vector3< double > sam)
Calculates a mask with one level per model.
Functions to generate masks from models.
Bsymmetry * init_point_group_symmetry(Bstring symmetry_string)
Sets up a symmetry structure from a string identifier.
double timer_report(double lasttime)
Reports the time elapsed since a given time.
long mask_invert()
Inverts a mask.
void change_type(char letter)
Get the data type indicated by a single letter code.
int filter_average(long kernel_size)
Applies an averaging filter to an image.
Bimage * model_create_shell_mask(Bmodel *model, Vector3< long > size, Vector3< double > origin, Vector3< double > sam, double shell_width, int curv_flag, int fast)
Calculates a shell mask covering a model structure.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
Library routines used for model processing.
Bmodel * read_model(Bstring &filename)
Bimage * model_create_projected_mask(Bmodel *model, Vector3< long > size, Vector3< double > ori, Vector3< double > sam, double dang, Bsymmetry *sym)
Calculates a set of 2D masks for the projections of a model structure.
DataType
Base data type specifier.
bool contains(const Bstring &s)
long model_set_component_radius(Bmodel *model, double comprad)
Set the display radius for all components to a specific value.
Bimage * model_create_hull_mask(Bmodel *model, Vector3< long > size, Vector3< double > origin, Vector3< double > sam, int curv_flag, int fast)
Calculates a mask based on the periphery of a model structure.
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.