| Bsoft 2.0.0 Bernard's software package

mg2imod.cpp
Go to the documentation of this file.
1
14 #include "mg_processing.h"
15 #include "mg_img_proc.h"
16 #include "mg_tomography.h"
17 #include "rwmg.h"
18 #include "rwimg.h"
19 #include "linked_list.h"
20 #include "utilities.h"
21 #include "options.h"
22 #include "timer.h"
23
24 // Declaration of global variables
25 extern int verbose; // Level of output to the screen
26
27 #define IMODSIZE 232
28 #define OBJTSIZE 176
29 #define CONTSIZE 16
30
31
32 struct IMOD {
33 char name[128]; // Name of model file.
34 int xmax; // Maximum values for x,y and z. These are usually
35 int ymax; // set to the image dimensions.
36 int zmax;
37
38 int objsize; // Number of objects in model.
39
40 uint flags; // Model flags (IMODF_FLAG...)
41 // Bit 12 on : multiple clip planes are possible
42 // Bit 13 on : mat1 and mat3 are stored as bytes
43 // Bit 14 on : otrans has image origin values
44 // Bit 15 on : current tilt angles are stored correctly
45 // Bit 16 on : model last viewed on Y/Z flipped image
46 int drawmode; // 1 to draw model, -1 not to
47 int mousemode; // Mouse editing mode. (0=movie,1=model)
48
49 int blacklevel; // Contrast adjustment. (0-256) Default = 0.
50 int whitelevel; // Contrast adjustment. (0-256) Default = 255.
51
52 float xoffset; // Offsets used for display & conversion,
53 float yoffset; // should be set to 0.
54 float zoffset; // (unused, superceded by MINX information)
55
56 float xscale; // Scaling for pixel size. xscale and yscale should
57 float yscale; // be 1.0 and zscale should be adjusted to account
58 float zscale; // for the image thickness.
59
60 int object; // Current object, contour and point, used for
61 int contour; // model editing.
62 int point;
63
64 int res; // Minimum number of pixels between points when adding
65 // points by dragging mouse with middle button down.
66 int thresh; // Threshold level for auto contour generator.
67
68 float pixsize; // Size of one pixel, in the units given next
69 int units; // 0 = pixels, 3 = km, 1 = m, -2 = cm, -3 = mm,
70 // -6 = microns, -9 = nm, -10 = Angstroms, -12 = pm
71
72 int csum; // Checksum storage. Used for autosave only.
73
74 float alpha; // Angles used for orientation of the model with
75 float beta; // image. Should be set to 0.0
76 float gamma; // (unused, superceded by MINX information)
77 };
78
79 struct OBJT {
80 char name[64]; // Name of Object. Null terminated string.
81 uint extra[16]; // Extra data for future use, indexed by IOBJ_EX_ defines
82 // 0 (PNT_LIMIT): Limit on number of points per contour
83
84 int contsize; // Number of Contours in object.
85 uint flags; // bit flags for object (IMOD_OBJFLAG...).
86 // Bit 1 on : Off - turns off display
87 // Bit 2 on : Draw using depth cue
88 // Bit 3 on : Open - contours are not closed
89 // Bit 4 on : Wild - contours not constrained in Z
90 // Bit 5 on : Inside-out - light inside surface
91 // Bit 6 on : Use fill color for spheres
92 // Bit 7 on : Draw spheres on central section only
93 // Bit 8 on : Fill - draw filled polygons
94 // Bit 9 on : Scattered - contours have scattered points
95 // Bit 10 on : Mesh - draw mesh data in 3D
96 // Bit 11 on : Lines - do not draw contours in 3D
97 // Bit 12 on : Use stored values to modify drawing
98 // Bit 13 on : Keep contours planar in open object
99 // Bit 14 on : Fill color - use instead of regular color
100 // Bit 15 on : Anti-aliasing on
101 // Bit 16 on : Normals have magnitudes
102 // Bit 17 on : Draw stored values with false color
103 // Bit 18 on : Time - contours have time indexes
104 // Bit 19 on : Light both sides of surface
105 // Bit 20 on : Draw current contour thicker in model view
106 // Bit 21 on : Draw extra object in model view
107 // Bit 22 on : Allow extra object editing in model view
108 // Bit 23 on : Do not draw spheres in model view
109 // Bit 24 on : Draw extra object only in model view
110 // Bit 31 reserved for temporary use
111
112 // In 3dmodv, Draw Data Type - Contour = Mesh flag off,
113 // Mesh = Mesh flag on
114 // Drawing Style - Points = Lines flag on, Fill flag off
115 // Lines = Lines flag off, Fill flag off
116 // Fill = Lines flag on, Fill flag on
117 // Fill Outline = Lines flag off, Fill flag on
118
119 int axis; // Z = 0, X = 1, Y = 2. (unused)
120 int drawmode; // Tells type of scattered points to draw (unused)
121
122 float red; // Color values, range is (0.0 - 1.0)
123 float green;
124 float blue;
125
126 int pdrawsize; // Default radius in pixels of scattered points in 3D.
127
128 unsigned char symbol; // Point Draw symbol in 2D, default is 1.
129 // 0 = circle, 1 = none, 2 = square, 3 = triangle,
130 // 4 = star.
131 unsigned char symsize; // Size of 2D symbol; radius in pixels.
132 unsigned char linewidth2; // Linewidth in 2-D view.
133 unsigned char linewidth; // Linewidth in 3-D view.
134 unsigned char linesty; // Line draw style, 0 = solid; 1 = dashed (unused).
135 unsigned char symflags; // Bit 0 on : Fill the symbol.
136 // Bit 1 on : Draw beginning and end symbols.
137 unsigned char sympad; // Set to 0, for future use.
138 unsigned char trans; // Transparency, range is (0 to 100), maps to
139 // (1.0 to 0.0) in call to glColor4f or glMaterialfv
140
141 int meshsize; // Number of meshes in object.
142 int surfsize; // Max surfaces in object.
143 };
144
145 struct CONT {
146 int psize; // Number of points in contour.
147 uint flags; // Bit 3 on : open, do not connect endpoints
148 // Bit 4 on : wild, not in one Z plane
149 // Bit 5 on : draw stippled lines
150 // Bit 6 on : draw if mouse in window, ignore Z
151 // Bit 7 on : draw on all planes, regardless of Z
152 // Bit 8 on : draw only in model mode
153 // Bit 17 on : contour has pairs of scan lines
154 // Bits 18, 19, 20, 31: reserved for temporary use
155 int time; // The time index used by this contour.
156 int surf; // The surface index used by this contour.
157 // float* pt; // Array of point triplets.
158 };
159
160 Bproject* project_from_IMOD(Bstring* file_list, int flag);
161 int write_IMOD_parameters(Bstring& imodfile, Bproject* project);
162
163 // Usage assistance
164 const char* use[] = {
165 " ",
166 "Usage: mg2imod [options] input.mrc input.xf input.tlt input.fid input.xyz",
167 "-------------------------------------------------------------------------",
168 "Converts between IMOD files and a micrograph parameter file.",
169 " ",
170 "Actions:",
171 "-topif Flag to convert the image file to multi-image PIF (default not).",
172 " ",
173 "Parameters:",
174 "-verbose 7 Verbosity of output.",
175 "-sampling 1.5 Sampling (A/pixel).",
176 " ",
177 "Output:",
178 "-output file.star Output micrograph parameter file.",
179 "-imod file.xf Output IMOD parameter files.",
180 " ",
181 NULL
182 };
183
184
185 int main(int argc, char** argv)
186 {
187 // Initializing variables
188 int flag(0); // Flag to rewrite the image file
189 float sampling(0); // A/pixel
190 Bstring outfile; // Output parameter file
191 Bstring imodfile; // IMOD output parameter file
192
193 int optind;
194 Boption* option = get_option_list(use, argc, argv, optind);
195 Boption* curropt;
196 for ( curropt = option; curropt; curropt = curropt->next ) {
197 if ( curropt->tag == "topif" ) flag = 1;
198 if ( curropt->tag == "sampling" )
199 if ( ( sampling = curropt->value.real() ) < 0.1 )
200 cerr << "-sampling: A pixel size must be specified" << endl;
201 if ( curropt->tag == "output" )
202 outfile = curropt->filename();
203 if ( curropt->tag == "imod" )
204 imodfile = curropt->filename();
205 }
206 option_kill(option);
207
208 double ti;
209 if ( verbose & VERB_TIME )
210 ti = timer_start();
211
212 // Read all the parameter files
213 Bstring* file_list = NULL;
214 while ( optind < argc ) string_add(&file_list, argv[optind++]);
215 if ( !file_list ) {
216 cerr << "Error: No parameter files specified!" << endl;
217 bexit(-1);
218 }
219
220 Bproject* project = NULL;
221 Bstring ext = file_list->extension();
222
223 if ( ext.contains("star") || ext.contains("xml") )
224 project = read_project(file_list);
225 else
226 project = project_from_IMOD(file_list, flag);
227
228 string_kill(file_list);
229
230 if ( project == NULL ) {
231 cerr << "Error: No project generated!" << endl;
232 bexit(-1);
233 }
234
235 if ( sampling > 0.1 )
236 project_set_pixel_size(project, sampling);
237
238 project_update_comment(project, argc, argv);
239
240 if ( outfile.length() )
241 write_project(outfile, project, 0, 0);
242
243 if ( imodfile.length() )
244 write_IMOD_parameters(imodfile, project);
245
246 project_kill(project);
247
248 if ( verbose & VERB_TIME )
249 timer_report(ti);
250
251 bexit(0);
252 }
253
254 int read_imod_xf(Bstring& filename, Bproject* project)
255 {
256 Bmicrograph* mg = NULL;
257 double a[4], dx, dy;
258
259 ifstream fprm(filename.c_str());
260 if ( fprm.fail() ) {
261 cerr << "Error: A text file specifying 2D transformations must be given!" << endl;
262 return -1;
263 }
264
265 if ( verbose & VERB_PROCESS )
266 cout << "Reading 2D transformations from " << filename << endl;
267
268 for ( mg = project->field->mg; mg; mg = mg->next ) {
269 fprm >> a[0] >> a[1] >> a[2] >> a[3] >> dx >> dy;
270 mg->tilt_axis = (atan2(-a[0], a[1]) + atan2(-a[3], -a[2]))/2.0;
271 mg->origin[0] -= a[0]*dx + a[2]*dy;
272 mg->origin[1] -= a[1]*dx + a[3]*dy;
273 cout << mg->origin << tab << mg->tilt_axis*180.0/M_PI << endl;
274 }
275
276 fprm.close();
277
278 return 0;
279 }
280
281 int read_imod_tlt(Bstring& filename, Bproject* project)
282 {
283 Bmicrograph* mg = NULL;
284 double ta;
285
286 ifstream fprm(filename.c_str());
287 if ( fprm.fail() ) {
288 cerr << "Error: A text file specifying tilt angles must be given!" << endl;
289 return -1;
290 }
291
292 if ( verbose & VERB_PROCESS )
293 cout << "Reading tilt angles from " << filename << endl;
294
295 for ( mg = project->field->mg; mg; mg = mg->next ) {
296 fprm >> ta;
297 mg->tilt_angle = ta*M_PI/180.0;
298 cout << mg->tilt_angle*180.0/M_PI << endl;
299 }
300
301 fprm.close();
302
303 return 0;
304 }
305
306 int read_imod_xyz(Bstring& filename, Breconstruction* rec)
307 {
308 int mark_id(0), first(1);
309 double x, y, z, dum;
310 string word;
311 Bmarker* mark = NULL;
312
313 ifstream fprm(filename.c_str());
314 if ( fprm.fail() ) {
315 cerr << "Error: A text file specifying the 3D marker model must be given!" << endl;
316 return -1;
317 }
318
319 fprm >> mark_id >> x >> y >> z >> dum >> dum;
320 while ( fprm >> word ) {
321 if ( word == "Pix:" ) fprm >> rec->voxel_size;
322 if ( word == "Dim:" ) break;
323 }
324 fprm >> rec->origin[0] >> rec->origin[1];
325 rec->origin /= 2;
326
327 if ( access(rec->frec.c_str(), R_OK) ) {
328 cout << "Getting reconstruction parameters from " << filename << endl;
329 } else {
330 cout << "Getting reconstruction parameters from " << rec->frec << endl;
331 Bimage* p = read_img(rec->frec, 0, -1);
332 rec->voxel_size = p->sampling().x();
333 rec->origin = p->size()/2;
334 delete p;
335 }
336 cout << setprecision(3) << "Voxel size = " << rec->voxel_size << " Origin = " << rec->origin << endl;
337
338 while ( !fprm.eof() ) {
339 if ( first ) first = 0;
340 else fprm >> mark_id >> x >> y >> z >> dum >> dum;
341 if ( fprm.fail() ) break;
342 mark = (Bmarker *) add_item((char **) &mark, sizeof(Bmarker));
343 if ( !rec->mark ) rec->mark = mark;
344 mark->id = mark_id;
345 // mark->loc = Vector3<float>(x - rec->origin.x(), y - rec->origin.y(), z);
346 mark->loc = Vector3<float>(x, y, z);
347 mark->fom = 1;
348 mark->sel = 1;
349 cout << mark_id << tab << x << tab << y << tab << z << endl;
350 }
351
352 fprm.close();
353
354 return 0;
355 }
356
357 int read_imod_fid(Bstring& filename, Bproject* project)
358 {
359 Bmicrograph* mg = NULL;
360 Bmarker* mark = NULL;
361
362 ifstream fprm(filename.c_str());
363 if ( fprm.fail() ) {
364 cerr << "Error: A binary IMOD file specifying the fiducial markers must be given!" << endl;
365 return -1;
366 }
367
368 if ( verbose & VERB_PROCESS )
369 cout << "Reading markers from " << filename << endl;
370
371 size_t i, j, psize;
372 char tag[8];
373 IMOD* imod = new IMOD;
374 OBJT* objt = new OBJT;
375 CONT* cont = new CONT;
376 float* point;
377
378 tag[4] = 0;
379 fprm.read((char *)tag, 4);
380 if ( fprm.fail() ) return -2;
381 cout << tag << tab;
382 fprm.read((char *)tag, 4);
383 if ( fprm.fail() ) return -2;
384 cout << tag << endl;
385
386 fprm.read((char *)imod, IMODSIZE);
387 if ( fprm.fail() ) return -2;
388
389 swapbytes((unsigned char *) &imod->objsize, 4);
390
391 if ( verbose & VERB_PROCESS )
392 cout << "number of objects = " << imod->objsize << endl;
393
394 fprm.read((char *)tag, 4);
395 if ( fprm.fail() ) return -2;
396
397 fprm.read((char *)objt, OBJTSIZE);
398 if ( fprm.fail() ) return -2;
399
400 swapbytes((unsigned char *) &objt->contsize, 4);
401
402 if ( verbose & VERB_PROCESS )
403 cout << "number of contours = " << objt->contsize << endl;
404
405 for ( i=0; i<objt->contsize; i++ ) {
406 fprm.read((char *)tag, 4);
407 if ( fprm.fail() ) return -2;
408
409 fprm.read((char *)cont, CONTSIZE);
410 if ( fprm.fail() ) return -2;
411
412 swapbytes((unsigned char *) &cont->psize, 4);
413
414 if ( verbose & VERB_PROCESS )
415 cout << "number of points = " << cont->psize << endl;
416
417 psize = 3*cont->psize*sizeof(float);
418 point = new float[3*cont->psize];
419
420 fprm.read((char *)point, psize);
421 if ( fprm.fail() ) return -2;
422
423 swapbytes(psize, (unsigned char *) point, 4);
424
425 for ( j=0, mg = project->field->mg; mg; mg = mg->next, j+=3 ) {
426 mark = (Bmarker *) add_item((char **) &mg->mark, sizeof(Bmarker));
427 mark->id = i+1;
428 mark->loc = Vector3<float>(point[j], point[j+1], 0);
429 mark->fom = 1;
430 mark->sel = 1;
431 cout << mg->id << tab << mark->id << tab << mark->loc << endl;
432 }
433
434 delete[] point;
435 }
436
437 delete imod;
438 delete objt;
439 delete cont;
440
441 fprm.close();
442
443 return 0;
444 }
445
468 Bproject* project_from_IMOD(Bstring* file_list, int flag)
469 {
470 if ( file_list->empty() ) {
471 cerr << "No filenames given to create a project!" << endl;
472 exit(-1);
473 }
474
475 Bimage* p = NULL;
476 Bstring base, imgfile;
477 Bstring* thisfile = NULL;
478 Bstring ext;
479
480 for ( thisfile = file_list; thisfile; thisfile = thisfile->next ) {
481 ext = thisfile->extension();
482 if ( ext.contains("pif") || ext.contains("mrc") || ext.contains("st") || ext.contains("ali") ) {
483 imgfile = *thisfile;
484 base = imgfile.base();
485 p = read_img(imgfile, 0, -1);
486 if ( !p ) {
487 cerr << "Error: Image file " << imgfile << " not read!" << endl;
488 error_show("project_from_IMOD", __FILE__, __LINE__);
489 return NULL;
490 }
491 if ( p->sizeZ() > 1 ) {
492 if ( flag ) {
493 delete p;
494 p = read_img(imgfile, 1, 0);
495 p->slices_to_images();
496 imgfile = base + ".pif";
497 write_img(imgfile, p);
498 } else {
499 p->slices_to_images();
500 }
501 }
502 }
503 }
504
505 if ( !p ) {
506 cerr << "Error: No image file provided!" << endl;
507 error_show("project_from_IMOD", __FILE__, __LINE__);
508 return NULL;
509 }
510
511 int n;
512 Bstring mg_id, rec_id;
513 Bproject* project = project_init();
514 Bfield* field = field_add(&project->field, base);
515 Bmicrograph* mg = NULL;
516 Breconstruction* rec = NULL;
517
518 for ( n=0; n<p->images(); n++ ) {
519 mg_id = base + Bstring(n+1, "_%03d");
520 mg = micrograph_add(&mg, mg_id);
521 if ( !field->mg ) field->mg = mg;
522 mg->block = n;
523 mg->img_num = n;
524 mg->fmg = imgfile;
525 mg->pixel_size = p->sampling().x();
526 mg->origin = p->size()/2;
527 mg->mark_radius = 10;
528 if ( verbose & VERB_FULL )
529 cout << "Creating field " << field->id << ", micrograph " << mg->id << endl;
530 cout << "Pixel size = " << mg->pixel_size << " Origin = " << mg->origin << endl;
531 }
532
533 delete p;
534
535 int err(0);
536
537 for ( thisfile = file_list; thisfile; thisfile = thisfile->next ) {
538 ext = thisfile->extension();
539 if ( ext.contains("xf") ) {
540 err += read_imod_xf(*thisfile, project);
541 } else if ( ext.contains("tlt") ) {
542 err += read_imod_tlt(*thisfile, project);
543 } else if ( ext.contains("xyz") ) {
544 rec_id = base;
545 rec = reconstruction_add(&project->rec, rec_id);
546 rec->frec = base + ".rec";
547 err += read_imod_xyz(*thisfile, rec);
548 } else if ( ext.contains("fid") ) {
549 err += read_imod_fid(*thisfile, project);
550 }
551 }
552
553 project_mg_tilt_to_matrix(project);
554
555 return project;
556 }
557
577 int write_IMOD_parameters(Bstring& imodfile, Bproject* project)
578 {
579 Bstring paramfile = imodfile.base() + ".xf";
580 Bmicrograph* mg = project->field->mg;
581 Breconstruction* rec = project->rec;
582 Bmarker* mark = NULL;
583
584 Vector3<float> d, origin = micrograph_get_nominal_origin(mg);
585
586 // FILE* fd = NULL;
587
588 // if ( ( fd = fopen(paramfile.c_str(), "w") ) == NULL ) {
589 // error_show("write_IMOD_parameters", __FILE__, __LINE__);
590 // return -1;
591 // }
592
593 ofstream fprm(paramfile.c_str());
594 if ( fprm.fail() ) {
595 error_show("write_IMOD_parameters", __FILE__, __LINE__);
596 return -1;
597 }
598
599 if ( verbose & VERB_PROCESS )
600 cout << "Writing 2D transformations to " << paramfile << endl;
601
602 double a[4];
603
604 for ( mg = project->field->mg; mg; mg = mg->next ) {
605 a[0] = a[3] = -sin(mg->tilt_axis);
606 a[1] = cos(mg->tilt_axis);
607 a[2] = -cos(mg->tilt_axis);
608 d = origin - mg->origin;
609 // fprintf(fd, "%12.7lf%12.7lf%12.7lf%12.7lf%12.3lf%12.3lf\n", a[0], a[1],
610 // a[2], a[3], a[0]*d.x() + a[1]*d.y(), a[2]*d.x() + a[3]*d.y());
611 fprm << setprecision(7) << setw(12) << a[0]
612 << setw(12) << a[1]
613 << setw(12) << a[2]
614 << setw(12) << a[3]
615 << setprecision(3) << setw(12) << a[0]*d.x() + a[1]*d.y()
616 << setw(12) << a[2]*d.x() + a[3]*d.y() << endl;
617 }
618
619 // fclose(fd);
620 fprm.close();
621
622 paramfile = imodfile.base() + ".tlt";
623
624 // if ( ( fd = fopen(paramfile.c_str(), "w") ) == NULL ) {
625 // error_show("write_IMOD_parameters", __FILE__, __LINE__);
626 // return -1;
627 // }
628
629 fprm.open(paramfile.c_str());
630 if ( fprm.fail() ) {
631 error_show("write_IMOD_parameters", __FILE__, __LINE__);
632 return -1;
633 }
634
635 if ( verbose & VERB_PROCESS )
636 cout << "Writing tilt angles to " << paramfile << endl;
637
638 for ( mg = project->field->mg; mg; mg = mg->next )
639 // fprintf(fd, "%g\n", mg->tilt_angle*180.0/M_PI);
640 fprm << mg->tilt_angle*180.0/M_PI << endl;
641
642 // fclose(fd);
643 fprm.close();
644
645 if ( rec && rec->mark ) {
646 paramfile = imodfile.base() + "fid.xyz";
647
648 // if ( ( fd = fopen(paramfile.c_str(), "w") ) == NULL ) {
649 // error_show("write_IMOD_parameters", __FILE__, __LINE__);
650 // return -1;
651 // }
652
653 fprm.open(paramfile.c_str());
654 if ( fprm.fail() ) {
655 error_show("write_IMOD_parameters", __FILE__, __LINE__);
656 return -1;
657 }
658
659 if ( verbose & VERB_PROCESS )
660 cout << "Writing the 3D marker model to " << paramfile << endl;
661
662 /* for ( mark = rec->mark; mark; mark = mark->next ) {
663 fprintf(fd, "%4d%10.2f%10.2f%10.2f %6d %4d", mark->id,
664 mark->loc.x() + rec->origin.x(), mark->loc.y() + rec->origin.y(), mark->loc.z(), 1, mark->id);
665 if ( mark == rec->mark )
666 fprintf(fd, " Pix: %11.5f Dim: %5.0f %5.0f\n",
667 rec->voxel_size, 2*rec->origin.x(), 2*rec->origin.y());
668 else
669 fprintf(fd, "\n");
670 }
671 */
672 for ( mark = rec->mark; mark; mark = mark->next ) {
673 fprm << setw(4) << mark->id
674 << setprecision(2) << setw(10) << mark->loc.x() + rec->origin.x()
675 << setw(10) << mark->loc.y() + rec->origin.y()
676 << setw(10) << mark->loc.z()
677 << setw(7) << 1 << setw(5) << mark->id;
678 if ( mark == rec->mark )
679 fprm << " Pix: " << setprecision(5) << setw(11) << rec->voxel_size
680 << " Dim: " << setprecision(0) << setw(6) << 2*rec->origin.x()
681 << setw(6) << 2*rec->origin.y();
682 fprm << endl;
683 }
684
685 // fclose(fd);
686 fprm.close();
687 }
688
689 return 0;
690 }
write_project
int write_project(const char *filename, Bproject *project)
Writing micrograph parameters to a file.
Definition: rwmg.cpp:292
rwmg.h
Header file for reading and writing micrograph parameters.
OBJT::meshsize
int meshsize
Definition: mg2imod.cpp:141
Bstring::real
double real()
Definition: Bstring.cpp:545
string_add
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
Definition: Bstring.cpp:730
OBJT::green
float green
Definition: mg2imod.cpp:123
Bproject::rec
Breconstruction * rec
Definition: mg_processing.h:327
OBJT::drawmode
int drawmode
Definition: mg2imod.cpp:120
IMOD::name
char name[128]
Definition: mg2imod.cpp:33
OBJT::surfsize
int surfsize
Definition: mg2imod.cpp:142
Breconstruction::mark
Bmarker * mark
Definition: mg_processing.h:290
Bmicrograph::origin
Vector3< float > origin
Definition: mg_processing.h:204
IMOD::xscale
float xscale
Definition: mg2imod.cpp:56
Bimage::slices_to_images
int slices_to_images()
Changes the slices in a 3D image into a set of 2D images.
Definition: Bimage.cpp:1758
Bmicrograph::id
Bstring id
Definition: mg_processing.h:186
Bmicrograph::img_num
int img_num
Definition: mg_processing.h:195
IMOD::yscale
float yscale
Definition: mg2imod.cpp:57
IMOD::beta
float beta
Definition: mg2imod.cpp:75
IMOD::zmax
int zmax
Definition: mg2imod.cpp:36
Vector3::z
Type z()
Definition: Vector3.h:159
utilities.h
Header file for general utilities.
Boption::value
Bstring value
Definition: options.h:30
Breconstruction
Definition: mg_processing.h:263
Boption::tag
Bstring tag
Definition: options.h:29
OBJT::linewidth2
unsigned char linewidth2
Definition: mg2imod.cpp:132
OBJT::sympad
unsigned char sympad
Definition: mg2imod.cpp:137
read_img
Bimage * read_img(Bstring filename, int readdata, int img_select)
General driver function to read multiple image formats.
Definition: rwimg.cpp:82
mg_img_proc.h
Header file for image processing from micrograph structures.
IMOD::xoffset
float xoffset
Definition: mg2imod.cpp:52
IMOD::units
int units
Definition: mg2imod.cpp:69
Bmarker
Definition: marker.h:21
add_item
char * add_item(char **list, unsigned long size)
Adds an item to a linked list.
Definition: linked_list.cpp:26
read_project
Bproject * read_project(const char *filename, int flags=0)
Reading micrograph parameters from files.
Definition: rwmg.cpp:138
Bstring::length
long length() const
Definition: Bstring.cpp:263
project
Bproject * project
Definition: bshow.cpp:31
error_show
int error_show(const char *message, const char *file, int line)
Displays the error with file and line reference.
Definition: utilities.cpp:687
VERB_PROCESS
#define VERB_PROCESS
Definition: utilities.h:101
use
const char * use[]
Definition: mg2imod.cpp:164
IMOD::drawmode
int drawmode
Definition: mg2imod.cpp:46
get_option_list
Boption * get_option_list(const char *use[], int argc, char *argv[], int &optind)
Parses command line arguments based on a template.
Definition: options.cpp:40
write_img
int write_img(Bstring filename, Bimage *p)
General driver function to write multiple image formats.
Definition: rwimg.cpp:263
IMOD::zscale
float zscale
Definition: mg2imod.cpp:58
Boption::filename
Bstring filename()
Definition: options.h:85
Bmicrograph::tilt_axis
float tilt_axis
Definition: mg_processing.h:200
project_init
Bproject * project_init()
Initializes a micrograph processing project parameter structure.
Definition: mg_processing.cpp:29
timer.h
Utilities for timing functions.
Bmicrograph::mark_radius
float mark_radius
Definition: mg_processing.h:219
IMOD::object
int object
Definition: mg2imod.cpp:60
read_imod_tlt
int read_imod_tlt(Bstring &filename, Bproject *project)
Definition: mg2imod.cpp:281
verbose
int verbose
OBJT::symsize
unsigned char symsize
Definition: mg2imod.cpp:131
OBJT::blue
float blue
Definition: mg2imod.cpp:124
Bimage
General image parameter class.
Definition: Bimage.h:140
IMOD::flags
uint flags
Definition: mg2imod.cpp:40
IMOD
Definition: mg2imod.cpp:32
OBJT::symflags
unsigned char symflags
Definition: mg2imod.cpp:135
IMOD::contour
int contour
Definition: mg2imod.cpp:61
CONTSIZE
#define CONTSIZE
Definition: mg2imod.cpp:29
reconstruction_add
Breconstruction * reconstruction_add(Breconstruction **rec, Bstring &rec_id)
Adds a reconstruction parameter structure to a linked list.
Definition: mg_processing.cpp:672
Bstring::contains
bool contains(const Bstring &s)
Definition: Bstring.cpp:584
Bfield
Definition: mg_processing.h:240
M_PI
#define M_PI
Definition: utilities.h:53
linked_list.h
Header file for generalized linked list functions.
Bmicrograph::pixel_size
float pixel_size
Definition: mg_processing.h:198
CONT::surf
int surf
Definition: mg2imod.cpp:156
OBJT::linewidth
unsigned char linewidth
Definition: mg2imod.cpp:133
IMOD::xmax
int xmax
Definition: mg2imod.cpp:34
IMOD::ymax
int ymax
Definition: mg2imod.cpp:35
project_from_IMOD
Bproject * project_from_IMOD(Bstring *file_list, int flag)
Creates a project structure using IMOD parameters.
Definition: mg2imod.cpp:468
Bfield::id
Bstring id
Definition: mg_processing.h:242
Bstring::next
Bstring * next
Definition: Bstring.h:30
Boption
A class for a command line input option.
Definition: options.h:26
Bimage::sampling
void sampling(double s)
Definition: Bimage.h:426
IMOD::objsize
int objsize
Definition: mg2imod.cpp:38
Bproject::field
Bfield * field
Definition: mg_processing.h:326
VERB_TIME
#define VERB_TIME
Definition: utilities.h:104
Bstring::extension
Bstring extension()
Definition: Bstring.cpp:515
Breconstruction::voxel_size
float voxel_size
Definition: mg_processing.h:275
project_mg_tilt_to_matrix
int project_mg_tilt_to_matrix(Bproject *project)
Sets the matrix from the tilt and axis angles for each micrograph.
Definition: mg_tomography.cpp:1764
Bmicrograph
Definition: mg_processing.h:184
read_imod_fid
int read_imod_fid(Bstring &filename, Bproject *project)
Definition: mg2imod.cpp:357
OBJTSIZE
#define OBJTSIZE
Definition: mg2imod.cpp:28
OBJT::red
float red
Definition: mg2imod.cpp:122
mg_tomography.h
Header file for single particle image processing in Bsoft.
Bmarker::fom
float fom
Definition: marker.h:28
Bimage::size
Vector3< long > size() const
Definition: Bimage.h:314
Bmarker::id
int id
Definition: marker.h:23
swapbytes
void swapbytes(unsigned char *v, size_t n)
Swaps bytes.
Definition: utilities.cpp:475
OBJT
Definition: mg2imod.cpp:79
Bstring::c_str
const char * c_str()
Definition: Bstring.h:68
IMOD::mousemode
int mousemode
Definition: mg2imod.cpp:47
Bmicrograph::mark
Bmarker * mark
Definition: mg_processing.h:225
Bmarker::next
Bmarker * next
Definition: marker.h:22
Bfield::mg
Bmicrograph * mg
Definition: mg_processing.h:247
IMOD::pixsize
float pixsize
Definition: mg2imod.cpp:68
IMOD::whitelevel
int whitelevel
Definition: mg2imod.cpp:50
field_add
Bfield * field_add(Bfield **field, Bstring &field_id)
Adds a field-of-view parameter structure to a linked list.
Definition: mg_processing.cpp:120
Bstring::base
Bstring base()
Definition: Bstring.cpp:508
IMOD::blacklevel
int blacklevel
Definition: mg2imod.cpp:49
CONT::flags
uint flags
Definition: mg2imod.cpp:147
Boption::next
Boption * next
Definition: options.h:28
Vector3::x
Type x()
Definition: Vector3.h:157
Bmicrograph::block
int block
Definition: mg_processing.h:188
Bstring
Definition: Bstring.h:28
OBJT::trans
unsigned char trans
Definition: mg2imod.cpp:138
project_kill
int project_kill(Bproject *project)
Frees a whole project.
Definition: mg_processing.cpp:1177
OBJT::axis
int axis
Definition: mg2imod.cpp:119
project_set_pixel_size
int project_set_pixel_size(Bproject *project, double pixel_size)
Sets the pixel size for all the micrographs.
Definition: mg_processing.cpp:3222
CONT::psize
int psize
Definition: mg2imod.cpp:146
Bimage::sizeZ
void sizeZ(long nz)
Definition: Bimage.h:319
Vector3< float >
Bmicrograph::fmg
Bstring fmg
Definition: mg_processing.h:189
timer_report
double timer_report(double lasttime)
Reports the time elapsed since a given time.
Definition: timer.cpp:67
OBJT::symbol
unsigned char symbol
Definition: mg2imod.cpp:128
micrograph_get_nominal_origin
Vector3< double > micrograph_get_nominal_origin(Bmicrograph *mg)
Gets the nominal origin for a micrograph.
Definition: mg_img_proc.cpp:423
Bmarker::loc
Vector3< float > loc
Definition: marker.h:25
Bmicrograph::tilt_angle
float tilt_angle
Definition: mg_processing.h:201
read_imod_xf
int read_imod_xf(Bstring &filename, Bproject *project)
Definition: mg2imod.cpp:254
option_kill
int option_kill(Boption *option)
Deallocates a linked list of option structures.
Definition: options.cpp:109
OBJT::contsize
int contsize
Definition: mg2imod.cpp:84
read_imod_xyz
int read_imod_xyz(Bstring &filename, Breconstruction *rec)
Definition: mg2imod.cpp:306
mg_processing.h
Header file for micrograph processing.
Breconstruction::frec
Bstring frec
Definition: mg_processing.h:270
IMODSIZE
#define IMODSIZE
Definition: mg2imod.cpp:27
rwimg.h
Header file for 2D and 3D image I/O.
OBJT::flags
uint flags
Definition: mg2imod.cpp:85
IMOD::yoffset
float yoffset
Definition: mg2imod.cpp:53
IMOD::alpha
float alpha
Definition: mg2imod.cpp:74
options.h
Header file for option handlers.
IMOD::res
int res
Definition: mg2imod.cpp:64
main
int main(int argc, char **argv)
Definition: mg2imod.cpp:185
OBJT::linesty
unsigned char linesty
Definition: mg2imod.cpp:134
Vector3::y
Type y()
Definition: Vector3.h:158
OBJT::pdrawsize
int pdrawsize
Definition: mg2imod.cpp:126
IMOD::gamma
float gamma
Definition: mg2imod.cpp:76
Bimage::images
long images()
Definition: Bimage.h:420
CONT::time
int time
Definition: mg2imod.cpp:155
Bstring::empty
bool empty()
Definition: Bstring.h:69
Breconstruction::origin
Vector3< float > origin
Definition: mg_processing.h:276
IMOD::thresh
int thresh
Definition: mg2imod.cpp:66
project_update_comment
int project_update_comment(Bproject *project, int n, char **strings)
Puts a set of strings and time in the main comment of a project.
Definition: rwmg.cpp:434
VERB_FULL
#define VERB_FULL
Definition: utilities.h:103
IMOD::zoffset
float zoffset
Definition: mg2imod.cpp:54
IMOD::csum
int csum
Definition: mg2imod.cpp:72
micrograph_add
Bmicrograph * micrograph_add(Bmicrograph **mg, Bstring &mg_id)
Adds a micrograph parameter structure to a linked list.
Definition: mg_processing.cpp:461
bexit
int bexit(int value)
Exit function for cleanup and debugging.
Definition: utilities.cpp:287
timer_start
double timer_start()
Starts timer and prints the time.
Definition: timer.cpp:52
Bmarker::sel
int sel
Definition: marker.h:29
tab
ostream & tab(ostream &out)
Definition: utilities.cpp:21
Bproject
Definition: mg_processing.h:316
string_kill
int string_kill(Bstring *list)
Kills a string linked list.
Definition: Bstring.cpp:785
CONT
Definition: mg2imod.cpp:145
write_IMOD_parameters
int write_IMOD_parameters(Bstring &imodfile, Bproject *project)
Creates IMOD parameter files from a project structure.
Definition: mg2imod.cpp:577
IMOD::point
int point
Definition: mg2imod.cpp:62
Bmicrograph::next
Bmicrograph * next
Definition: mg_processing.h:185