Bsoft  2.1.0
Bernard's software package
mg_processing.cpp
Go to the documentation of this file.
1 
9 #include "mg_processing.h"
10 #include "mg_select.h"
11 #include "mg_tags.h"
12 #include "qsort_functions.h"
13 #include "linked_list.h"
14 #include "math_util.h"
15 #include "random_numbers.h"
16 #include "utilities.h"
17 #include <fstream>
18 
19 // Declaration of global variables
20 extern int verbose; // Level of output to the screen
21 
22 
31 {
32  Bproject* project = new Bproject;
33  memset(project, 0, sizeof(Bproject));
34 
35  return project;
36 }
37 
48 Bproject* project_create(int nmg, int nrec)
49 {
50  int i, j=0;
51  Bstring id("1");
53  Bmicrograph* mg = NULL;
54  Breconstruction* rec = NULL;
55 
56  if ( nmg > 0 ) {
57  field_add(&project->field, id);
58  for ( i=0; i<nmg; i++, j++ ) {
59  id = Bstring(i, "%03d");
60  mg = micrograph_add(&project->field->mg, id);
61  mg->block = j;
62  mg->img_num = i;
63  }
64  }
65 
66  if ( nrec > 0 ) {
67  for ( i=0; i<nrec; i++, j++ ) {
68  id = Bstring(i, "%03d");
69  rec = reconstruction_add(&project->rec, id);
70  rec->block = j;
71  }
72  }
73 
74  if ( nmg < 1 && nrec > 0 ) project->select = 1;
75 
76  return project;
77 }
78 
89 {
90  Bfield* field;
91  Bmicrograph* mg;
92 
93  if ( verbose & VERB_PROCESS )
94  cout << "Setting micrograph and particle file names to be the same" << endl << endl;
95 
96  for ( field = project->field; field; field = field->next ) {
97  for ( mg = field->mg; mg; mg = mg->next ) {
98 // cout << "mg=" << mg->fmg << " part=" << mg->fpart << endl;
99  if ( mg->fmg.length() ) mg->fpart = mg->fmg;
100  else if ( mg->fpart.length() ) mg->fmg = mg->fpart;
101  else cerr << "No file name for micrograph " << mg->id << endl;
102 // cout << "mg=" << mg->fmg << " part=" << mg->fpart << endl;
103  }
104  }
105 
106  return 0;
107 }
108 
121 Bfield* field_add(Bfield** field, Bstring& field_id)
122 {
123  Bfield* this_field = *field;
124  Bfield* nu_field = new Bfield;
125  memset(nu_field, 0, sizeof(Bfield));
126 
127  if ( field_id.length() ) nu_field->id = field_id.c_str();
128 
129  nu_field->matrix = Matrix3(1);
130  nu_field->select = 1;
131 
132  if ( !this_field )
133  *field = nu_field;
134  else {
135  while ( this_field->next ) this_field = this_field->next;
136  this_field->next = nu_field;
137  }
138 
139  return nu_field;
140 }
141 
155 {
156  Bmicrograph* this_mg = *mg;
157  Bmicrograph* nu_mg = new Bmicrograph;
158  memset(nu_mg, 0, sizeof(Bmicrograph));
159 
160  if ( mg_id.length() ) nu_mg->id = mg_id;
161 
162  nu_mg->matrix = Matrix3(1);
163  nu_mg->select = 1;
164  nu_mg->scale = Vector3<double>(1,1,1);
165  nu_mg->pixel_size = Vector3<double>(1,1,1);
166 
167  if ( !this_mg )
168  *mg = nu_mg;
169  else {
170  while ( this_mg->next ) this_mg = this_mg->next;
171  this_mg->next = nu_mg;
172  }
173 
174  return nu_mg;
175 }
176 
189 Bframe* frame_add(Bframe** frame, int pid)
190 {
191  Bframe* this_frame = *frame;
192  Bframe* nu_frame = new Bframe;
193  memset(nu_frame, 0, sizeof(Bframe));
194 
195  nu_frame->id = pid;
196  nu_frame->fom = 1;
197  nu_frame->sel = 1;
198 
199  if ( !this_frame )
200  *frame = nu_frame;
201  else {
202  while ( this_frame->next ) this_frame = this_frame->next;
203  this_frame->next = nu_frame;
204  }
205 
206  return nu_frame;
207 }
208 
222 {
223  Bparticle* this_part = *part;
224  Bparticle* nu_part = new Bparticle;
225  memset(nu_part, 0, sizeof(Bparticle));
226 
227  nu_part->id = pid;
228  nu_part->group = 1;
229  nu_part->mag = 1;
230  nu_part->view[2] = 1;
231  nu_part->fom[0] = 1;
232  nu_part->sel = 1;
233 
234  if ( !this_part )
235  *part = nu_part;
236  else {
237  while ( this_part->next ) this_part = this_part->next;
238  this_part->next = nu_part;
239  }
240 
241  return nu_part;
242 }
243 
250 {
251  Bparticle* part;
252 
253 // cout << "Setting links from particles to micrographs" << endl;
254 
255  for ( part = mg->part; part; part = part->next ) part->mg = mg;
256 
257  return 0;
258 }
259 
266 {
267  Bparticle* part;
268 
269  for ( part = rec->part; part; part = part->next ) part->rec = rec;
270 
271  return 0;
272 }
273 
274 
284 {
285  Bfield* field;
286  Bmicrograph* mg;
287  Breconstruction* rec;
288  Bparticle* part = NULL;
289 
290  if ( project->select < 1 ) {
291  for ( field = project->field; field; field = field->next ) {
292  for ( mg = field->mg; mg; mg = mg->next ) {
293  part = mg->part;
294  if ( part ) return part;
295  }
296  }
297  } else {
298  for ( rec = project->rec; rec; rec = rec->next ) {
299  part = rec->part;
300  if ( part ) return part;
301  }
302  }
303 
304  return part;
305 }
306 
320 {
321  Bfilament* this_fil = *fil;
322  Bfilament* nu_fil = new Bfilament;
323  memset(nu_fil, 0, sizeof(Bfilament));
324 
325  nu_fil->id = pid;
326 
327  if ( !this_fil )
328  *fil = nu_fil;
329  else {
330  while ( this_fil->next ) this_fil = this_fil->next;
331  this_fil->next = nu_fil;
332  }
333 
334  return nu_fil;
335 }
336 
350 {
351  Bfilnode* this_fnode = *fnode;
352  Bfilnode* nu_fnode = new Bfilnode;
353  memset(nu_fnode, 0, sizeof(Bfilnode));
354 
355  nu_fnode->id = pid;
356 
357  if ( !this_fnode )
358  *fnode = nu_fnode;
359  else {
360  while ( this_fnode->next ) this_fnode = this_fnode->next;
361  this_fnode->next = nu_fnode;
362  }
363 
364  return nu_fnode;
365 }
366 
376 {
377  double length(0);
378  Bfilnode* fnode;
379 
380  for ( fnode=fil->node; fnode->next; fnode=fnode->next )
381  length += (fnode->loc - fnode->next->loc).length();
382 
383  return length;
384 }
385 
399 {
400  Breconstruction* this_rec = *rec;
401  Breconstruction* nu_rec = new Breconstruction;
402  memset(nu_rec, 0, sizeof(Breconstruction));
403 
404  if ( rec_id.length() ) nu_rec->id = rec_id;
405 
406  nu_rec->select = 1;
407  nu_rec->view[2] = 1;
408  nu_rec->scale = Vector3<double>(1,1,1);
409  nu_rec->voxel_size = Vector3<double>(1,1,1);
410 
411  if ( !this_rec )
412  *rec = nu_rec;
413  else {
414  while ( this_rec->next ) this_rec = this_rec->next;
415  this_rec->next = nu_rec;
416  }
417 
418  return nu_rec;
419 }
420 
430 {
431  if ( !project ) return 0;
432 
433  project->comment = 0;
434  project->filename = 0;
435 
437 
438  Bfield *field, *field2;
439  Breconstruction *rec, *rec2;
440 
441  for ( field = project->field; field; ) {
442  field2 = field->next;
443  field_kill(field);
444  field = field2;
445  }
446 
447  for ( rec = project->rec; rec; ) {
448  rec2 = rec->next;
449  reconstruction_kill(rec);
450  rec = rec2;
451  }
452 
453  delete project;
454 
455  return 0;
456 }
457 
466 int field_kill(Bfield* field)
467 {
468  if ( !field ) return 0;
469 
470  field->id = 0;
471 
472  Bmicrograph *mg, *mg2;
473 
474  for ( mg = field->mg; mg; ) {
475  mg2 = mg->next;
476  micrograph_kill(mg);
477  mg = mg2;
478  }
479 
480  delete field;
481 
482  return 0;
483 }
484 
494 {
495  if ( !mg ) return 0;
496 
497  mg->id = 0;
498  mg->fmg = 0;
499  mg->fframe = 0;
500  mg->fpart = 0;
501  mg->ffil = 0;
502  mg->fft = 0;
503  mg->fps = 0;
504 
505  delete mg->ctf;
506 
507  particle_kill(mg->part);
508  filament_kill(mg->fil);
509 
510  kill_list((char *) mg->bad, sizeof(Bbadarea));
511  kill_list((char *) mg->sf, sizeof(Bstrucfac));
512  kill_list((char *) mg->layer, sizeof(Blayerline));
513  kill_list((char *) mg->mark, sizeof(Bmarker));
514 
515  delete mg;
516 
517  return 0;
518 }
519 
529 {
530  if ( !part ) return 0;
531 
532  Bparticle *part2;
533 
534  for ( ; part; ) {
535  part2 = part->next;
536  part->fpart = 0;
537  delete part;
538  part = part2;
539  }
540 
541  return 0;
542 }
543 
553 {
554  if ( !fil ) return 0;
555 
556  Bfilament *fil2;
557  Bfilnode *fnode, *fnode2;
558 
559  for ( ; fil; ) {
560  for ( fnode=fil->node; fnode; ) {
561  fnode2 = fnode->next;
562  delete fnode;
563  fnode = fnode2;
564  }
565  fil2 = fil->next;
566  fil->ffil = 0;
567  delete fil;
568  fil = fil2;
569  }
570 
571  return 0;
572 }
573 
583 {
584  if ( !rec ) return 0;
585 
586  rec->id = 0;
587  rec->symmetry = 0;
588  rec->frec = 0;
589  rec->fpart = 0;
590  rec->ffil = 0;
591  rec->fft = 0;
592  rec->fps = 0;
593 
594  particle_kill(rec->part);
595  filament_kill(rec->fil);
596 
597  kill_list((char *) rec->bad, sizeof(Bbadarea));
598  kill_list((char *) rec->sf, sizeof(Bstrucfac));
599  kill_list((char *) rec->mark, sizeof(Bmarker));
600 
601  string_kill(rec->model);
602 
603  delete rec;
604 
605  return 0;
606 }
607 
615 {
616  int i;
617  Bparticle* partnu = NULL;
618 
619  partnu = particle_add(partlist, part->id);
620  partnu->fpart = part->fpart; // Particle image file name
621  partnu->group = part->group; // Group membership (such as filaments or crystals)
622  partnu->mag = part->mag; // Magnification
623  partnu->def = part->def; // Defocus (angstrom)
624  partnu->dev = part->dev; // Defocus deviation (angstrom)
625  partnu->ast = part->ast; // Astigmatism angle (radians)
626  partnu->loc = part->loc; // Coordinates in the micrograph or tomogram
627  partnu->pixel_size = part->pixel_size; // Sampling in angstrom/pixel
628  partnu->ori = part->ori; // Origin of particle in voxel units
629  partnu->view = part->view; // View: 3-value vector and angle (radians)
630  for ( i=0; i<NFOM; i++ ) partnu->fom[i] = part->fom[i]; // Figure-of-merit, types defined in project structure
631  partnu->sel = part->sel; // Selection flag
632  partnu->mg = part->mg;
633  partnu->rec = part->rec;
634 
635  return partnu;
636 }
637 
644 {
645  Bparticle* part;
646  Bparticle* partlistnu = NULL;
647 
648  for ( part = partlist; part; part = part->next )
649  particle_copy(&partlistnu, part);
650 
651  return partlistnu;
652 }
653 
655 {
656  Bbadarea* bad;
657  Bbadarea* badnu = NULL;
658  Bbadarea* badlistnu = NULL;
659 
660  for ( bad = badlist; bad; bad = bad->next ) {
661  badnu = (Bbadarea *) add_item((char **) &badlistnu, sizeof(Bbadarea));
662  badnu->id = bad->id;
663  badnu->loc = bad->loc;
664  }
665 
666  return badlistnu;
667 }
668 
670 {
671  Bfilament* fil;
672  Bfilament* filnu = NULL;
673  Bfilament* fillistnu = NULL;
674  Bfilnode* fnode = NULL;
675  Bfilnode* fnodenu = NULL;
676 
677  for ( fil = fillist; fil; fil = fil->next ) {
678  filnu = filament_add(&fillistnu, fil->id);
679  filnu->ffil = fil->ffil;
680  for ( fnode = fil->node; fnode; fnode = fnode->next ) {
681  fnodenu = filament_node_add(&filnu->node, fnode->id);
682  fnodenu->loc = fnode->loc;
683  }
684  }
685 
686  return fillistnu;
687 }
688 
690 {
691  Bstrucfac* sf;
692  Bstrucfac* sfnu = NULL;
693  Bstrucfac* sflistnu = NULL;
694 
695  for ( sf = sflist; sf; sf = sf->next ) {
696  sfnu = (Bstrucfac *) add_item((char **) &sflistnu, sizeof(Bstrucfac));
697  sfnu->loc = sf->loc; // Coordinates in the transform
698  sfnu->index = sf->index; // Miller indices
699  sfnu->amp = sf->amp; // Amplitude
700  sfnu->sigamp = sf->sigamp; // Amplitude deviation
701  sfnu->phi = sf->phi; // Phase
702  sfnu->sigphi = sf->sigphi; // Phase deviation
703  sfnu->fom = sf->fom; // Figure-of-merit
704  sfnu->sel = sf->sel; // Selection flag
705  }
706 
707  return sflistnu;
708 }
709 
711 {
712  Blayerline* line;
713  Blayerline* linenu = NULL;
714  Blayerline* linelistnu = NULL;
715 
716  for ( line = layerlist; line; line = line->next ) {
717  linenu = (Blayerline *) add_item((char **) &linelistnu, sizeof(Blayerline));
718  linenu->number = line->number; // Layer line number
719  linenu->order = line->order; // Bessel order
720  linenu->distance = line->distance; // Distance along helical axis from origin
721  linenu->freq = line->freq; // Spatial frequency
722  linenu->amp = line->amp; // Amplitude
723  linenu->fom = line->fom; // Figure-of-merit
724  linenu->sel = line->sel; // Selection flag
725  }
726 
727  return linelistnu;
728 }
729 
736 {
737  Bmicrograph* mgnu = NULL;
738 
739  if ( verbose & VERB_FULL )
740  cout << "Copying micrograph " << mg->id << endl;
741 
742  micrograph_add(&mgnu, mg->id);
743 
744  mgnu->select = mg->select;
745  mgnu->fmg = mg->fmg; // Micrograph image file
746  mgnu->fframe = mg->fframe; // Micrograph frames image file
747  mgnu->fpart = mg->fpart; // Image file with picked particles
748  mgnu->ffil = mg->ffil; // Image file with filaments
749  mgnu->fft = mg->fft; // Image file with Fourier transform
750  mgnu->fps = mg->fps; // Image file with power spectrum
751  mgnu->img_num = mg->img_num; // Image number in file
752  mgnu->magnification = mg->magnification; // Microscope magnification
753  mgnu->sampling = mg->sampling; // Scanner sampling (angstrom)
754  mgnu->pixel_size = mg->pixel_size; // Nominal micrograph pixel size
755  mgnu->dose = mg->dose; // Direct beam/Dose
756  mgnu->intensity = mg->intensity; // Micrograph average
757  mgnu->tilt_axis = mg->tilt_axis; // Tilt axis angle, origin at x-axis (radians)
758  mgnu->tilt_angle = mg->tilt_angle; // Tilt angle, right-handed around tilt axis (radians)
759  mgnu->level_angle = mg->level_angle; // Level angle (radians)
760  mgnu->rot_angle = mg->rot_angle; // In-plane rotation angle of micrograph or specimen (radians)
761  mgnu->origin = mg->origin; // Origin within field-of-view
762  mgnu->scale = mg->scale; // Scale with respect to field-of-view
763  mgnu->matrix = mg->matrix; // Rotation matrix
764  mgnu->box_size = mg->box_size; // Particle size
765  mgnu->bad_radius = mg->bad_radius; // Radius of bad area around coordinates
766  mgnu->filament_width = mg->filament_width; // Filament width
767  mgnu->fil_node_radius = mg->fil_node_radius;// Radius of filament node
768  mgnu->sf_radius = mg->sf_radius; // Radius of marker
769  mgnu->mark_radius = mg->mark_radius; // Radius of marker
770  mgnu->fom = mg->fom; // Micrograph figure-of-merit
771 
772  if ( mg->ctf ) mgnu->ctf->update(mg->ctf);
773 
774  mgnu->part = particle_copy(mg->part);
775 
776  mgnu->bad = particle_bad_copy(mg->bad);
777 
778  mgnu->fil = filament_copy(mg->fil);
779 
780  mgnu->sf = structurefactor_copy(mg->sf);
781 
782  mgnu->layer = layerline_copy(mg->layer);
783 
784  mgnu->mark = markers_copy(mg->mark);
785 
786  return mgnu;
787 }
788 
789 
809 int project_update(Bproject* project, Bproject* proj_new, int fom_index)
810 {
811  int notfound;
812  Bfield *field, *nu_field;
813  Bmicrograph *mg = NULL, *nu_mg;
814  Breconstruction *rec = NULL, *nu_rec;
815 
816  for ( nu_field = proj_new->field; nu_field; nu_field = nu_field->next ) {
817  for ( nu_mg = nu_field->mg; nu_mg; nu_mg = nu_mg->next ) {
818  notfound = 1;
819  for ( field = project->field; field && notfound; field = field->next ) {
820  for ( mg = field->mg; mg && notfound; ) {
821  if ( mg->id == nu_mg->id )
822  notfound = 0;
823  else
824  mg = mg->next;
825  }
826  }
827  if ( notfound )
828  cerr << "Error: Micrograph " << nu_mg->id << " not found!" << endl;
829  else
830  micrograph_update(mg, nu_mg, fom_index, 63);
831  }
832  }
833 
834  for ( nu_rec = proj_new->rec; nu_rec; nu_rec = nu_rec->next ) {
835  notfound = 1;
836  for ( rec = project->rec; rec && notfound; ) {
837  if ( rec->id == nu_rec->id )
838  notfound = 0;
839  else
840  rec = rec->next;
841  }
842  if ( notfound )
843  cerr << "Error: Reconstruction " << nu_rec->id << " not found!" << endl;
844  else
845  reconstruction_update(rec, nu_rec, fom_index, 63);
846  }
847 
848  return 0;
849 }
850 
878 int micrograph_update(Bmicrograph* mg, Bmicrograph* nu_mg, int fom_index, int flags)
879 {
880  if ( nu_mg->select < 1 ) return 0;
881 
882  if ( verbose & VERB_DEBUG )
883  cout << "DEBUG micrograph_update: " << nu_mg->id << tab << nu_mg->select << tab << flags << endl;
884 
885  if ( verbose & VERB_FULL )
886  cout << "Updating micrograph " << mg->id << endl;
887 
888  mg->select = nu_mg->select;
889  if ( nu_mg->fmg.length() ) mg->fmg = nu_mg->fmg; // Micrograph image file
890  if ( nu_mg->fframe.length() ) mg->fframe = nu_mg->fframe; // Micrograph frames image file
891  if ( nu_mg->fpart.length() ) mg->fpart = nu_mg->fpart; // Image file with picked particles
892  if ( nu_mg->ffil.length() ) mg->ffil = nu_mg->ffil; // Image file with filaments
893  if ( nu_mg->fft.length() ) mg->fft = nu_mg->fft; // Image file with Fourier transform
894  if ( nu_mg->fps.length() ) mg->fps = nu_mg->fps; // Image file with power spectrum
895  if ( nu_mg->img_num ) mg->img_num = nu_mg->img_num; // Image number in file
896  if ( nu_mg->magnification ) mg->magnification = nu_mg->magnification; // Microscope magnification
897  if ( nu_mg->sampling ) mg->sampling = nu_mg->sampling; // Scanner sampling (angstrom)
898  if ( nu_mg->pixel_size[0] ) mg->pixel_size = nu_mg->pixel_size; // Nominal micrograph pixel size
899  if ( nu_mg->dose ) mg->dose = nu_mg->dose; // Direct beam/Dose
900  if ( nu_mg->intensity ) mg->intensity = nu_mg->intensity; // Micrograph average
901  if ( nu_mg->tilt_axis ) mg->tilt_axis = nu_mg->tilt_axis; // Tilt axis angle, origin at x-axis (radians)
902  if ( nu_mg->tilt_angle ) mg->tilt_angle = nu_mg->tilt_angle; // Tilt angle, right-handed around tilt axis (radians)
903  if ( nu_mg->rot_angle ) mg->rot_angle = nu_mg->rot_angle; // In-plane rotation angle of micrograph or specimen (radians)
904  if ( nu_mg->origin.length2() ) mg->origin = nu_mg->origin; // Origin within field-of-view
905  if ( nu_mg->scale.length2() ) mg->scale = nu_mg->scale; // Scale with respect to field-of-view
906  if ( nu_mg->box_size[0] ) mg->box_size = nu_mg->box_size; // Particle size
907  if ( nu_mg->bad_radius ) mg->bad_radius = nu_mg->bad_radius; // Radius of bad area around coordinates
908  if ( nu_mg->mark_radius ) mg->mark_radius = nu_mg->mark_radius; // Radius of marker
909 
910  if ( nu_mg->ctf ) {
911  if ( !mg->ctf ) mg->ctf = new CTFparam;
912  mg->ctf->update(nu_mg->ctf);
913  }
914 
915  if ( flags & 1)
916  particle_update(&mg->part, nu_mg->part, fom_index);
917 
918  if ( (flags & 2) && nu_mg->bad ) {
919  if ( verbose & VERB_PROCESS )
920  cout << "Replacing bad areas" << endl;
921  kill_list((char *) mg->bad, sizeof(Bbadarea));
922  mg->bad = nu_mg->bad;
923  nu_mg->bad = NULL;
924  }
925 
926  if ( (flags & 4) && nu_mg->fil ) {
927  if ( verbose & VERB_PROCESS )
928  cout << "Replacing filaments" << endl;
929  kill_list((char *) mg->fil, sizeof(Bfilament));
930  mg->fil = nu_mg->fil;
931  nu_mg->fil = NULL;
932  }
933 
934  if ( (flags & 8) && nu_mg->sf ) {
935  if ( verbose & VERB_PROCESS )
936  cout << "Replacing structure factors" << endl;
937  kill_list((char *) mg->sf, sizeof(Bstrucfac));
938  mg->sf = nu_mg->sf;
939  nu_mg->sf = NULL;
940  }
941 
942  if ( (flags & 16) && nu_mg->layer ) {
943  if ( verbose & VERB_PROCESS )
944  cout << "Replacing layer lines" << endl;
945  kill_list((char *) mg->layer, sizeof(Blayerline));
946  mg->layer = nu_mg->layer;
947  nu_mg->layer = NULL;
948  }
949 
950  if ( (flags & 32) && nu_mg->mark ) {
951  if ( verbose & VERB_FULL )
952  cout << "Replacing markers" << endl;
953  kill_list((char *) mg->mark, sizeof(Bmarker));
954  mg->mark = nu_mg->mark;
955  nu_mg->mark = NULL;
956  }
957 
958  return 0;
959 }
960 
982 int reconstruction_update(Breconstruction* rec, Breconstruction* nu_rec, int fom_index, int flags)
983 {
984  if ( nu_rec->select < 1 ) return 0;
985 
986  if ( verbose & VERB_DEBUG )
987  cout << "DEBUG reconstruction_update: " << nu_rec->id << tab << nu_rec->select << tab << flags << endl;
988 
989  if ( verbose & VERB_FULL )
990  cout << "Updating reconstruction " << rec->id << endl;
991 
992  rec->select = nu_rec->select;
993  rec->fom = nu_rec->fom;
994  if ( nu_rec->symmetry.length() ) rec->symmetry = nu_rec->symmetry; // Reconstruction symmetry
995  if ( nu_rec->frec.length() ) rec->frec = nu_rec->frec; // Reconstruction image file
996  if ( nu_rec->fpart.length() ) rec->fpart = nu_rec->fpart; // Image file with picked particles
997  if ( nu_rec->ffil.length() ) rec->ffil = nu_rec->ffil; // Image file with filaments
998  if ( nu_rec->fft.length() ) rec->fft = nu_rec->fft; // Image file with Fourier transform
999  if ( nu_rec->fps.length() ) rec->fps = nu_rec->fps; // Image file with power spectrum
1000  if ( nu_rec->voxel_size[0] ) rec->voxel_size = nu_rec->voxel_size; // Nominal voxel size
1001  if ( nu_rec->origin.length2() ) rec->origin = nu_rec->origin; // Origin within field-of-view
1002  if ( nu_rec->scale.length2() ) rec->scale = nu_rec->scale; // Scale with respect to field-of-view
1003  if ( nu_rec->box_size[0] ) rec->box_size = nu_rec->box_size; // Particle size
1004  if ( nu_rec->bad_radius ) rec->bad_radius = nu_rec->bad_radius; // Radius of bad area around coordinates
1005  if ( nu_rec->mark_radius ) rec->mark_radius = nu_rec->mark_radius; // Radius of marker
1006  rec->view = nu_rec->view; // Reconstruction orientation
1007 
1008  if ( flags & 1)
1009  particle_update(&rec->part, nu_rec->part, fom_index);
1010 
1011  return 0;
1012 }
1013 
1027 {
1028  if ( nu_part->def > 0 ) {
1029  part->def = nu_part->def;
1030  part->dev = nu_part->dev;
1031  part->ast = nu_part->ast;
1032  }
1033 
1034  if ( nu_part->mag > 0 && nu_part->mag != 1 )
1035  part->mag = nu_part->mag;
1036 
1037  if ( nu_part->loc.length2() > 0 )
1038  part->loc = nu_part->loc;
1039 
1040  if ( nu_part->pixel_size.volume() > 0 )
1041  part->pixel_size = nu_part->pixel_size;
1042 
1043  if ( nu_part->ori.length2() > 0 )
1044  part->ori = nu_part->ori;
1045 
1046  if ( nu_part->view.vector_size() > 0.1 )
1047  part->view = nu_part->view;
1048 
1049  for ( int f=0; f<NFOM; f++ )
1050  if ( nu_part->fom[f] ) part->fom[f] = nu_part->fom[f];
1051 
1052  part->sel = nu_part->sel;
1053 
1054  if ( nu_part->fpart.length() )
1055  part->fpart = nu_part->fpart;
1056 
1057  return 0;
1058 }
1059 
1073 int particle_update(Bparticle** pnt_part, Bparticle* nu_part, int fom_index)
1074 {
1075  if ( verbose & VERB_FULL )
1076  cout << "Updating particles" << endl;
1077 
1078  int notfound(1), set_new(0);
1079  Bparticle* part;
1080 
1081  for ( ; nu_part; nu_part = nu_part->next ) {
1082  notfound = 1;
1083  set_new = 0;
1084  for ( part = *pnt_part; part && notfound; ) {
1085  if ( part->id == nu_part->id ) notfound = 0;
1086  else part = part->next;
1087  }
1088  if ( notfound ) {
1089  cerr << "Particle " << nu_part->id << " not found!" << endl;
1090  part = particle_add(pnt_part, nu_part->id);
1091  part->group = 0;
1092  part->sel = 0;
1093  part->fom[fom_index] = 0;
1094  set_new = 1;
1095  }
1096  if ( nu_part->sel > 0 ) {
1097  set_new = 1;
1098  if ( part->sel > 0 ) {
1099  if ( nu_part->fom[fom_index] < part->fom[fom_index] ) set_new = 0;
1100 // if ( nu_part->fom[fom_index] > 0.999 && nu_part->view[2] > 0.999 ) set_new = 0;
1101  }
1102  }
1103  if ( verbose & VERB_DEBUG )
1104  cout << "DEBUG particle_update: " << part->id << tab << part->sel << tab << nu_part->sel << tab
1105  << part->fom[fom_index] << tab << nu_part->fom[fom_index] << tab << set_new << endl;
1106  if ( set_new ) particle_update(part, nu_part);
1107  }
1108 
1109  return 0;
1110 }
1111 
1119 {
1120  if ( !project || ! partproject ) return 0;
1121 
1122  Bfield *field, *partfield;
1123  Bmicrograph *mg, *partmg;
1124  Breconstruction *rec, *partrec;
1125 
1126  if ( verbose & VERB_PROCESS )
1127  cout << "Merging particle parameters into the main project" << endl << endl;
1128 
1129  for ( field=project->field, partfield=partproject->field; field; field=field->next, partfield=partfield->next ) {
1130  for ( mg=field->mg, partmg=partfield->mg; mg && partmg; mg=mg->next, partmg=partmg->next ) {
1131  particle_update(&mg->part, partmg->part, 0);
1132  }
1133  }
1134 
1135  for ( rec=project->rec, partrec=partproject->rec; rec && partrec; rec=rec->next, partrec=partrec->next ) {
1136  particle_update(&rec->part, partrec->part, 0);
1137  }
1138 
1139  return 0;
1140 }
1141 
1142 
1149 {
1150  long npart(0);
1151  Bfield* field;
1152  Bmicrograph* mg;
1153  Breconstruction* rec;
1154 
1155  for ( field = project->field; field; field = field->next )
1156  for ( mg = field->mg; mg; mg = mg->next )
1157  npart += micrograph_set_part_links(mg);
1158 
1159  for ( rec = project->rec; rec; rec = rec->next )
1160  npart += reconstruction_set_part_links(rec);
1161 
1162  return npart;
1163 }
1164 
1171 {
1172  long npart(0);
1173  Bparticle* part;
1174 
1175  for ( part = mg->part; part; part = part->next, npart++ ) part->mg = mg;
1176 
1177  return npart;
1178 }
1179 
1186 {
1187  long npart(0);
1188  Bparticle* part;
1189 
1190  for ( part = rec->part; part; part = part->next, npart++ ) part->rec = rec;
1191 
1192  return npart;
1193 }
1194 
1205 {
1206  long i, j, k, t, nmg(0), nrec(0), ndiv(0);
1207  Bproject* project2 = project;
1208  Bfield* field, *field_prev;
1209  Bmicrograph* mg;
1210  Breconstruction* rec, *rec_prev;
1211 
1212  for ( nmg=0, field = project->field; field; field = field->next )
1213  for ( mg = field->mg; mg; mg = mg->next ) if ( mg->select)
1214  nmg++;
1215 
1216  for ( nrec=0, rec = project->rec; rec; rec = rec->next )
1217  if ( rec->select ) nrec++;
1218 
1219  field = field_prev = project->field;
1220  rec = rec_prev = project->rec;
1221 
1222  for ( i=j=k=0; i<n; i++ ) {
1223  t = (nmg*(i+1))/n;
1224  for ( ; field && j<t; field_prev = field, field = field->next )
1225  for ( mg = field->mg; mg; mg = mg->next )
1226  if ( mg->select) j++;
1227  t = (nrec*(i+1))/n;
1228  for ( ; rec && k<t; rec_prev = rec, rec = rec->next )
1229  if ( rec->select) k++;
1230  if ( field || rec ) {
1231  if ( field_prev ) field_prev->next = NULL;
1232  if ( rec_prev ) rec_prev->next = NULL;
1233  project2->next = project_init();
1234  project2 = project2->next;
1235  project2->field = field;
1236  project2->rec = rec;
1237  for ( i=0; i<NFOM; i++ ) project2->fom_tag[i] = project->fom_tag[i];
1238  ndiv++;
1239  }
1240  }
1241 
1242  return ndiv;
1243 }
1244 
1255 {
1256  Bfield* field;
1257  Bmicrograph* mg;
1258 
1259  for ( nmg=0, field=project->field; field; field=field->next )
1260  for ( mg = field->mg; mg; mg = mg->next ) if ( mg->select)
1261  nmg++;
1262 
1263  Bmicrograph** mgarr = new Bmicrograph*[nmg];
1264 
1265  for ( nmg=0, field=project->field; field; field=field->next )
1266  for ( mg = field->mg; mg; mg = mg->next ) if ( mg->select)
1267  mgarr[nmg++] = mg;
1268 
1269  return mgarr;
1270 }
1271 
1283 {
1284  Bfield* field;
1285  Bmicrograph* mg;
1286  Bparticle* part;
1287 
1288  for ( npart=0, field=project->field; field; field=field->next ) {
1289  for ( mg = field->mg; mg; mg = mg->next ) {
1290  for ( part = mg->part; part; part = part->next ) {
1291  part->mg = mg;
1292  if ( ( part_select<0 && part->sel ) || ( part->sel==part_select ) )
1293  npart++;
1294  else
1295  part->fom[0] = part->fom[1] = part->sel = 0;
1296  }
1297  }
1298  }
1299 
1300  Bparticle** partarr = new Bparticle*[npart];
1301 
1302  for ( npart=0, field=project->field; field; field=field->next ) {
1303  for ( mg = field->mg; mg; mg = mg->next ) {
1304  for ( part = mg->part; part; part = part->next ) {
1305  if ( ( part_select<0 && part->sel ) || ( part->sel==part_select ) )
1306  partarr[npart++] = part;
1307  }
1308  }
1309  }
1310 
1311  return partarr;
1312 }
1313 
1325 {
1326  Breconstruction* rec;
1327  Bparticle* part;
1328 
1329  for ( npart=0, rec=project->rec; rec; rec=rec->next ) {
1330  for ( part = rec->part; part; part = part->next ) {
1331  if ( ( part_select<0 && part->sel ) || ( part->sel==part_select ) )
1332  npart++;
1333  else
1334  part->fom[0] = part->fom[1] = part->sel = 0;
1335  }
1336  }
1337 
1338  Bparticle** partarr = new Bparticle*[npart];
1339 
1340  for ( npart=0, rec=project->rec; rec; rec=rec->next ) {
1341  for ( part = rec->part; part; part = part->next ) {
1342  if ( ( part_select<0 && part->sel ) || ( part->sel==part_select ) )
1343  partarr[npart++] = part;
1344  }
1345  }
1346 
1347  return partarr;
1348 }
1349 
1360 Bparticle** particle_array(Bparticle* partlist, int part_select, long &npart)
1361 {
1362  Bparticle* part;
1363 
1364  for ( npart=0, part = partlist; part; part = part->next ) {
1365  if ( ( part_select<0 && part->sel ) || ( part->sel==part_select ) )
1366  npart++;
1367  else
1368  part->fom[0] = part->fom[1] = part->sel = 0;
1369  }
1370 
1371  Bparticle** partarr = new Bparticle*[npart];
1372 
1373  for ( npart=0, part = partlist; part; part = part->next )
1374  if ( ( part_select<0 && part->sel ) || ( part->sel==part_select ) )
1375  partarr[npart++] = part;
1376 
1377  return partarr;
1378 }
1379 
1380 
1388 int project_revert_filenames(Bproject* project, Bproject* project_old, int flag)
1389 {
1390  if ( !project ) return 0;
1391  if ( !project_old ) return 0;
1392 
1393  Bfield* field, *field_old;
1394  Bmicrograph* mg, *mg_old;
1395  Breconstruction* rec, *rec_old;
1396  Bparticle* part, *part_old;
1397 
1398  if ( verbose & VERB_PROCESS )
1399  cout << "Reverting to old particle file names in: " << project_old->filename << endl << endl;
1400 
1401  for ( field = project->field; field; field = field->next ) {
1402  for ( field_old = project_old->field; field_old && field_old->id != field->id; field_old = field_old->next ) ;
1403  if ( field_old ) {
1404  for ( mg = field->mg; mg; mg = mg->next ) {
1405  for ( mg_old = field_old->mg; mg_old && mg_old->id != mg->id; mg_old = mg_old->next ) ;
1406  if ( mg_old ) {
1407  if ( flag & 1 ) mg->fmg = mg_old->fmg;
1408  if ( flag & 16 ) mg->fframe = mg_old->fframe;
1409  if ( flag & 2 ) mg->fps = mg_old->fps;
1410  if ( flag & 8 ) {
1411  mg->fpart = mg_old->fpart;
1412  part_old = mg_old->part;
1413  for ( part = mg->part; part; part = part->next ) {
1414  for ( ; part_old && part_old->id != part->id; part_old = part_old->next ) ;
1415  if ( part_old ) {
1416  part->fpart = part_old->fpart;
1417  }
1418  }
1419  }
1420  }
1421  }
1422  }
1423  }
1424 
1425  for ( rec = project->rec; rec; rec = rec->next ) {
1426  for ( rec_old = project_old->rec; rec_old && rec_old->id != rec->id; rec_old = rec_old->next ) ;
1427  if ( rec_old ) {
1428  if ( flag & 4 ) rec->frec = rec_old->frec;
1429  if ( flag & 8 ) {
1430  part_old = rec_old->part;
1431  for ( part = rec->part; part; part = part->next ) {
1432  for ( ; part_old && part_old->id != part->id; part_old = part_old->next ) ;
1433  if ( part_old ) {
1434  part->fpart = part_old->fpart;
1435  }
1436  }
1437  }
1438  }
1439  }
1440 
1441  return 0;
1442 }
1443 
1456 int project_set_field_id(Bproject* project, int nseries, Bstring& field_id)
1457 {
1458  int i(0), nf(0);
1459  Bfield* field;
1460  Bfield* nu_field = NULL;
1461  Bfield* nu_field_start = NULL;
1462  Bmicrograph* mg = NULL;
1463  Bmicrograph* nu_mg = NULL;
1464 
1465  for ( field = project->field; field; field = field->next ) {
1466  for ( mg = field->mg; mg; mg = mg->next ) {
1467  if ( i%nseries == 0 ) {
1468  nu_field = field_add(&nu_field, mg->id);
1469  if ( i == 0 ) nu_field_start = nu_field;
1470  else nu_mg->next = NULL;
1471  nu_field->mg = nu_mg = mg;
1472  nf++;
1473  } else {
1474  nu_mg->next = mg;
1475  nu_mg = mg;
1476  }
1477  i++;
1478  }
1479  }
1480 
1481  for ( field=project->field; field; ) {
1482  nu_field = field->next;
1483  delete field;
1484  field = nu_field;
1485  }
1486 
1487  project->field = nu_field_start;
1488 
1489  if ( field_id.length() > 0 ) {
1490  if ( nf < 2 ) {
1491  project->field->id = field_id;
1492  } else {
1493  for ( i=1, field = project->field; field; field = field->next, i++ )
1494  field->id = field_id + Bstring(i, "_%04d");
1495  }
1496  }
1497 
1498  return 0;
1499 }
1500 
1507 {
1508  if ( !project ) return 0;
1509 
1510  if ( !verbose ) return 0;
1511 
1512  long i, j, k, l, nf(0), nmg(0), nmgsel(0);
1513  long npart(0), nsel(0), nfil(0), nfn(0);
1514  double nmgpercent(0), npercent(0);
1515  int g;
1516  Bfield* field = project->field;
1517  Breconstruction* rec = project->rec;
1518  Bmicrograph* mg;
1519  Bparticle* part;
1520 
1521  long gmax = 10000000;
1522  int* ng = new int[gmax];
1523  for ( i=0; i<gmax; i++ ) ng[i] = 0;
1524 
1525  if ( verbose > VERB_RESULT )
1526  cout << "Project hierarchy:" << endl;
1527  if ( field ) {
1528  for ( field = project->field; field; field = field->next, nf++ ) {
1529  if ( verbose > VERB_RESULT )
1530  cout << "Field: " << field->id << " (" << field->select << ")" << endl;
1531  for ( mg = field->mg; mg; mg = mg->next, nmg++ ) {
1532  if ( mg->select ) nmgsel++;
1533  for ( part = mg->part; part; part = part->next ) {
1534  g = part->group;
1535  if ( g >= gmax ) g = gmax-1;
1536  ng[g]++;
1537  }
1538  i = particle_count(mg->part);
1539  j = particle_count_selected(mg->part);
1540  k = filament_count(mg->fil);
1541  l = filament_node_count(mg->fil);
1542  npart += i;
1543  nsel += j;
1544  nfil += k;
1545  nfn += l;
1546  if ( verbose > VERB_RESULT )
1547  cout << "\tMicrograph: " << mg->id << " ("
1548  << mg->select << ")\tParticles: " << i << " ("
1549  << j << ")\tFilaments: " << k << " (" << l << ")" << endl;
1550  }
1551  }
1552  if ( nmg ) nmgpercent = nmgsel*100.0/nmg;
1553  if ( npart ) npercent = nsel*100.0/npart;
1554  cout << "Totals:" << endl;
1555  cout << nf << " fields\t" << nmg << " micrographs\t"
1556  << nmgsel << " selected\t(" << nmgpercent << "%)" << endl;
1557  if ( npart )
1558  cout << npart << " particles\t" << nsel << " selected\t("
1559  << npercent << "%)" << endl;
1560  if ( nfil )
1561  cout << nfil << " filaments\t" << nfn << " filament nodes" << endl;
1562  if ( npart ) {
1563  cout << "Group\tCount" << endl;
1564  for ( g=0; g<gmax; g++ ) if ( ng[g] )
1565  cout << g << tab << ng[g] << endl;
1566  }
1567  }
1568 
1569  for ( g=0; g<gmax; g++ ) ng[g] = 0;
1570  if ( rec ) {
1571  npart = nsel = nfil = nfn = 0;
1572  npercent = 0;
1573  for ( rec = project->rec; rec; rec = rec->next ) {
1574  for ( part = rec->part; part; part = part->next ) {
1575  g = part->group;
1576  if ( g >= gmax ) g = gmax-1;
1577  ng[g]++;
1578  }
1579  if ( verbose > VERB_RESULT ) {
1580  cout << "Reconstruction: " << rec->id;
1581  if ( rec->frec.length() ) cout << ", " << rec->frec;
1582  cout << endl;
1583  }
1584  i = particle_count(rec->part);
1585  j = particle_count_selected(rec->part);
1586  k = filament_count(rec->fil);
1587  l = filament_node_count(rec->fil);
1588  npart += i;
1589  nsel += j;
1590  nfil += k;
1591  nfn += l;
1592  if ( verbose > VERB_RESULT )
1593  cout << "\tParticles: " << i << " (" << j << ")\tFilaments: " << k << " (" << l << ")" << endl;
1594  }
1595  if ( npart ) npercent = nsel*100.0/npart;
1596  cout << "Totals:\t" << npart << " particles\t" << nsel << " selected\t("
1597  << npercent << "%)\t" << nfil << " filaments\t" << nfn << " filament nodes" << endl;
1598  if ( npart ) {
1599  cout << "Group\tCount" << endl;
1600  for ( g=0; g<gmax; g++ ) if ( ng[g] )
1601  cout << g << tab << ng[g] << endl;
1602  }
1603  }
1604 
1605  cout << endl;
1606 
1607  delete[] ng;
1608 
1609  return nsel;
1610 }
1611 
1618 {
1619  if ( !verbose ) return 0;
1620 
1621  if ( !project->class_avg ) return 0;
1622 
1623  long n(0);
1625  Bparticle* part;
1626 
1627  cout << "Class averages:" << endl;
1628  cout << "Class\tNumber\t % \tFOM" << endl;
1629  for ( part = project->class_avg; part; part = part->next ) {
1630  cout << part->id << tab << part->sel << tab <<
1631  setw(8) << part->sel*100.0/npart << tab <<
1632  part->fom[0] << endl;
1633  n++;
1634  }
1635  cout << endl;
1636 
1637  return n;
1638 }
1639 
1647 {
1648  if ( !project ) return 0;
1649 
1650  int f;
1651  long i, j, npart(0), nsel(0);
1652  double npercent(0);
1653  Euler euler;
1654  Bfield* field;
1655  Bmicrograph* mg;
1656  Bparticle* part;
1657  Breconstruction* rec;
1658 
1659  ofstream fd(filename.c_str());
1660  if ( fd.fail() ) return -1;
1661 
1662  fd << "Project hierarchy:" << endl;
1663  for ( field = project->field; field; field = field->next ) {
1664  fd << "Field: " << field->id << endl;
1665  for ( mg = field->mg; mg; mg = mg->next ) {
1666  i = particle_count(mg->part);
1667  j = particle_count_selected(mg->part);
1668  npart += i;
1669  nsel += j;
1670  fd << "Micrograph: " << mg->id << tab << i << " particles\t" << j << " selected" << endl;
1671  if ( !project->euler_flag ) fd << "ID\tox\toy\toz\tvx\tvy\tvz\tva";
1672  else fd << "ID\tox\toy\toz\tphi\ttheta\tpsi";
1673  for ( f=0; f<NFOM; f++ ) fd << "\tFOM" << f;
1674  fd << endl;
1675  for ( part = mg->part; part; part = part->next ) {
1676  if ( part->sel ) {
1677  if ( !project->euler_flag ) {
1678  fd << part->id << tab << part->ori[0] << tab
1679  << part->ori[1] << tab << part->ori[2] << tab
1680  << part->view[0] << tab << part->view[1] << tab
1681  << part->view[2] << tab << part->view.angle()*180/M_PI;
1682  } else {
1683  euler = Euler(part->view);
1684  fd << part->id << tab << part->ori[0] << tab
1685  << part->ori[1] << tab << part->ori[2] << tab
1686  << euler.phi()*180/M_PI << tab << euler.theta()*180/M_PI
1687  << tab << euler.psi()*180/M_PI;
1688  }
1689  for ( f=0; f<NFOM; f++ ) fd << tab << part->fom[f];
1690  fd << endl;
1691  }
1692  }
1693  fd << endl;
1694  }
1695  }
1696  if ( npart ) npercent = nsel*100.0/npart;
1697  fd << "Totals:\t" << npart << " particles\t" << nsel << " selected\t(" << npercent << "%)" << endl << endl;
1698 
1699  if ( project->rec && project->rec->part ) {
1700  for ( npart=nsel=0, rec = project->rec; rec; rec = rec->next ) {
1701  i = particle_count(rec->part);
1702  j = particle_count_selected(rec->part);
1703  npart += i;
1704  nsel += j;
1705  fd << "Reconstruction: " << rec->id << tab << i << " particles\t" << j << " selected" << endl;
1706  if ( !project->euler_flag ) fd << "ID\tox\toy\toz\tvx\tvy\tvz\tva";
1707  else fd << "ID\tox\toy\toz\tphi\ttheta\tpsi";
1708  for ( f=0; f<NFOM; f++ ) fd << "\tFOM" << f;
1709  fd << endl;
1710  for ( part = rec->part; part; part = part->next ) {
1711  if ( part->sel ) {
1712  if ( !project->euler_flag ) {
1713  fd << part->id << tab << part->ori[0] << tab
1714  << part->ori[1] << tab << part->ori[2] << tab
1715  << part->view[0] << tab << part->view[1] << tab
1716  << part->view[2] << tab << part->view.angle()*180/M_PI;
1717  } else {
1718  euler = Euler(part->view);
1719  fd << part->id << tab << part->ori[0] << tab
1720  << part->ori[1] << tab << part->ori[2] << tab
1721  << euler.phi()*180/M_PI << tab << euler.theta()*180/M_PI
1722  << tab << euler.psi()*180/M_PI;
1723  }
1724  for ( f=0; f<NFOM; f++ ) fd << tab << part->fom[f];
1725  fd << endl;
1726  }
1727  }
1728  fd << endl;
1729  }
1730  if ( npart ) npercent = nsel*100.0/npart;
1731  if ( npart ) npercent = nsel*100.0/npart;
1732  fd << "Totals:\t" << npart << " particles\t" << nsel << " selected\t(" << npercent << "%)" << endl << endl;
1733  }
1734 
1735  fd.close();
1736 
1737  return nsel;
1738 }
1739 
1741 {
1742  if ( verbose & VERB_DEBUG )
1743  cout << "DEBUG path_update: Old name = " << filename << endl;
1744 
1745  if ( path[-1] != '/' ) path += "/";
1746 // if ( path == "./" ) path = 0;
1747 
1748  Bstring newname = filename;
1749  if ( newname.contains("/") ) newname = newname.post_rev('/');
1750  if ( path.length() && path != "./" ) newname = path + newname;
1751  if ( verbose & VERB_DEBUG )
1752  cout << "DEBUG path_update: New name = " << newname << endl;
1753 
1754  return newname;
1755 }
1756 
1767 {
1768  if ( !project ) return 0;
1769  if ( path.length() < 1 ) return 0;
1770 
1771  Bfield* field;
1772  Bmicrograph* mg;
1773 
1774  if ( verbose )
1775  cout << "Setting micrograph path to " << path << endl;
1776 
1777  for ( field = project->field; field; field = field->next ) {
1778  for ( mg = field->mg; mg; mg = mg->next ) if ( mg->fmg.length() ) {
1779  mg->fmg = path_update(mg->fmg, path);
1780  }
1781  }
1782 
1783  return 0;
1784 }
1785 
1796 {
1797  if ( !project ) return 0;
1798  if ( path.length() < 1 ) return 0;
1799 
1800  Bfield* field;
1801  Bmicrograph* mg;
1802 
1803  if ( verbose )
1804  cout << "Setting micrograph frames path to " << path << endl;
1805 
1806  for ( field = project->field; field; field = field->next ) {
1807  for ( mg = field->mg; mg; mg = mg->next ) if ( mg->fframe.length() ) {
1808  mg->fframe = path_update(mg->fframe, path);
1809  }
1810  }
1811 
1812  return 0;
1813 }
1814 
1825 {
1826  if ( !project ) return 0;
1827  if ( path.length() < 1 ) return 0;
1828 
1829  Bfield* field;
1830  Bmicrograph* mg;
1831 
1832  if ( verbose )
1833  cout << "Setting power spectrum path to " << path << endl;
1834 
1835  for ( field = project->field; field; field = field->next ) {
1836  for ( mg = field->mg; mg; mg = mg->next ) if ( mg->fps.length() ) {
1837  mg->fps = path_update(mg->fps, path);
1838  }
1839  }
1840 
1841  return 0;
1842 }
1843 
1854 {
1855  if ( !project ) return 0;
1856  if ( path.length() < 1 ) return 0;
1857 
1858  Bfield* field;
1859  Bmicrograph* mg;
1860  Breconstruction* rec;
1861  Bparticle* part = NULL;
1862 
1863  if ( verbose )
1864  cout << "Setting particle path to " << path << endl;
1865 
1866  if ( project->select ) {
1867  for ( rec = project->rec; rec; rec = rec->next ) {
1868  if ( rec->part && rec->part->fpart.length() ) {
1869  for ( part = rec->part; part; part = part->next )
1870  part->fpart = path_update(part->fpart, path);
1871  } else if ( rec->fpart.length() ) {
1872  rec->fpart = path_update(rec->fpart, path);
1873  }
1874  }
1875  } else {
1876  for ( field = project->field; field; field = field->next ) {
1877  for ( mg = field->mg; mg; mg = mg->next ) {
1878  if ( mg->part && mg->part->fpart.length() ) {
1879  for ( part = mg->part; part; part = part->next )
1880  part->fpart = path_update(part->fpart, path);
1881  } else if ( mg->fpart.length() ) {
1882  mg->fpart = path_update(mg->fpart, path);
1883  }
1884  }
1885  }
1886  }
1887 
1888  if ( verbose & VERB_DEBUG )
1889  cout << "DEBUG project_set_particle_path: done" << endl;
1890 
1891  return 0;
1892 }
1893 
1904 {
1905  if ( !project ) return 0;
1906  if ( path.length() < 1 ) return 0;
1907 
1908  Bfield* field;
1909  Bmicrograph* mg;
1910  Breconstruction* rec;
1911  Bstring newname, insert = "_fil.";
1912 
1913  if ( project->select ) {
1914  for ( rec = project->rec; rec; rec = rec->next ) {
1915  if ( verbose & VERB_DEBUG )
1916  cout << "DEBUG project_set_particle_path: Old name = " << rec->ffil << endl;
1917  newname = rec->ffil;
1918  if ( rec->ffil.length() < 1 )
1919  newname = rec->frec.pre_rev('.') + insert + rec->frec.post_rev('.');
1920 // if ( newname.contains("/") ) newname = newname.post_rev('/');
1921 // rec->ffil = newname;
1922 // if ( path.length() ) rec->ffil = path + rec->ffil;
1923  rec->ffil = path_update(rec->ffil, path);
1924  if ( verbose & VERB_DEBUG )
1925  cout << "DEBUG project_set_filament_path: New name = " << rec->ffil << endl;
1926  }
1927  } else {
1928  for ( field = project->field; field; field = field->next ) {
1929  for ( mg = field->mg; mg; mg = mg->next ) {
1930  if ( verbose & VERB_DEBUG )
1931  cout << "DEBUG project_set_particle_path: Old name = " << mg->ffil << endl;
1932  newname = mg->ffil;
1933  if ( mg->ffil.length() < 1 )
1934  newname = mg->fmg.pre_rev('.') + insert + mg->fmg.post_rev('.');
1935 // if ( newname.contains("/") ) newname = newname.post_rev('/');
1936 // mg->ffil = newname;
1937 // if ( path.length() ) mg->ffil = path + mg->ffil;
1938  mg->ffil = path_update(mg->ffil, path);
1939  if ( verbose & VERB_DEBUG )
1940  cout << "DEBUG project_set_filament_path: New name = " << mg->ffil << endl;
1941  }
1942  }
1943  }
1944 
1945  return 0;
1946 }
1947 
1955 {
1956  if ( !project ) return 0;
1957 
1958  Bfield* field;
1959  Bmicrograph* mg;
1960 
1961  for ( field = project->field; field; field = field->next )
1962  for ( mg = field->mg; mg; mg = mg->next )
1963  mg->magnification = mag;
1964 
1965  return 0;
1966 }
1967 
1978 {
1979  if ( !project ) return 0;
1980 
1981  Bfield* field;
1982  Bmicrograph* mg;
1983 
1984  for ( field = project->field; field; field = field->next )
1985  for ( mg = field->mg; mg; mg = mg->next )
1986  mg->sampling = sampling;
1987 
1988  return 0;
1989 }
1990 
1998 {
1999  if ( !project ) return 0;
2000 
2001  Bfield* field;
2002  Bmicrograph* mg;
2003 
2004  if ( verbose & VERB_DEBUG )
2005  cout << "DEBUG project_set_mg_pixel_size: pixel_size = " << pixel_size << endl;
2006 
2007  pixel_size[2] = 1;
2008  for ( field = project->field; field; field = field->next )
2009  for ( mg = field->mg; mg; mg = mg->next )
2010  mg->pixel_size = pixel_size;
2011 
2012  return 0;
2013 }
2014 
2022 {
2023  if ( !project ) return 0;
2024 
2025  Breconstruction* rec;
2026 
2027  if ( verbose & VERB_DEBUG )
2028  cout << "DEBUG project_set_rec_voxel_size: voxel_size = " << pixel_size << endl;
2029 
2030  for ( rec = project->rec; rec; rec = rec->next )
2031  rec->voxel_size = pixel_size;
2032 
2033  return 0;
2034 }
2035 
2043 {
2044  if ( !project ) return 0;
2045 
2046  Bfield* field;
2047  Bmicrograph* mg;
2048  Breconstruction* rec;
2049  Bparticle* part;
2050 
2051  if ( verbose & VERB_DEBUG )
2052  cout << "DEBUG project_set_part_pixel_size: pixel_size = " << pixel_size << endl;
2053 
2054  if ( project->select ) {
2055  for ( rec = project->rec; rec; rec = rec->next )
2056  for ( part = rec->part; part; part = part->next )
2057  part->pixel_size = pixel_size;
2058  } else {
2059  pixel_size[2] = 1;
2060  for ( field = project->field; field; field = field->next )
2061  for ( mg = field->mg; mg; mg = mg->next )
2062  for ( part = mg->part; part; part = part->next )
2063  part->pixel_size = pixel_size;
2064  }
2065 
2066  return 0;
2067 }
2068 
2076 int project_set_tilt(Bproject* project, double tilt_axis, double tilt_angle)
2077 {
2078  if ( !project ) return 0;
2079 
2080  Bfield* field;
2081  Bmicrograph* mg;
2082 
2083  for ( field = project->field; field; field = field->next ) {
2084  for ( mg = field->mg; mg; mg = mg->next ) {
2085  mg->tilt_axis = tilt_axis;
2086  mg->tilt_angle = tilt_angle;
2087  }
2088  }
2089 
2090  return 0;
2091 }
2092 
2100 {
2101  if ( !project ) return 0;
2102 
2103  Bfield* field;
2104  Bmicrograph* mg;
2105 
2106  for ( field = project->field; field; field = field->next )
2107  for ( mg = field->mg; mg; mg = mg->next )
2108  mg->dose = dose;
2109 
2110  return 0;
2111 }
2112 
2123 {
2124  if ( !project ) return 0;
2125  if ( !project->field ) return 0;
2126  if ( !project->field->mg ) return 0;
2127 
2128  Bfield* field;
2129  Bmicrograph* mg;
2130 
2131  if ( verbose & VERB_FULL )
2132  cout << "Setting micrograph origins to " << origin << endl;
2133 
2134  for ( field = project->field; field; field = field->next ) {
2135  field->origin = origin;
2136  for ( mg = field->mg; mg; mg = mg->next )
2137  mg->origin = origin;
2138  }
2139 
2140  return 0;
2141 }
2142 
2155 {
2156  if ( !project ) return 0;
2157 
2158  Bfield* field;
2159  Bmicrograph* mg;
2160  Breconstruction* rec;
2161  Bparticle* part;
2162 
2163  if ( project->select ) {
2164  for ( rec = project->rec; rec; rec = rec->next ) {
2165  for ( part = rec->part; part; part = part->next ) {
2166  part->loc += part->ori - rec->box_size/2;
2167  part->ori = rec->box_size/2;
2168  }
2169  }
2170  } else {
2171  for ( field = project->field; field; field = field->next ) {
2172  for ( mg = field->mg; mg; mg = mg->next ) {
2173  for ( part = mg->part; part; part = part->next ) {
2174  part->loc += part->ori - mg->box_size/2;
2175  part->ori = mg->box_size/2;
2176  }
2177  }
2178  }
2179  }
2180 
2181  return 0;
2182 }
2183 
2197 {
2198  if ( !project ) return 0;
2199 
2200  Bfield* field;
2201  Bmicrograph* mg;
2202  Breconstruction* rec;
2203  Bparticle* part;
2204 
2205  int fx(flip & 1);
2206  int fy(flip & 2);
2207  int fz(flip & 4);
2208 
2209  if ( verbose & VERB_PROCESS ) {
2210  cout << "Flipping origins along ";
2211  if ( fx ) cout << "x";
2212  if ( fy ) cout << "y";
2213  if ( fz ) cout << "z";
2214  cout << endl;
2215  }
2216 
2217  if ( project->select ) {
2218  for ( rec = project->rec; rec; rec = rec->next ) {
2219  for ( part = rec->part; part; part = part->next ) {
2220  if ( fx ) part->ori[0] = rec->box_size[0] - part->ori[0];
2221  if ( fy ) part->ori[1] = rec->box_size[1] - part->ori[1];
2222  if ( fz ) part->ori[2] = rec->box_size[2] - part->ori[2];
2223  }
2224  }
2225  } else {
2226  for ( field = project->field; field; field = field->next ) {
2227  for ( mg = field->mg; mg; mg = mg->next ) {
2228  for ( part = mg->part; part; part = part->next ) {
2229  if ( fx ) part->ori[0] = mg->box_size[0] - part->ori[0];
2230  if ( fy ) part->ori[1] = mg->box_size[1] - part->ori[1];
2231  }
2232  }
2233  }
2234  }
2235 
2236  return 0;
2237 }
2238 
2248 {
2249  if ( !project ) return 0;
2250 
2251  long n, np(0);
2252  Bfield* field;
2253  Bmicrograph* mg;
2254  Breconstruction* rec;
2255  Bparticle* part;
2256 
2257  if ( verbose & VERB_FULL )
2258  cout << "Renumbering particles" << endl << endl;
2259 
2260  if ( project->select ) {
2261  for ( rec = project->rec; rec; rec = rec->next )
2262  for ( n=1, part = rec->part; part; part = part->next, n++, np++ )
2263  part->id = n;
2264  } else {
2265  for ( field = project->field; field; field = field->next )
2266  for ( mg = field->mg; mg; mg = mg->next )
2267  for ( n=1, part = mg->part; part; part = part->next, n++, np++ )
2268  part->id = n;
2269  }
2270 
2271  return np;
2272 }
2273 
2285 {
2286  if ( !project ) return 0;
2287 
2288  Bfield* field;
2289  Bmicrograph* mg;
2290  Breconstruction* rec;
2291  Bparticle* part;
2292 
2293  if ( verbose & VERB_FULL )
2294  cout << "Setting the box size to " << box_size << endl << endl;
2295 
2296  if ( project->select ) {
2297  for ( rec = project->rec; rec; rec = rec->next ) {
2298  for ( part = rec->part; part; part = part->next )
2299  part->ori -= rec->box_size/2;
2300  rec->box_size = box_size;
2301  for ( part = rec->part; part; part = part->next )
2302  part->ori += rec->box_size/2;
2303  }
2304  } else {
2305  box_size[2] = 1;
2306  for ( field = project->field; field; field = field->next )
2307  for ( mg = field->mg; mg; mg = mg->next ) {
2308  for ( part = mg->part; part; part = part->next )
2309  part->ori -= mg->box_size/2;
2310  mg->box_size = box_size;
2311  for ( part = mg->part; part; part = part->next )
2312  part->ori += mg->box_size/2;
2313  }
2314  }
2315 
2316  return 0;
2317 }
2318 
2330 {
2331  if ( !project ) return 0;
2332 
2333  Vector3<long> bsize(box_size, box_size, 1);
2334  if ( project->select ) bsize[2] = box_size;
2335 
2336  return project_set_particle_box_size(project, bsize);
2337 }
2338 
2349 {
2350  if ( !project ) return 0;
2351 
2352  Bfield* field;
2353  Bmicrograph* mg;
2354  Breconstruction* rec;
2355  Bparticle* part;
2356 
2357  if ( verbose & VERB_FULL )
2358  cout << "Setting origins to " << origin << endl << endl;
2359 
2360  if ( project->select ) {
2361  for ( rec = project->rec; rec; rec = rec->next )
2362  for ( part = rec->part; part; part = part->next )
2363  part->ori = origin;
2364  } else {
2365  for ( field = project->field; field; field = field->next )
2366  for ( mg = field->mg; mg; mg = mg->next )
2367  for ( part = mg->part; part; part = part->next )
2368  part->ori = origin;
2369  }
2370 
2371  return 0;
2372 }
2373 
2384 {
2385  if ( !project ) return 0;
2386 
2387  Bsymmetry* sym = init_point_group_symmetry(symmetry_asu);
2388 
2390 
2391  kill_symmetry(sym);
2392 
2393  return 0;
2394 }
2395 
2397 {
2398  if ( !project ) return 0;
2399 
2400  Bfield* field;
2401  Bmicrograph* mg;
2402  Breconstruction* rec;
2403  Bparticle* part;
2404 
2405  if ( verbose )
2406  cout << "Setting particle views to the asymmetric unit for point group " << sym->label << endl << endl;
2407 
2408  if ( project->select ) {
2409  for ( rec = project->rec; rec; rec = rec->next )
2410  for ( part = rec->part; part; part = part->next )
2411  part->view = find_asymmetric_unit_view(sym, part->view);
2412  } else {
2413  for ( field = project->field; field; field = field->next )
2414  for ( mg = field->mg; mg; mg = mg->next )
2415  for ( part = mg->part; part; part = part->next )
2416  part->view = find_asymmetric_unit_view(sym, part->view);
2417  }
2418 
2419  return 0;
2420 }
2421 
2430 {
2431  if ( !project ) return 0;
2432 
2433  if ( view[2] >= 0.999999 ) return 0; // Standard view
2434 
2435  Bfield* field;
2436  Bmicrograph* mg;
2437  Breconstruction* rec;
2438  Bparticle* part;
2439  Quaternion q;
2440 
2441  if ( verbose & VERB_PROCESS ) {
2442  cout << "Rotating particle views relative to the reference view:" << endl;
2443  cout << view << endl << endl;
2444  }
2445 
2446  if ( project->select ) {
2447  for ( rec = project->rec; rec; rec = rec->next )
2448  for ( part = rec->part; part; part = part->next ) {
2449  q = view.quaternion() * part->view.quaternion();
2450  part->view = View(q);
2451  }
2452  } else {
2453  for ( field=project->field; field; field=field->next )
2454  for ( mg=field->mg; mg ; mg=mg->next )
2455  for ( part=mg->part; part; part=part->next) {
2456  q = view.quaternion() * part->view.quaternion();
2457  part->view = View(q);
2458  }
2459  }
2460 
2461  return 0;
2462 }
2463 
2471 int project_apply_map_magnifications(Bproject* project, int mag_num, float* mag)
2472 {
2473  if ( !project ) return 0;
2474 
2475  int i;
2476  Bfield* field;
2477  Bmicrograph* mg;
2478  Breconstruction* rec;
2479  Bparticle* part;
2480 
2481  if ( verbose & VERB_PROCESS ) {
2482  cout << "Applying map magnifications to particles:" << endl;
2483  cout << "Number of reference maps: " << mag_num << endl;
2484  for ( i=0; i<mag_num; i++ ) cout << i+1 << tab << mag[i] << endl;
2485  }
2486 
2487  if ( project->select < 1 ) {
2488  for ( field = project->field; field; field = field->next ) {
2489  for ( mg = field->mg; mg; mg = mg->next ) {
2490  for ( part = mg->part; part; part = part->next ) {
2491  if ( part->sel > 0 && part->sel <= mag_num ) {
2492  part->mag = mag[part->sel-1];
2493  }
2494  }
2495  }
2496  }
2497  } else {
2498  for ( rec = project->rec; rec; rec = rec->next ) {
2499  for ( part = rec->part; part; part = part->next ) {
2500  if ( part->sel > 0 && part->sel <= mag_num ) {
2501  part->mag = mag[part->sel-1];
2502  }
2503  }
2504  }
2505  }
2506 
2507  return 0;
2508 }
2509 
2517 {
2518  if ( !project ) return 0;
2519 
2520  if ( reset[0] == 'd' ) reset = "defocus";
2521  else return 0;
2522 
2523  long np(0);
2524  Bfield* field;
2525  Bmicrograph* mg;
2526  Breconstruction* rec;
2527  Bparticle* part;
2528 
2529  if ( verbose )
2530  cout << "Resetting " << reset << " from the micrographs" << endl;
2531 
2532  if ( project->select < 1 ) {
2533  for ( field = project->field; field; field = field->next ) {
2534  for ( mg = field->mg; mg; mg = mg->next ) {
2535  for ( part = mg->part; part; part = part->next ) {
2536  if ( part->sel && mg->ctf ) {
2537  part->def = mg->ctf->defocus_average();
2538  np++;
2539  }
2540  }
2541  }
2542  }
2543  } else {
2544  for ( rec = project->rec; rec; rec = rec->next ) {
2545  for ( part = rec->part; part; part = part->next ) {
2546  if ( part->sel && rec->ctf ) {
2547  part->def = rec->ctf->defocus_average();
2548  np++;
2549  }
2550  }
2551  }
2552  }
2553 
2554  if ( verbose )
2555  cout << "Number of particles changed: " << np << endl << endl;
2556 
2557  return np;
2558 }
2559 
2567 {
2568  if ( !project ) return 0;
2569 
2570  Bfield* field;
2571  Bmicrograph* mg;
2572  Breconstruction* rec;
2573  Bparticle* part;
2574  View* view = NULL;
2575  View* v = NULL;
2576 
2577  if ( project->select < 1 ) {
2578  if ( verbose & VERB_PROCESS )
2579  cout << "Retrieving the particle views from the micrographs" << endl << endl;
2580  for ( field = project->field; field; field = field->next )
2581  for ( mg = field->mg; mg; mg = mg->next )
2582  for ( part = mg->part; part; part = part->next ) {
2583  if ( selection==0 || ( selection==part->sel ) || ( selection<0 && part->sel>0 ) ) {
2584  v = (View *) add_item((char **) &v, sizeof(View));
2585  if ( !view ) view = v;
2586  *v = part->view;
2587  v->next = NULL;
2588  }
2589  }
2590  } else {
2591  if ( verbose & VERB_PROCESS )
2592  cout << "Retrieving the particle views from the reconstructions" << endl << endl;
2593  for ( rec = project->rec; rec; rec = rec->next )
2594  for ( part = rec->part; part; part = part->next ) {
2595  if ( selection==0 || ( selection==part->sel ) || ( selection<0 && part->sel>0 ) ) {
2596  v = (View *) add_item((char **) &v, sizeof(View));
2597  if ( !view ) view = v;
2598  *v = part->view;
2599  v->next = NULL;
2600  }
2601  }
2602  }
2603 
2604  return view;
2605 }
2606 
2613 {
2614  Bstring fom_tag;
2615 
2616  switch ( fom_type ) {
2617  case FOM: fom_tag = PARTICLE_FOM; break;
2618  case FOM_CC: fom_tag = PARTICLE_CC; break;
2619  case FOM_CC_AVG: fom_tag = PARTICLE_CC_AVG; break;
2620  case FOM_CV: fom_tag = PARTICLE_FOM_CV; break;
2621  case FOM_SNR: fom_tag = PARTICLE_FOM_SNR; break;
2622  case FOM_HAND_A: fom_tag = PARTICLE_HANDA_FOM; break;
2623  case FOM_HAND_B: fom_tag = PARTICLE_HANDB_FOM; break;
2624  case FOM_PFT_CC: fom_tag = PARTICLE_PFT_CC; break;
2625  case FOM_PFT_PRJ: fom_tag = PARTICLE_PRJ_CC; break;
2626  case FOM_PFT_CMP: fom_tag = PARTICLE_CMP_CC; break;
2627  case FOM_RFACTORAB: fom_tag = PARTICLE_RFACTORAB; break;
2628  case COVERAGE: fom_tag = PARTICLE_COVERAGE; break;
2629  case DENSITY: fom_tag = PARTICLE_DENSITY; break;
2630  case FOM1: fom_tag = PARTICLE_FOM1; break;
2631  case FOM2: fom_tag = PARTICLE_FOM2; break;
2632  case FOM3: fom_tag = PARTICLE_FOM3; break;
2633  case FOM4: fom_tag = PARTICLE_FOM4; break;
2634  case FOM5: fom_tag = PARTICLE_FOM5; break;
2635  case FOM6: fom_tag = PARTICLE_FOM6; break;
2636  case FOM7: fom_tag = PARTICLE_FOM7; break;
2637  case FOM8: fom_tag = PARTICLE_FOM8; break;
2638  case FOM9: fom_tag = PARTICLE_FOM9; break;
2639  default: break;
2640  }
2641 
2642  return fom_tag;
2643 }
2644 
2651 int get_fom_tag(FOMType fom_type, char* tag)
2652 {
2653  switch ( fom_type ) {
2654  case FOM: strcpy(tag, PARTICLE_FOM); break;
2655  case FOM_CC: strcpy(tag, PARTICLE_CC); break;
2656  case FOM_CC_AVG: strcpy(tag, PARTICLE_CC_AVG); break;
2657  case FOM_CV: strcpy(tag, PARTICLE_FOM_CV); break;
2658  case FOM_SNR: strcpy(tag, PARTICLE_FOM_SNR); break;
2659  case FOM_HAND_A: strcpy(tag, PARTICLE_HANDA_FOM); break;
2660  case FOM_HAND_B: strcpy(tag, PARTICLE_HANDB_FOM); break;
2661  case FOM_PFT_CC: strcpy(tag, PARTICLE_PFT_CC); break;
2662  case FOM_PFT_PRJ: strcpy(tag, PARTICLE_PRJ_CC); break;
2663  case FOM_PFT_CMP: strcpy(tag, PARTICLE_CMP_CC); break;
2664  case FOM_RFACTORAB: strcpy(tag, PARTICLE_RFACTORAB); break;
2665  case COVERAGE: strcpy(tag, PARTICLE_COVERAGE); break;
2666  case DENSITY: strcpy(tag, PARTICLE_DENSITY); break;
2667  case FOM1: strcpy(tag, PARTICLE_FOM1); break;
2668  case FOM2: strcpy(tag, PARTICLE_FOM2); break;
2669  case FOM3: strcpy(tag, PARTICLE_FOM3); break;
2670  case FOM4: strcpy(tag, PARTICLE_FOM4); break;
2671  case FOM5: strcpy(tag, PARTICLE_FOM5); break;
2672  case FOM6: strcpy(tag, PARTICLE_FOM6); break;
2673  case FOM7: strcpy(tag, PARTICLE_FOM7); break;
2674  case FOM8: strcpy(tag, PARTICLE_FOM8); break;
2675  case FOM9: strcpy(tag, PARTICLE_FOM9); break;
2676  default: tag[0] = 0; break;
2677  }
2678 
2679  return 0;
2680 }
2681 
2682 
qsort_functions.h
Header file for utility functions for use in qsort calls.
Bmicrograph::scale
Vector3< double > scale
Definition: mg_processing.h:224
project_set_particle_path
int project_set_particle_path(Bproject *project, Bstring &path)
Sets the path to particle files for all the micrographs.
Definition: mg_processing.cpp:1853
PARTICLE_FOM3
#define PARTICLE_FOM3
Definition: mg_tags.h:223
Bstrucfac::fom
double fom
Definition: mg_processing.h:164
PARTICLE_CMP_CC
#define PARTICLE_CMP_CC
Definition: mg_tags.h:236
FOM_PFT_CMP
@ FOM_PFT_CMP
Definition: mg_processing.h:50
Bbadarea::loc
Vector3< double > loc
Definition: mg_processing.h:146
Bmicrograph::sf
Bstrucfac * sf
Definition: mg_processing.h:246
Bmicrograph::id
Bstring id
Definition: mg_processing.h:203
PARTICLE_FOM5
#define PARTICLE_FOM5
Definition: mg_tags.h:225
Bmicrograph
Definition: mg_processing.h:201
layerline_copy
Blayerline * layerline_copy(Blayerline *layerlist)
Definition: mg_processing.cpp:710
FOM7
@ FOM7
Definition: mg_processing.h:60
Breconstruction::part
Bparticle * part
Definition: mg_processing.h:307
Breconstruction::id
Bstring id
Definition: mg_processing.h:285
Breconstruction::mark
Bmarker * mark
Definition: mg_processing.h:310
View::next
View * next
Definition: View.h:28
part_find_first
Bparticle * part_find_first(Bproject *project)
Finds the first particle in a project.
Definition: mg_processing.cpp:283
Bmicrograph::filament_width
double filament_width
Definition: mg_processing.h:234
Breconstruction::fpart
Bstring fpart
Definition: mg_processing.h:291
FOM_HAND_A
@ FOM_HAND_A
Definition: mg_processing.h:46
project_set_scan_sampling
int project_set_scan_sampling(Bproject *project, double sampling)
Sets the scan sampling for all the micrographs.
Definition: mg_processing.cpp:1977
FOM9
@ FOM9
Definition: mg_processing.h:62
Bstrucfac
Definition: mg_processing.h:156
Breconstruction::fil
Bfilament * fil
Definition: mg_processing.h:308
FOM8
@ FOM8
Definition: mg_processing.h:61
Bbadarea::id
int id
Definition: mg_processing.h:145
Bproject::rec
Breconstruction * rec
Definition: mg_processing.h:347
Blayerline::sel
long sel
Definition: mg_processing.h:183
VERB_DEBUG
#define VERB_DEBUG
Definition: utilities.h:116
PARTICLE_RFACTORAB
#define PARTICLE_RFACTORAB
Definition: mg_tags.h:237
string_kill
int string_kill(Bstring *list)
Kills a string linked list.
Definition: Bstring.cpp:768
project_rotate_particle_views
int project_rotate_particle_views(Bproject *project, View view)
Rotates particle views with respect to a reference view.
Definition: mg_processing.cpp:2429
particle_array
Bparticle ** particle_array(Bparticle *partlist, int part_select, long &npart)
Sets up an array of selected particle pointers.
Definition: mg_processing.cpp:1360
Bproject::next
Bproject * next
Definition: mg_processing.h:337
filament_copy
Bfilament * filament_copy(Bfilament *fillist)
Definition: mg_processing.cpp:669
Bproject::select
int select
Definition: mg_processing.h:342
Quaternion
Definition: Quaternion.h:25
kill_list
long kill_list(char *list, unsigned long size)
Frees all the items in a linked list.
Definition: linked_list.cpp:214
project_set_part_links
long project_set_part_links(Bproject *project)
Sets the links from particles back to the micrographs and reconstructions.
Definition: mg_processing.cpp:1148
Bparticle::view
View view
Definition: mg_processing.h:102
NFOM
#define NFOM
Definition: mg_processing.h:16
filament_node_count
long filament_node_count(Bfilament *fil)
Counts the number of filament nodes in a linked list of filaments.
Definition: mg_select.cpp:809
project_set_field_id
int project_set_field_id(Bproject *project, int nseries, Bstring &field_id)
Sets the field id's according to a regular series.
Definition: mg_processing.cpp:1456
Bfilament
Definition: mg_processing.h:129
Bstring
Definition: Bstring.h:29
CTFparam::update
int update(CTFparam *ctf)
Definition: ctf.h:81
frame_add
Bframe * frame_add(Bframe **frame, int pid)
Adds a movie frame parameter structure to a linked list.
Definition: mg_processing.cpp:189
add_item
char * add_item(char **list, unsigned long size)
Adds an item to a linked list.
Definition: linked_list.cpp:26
Breconstruction::voxel_size
Vector3< double > voxel_size
Definition: mg_processing.h:295
structurefactor_copy
Bstrucfac * structurefactor_copy(Bstrucfac *sflist)
Definition: mg_processing.cpp:689
Bparticle
Definition: mg_processing.h:90
project_init
Bproject * project_init()
Initializes a micrograph processing project parameter structure.
Definition: mg_processing.cpp:30
project_set_tilt
int project_set_tilt(Bproject *project, double tilt_axis, double tilt_angle)
Sets the tilt parameters for all the micrographs.
Definition: mg_processing.cpp:2076
Bstring::post_rev
Bstring post_rev(char c)
Definition: Bstring.cpp:436
Bproject::field
Bfield * field
Definition: mg_processing.h:346
project_mg_particle_array
Bparticle ** project_mg_particle_array(Bproject *project, int part_select, long &npart)
Sets up an array of selected particle pointers.
Definition: mg_processing.cpp:1282
particle_count_selected
long particle_count_selected(Bparticle *part)
Counts the number of particles in a linked list.
Definition: mg_select.cpp:773
markers_copy
Bmarker * markers_copy(Bmarker *mark)
Copies a set of markers.
Definition: marker.cpp:142
View::vector_size
double vector_size()
Definition: View.h:106
filament_add
Bfilament * filament_add(Bfilament **fil, int pid)
Adds a filament parameter structure to a linked list.
Definition: mg_processing.cpp:319
PARTICLE_FOM1
#define PARTICLE_FOM1
Definition: mg_tags.h:221
micrograph_kill
int micrograph_kill(Bmicrograph *mg)
Frees a whole micrograph parameter structure.
Definition: mg_processing.cpp:493
Euler::theta
double theta()
Definition: Euler.h:57
Bstrucfac::sel
long sel
Definition: mg_processing.h:165
Breconstruction::ctf
CTFparam * ctf
Definition: mg_processing.h:306
verbose
int verbose
FOMType
FOMType
Definition: mg_processing.h:38
Bmicrograph::bad_radius
double bad_radius
Definition: mg_processing.h:236
Breconstruction::fom
double fom
Definition: mg_processing.h:305
project_create
Bproject * project_create(int nmg, int nrec)
Creates a micrograph processing project parameter structure.
Definition: mg_processing.cpp:48
Bmicrograph::tilt_angle
double tilt_angle
Definition: mg_processing.h:220
Vector3< double >
PARTICLE_PRJ_CC
#define PARTICLE_PRJ_CC
Definition: mg_tags.h:235
random_numbers.h
Header file for functions for creating random images.
Bparticle::ast
double ast
Definition: mg_processing.h:98
Bstrucfac::loc
Vector3< double > loc
Definition: mg_processing.h:158
Bfilament::next
Bfilament * next
Definition: mg_processing.h:130
Euler::psi
double psi()
Definition: Euler.h:56
FOM_HAND_B
@ FOM_HAND_B
Definition: mg_processing.h:47
Bmicrograph::img_num
int img_num
Definition: mg_processing.h:212
particle_add
Bparticle * particle_add(Bparticle **part, int pid)
Adds a particle parameter structure to a linked list.
Definition: mg_processing.cpp:221
PARTICLE_PFT_CC
#define PARTICLE_PFT_CC
Definition: mg_tags.h:234
mg_select.h
Header file for micrograph processing.
project_equal_mg_part_files
int project_equal_mg_part_files(Bproject *project)
Sets micrograph and particle files to be the same.
Definition: mg_processing.cpp:88
Bfield::origin
Vector3< double > origin
Definition: mg_processing.h:263
Bproject::filename
Bstring filename
Definition: mg_processing.h:338
Bparticle::fom
double fom[NFOM]
Definition: mg_processing.h:103
Bframe::fom
double fom
Definition: mg_processing.h:79
project_add_origins_to_coords
int project_add_origins_to_coords(Bproject *project)
Adds the particle origins to the micrograph coordinates.
Definition: mg_processing.cpp:2154
FOM1
@ FOM1
Definition: mg_processing.h:54
Bparticle::mg
Bmicrograph * mg
Definition: mg_processing.h:105
Bmicrograph::sampling
double sampling
Definition: mg_processing.h:214
Breconstruction::box_size
Vector3< long > box_size
Definition: mg_processing.h:299
Bmicrograph::part
Bparticle * part
Definition: mg_processing.h:242
reconstruction_add
Breconstruction * reconstruction_add(Breconstruction **rec, Bstring &rec_id)
Adds a reconstruction parameter structure to a linked list.
Definition: mg_processing.cpp:398
Bfield::id
Bstring id
Definition: mg_processing.h:262
View
Definition: View.h:26
FOM_PFT_PRJ
@ FOM_PFT_PRJ
Definition: mg_processing.h:49
micrograph_set_part_links
long micrograph_set_part_links(Bmicrograph *mg)
Sets the links from particles back to the micrograph.
Definition: mg_processing.cpp:1170
Bmicrograph::fpart
Bstring fpart
Definition: mg_processing.h:208
Breconstruction::mark_radius
double mark_radius
Definition: mg_processing.h:304
Bfield
Definition: mg_processing.h:260
Blayerline::amp
double amp
Definition: mg_processing.h:181
length
double length(vector< T > v)
Definition: Vector3.h:530
VERB_PROCESS
#define VERB_PROCESS
Definition: utilities.h:111
Bsymmetry
Definition: symmetry.h:38
get_fom_tag
Bstring get_fom_tag(FOMType fom_type)
Returns the tag associated with a particular FOM.
Definition: mg_processing.cpp:2612
project_merge_part_parameters
int project_merge_part_parameters(Bproject *project, Bproject *partproject)
Puts particle parameters from one project into another.
Definition: mg_processing.cpp:1118
Blayerline::order
int order
Definition: mg_processing.h:178
project_reset
long project_reset(Bproject *project, Bstring &reset)
Reset a particle parameter from its micrograph.
Definition: mg_processing.cpp:2516
Bstring::c_str
const char * c_str()
Definition: Bstring.h:70
Breconstruction::model
Bstring * model
Definition: mg_processing.h:312
Bmicrograph::fframe
Bstring fframe
Definition: mg_processing.h:207
Bbadarea
Definition: mg_processing.h:143
FOM2
@ FOM2
Definition: mg_processing.h:55
Bframe
Definition: mg_processing.h:75
Bmicrograph::dose
double dose
Definition: mg_processing.h:216
Bframe::id
int id
Definition: mg_processing.h:77
Bmarker
Definition: marker.h:21
FOM_SNR
@ FOM_SNR
Definition: mg_processing.h:43
mg_part_links
int mg_part_links(Bmicrograph *mg)
Sets the links from particles to micrographs.
Definition: mg_processing.cpp:249
Bmicrograph::fil
Bfilament * fil
Definition: mg_processing.h:243
project_set_frame_path
int project_set_frame_path(Bproject *project, Bstring &path)
Sets the path to micrograph frames files for all the micrographs.
Definition: mg_processing.cpp:1795
PARTICLE_HANDA_FOM
#define PARTICLE_HANDA_FOM
Definition: mg_tags.h:230
Breconstruction::origin
Vector3< double > origin
Definition: mg_processing.h:296
Bstrucfac::sigamp
double sigamp
Definition: mg_processing.h:161
project
Bproject * project
Definition: bshow.cpp:33
field_kill
int field_kill(Bfield *field)
Frees a whole field-of-view structure.
Definition: mg_processing.cpp:466
Matrix3
Definition: Matrix3.h:18
Bframe::sel
long sel
Definition: mg_processing.h:80
Bfilament::id
int id
Definition: mg_processing.h:132
PARTICLE_FOM4
#define PARTICLE_FOM4
Definition: mg_tags.h:224
project_renumber_particles
long project_renumber_particles(Bproject *project)
Renumbers particles.
Definition: mg_processing.cpp:2247
PARTICLE_FOM2
#define PARTICLE_FOM2
Definition: mg_tags.h:222
PARTICLE_COVERAGE
#define PARTICLE_COVERAGE
Definition: mg_tags.h:238
Bmicrograph::ffil
Bstring ffil
Definition: mg_processing.h:209
Bparticle::fpart
Bstring fpart
Definition: mg_processing.h:92
insert
string insert(string &filename, string ins)
Definition: string_util.cpp:48
FOM6
@ FOM6
Definition: mg_processing.h:59
Bstrucfac::phi
double phi
Definition: mg_processing.h:162
project_set_part_pixel_size
int project_set_part_pixel_size(Bproject *project, Vector3< double > pixel_size)
Sets the pixel size for all the particles.
Definition: mg_processing.cpp:2042
Bmicrograph::level_angle
double level_angle
Definition: mg_processing.h:221
PARTICLE_FOM_SNR
#define PARTICLE_FOM_SNR
Definition: mg_tags.h:218
FOM_CC_AVG
@ FOM_CC_AVG
Definition: mg_processing.h:44
PARTICLE_FOM_CV
#define PARTICLE_FOM_CV
Definition: mg_tags.h:217
FOM4
@ FOM4
Definition: mg_processing.h:57
FOM_RFACTORAB
@ FOM_RFACTORAB
Definition: mg_processing.h:51
Bmicrograph::origin
Vector3< double > origin
Definition: mg_processing.h:223
Bstring::pre_rev
Bstring pre_rev(char c)
Definition: Bstring.cpp:421
project_count_mg_part_selected
long project_count_mg_part_selected(Bproject *project)
Counts the number of particles in a project.
Definition: mg_select.cpp:437
FOM5
@ FOM5
Definition: mg_processing.h:58
VERB_RESULT
#define VERB_RESULT
Definition: utilities.h:109
Bfilnode::id
int id
Definition: mg_processing.h:118
project_set_rec_voxel_size
int project_set_rec_voxel_size(Bproject *project, Vector3< double > pixel_size)
Sets the pixel size for all the reconstructions.
Definition: mg_processing.cpp:2021
project_set_micrograph_origins
int project_set_micrograph_origins(Bproject *project, Vector3< double > origin)
Sets micrograph origins to the given origin.
Definition: mg_processing.cpp:2122
Bmicrograph::magnification
double magnification
Definition: mg_processing.h:213
Bmicrograph::tilt_axis
double tilt_axis
Definition: mg_processing.h:219
Bstrucfac::amp
double amp
Definition: mg_processing.h:160
project_set_micrograph_path
int project_set_micrograph_path(Bproject *project, Bstring &path)
Sets the path to micrograph files for all the micrographs.
Definition: mg_processing.cpp:1766
project_set_particle_origins
int project_set_particle_origins(Bproject *project, Vector3< double > origin)
Sets particle origins to given values.
Definition: mg_processing.cpp:2348
Bfilament::node
Bfilnode * node
Definition: mg_processing.h:133
Bproject
Definition: mg_processing.h:336
find_asymmetric_unit_view
View find_asymmetric_unit_view(Bsymmetry *sym, View theview)
Finds the corresponding view in the asymmetric unit.
Definition: symmetry.cpp:850
Bstrucfac::next
Bstrucfac * next
Definition: mg_processing.h:157
micrograph_update
int micrograph_update(Bmicrograph *mg, Bmicrograph *nu_mg, int fom_index, int flags)
Updates an existing micrograph with new information.
Definition: mg_processing.cpp:878
COVERAGE
@ COVERAGE
Definition: mg_processing.h:52
Bbadarea::next
Bbadarea * next
Definition: mg_processing.h:144
part_select
Tcl_Obj * part_select(Bparticle *part, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bmg.cpp:563
PARTICLE_FOM7
#define PARTICLE_FOM7
Definition: mg_tags.h:227
Bparticle::sel
long sel
Definition: mg_processing.h:104
filament_node_add
Bfilnode * filament_node_add(Bfilnode **fnode, int pid)
Adds a filament node parameter structure to a linked list.
Definition: mg_processing.cpp:349
Bparticle::pixel_size
Vector3< double > pixel_size
Definition: mg_processing.h:99
FOM_PFT_CC
@ FOM_PFT_CC
Definition: mg_processing.h:48
project_set_dose
int project_set_dose(Bproject *project, double dose)
Sets the electron dose of all the micrographs.
Definition: mg_processing.cpp:2099
project_divide
long project_divide(Bproject *project, long n)
Divides a project into a number of micrograph subsets.
Definition: mg_processing.cpp:1204
Bmicrograph::mark_radius
double mark_radius
Definition: mg_processing.h:238
PARTICLE_FOM6
#define PARTICLE_FOM6
Definition: mg_tags.h:226
Bfilament::ffil
Bstring ffil
Definition: mg_processing.h:131
Bparticle::loc
Vector3< double > loc
Definition: mg_processing.h:100
Euler::phi
double phi()
Definition: Euler.h:58
PARTICLE_HANDB_FOM
#define PARTICLE_HANDB_FOM
Definition: mg_tags.h:231
Blayerline::next
Blayerline * next
Definition: mg_processing.h:176
project_micrograph_array
Bmicrograph ** project_micrograph_array(Bproject *project, long &nmg)
Sets up an array of selected micrograph pointers.
Definition: mg_processing.cpp:1254
Breconstruction::fft
Bstring fft
Definition: mg_processing.h:293
FOM_CC
@ FOM_CC
Definition: mg_processing.h:41
mg_tags.h
All STAR and XML file format tags for micrographs and reconstructions.
Bfilnode::next
Bfilnode * next
Definition: mg_processing.h:117
M_PI
#define M_PI
Definition: utilities.h:63
utilities.h
Header file for general utilities.
Breconstruction::symmetry
Bstring symmetry
Definition: mg_processing.h:289
tab
ostream & tab(ostream &out)
Definition: utilities.cpp:22
Bstrucfac::index
Vector3< int > index
Definition: mg_processing.h:159
project_dump
long project_dump(Bproject *project, Bstring &filename)
Dumps particle info in the project hierarchy.
Definition: mg_processing.cpp:1646
Breconstruction::sf
Bstrucfac * sf
Definition: mg_processing.h:311
project_set_particle_box_size
int project_set_particle_box_size(Bproject *project, Vector3< long > box_size)
Sets particle box size to the given value.
Definition: mg_processing.cpp:2284
Bmicrograph::box_size
Vector3< long > box_size
Definition: mg_processing.h:233
project_set_filament_path
int project_set_filament_path(Bproject *project, Bstring &path)
Sets the path to filament files for all the micrographs.
Definition: mg_processing.cpp:1903
Bfield::matrix
Matrix3 matrix
Definition: mg_processing.h:264
project_rec_particle_array
Bparticle ** project_rec_particle_array(Bproject *project, int part_select, long &npart)
Sets up an array of selected particle pointers.
Definition: mg_processing.cpp:1324
Breconstruction
Definition: mg_processing.h:283
Bstring::length
long length() const
Definition: Bstring.cpp:263
Breconstruction::select
long select
Definition: mg_processing.h:286
particle_bad_copy
Bbadarea * particle_bad_copy(Bbadarea *badlist)
Definition: mg_processing.cpp:654
project_kill
int project_kill(Bproject *project)
Frees a whole project.
Definition: mg_processing.cpp:429
reconstruction_kill
int reconstruction_kill(Breconstruction *rec)
Frees a whole reconstruction parameter structure.
Definition: mg_processing.cpp:582
Bparticle::def
double def
Definition: mg_processing.h:96
Bmicrograph::matrix
Matrix3 matrix
Definition: mg_processing.h:225
init_point_group_symmetry
Bsymmetry * init_point_group_symmetry(Bstring symmetry_string)
Sets up a symmetry structure from a string identifier.
Definition: symmetry.cpp:39
project_set_magnification
int project_set_magnification(Bproject *project, double mag)
Sets the magnification for all the micrographs.
Definition: mg_processing.cpp:1954
project_set_mg_pixel_size
int project_set_mg_pixel_size(Bproject *project, Vector3< double > pixel_size)
Sets the pixel size for all the micrographs.
Definition: mg_processing.cpp:1997
PARTICLE_CC
#define PARTICLE_CC
Definition: mg_tags.h:232
Bmicrograph::fmg
Bstring fmg
Definition: mg_processing.h:206
Bproject::class_avg
Bparticle * class_avg
Definition: mg_processing.h:348
Bfield::select
long select
Definition: mg_processing.h:265
CTFparam
Definition: ctf.h:28
Vector3::volume
double volume()
Definition: Vector3.h:237
Bmicrograph::fom
double fom
Definition: mg_processing.h:239
Bmicrograph::ctf
CTFparam * ctf
Definition: mg_processing.h:241
Bproject::euler_flag
int euler_flag
Definition: mg_processing.h:343
Bparticle::dev
double dev
Definition: mg_processing.h:97
Bfield::next
Bfield * next
Definition: mg_processing.h:261
Bmicrograph::mark
Bmarker * mark
Definition: mg_processing.h:245
project_show_hierarchy
long project_show_hierarchy(Bproject *project)
Shows the project hierarchy.
Definition: mg_processing.cpp:1506
Bparticle::ori
Vector3< double > ori
Definition: mg_processing.h:101
Bparticle::group
int group
Definition: mg_processing.h:94
mg_processing.h
Header file for micrograph processing.
Bstrucfac::sigphi
double sigphi
Definition: mg_processing.h:163
Bmicrograph::intensity
double intensity
Definition: mg_processing.h:217
PARTICLE_CC_AVG
#define PARTICLE_CC_AVG
Definition: mg_tags.h:233
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:121
View::quaternion
Quaternion quaternion()
Definition: View.h:130
project_set_particle_asu_views
int project_set_particle_asu_views(Bproject *project, Bstring &symmetry_asu)
Sets particle views within the asymmetric unit.
Definition: mg_processing.cpp:2383
PARTICLE_FOM
#define PARTICLE_FOM
Definition: mg_tags.h:216
CTFparam::defocus_average
double defocus_average()
Definition: ctf.h:106
Bmicrograph::block
int block
Definition: mg_processing.h:205
Breconstruction::bad_radius
double bad_radius
Definition: mg_processing.h:302
Bparticle::next
Bparticle * next
Definition: mg_processing.h:91
Bmicrograph::rot_angle
double rot_angle
Definition: mg_processing.h:222
rec_part_links
int rec_part_links(Breconstruction *rec)
Sets the links from particles to reconstructions.
Definition: mg_processing.cpp:265
kill_symmetry
int kill_symmetry(Bsymmetry *sym)
Deallocates a symmetry structure.
Definition: symmetry.cpp:207
linked_list.h
Header file for generalized linked list functions.
math_util.h
Header file for general utilities.
Bmicrograph::select
long select
Definition: mg_processing.h:204
PARTICLE_FOM9
#define PARTICLE_FOM9
Definition: mg_tags.h:229
Breconstruction::block
int block
Definition: mg_processing.h:287
project_revert_filenames
int project_revert_filenames(Bproject *project, Bproject *project_old, int flag)
Reverts file names to what it was in an old project.
Definition: mg_processing.cpp:1388
Breconstruction::scale
Vector3< double > scale
Definition: mg_processing.h:297
particle_update
int particle_update(Bparticle *part, Bparticle *nu_part)
Updates one existing particle with new information.
Definition: mg_processing.cpp:1026
Bmicrograph::fps
Bstring fps
Definition: mg_processing.h:211
Breconstruction::ffil
Bstring ffil
Definition: mg_processing.h:292
Bfilnode::loc
Vector3< double > loc
Definition: mg_processing.h:119
VERB_FULL
#define VERB_FULL
Definition: utilities.h:113
Breconstruction::bad
Bbadarea * bad
Definition: mg_processing.h:309
Breconstruction::frec
Bstring frec
Definition: mg_processing.h:290
Blayerline::distance
double distance
Definition: mg_processing.h:179
project_show_class_averages
long project_show_class_averages(Bproject *project)
Shows the class averages in a project.
Definition: mg_processing.cpp:1617
project_apply_map_magnifications
int project_apply_map_magnifications(Bproject *project, int mag_num, float *mag)
Change particle pixel sizes for particles based on map magnifications.
Definition: mg_processing.cpp:2471
Blayerline::freq
double freq
Definition: mg_processing.h:180
path_update
Bstring path_update(Bstring &filename, Bstring &path)
Definition: mg_processing.cpp:1740
Bproject::reference
Bstring * reference
Definition: mg_processing.h:341
Bmicrograph::pixel_size
Vector3< double > pixel_size
Definition: mg_processing.h:215
particle_kill
int particle_kill(Bparticle *part)
Frees a list of particles.
Definition: mg_processing.cpp:528
filament_kill
int filament_kill(Bfilament *fil)
Frees a list of filaments.
Definition: mg_processing.cpp:552
project_set_powerspectrum_path
int project_set_powerspectrum_path(Bproject *project, Bstring &path)
Sets the path to powerspectrum files for all the micrographs.
Definition: mg_processing.cpp:1824
Bmicrograph::fil_node_radius
double fil_node_radius
Definition: mg_processing.h:235
Bproject::comment
Bstring comment
Definition: mg_processing.h:339
Blayerline::fom
double fom
Definition: mg_processing.h:182
Bmicrograph::layer
Blayerline * layer
Definition: mg_processing.h:247
filament_count
long filament_count(Bfilament *fil)
Counts the number of filaments in a linked list of filaments.
Definition: mg_select.cpp:791
Bsymmetry::label
Bstring label
Definition: symmetry.h:41
Bfilnode
Definition: mg_processing.h:116
Bstring::contains
bool contains(const Bstring &s)
Definition: Bstring.cpp:592
Bmicrograph::bad
Bbadarea * bad
Definition: mg_processing.h:244
FOM_CV
@ FOM_CV
Definition: mg_processing.h:42
project_update
int project_update(Bproject *project, Bproject *proj_new, int fom_index)
Updates an existing project with new information.
Definition: mg_processing.cpp:809
micrograph_add
Bmicrograph * micrograph_add(Bmicrograph **mg, Bstring &mg_id)
Adds a micrograph parameter structure to a linked list.
Definition: mg_processing.cpp:154
Breconstruction::fps
Bstring fps
Definition: mg_processing.h:294
particle_count
long particle_count(Bparticle *part)
Counts the number of particles in a linked list.
Definition: mg_select.cpp:755
Bparticle::mag
double mag
Definition: mg_processing.h:95
filament_length
double filament_length(Bfilament *fil)
Calculates the length of a filament.
Definition: mg_processing.cpp:375
View::angle
double angle()
Definition: View.h:98
Euler
Definition: Euler.h:28
Bframe::next
Bframe * next
Definition: mg_processing.h:76
Bmicrograph::next
Bmicrograph * next
Definition: mg_processing.h:202
views_from_project
View * views_from_project(Bproject *project, int selection)
Retrieves the particle views from a project.
Definition: mg_processing.cpp:2566
Bparticle::rec
Breconstruction * rec
Definition: mg_processing.h:106
Blayerline
Definition: mg_processing.h:175
reconstruction_set_part_links
long reconstruction_set_part_links(Breconstruction *rec)
Sets the links from particles back to the reconstruction.
Definition: mg_processing.cpp:1185
Bfield::mg
Bmicrograph * mg
Definition: mg_processing.h:267
Bmicrograph::sf_radius
double sf_radius
Definition: mg_processing.h:237
Bparticle::id
int id
Definition: mg_processing.h:93
Blayerline::number
int number
Definition: mg_processing.h:177
Vector3::length2
double length2()
Definition: Vector3.h:221
reconstruction_update
int reconstruction_update(Breconstruction *rec, Breconstruction *nu_rec, int fom_index, int flags)
Updates an existing reconstruction with new information.
Definition: mg_processing.cpp:982
PARTICLE_FOM8
#define PARTICLE_FOM8
Definition: mg_tags.h:228
PARTICLE_DENSITY
#define PARTICLE_DENSITY
Definition: mg_tags.h:239
project_flip_origins
int project_flip_origins(Bproject *project, int flip)
Flip origin coordinates.
Definition: mg_processing.cpp:2196
FOM3
@ FOM3
Definition: mg_processing.h:56
FOM
@ FOM
Definition: mg_processing.h:40
Bmicrograph::fft
Bstring fft
Definition: mg_processing.h:210
micrograph_copy
Bmicrograph * micrograph_copy(Bmicrograph *mg)
Copies a micrograph.
Definition: mg_processing.cpp:735
particle_copy
Bparticle * particle_copy(Bparticle **partlist, Bparticle *part)
Adds one particle onto a list of particle parameters.
Definition: mg_processing.cpp:614
DENSITY
@ DENSITY
Definition: mg_processing.h:53
Breconstruction::view
View view
Definition: mg_processing.h:298
Breconstruction::next
Breconstruction * next
Definition: mg_processing.h:284
Bproject::fom_tag
FOMType fom_tag[NFOM]
Definition: mg_processing.h:345