 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
25 "Usage: bmultimask [options] input.img output.img",
26 "------------------------------------------------",
27 "Manipulates composite/level masks.",
28 "The input image is considered to have multiple integer levels (even for floating point).",
31 "-invert Invert mask before other operations.",
32 "-dilate 2 Dilate mask a number of times.",
33 "-switch 3,6 Switch two levels.",
34 "-color size Generate a RGBA image (random/level/size).",
35 "-size Convert level mask to region size map.",
36 "-level 134 Convert a mask to multiple levels, with the given voxels per level.",
37 "-bands 250,-1,150,1,30,0 Banded mask for reciprocal space (pairs of numbers: angstrom,value).",
38 " Band with 0: Not used.",
39 " Band with 1: Use for orientation determination.",
40 " Band with -1: Use for cross-validation.",
41 "-collapse Convert a multi-level mask to a binary mask.",
42 "-interfaces 3 Calculates interfaces for the indicated region (-1 gives whole matrix).",
43 "-merge 25,4 Calculates a region interface matrix and deletes/merges",
44 " regions smaller than the given size and interface size.",
45 "-symmetry C5 Set all symmetry-related segments to the same index.",
48 "-select 1,5-7 Select levels in a multi-level mask.",
49 "-combine 1,5-7 Combine levels to create a binary mask.",
50 "-voxel 23,241,193 Select the level including this voxel.",
53 "-verbose 1 Verbosity of output.",
54 "-datatype u Force writing of a new data type.",
55 "-sampling 1.5,1.5,1.5 Sampling (A/pixel; a single value can be given).",
56 "-origin 110,50,44 Origin for the mask (default from input image).",
58 "Parameters for model generation:",
59 "-componentradius 8.4 Set display radius for all components.",
60 "-linkradius 5.1 Set display radius for all links.",
63 "-Mask file.img Template mask to select levels.",
66 "-Model model.star Output model file.",
67 "-Postscript his.ps Output plot file of level size histogram.",
72 int main(
int argc,
char **argv)
77 long index1(-1000), index2(-1000);
103 for ( curropt = option; curropt; curropt = curropt->
next ) {
104 if ( curropt->
tag ==
"invert" )
106 if ( curropt->
tag ==
"dilate" )
108 cerr <<
"-dilate: A number of times to dilate must be specified!" << endl;
109 if ( curropt->
tag ==
"switch" )
110 if ( curropt->
values(index1, index2) < 2 )
111 cerr <<
"-switch: Both indices must be specified!" << endl;
112 if ( curropt->
tag ==
"color" )
113 color = curropt->
value;
114 if ( curropt->
tag ==
"size" )
116 if ( curropt->
tag ==
"select" ) {
117 level_select = curropt->
value;
118 if ( level_select.
length() < 1 )
119 cerr <<
"-select: Level numbers must be specified!" << endl;
123 if ( curropt->
tag ==
"combine" ) {
124 level_select = curropt->
value;
125 if ( level_select.
length() < 1 )
126 cerr <<
"-combine: Level numbers must be specified!" << endl;
130 if ( curropt->
tag ==
"voxel" ) {
131 voxel = curropt->
size();
133 cerr <<
"-voxel: A voxel must be specified!" << endl;
135 if ( curropt->
tag ==
"level" )
137 cerr <<
"-level: The voxels per level must be specified!" << endl;
138 if ( curropt->
tag ==
"bands" ) {
140 if ( band.size() < 2 )
141 cerr <<
"-bands: At least two pairs of numbers must be specified!" << endl;
142 band[band.size()] = 0;
144 if ( curropt->
tag ==
"collapse" )
146 if ( curropt->
tag ==
"interfaces" )
148 cerr <<
"-interfaces: A region number must be specified!" << endl;
149 if ( curropt->
tag ==
"merge" )
150 if ( curropt->
values(min_size, min_if) < 1 )
151 cerr <<
"-merge: A minimum size must be specified!" << endl;
152 if ( curropt->
tag ==
"symmetry" )
154 if ( curropt->
tag ==
"datatype" )
156 if ( curropt->
tag ==
"sampling" )
157 sampling = curropt->
scale();
158 if ( curropt->
tag ==
"origin" ) {
159 if ( curropt->
value[0] ==
'c' ) {
162 origin = curropt->
origin();
166 if ( curropt->
tag ==
"Mask" )
168 if ( curropt->
tag ==
"Model" )
170 if ( curropt->
tag ==
"Postscript" )
179 if ( p == NULL )
bexit(-1);
182 if ( set_origin == 2 ) p->
origin(p->
size()/2);
188 if ( invert ) p->
invert();
190 if ( level_select.
length() )
197 if ( band.size() && band[0] )
211 if ( mask_file.
length() ) {
225 else if ( color[0] ==
's' ) {
230 }
else if ( convert_size ) {
243 if ( mod_file.
length() ) {
251 if ( optind < argc ) {
A class for a command line input option.
int ps_plot(Bstring filename, Bplot *plot)
Generates postscript graphs.
Vector3< double > scale()
Header file for reading and writing atomic model files.
Bimage * levelmask_color_by_size()
Color a multi-level mask based on the volumes of regions.
Bmodel * model_from_multilevel_mask(Bimage *p)
Generates components at the center of mass of each mask level.
long levelmask_select(Bstring &select_list, int flag=0)
Retains the selected levels in a multi-level mask.
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.
Vector3< long > size() const
long levelmask_symmetrize(Bsymmetry *sym)
Symetrizes a multi-level mask.
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.
long values(T1 &v1, T2 &v2)
Bimage * read_img(char *filename, int readdata, int img_select)
General driver function to read multiple image formats.
long levelmask_clean()
Removes empty levels from a multi-level mask.
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.
int levelmask_region_size()
Convert a mask to reflect region sizes.
long levelmask_dilate(int times)
Dilates a level mask.
int model_kill(Bmodel *model)
Deallocates all memory in the list.
General image parameter class.
Utilities for timing functions.
long mask_region_interfaces(int reg_num)
Reports the whole interface matrix or interfaces for one region only.
vector< double > split_into_doubles(const Bstring &delim)
Bplot * levelmask_size_histogram()
Color a multi-level mask based on the volumes of regions.
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
int write_model(Bstring &filename, Bmodel *model)
Writes model parameters.
Functions to generate masks from models.
long levelmask_collapse()
Collapse a multi-level mask to a binary mask.
double timer_report(double lasttime)
Reports the time elapsed since a given time.
void origin(double ox, double oy, double oz)
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 main(int argc, char **argv)
long mask_split(long voxels_per_level)
Converts a mask to a multilevel mask with a given number of voxels per level.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
void invert()
Inverts the data in the image.
Library routines used for model processing.
void sampling(long nn, Vector3< double > u)
long levelmask_switch(long index1, long index2)
Switches two segments in a multi-level mask.
DataType
Base data type specifier.
long levelmask_colorize()
Colorizes a multi-level mask with random color assignments.
long model_set_component_radius(Bmodel *model, double comprad)
Set the display radius for all components to a specific value.
void simple_to_rgba()
A simple image is converted to a color image.
int mask_fspace_banded(vector< double > &band)
Generate reciprocal space mask based on a specification of bands.
long mask_merge_delete(long min_size, long min_if)
Calculates the interfaces between regions and deletes/merges small ones.