Bsoft  2.1.0
Bernard's software package
rwmgSTAR.cpp
Go to the documentation of this file.
1 
9 #include "mg_processing.h"
10 #include "rwmgSTAR.h"
11 #include "rwstar.h"
12 #include "mg_tags.h"
13 #include "linked_list.h"
14 #include "utilities.h"
15 
16 // Declaration of global variables
17 extern int verbose; // Level of output to the screen
18 
19 // Internal function prototypes
21 int project_to_star(Bproject* project, Bstar* star, int mg_select, int rec_select);
22 
30 {
31  int err(0);
32  Bstar* star = init_star();
33  star->line_length = 200; // Set the output line length
34 
35  err = read_star(filename, star);
36 
37  if ( err == 0 ) {
38  if ( project->comment.length() < 1 )
39  project->comment = star->comment;
40  err = star_to_project(star, project);
41  }
42 
43  kill_star(star);
44 
45  return err;
46 }
47 
56 int write_project_star(const char* filename, Bproject* project, int mg_select, int rec_select)
57 {
58  Bstring thefile(filename);
59  return write_project_star(thefile, project, mg_select, rec_select);
60 }
61 
62 int write_project_star(Bstring& filename, Bproject* project, int mg_select, int rec_select)
63 {
64  int err(0);
65  Bstar* star = init_star();
66  star->line_length = 200; // Set the output line length
67 
68  err = project_to_star(project, star, mg_select, rec_select);
69 
70  if ( err == 0 )
71  err = write_star(filename, star);
72 
73  kill_star(star);
74 
75  return err;
76 }
77 
84 {
87 
103 
113 
128 
129  return 0;
130 }
131 
133 {
134  if ( verbose & VERB_DEBUG )
135  cout << "DEBUG frame_from_starblock:" << endl;
136 
137  Bstar_item* item;
138  Bstring* data;
139  Bframe* framelist = NULL;
140  Bframe* frame = NULL;
141 
142  item = item_find(block, MICROGRAPH_FRAME);
143  if ( item )
144  for ( data=item->data; data; data=data->next ) {
145  frame = frame_add(&frame, data->integer());
146  if ( !framelist ) framelist = frame;
147  }
148  if ( ( item = item_find(block, MICROGRAPH_FRAME_SHIFT_X) ) )
149  for ( data=item->data, frame=framelist; data && frame; data=data->next, frame=frame->next )
150  if ( data->length() > 1 ) frame->shift[0] = data->real();
151  if ( ( item = item_find(block, MICROGRAPH_FRAME_SHIFT_Y) ) )
152  for ( data=item->data, frame=framelist; data && frame; data=data->next, frame=frame->next )
153  if ( data->length() > 1 ) frame->shift[1] = data->real();
154  if ( ( item = item_find(block, MICROGRAPH_FRAME_SELECT) ) )
155  for ( data=item->data, frame=framelist; data && frame; data=data->next, frame=frame->next )
156  if ( data->length() > 1 ) frame->sel = data->integer();
157  if ( ( item = item_find(block, MICROGRAPH_FRAME_FOM) ) )
158  for ( data=item->data, frame=framelist; data && frame; data=data->next, frame=frame->next )
159  if ( data->length() > 1 ) frame->fom = data->real();
160 
161  return framelist;
162 }
163 
165 {
166  if ( verbose & VERB_DEBUG )
167  cout << "DEBUG particle_from_starblock:" << endl;
168 
169  Bstar_item* item;
170  Bstring* data;
171  Bparticle* partlist = NULL;
172  Bparticle* part = NULL;
173 
174  char tag[128];
175  int f, omega_flag(0);
176  Euler euler;
177 
178  item = item_find(block, PARTICLE_ID);
179  if ( item )
180  for ( data=item->data; data; data=data->next ) {
181  part = particle_add(&part, data->integer());
182  if ( !partlist ) partlist = part;
183  }
184  if ( ( item = item_find(block, PARTICLE_FILE) ) ) {
185  if ( item->loop >= 0 )
186  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
187  if ( data->length() > 1 ) part->fpart = *data;
188  }
189  item = item_find(block, PARTICLE_GROUP);
190  if ( item )
191  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
192  part->group = data->integer();
193  item = item_find(block, PARTICLE_DEFOCUS);
194  if ( item )
195  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
196  part->def = data->real();
197  item = item_find(block, PARTICLE_DEF_DEV);
198  if ( item )
199  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
200  part->dev = data->real();
201  item = item_find(block, PARTICLE_AST_ANG);
202  if ( item )
203  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
204  part->ast = data->real() * M_PI/180.0;
205  item = item_find(block, PARTICLE_MAGNIF);
206  if ( item )
207  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
208  part->mag = data->real();
209  item = item_find(block, PARTICLE_X);
210  if ( item )
211  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
212  part->loc[0] = data->real();
213  item = item_find(block, PARTICLE_Y);
214  if ( item )
215  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
216  part->loc[1] = data->real();
217  item = item_find(block, PARTICLE_Z);
218  if ( item )
219  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
220  part->loc[2] = data->real();
221  item = item_find(block, PARTICLE_PIXEL);
222  if ( item ) {
223  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
224  part->pixel_size[0] = part->pixel_size[1] = part->pixel_size[2] = data->real();
225  } else {
226  item = item_find(block, PARTICLE_PIXEL_X);
227  if ( item )
228  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
229  part->pixel_size[0] = data->real();
230  item = item_find(block, PARTICLE_PIXEL_Y);
231  if ( item )
232  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
233  part->pixel_size[1] = data->real();
234  item = item_find(block, PARTICLE_PIXEL_Z);
235  if ( item )
236  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
237  part->pixel_size[2] = data->real();
238  }
239  item = item_find(block, PARTICLE_ORIGIN_X);
240  if ( item )
241  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
242  part->ori[0] = data->real();
243  item = item_find(block, PARTICLE_ORIGIN_Y);
244  if ( item )
245  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
246  part->ori[1] = data->real();
247  item = item_find(block, PARTICLE_ORIGIN_Z);
248  if ( item )
249  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
250  part->ori[2] = data->real();
251  item = item_find(block, PARTICLE_VIEW_X);
252  if ( item ) {
253  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
254  part->view[0] = data->real();
255  item = item_find(block, PARTICLE_VIEW_Y);
256  if ( item )
257  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
258  part->view[1] = data->real();
259  item = item_find(block, PARTICLE_VIEW_Z);
260  if ( item )
261  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
262  part->view[2] = data->real();
263  item = item_find(block, PARTICLE_VIEW_ANGLE);
264  if ( item )
265  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
266  part->view[3] = data->real()*M_PI/180.0;
267  } else {
268  omega_flag = 0;
269  item = item_find(block, PARTICLE_PSI);
270  if ( !item ) {
271  item = item_find(block, PARTICLE_OMEGA);
272  omega_flag = 1;
273  }
274  if ( item )
275  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next ) {
276  part->view[0] = data->real()*M_PI/180.0;
277  if ( omega_flag ) part->view[0] = -part->view[0];
278  }
279  item = item_find(block, PARTICLE_THETA);
280  if ( item )
281  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
282  part->view[1] = data->real()*M_PI/180.0;
283  item = item_find(block, PARTICLE_PHI);
284  if ( item )
285  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
286  part->view[2] = data->real()*M_PI/180.0;
287  for ( part=partlist; part; part=part->next ) {
288  euler = Euler(part->view[0], part->view[1], part->view[2]);
289  part->view = euler.view();
290  }
291  }
292  for ( f=0; f<NFOM; f++ ) if ( fom_tag[f] ) {
293  get_fom_tag(fom_tag[f], tag);
294  if ( strlen(tag) > 1 ) {
295  item = item_find(block, tag);
296  if ( item )
297  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
298  part->fom[f] = data->real();
299  }
300  }
301  item = item_find(block, PARTICLE_SELECT);
302  if ( item )
303  for ( data=item->data, part=partlist; data && part; data=data->next, part=part->next )
304  part->sel = data->integer();
305 
306  return partlist;
307 }
308 
310 {
311  if ( verbose & VERB_DEBUG )
312  cout << "DEBUG filament_from_starblock:" << endl;
313 
314  Bstar_item* item;
315  Bstring* data;
316  Bfilament* fillist = NULL;
317  Bfilament* fil = NULL;
318  Bfilnode* fnode = NULL;
319 
320  int f, fp;
321 
322  item = item_find(block, FILAMENT_ID);
323  for ( fp=-1, data=item->data; data; data=data->next ) {
324  f = data->integer();
325  if ( f != fp ) fil = filament_add(&fillist, f);
326  filament_node_add(&fil->node, 0);
327  fp = f;
328  }
329  if ( ( item = item_find(block, FILAMENT_FILE) ) ) {
330  if ( item->loop >= 0 )
331  for ( data=item->data, fil=fillist; data && fil; fil=fil->next )
332  fil->ffil = *data;
333  }
334 
335  item = item_find(block, FILAMENT_NODE_ID);
336  if ( item )
337  for ( data=item->data, fil=fillist; data && fil; fil=fil->next )
338  for ( fnode=fil->node; data && fnode; data=data->next, fnode=fnode->next )
339  fnode->id = data->integer();
340  item = item_find(block, FILAMENT_NODE_X);
341  if ( item )
342  for ( data=item->data, fil=fillist; data && fil; fil=fil->next )
343  for ( fnode=fil->node; data && fnode; data=data->next, fnode=fnode->next )
344  fnode->loc[0] = data->real();
345  item = item_find(block, FILAMENT_NODE_Y);
346  if ( item )
347  for ( data=item->data, fil=fillist; data && fil; fil=fil->next )
348  for ( fnode=fil->node; data && fnode; data=data->next, fnode=fnode->next )
349  fnode->loc[1] = data->real();
350  item = item_find(block, FILAMENT_NODE_Z);
351  if ( item )
352  for ( data=item->data, fil=fillist; data && fil; fil=fil->next )
353  for ( fnode=fil->node; data && fnode; data=data->next, fnode=fnode->next )
354  fnode->loc[2] = data->real();
355 
356  return fillist;
357 }
358 
360 {
361  if ( verbose & VERB_DEBUG )
362  cout << "DEBUG badarea_from_starblock:" << endl;
363 
364  Bstar_item* item;
365  Bstring* data;
366  Bbadarea* bad = NULL;
367  Bbadarea* badlist = NULL;
368 
369  long j, nbad = item_get_number_for_block(block, PARTICLE_BAD_X);
370 
371  for ( j=0; j<nbad; j++ ) {
372  bad = (Bbadarea *) add_item((char **) &bad, sizeof(Bbadarea));
373  if ( !badlist ) badlist = bad;
374  }
375  item = item_find(block, PARTICLE_BAD_X);
376  if ( item )
377  for ( data=item->data, bad=badlist; data && bad; data=data->next, bad=bad->next )
378  bad->loc[0] = data->real();
379  item = item_find(block, PARTICLE_BAD_Y);
380  if ( item )
381  for ( data=item->data, bad=badlist; data && bad; data=data->next, bad=bad->next )
382  bad->loc[1] = data->real();
383  item = item_find(block, PARTICLE_BAD_Z);
384  if ( item )
385  for ( data=item->data, bad=badlist; data && bad; data=data->next, bad=bad->next )
386  bad->loc[2] = data->real();
387 
388  return badlist;
389 }
390 
392 {
393  if ( verbose & VERB_DEBUG )
394  cout << "DEBUG marker_from_starblock:" << endl;
395 
396  Bstar_item* item;
397  Bstring* data;
398  Bmarker* marklist = NULL;
399  Bmarker* mark = NULL;
400 
401  long j, nmark = item_get_number_for_block(block, MARKER_X);
402 
403  for ( j=0; j<nmark; j++ ) {
404  mark = (Bmarker *) add_item((char **) &mark, sizeof(Bmarker));
405  if ( !marklist ) marklist = mark;
406  mark->id = j+1;
407  mark->fom = 1;
408  mark->sel = 1;
409  }
410  item = item_find(block, MARKER_ID);
411  if ( item )
412  for ( data=item->data, mark=marklist; data && mark; data=data->next, mark=mark->next )
413  mark->id = data->integer();
414  item = item_find(block, MARKER_X);
415  if ( item )
416  for ( data=item->data, mark=marklist; data && mark; data=data->next, mark=mark->next )
417  mark->loc[0] = data->real();
418  item = item_find(block, MARKER_Y);
419  if ( item )
420  for ( data=item->data, mark=marklist; data && mark; data=data->next, mark=mark->next )
421  mark->loc[1] = data->real();
422  item = item_find(block, MARKER_Z);
423  if ( item )
424  for ( data=item->data, mark=marklist; data && mark; data=data->next, mark=mark->next )
425  mark->loc[2] = data->real();
426  item = item_find(block, MARKER_ERROR_X);
427  if ( item )
428  for ( data=item->data, mark=marklist; data && mark; data=data->next, mark=mark->next )
429  mark->err[0] = data->real();
430  item = item_find(block, MARKER_ERROR_Y);
431  if ( item )
432  for ( data=item->data, mark=marklist; data && mark; data=data->next, mark=mark->next )
433  mark->err[1] = data->real();
434  item = item_find(block, MARKER_ERROR_Z);
435  if ( item )
436  for ( data=item->data, mark=marklist; data && mark; data=data->next, mark=mark->next )
437  mark->err[2] = data->real();
438  item = item_find(block, MARKER_RESIDUAL);
439  if ( item )
440  for ( data=item->data, mark=marklist; data && mark; data=data->next, mark=mark->next )
441  mark->res = data->real();
442  item = item_find(block, MARKER_FOM);
443  if ( item )
444  for ( data=item->data, mark=marklist; data && mark; data=data->next, mark=mark->next )
445  mark->fom = data->real();
446  item = item_find(block, MARKER_SELECT);
447  if ( item )
448  for ( data=item->data, mark=marklist; data && mark; data=data->next, mark=mark->next )
449  mark->sel = data->integer();
450 
451  return marklist;
452 }
453 
455 {
456  if ( verbose & VERB_DEBUG )
457  cout << "DEBUG strucfac_from_starblock:" << endl;
458 
459  Bstar_item* item;
460  Bstring* data;
461  Bstrucfac* sflist = NULL;
462  Bstrucfac* sf = NULL;
463 
464  long j, nsf = item_get_number_for_block(block, REFLEX_H);
465 
466  for ( j=0; j<nsf; j++ ) {
467  sf = (Bstrucfac *) add_item((char **) &sf, sizeof(Bstrucfac));
468  if ( !sflist ) sflist = sf;
469  sf->fom = sf->sel = 1;
470  }
471  item = item_find(block, REFLEX_H);
472  if ( item )
473  for ( data=item->data, sf=sflist; data && sf; data=data->next, sf=sf->next )
474  sf->index[0] = data->integer();
475  item = item_find(block, REFLEX_K);
476  if ( item )
477  for ( data=item->data, sf=sflist; data && sf; data=data->next, sf=sf->next )
478  sf->index[1] = data->integer();
479  item = item_find(block, REFLEX_L);
480  if ( item )
481  for ( data=item->data, sf=sflist; data && sf; data=data->next, sf=sf->next )
482  sf->index[2] = data->integer();
483  item = item_find(block, REFLEX_X);
484  if ( item )
485  for ( data=item->data, sf=sflist; data && sf; data=data->next, sf=sf->next )
486  sf->loc[0] = data->real();
487  item = item_find(block, REFLEX_Y);
488  if ( item )
489  for ( data=item->data, sf=sflist; data && sf; data=data->next, sf=sf->next )
490  sf->loc[1] = data->real();
491  item = item_find(block, REFLEX_Z);
492  if ( item )
493  for ( data=item->data, sf=sflist; data && sf; data=data->next, sf=sf->next )
494  sf->loc[2] = data->real();
495  item = item_find(block, REFLEX_AMP);
496  if ( item )
497  for ( data=item->data, sf=sflist; data && sf; data=data->next, sf=sf->next )
498  sf->amp = data->real();
499  item = item_find(block, REFLEX_SIGAMP);
500  if ( item )
501  for ( data=item->data, sf=sflist; data && sf; data=data->next, sf=sf->next )
502  sf->sigamp = data->real();
503  item = item_find(block, REFLEX_PHI);
504  if ( item )
505  for ( data=item->data, sf=sflist; data && sf; data=data->next, sf=sf->next )
506  sf->phi = data->real();
507  item = item_find(block, REFLEX_SIGPHI);
508  if ( item )
509  for ( data=item->data, sf=sflist; data && sf; data=data->next, sf=sf->next )
510  sf->sigphi = data->real();
511  item = item_find(block, REFLEX_FOM);
512  if ( item )
513  for ( data=item->data, sf=sflist; data && sf; data=data->next, sf=sf->next )
514  sf->fom = data->real();
515  item = item_find(block, REFLEX_STATUS);
516  if ( item )
517  for ( data=item->data, sf=sflist; data && sf; data=data->next, sf=sf->next )
518  sf->sel = data->integer();
519 
520  return sflist;
521 }
522 
524 {
525  if ( verbose & VERB_DEBUG )
526  cout << "DEBUG layerline_from_starblock:" << endl;
527 
528  Bstar_item* item;
529  Bstring* data;
530  Blayerline* linelist = NULL;
531  Blayerline* line = NULL;
532 
533  long j, nline = item_get_number_for_block(block, LAYERLINE_NUMBER);
534 
535  for ( j=0; j<nline; j++ ) {
536  line = (Blayerline *) add_item((char **) &line, sizeof(Blayerline));
537  if ( !linelist ) linelist = line;
538  line->fom = line->sel = 1;
539  }
540  item = item_find(block, LAYERLINE_NUMBER);
541  if ( item )
542  for ( data=item->data, line=linelist; data && line; data=data->next, line=line->next )
543  line->number = data->integer();
544  item = item_find(block, LAYERLINE_ORDER);
545  if ( item )
546  for ( data=item->data, line=linelist; data && line; data=data->next, line=line->next )
547  line->order = data->integer();
548  item = item_find(block, LAYERLINE_DISTANCE);
549  if ( item )
550  for ( data=item->data, line=linelist; data && line; data=data->next, line=line->next )
551  line->distance = data->real();
552  item = item_find(block, LAYERLINE_FREQ);
553  if ( item )
554  for ( data=item->data, line=linelist; data && line; data=data->next, line=line->next )
555  line->freq = data->real();
556  item = item_find(block, LAYERLINE_AMP);
557  if ( item )
558  for ( data=item->data, line=linelist; data && line; data=data->next, line=line->next )
559  line->amp = data->real();
560  item = item_find(block, LAYERLINE_FOM);
561  if ( item )
562  for ( data=item->data, line=linelist; data && line; data=data->next, line=line->next )
563  line->fom = data->real();
564  item = item_find(block, LAYERLINE_SELECT);
565  if ( item )
566  for ( data=item->data, line=linelist; data && line; data=data->next, line=line->next )
567  line->sel = data->integer();
568 
569  return linelist;
570 }
571 
573 {
574  if ( verbose & VERB_DEBUG )
575  cout << "DEBUG ctf_from_starblock:" << endl;
576 
577  if ( item_get_number_for_block(block, CTF_DEF_AVG) < 1 &&
579  return NULL;
580 
581  CTFparam* ctf = new CTFparam;
582 
583  ctf->volt(item_get_float(block, CTF_VOLTAGE));
584  if ( item_get_number_for_block(block, CTF_FOCAL) )
585  ctf->focal_length(item_get_float(block, CTF_FOCAL));
589  ctf->amp_shift(item_get_float(block, CTF_AMP_SHIFT));
590  else
591  ctf->amp_shift(asin(item_get_float(block, CTF_AMP)));
592  if ( item_get_number_for_block(block, CTF_DEF_AVG) > 0 ) {
595  } else {
596  double min = item_get_float(block, CTF_DEF_MIN);
597  double max = item_get_float(block, CTF_DEF_MAX);
598  ctf->defocus_average((max + min)/2);
599  ctf->defocus_deviation((max - min)/2);
600  }
601  ctf->astigmatism_angle(item_get_float(block, CTF_AST_ANG) * M_PI/180.0);
602  ctf->Cs(item_get_float(block, CTF_CS));
603  ctf->Cc(item_get_float(block, CTF_CC));
604  ctf->alpha(item_get_float(block, CTF_ALPHA));
605  ctf->dE(item_get_float(block, CTF_DE));
606  ctf->zero(1);
607 
608  Bstar_item* item;
609 
610  if ( ( item = item_find(block, CTF_BASELINE) ) )
611  ctf->parse_baseline_equation(*(item->data));
612 
613  if ( ( item = item_find(block, CTF_ENVELOPE) ) )
614  ctf->parse_envelope_equation(*(item->data));
615 
616  return ctf;
617 }
618 
620 {
621  if ( verbose & VERB_DEBUG )
622  cout << "DEBUG micrograph_from_starblock:" << endl;
623 
624  Bstar_item* item;
625 
626  int npart(0), nfil(0), nbad, nmark, nsf, nline;
627 
628  Bmicrograph* mg = NULL;
629  mg = micrograph_add(&mg, mg_id);
630  if ( ( item = item_find(block, MICROGRAPH_FILE) ) ) mg->fmg = *(item->data);
631  if ( ( item = item_find(block, MICROGRAPH_FRAMES_FILE) ) ) mg->fframe = *(item->data);
632  if ( ( item = item_find(block, PARTICLE_FILE) ) ) {
633  if ( item->loop < 0 )
634  mg->fpart = *(item->data);
635  }
636  if ( ( item = item_find(block, FILAMENT_FILE) ) ) mg->ffil = *(item->data);
637  if ( ( item = item_find(block, MICROGRAPH_TRANSFORM_FILE) ) ) mg->fft = *(item->data);
638  if ( ( item = item_find(block, MICROGRAPH_POWERSPEC_FILE) ) ) mg->fps = *(item->data);
641  mg->fom = item_get_float(block, MICROGRAPH_FOM);
644  if ( ( item = item_find(block, MICROGRAPH_PIXEL) ) ) {
645  mg->pixel_size[0] = mg->pixel_size[1] = item_get_float(block, MICROGRAPH_PIXEL);
646  } else {
649  }
650  mg->dose = item_get_float(block, MICROGRAPH_DOSE);
653  mg->origin[0] = item_get_float(block, MICROGRAPH_ORIGIN_X);
654  mg->origin[1] = item_get_float(block, MICROGRAPH_ORIGIN_Y);
655  mg->origin[2] = item_get_float(block, MICROGRAPH_ORIGIN_Z);
656  mg->scale[0] = item_get_float(block, MICROGRAPH_SCALE_X);
657  mg->scale[1] = item_get_float(block, MICROGRAPH_SCALE_Y);
658  mg->scale[2] = item_get_float(block, MICROGRAPH_SCALE_Z);
663  mg->matrix[0][0] = item_get_float(block, MICROGRAPH_MATRIX_1_1);
664  mg->matrix[0][1] = item_get_float(block, MICROGRAPH_MATRIX_1_2);
665  mg->matrix[0][2] = item_get_float(block, MICROGRAPH_MATRIX_1_3);
666  mg->matrix[1][0] = item_get_float(block, MICROGRAPH_MATRIX_2_1);
667  mg->matrix[1][1] = item_get_float(block, MICROGRAPH_MATRIX_2_2);
668  mg->matrix[1][2] = item_get_float(block, MICROGRAPH_MATRIX_2_3);
669  mg->matrix[2][0] = item_get_float(block, MICROGRAPH_MATRIX_3_1);
670  mg->matrix[2][1] = item_get_float(block, MICROGRAPH_MATRIX_3_2);
671  mg->matrix[2][2] = item_get_float(block, MICROGRAPH_MATRIX_3_3);
672  mg->hvec[0] = item_get_float(block, MICROGRAPH_HVEC_X);
673  mg->hvec[1] = item_get_float(block, MICROGRAPH_HVEC_Y);
674  mg->hvec[2] = item_get_float(block, MICROGRAPH_HVEC_Z);
675  mg->kvec[0] = item_get_float(block, MICROGRAPH_KVEC_X);
676  mg->kvec[1] = item_get_float(block, MICROGRAPH_KVEC_Y);
677  mg->kvec[2] = item_get_float(block, MICROGRAPH_KVEC_Z);
678  mg->lvec[0] = item_get_float(block, MICROGRAPH_LVEC_X);
679  mg->lvec[1] = item_get_float(block, MICROGRAPH_LVEC_Y);
680  mg->lvec[2] = item_get_float(block, MICROGRAPH_LVEC_Z);
685  mg->tilt_axis *= M_PI/180.0;
686  mg->tilt_angle *= M_PI/180.0;
687  mg->level_angle *= M_PI/180.0;
688  mg->rot_angle *= M_PI/180.0;
689  mg->helix_axis *= M_PI/180.0;
690  mg->helix_angle *= M_PI/180.0;
691 
693  mg->box_size[0] = mg->box_size[1] = mg->box_size[2] =
696  mg->box_size[0] = 2 * item_get_integer(block, PARTICLE_BOX_RADIUS_X);
697  mg->box_size[1] = 2 * item_get_integer(block, PARTICLE_BOX_RADIUS_Y);
698  mg->box_size[2] = 2 * item_get_integer(block, PARTICLE_BOX_RADIUS_Z);
699  }
701  mg->box_size[0] = mg->box_size[1] = mg->box_size[2] =
707  }
708 
712  mg->sf_radius = item_get_float(block, REFLEX_RADIUS);
714 
715  mg->ctf = ctf_from_starblock(block);
716 
717  mg->frame = frame_from_starblock(block);
718 
719  npart = item_get_number_for_block(block, PARTICLE_ID);
720  if ( verbose & VERB_FULL )
721  cout << npart << " particles" << endl;
722  if ( npart )
723  mg->part = particle_from_starblock(block, fom_tag);
724 
725  nfil = item_get_number_for_block(block, FILAMENT_ID);
726  if ( nfil ) {
727  if ( verbose & VERB_FULL )
728  cout << nfil << " filament nodes" << endl;
729  mg->fil = filament_from_starblock(block);
730  }
731 
733  if ( nbad )
734  mg->bad = badarea_from_starblock(block);
735 
736  nmark = item_get_number_for_block(block, MARKER_X);
737  if ( nmark )
738  mg->mark = marker_from_starblock(block);
739 
740  nsf = item_get_number_for_block(block, REFLEX_H);
741  if ( nsf )
742  mg->sf = strucfac_from_starblock(block);
743 
745  if ( nline )
746  mg->layer = layerline_from_starblock(block);
747 
748  return mg;
749 }
750 
752 {
753  if ( verbose & VERB_DEBUG )
754  cout << "DEBUG reconstruction_from_starblock:" << endl;
755 
756  if ( verbose & VERB_FULL )
757  cout << "Converting reconstruction" << endl;
758 
759  Bstar_item* item;
760  Bstring id("1");
761  Breconstruction* rec = NULL;
762  reconstruction_add(&rec, id);
763 
764  rec->block = block->number;
765  rec->select = 1;
766 
767  if ( ( item = item_find(block, MAP_ID) ) ) rec->id = *(item->data);
768  if ( verbose & VERB_DEBUG )
769  cout << "DEBUG reconstruction_from_starblock: ID = " << rec->id << endl;
770 
771  if ( ( item = item_find(block, MAP_RECONSTRUCTION) ) ) rec->frec = *(item->data);
772  if ( verbose & VERB_DEBUG )
773  cout << "DEBUG reconstruction_from_starblock: frec = " << rec->frec << endl;
774 
775  if ( ( item = item_find(block, MAP_TRANSFORM_FILE) ) ) rec->fft = *(item->data);
776  if ( verbose & VERB_DEBUG )
777  cout << "DEBUG reconstruction_from_starblock: fft = " << rec->fft << endl;
778 
779  if ( ( item = item_find(block, MAP_POWERSPEC_FILE) ) ) rec->fps = *(item->data);
780  if ( verbose & VERB_DEBUG )
781  cout << "DEBUG reconstruction_from_starblock: fps = " << rec->fps << endl;
782 
783  if ( ( item = item_find(block, PARTICLE_FILE) ) ) {
784  if ( item->loop < 0 )
785  rec->fpart = *(item->data);
786  }
787  if ( verbose & VERB_DEBUG )
788  cout << "DEBUG reconstruction_from_starblock: fpart = " << rec->fpart << endl;
789 
790  if ( ( item = item_find(block, FILAMENT_FILE) ) ) rec->ffil = *(item->data);
791  if ( verbose & VERB_DEBUG )
792  cout << "DEBUG reconstruction_from_starblock: fpart = " << rec->ffil << endl;
793 
794  if ( ( item = item_find(block, MAP_MODEL) ) ) string_add(&rec->model, *(item->data));
795 
796  rec->select = item_get_integer(block, MAP_SELECT);
797  rec->fom = item_get_float(block, MAP_FOM);
798 
799  rec->origin[0] = item_get_float(block, MAP_ORIGIN_X);
800  rec->origin[1] = item_get_float(block, MAP_ORIGIN_Y);
801  rec->origin[2] = item_get_float(block, MAP_ORIGIN_Z);
802  rec->scale[0] = item_get_float(block, MAP_SCALE_X);
803  rec->scale[1] = item_get_float(block, MAP_SCALE_Y);
804  rec->scale[2] = item_get_float(block, MAP_SCALE_Z);
805  if ( ( item = item_find(block, MAP_VOXEL_SIZE) ) ) {
806  rec->voxel_size[0] = item_get_float(block, MAP_VOXEL_SIZE);
807  rec->voxel_size[1] = rec->voxel_size[2] = rec->voxel_size[0];
808  } else {
809  rec->voxel_size[0] = item_get_float(block, MAP_VOXEL_SIZE_X);
810  rec->voxel_size[1] = item_get_float(block, MAP_VOXEL_SIZE_Y);
811  rec->voxel_size[2] = item_get_float(block, MAP_VOXEL_SIZE_Z);
812  }
813 
814  if ( ( item = item_find(block, MAP_SYMMETRY) ) ) rec->symmetry = *(item->data);
815  if ( verbose & VERB_DEBUG )
816  cout << "DEBUG reconstruction_from_starblock: symmetry = " << rec->symmetry << endl;
817 
818  if ( item_find(block, CTF_VOLTAGE) ) rec->ctf = ctf_from_starblock(block);
819 
821  rec->box_size[0] = rec->box_size[1] = rec->box_size[2] =
824  rec->box_size[0] = 2 * item_get_integer(block, PARTICLE_BOX_RADIUS_X);
825  rec->box_size[1] = 2 * item_get_integer(block, PARTICLE_BOX_RADIUS_Y);
826  rec->box_size[2] = 2 * item_get_integer(block, PARTICLE_BOX_RADIUS_Z);
827  }
829  rec->box_size[0] = rec->box_size[1] = rec->box_size[2] =
835  }
836 
840  rec->sf_radius = item_get_float(block, REFLEX_RADIUS);
842 
843  rec->view[0] = item_get_float(block, MAP_VIEW_X);
844  rec->view[1] = item_get_float(block, MAP_VIEW_Y);
845  rec->view[2] = item_get_float(block, MAP_VIEW_Z);
846  rec->view[3] = item_get_float(block, MAP_VIEW_ANGLE)*M_PI/180.0;
847 
848  long npart = item_get_number_for_block(block, PARTICLE_ID);
849  if ( npart ) {
850  if ( verbose & VERB_FULL )
851  cout << "Reading reconstruction \"" << rec->id << "\" with " << npart << " particles" << endl;
852  rec->part = particle_from_starblock(block, fom_tag);
853  }
854 
855  long nfil = item_get_number_for_block(block, FILAMENT_ID);
856  if ( nfil ) {
857  if ( verbose & VERB_FULL )
858  cout << "Reading reconstruction \"" << rec->id << "\", with " << nfil << " filament nodes" << endl;
859  rec->fil = filament_from_starblock(block);
860  }
861 
862  long nbad = item_get_number_for_block(block, PARTICLE_BAD_X);
863  if ( nbad )
864  rec->bad = badarea_from_starblock(block);
865 
866  long nmark = item_get_number_for_block(block, MARKER_X);
867  if ( nmark ) {
868  if ( verbose & VERB_FULL )
869  cout << "Reading reconstruction \"" << rec->id << "\" with " << nmark << " markers" << endl;
870  rec->mark = marker_from_starblock(block);
871  }
872 
873  long nsf = item_get_number_for_block(block, REFLEX_H);
874  if ( nsf ) {
875  if ( verbose & VERB_FULL )
876  cout << "Reading reconstruction \"" << rec->id << "\" with " << nsf << " structure factors" << endl;
877  rec->sf = strucfac_from_starblock(block);
878  }
879 
880  return rec;
881 }
882 
883 /*
884 @brief Converts micrograph data from a STAR data base to a project structure.
885 @param *star STAR data base.
886 @param *project project structure.
887 @return int error code (<0 means failure).
888 
889  The function sets up the project hierarchy from a STAR database file.
890  Micrograph data blocks must contain the "micrograph.id" tag.
891  If the "micrograph.field_of_view_id" is present, the micrographs are
892  distributed into multi-micrograph fields-of-view. Otherwise, each
893  micrograph is assumed to be a unique field-of-view.
894  All angles given in the STAR data base are assumed to be in degrees,
895  and are converted here only to radians.
896 
897 **/
899 {
900  int err(0);
901  int nmg(0), nrec(0);
902 
903  if ( verbose & VERB_DEBUG )
904  cout << "DEBUG star_to_project:" << endl;
905 
906  mg_star_update_tags(star);
907 
908  nmg = item_get_number(star, MICROGRAPH_ID);
909  if ( nmg < 1 ) nmg = item_get_number(star, MICROGRAPH_FILE);
910  if ( nmg < 1 ) nmg = item_get_number(star, MICROGRAPH_FRAMES_FILE);
911  if ( nmg < 1 ) nmg = item_get_number(star, MICROGRAPH_TRANSFORM_FILE);
912  if ( nmg < 1 ) nmg = item_get_number(star, MICROGRAPH_POWERSPEC_FILE);
913 
914  nrec = item_get_number(star, MAP_ID);
915  if ( nrec < 1 ) nrec = item_get_number(star, MAP_RECONSTRUCTION);
916  if ( nrec < 1 ) nrec = item_get_number(star, MAP_TRANSFORM_FILE);
917  if ( nrec < 1 ) nrec = item_get_number(star, MAP_POWERSPEC_FILE);
918 
919  if ( nmg < 1 && nrec < 1 ) {
920  cerr << "Warning: No micrograph or reconstruction data blocks found" << endl;
921  return 0;
922  }
923 
924  Bstar_block* block;
925  Bstar_item* item;
926  Bstring* data;
927 
928  Bfield* field = NULL;
929  Bmicrograph *mg, *mg2;
930  Breconstruction *rec, *rec2;
931 
932  for ( rec2 = project->rec; rec2 && rec2->next; rec2 = rec2->next ) ;
933 
934  block = block_find_with_tag(star, MAP_REFERENCE);
935  if ( block ) {
936  item = item_find(block, MAP_REFERENCE);
937  if ( item )
938  for ( data=item->data; data; data=data->next )
939  string_add(&project->reference, data->c_str());
940  }
941 
942  if ( ( verbose & VERB_DEBUG ) && project->reference )
943  cout << "DEBUG star_to_project: reference map = " << *(project->reference) << endl;
944 
945  int i, j, f, nfield(0);
946  Bstring field_id, mg_id;
947  Bstring base;
948 
949  // Make sure FOM tags are properly set up
950  if ( item_get_number(star, PARTICLE_FOM) ) project->fom_tag[0] = FOM;
954 
955  for ( f=i=0; f<NFOM; f++ ) i += project->fom_tag[f];
956  if ( i < 2 ) project->fom_tag[0] = FOM;
957 
958  // The orientation convention used is set based on whether the view angle
959  // array or the phi euler angle array is present in the file.
960  // If both are present, the one with the larger number of values wins,
961  // otherwise only the view vector and rotation angle
962  // representation will be used.
963  i = item_get_number(star, PARTICLE_PHI);
965  project->euler_flag = 0;
966  project->omega_flag = 0;
967  if ( i > 0 && j > 0 )
968  cerr << "Error: The STAR file contains both views and Euler angles!" << endl;
969  else if ( i > j ) {
970  project->euler_flag = 1;
971  if ( item_get_number(star, PARTICLE_OMEGA) > 0 )
972  project->omega_flag = 1;
973  }
974 
975  nmg = 0;
976  for ( i=0, block = star->block; block; block = block->next, i++ ) {
978  mg_id = 0;
979  field_id = 0;
980  /* This deals with old style access to micrograph data blocks */
981  if ( ( item = item_find(block, MICROGRAPH_ID) ) ) {
982  mg_id = *(item->data);
983  } else {
984  if ( ( item = item_find(block, MICROGRAPH_FILE) ) ) mg_id = *(item->data);
985  else if ( ( item = item_find(block, MICROGRAPH_FRAMES_FILE) ) ) mg_id = *(item->data);
986  else if ( ( item = item_find(block, PARTICLE_FILE) ) ) mg_id = *(item->data);
987  else if ( ( item = item_find(block, FILAMENT_FILE) ) ) mg_id = *(item->data);
988  else if ( ( item = item_find(block, MICROGRAPH_TRANSFORM_FILE) ) ) mg_id = *(item->data);
989  else if ( ( item = item_find(block, MICROGRAPH_POWERSPEC_FILE) ) ) mg_id = *(item->data);
990  if ( mg_id.length() > 0 ) mg_id = mg_id.base();
991  }
992  if ( mg_id.length() > 0 ) {
993  if ( ( item = item_find(block, MICROGRAPH_FIELD_ID) ) ) field_id = *(item->data);
994  if ( field_id.length() < 1 ) field_id = mg_id;
995  if ( !project->field ) {
996  field_add(&field, field_id);
997  project->field = field; // First field
998  nfield++;
999  } else {
1000  field = NULL;
1001  if ( field_id.length() > 0 )
1002  field = field_find_id(project->field, field_id);
1003  if ( !field ) {
1004  field = project->field;
1005  field = field_add(&field, field_id);
1006  nfield++;
1007  }
1008  }
1009  mg = micrograph_from_starblock(block, mg_id, project->fom_tag);
1010  mg->block = i;
1011  if ( verbose & VERB_FULL )
1012  cout << "Reading field \"" << field->id << "\", micrograph \"" << mg->id <<"\"" << endl;
1013  if ( field->mg ) {
1014  for ( mg2 = field->mg; mg2->next; mg2 = mg2->next ) ;
1015  mg2->next = mg;
1016  } else field->mg = mg;
1017  mg_id = 0;
1018  field_id = 0;
1019  nmg++;
1020  }
1021  } else if ( item_get_number_for_block(block, MAP_ID) ||
1026  if ( !project->rec ) project->rec = rec;
1027  else rec2->next = rec;
1028  rec2 = rec;
1029  } else if ( item_get_number_for_block(block, PARTICLE_ID) ) {
1031  }
1032  }
1033 
1036 
1037  return err;
1038 }
1039 
1040 int item_put_filament_list(Bstar_block* block, const char* tag, Bfilament* fil, const char* format)
1041 {
1042  if ( !block ) return -1;
1043 
1044  Bstring s;
1045 
1046  Bstar_item* item = item_find_or_make(block, tag);
1047  Bstring* data = NULL;
1048 
1049  if ( item->data ) {
1050  string_kill(item->data);
1051  item->data = NULL;
1052  }
1053 
1054  item->type = NumberItem;
1055  item->loop = -1;
1056 
1057  if ( strcmp(tag, FILAMENT_ID) == 0 )
1058  item->type = StringItem;
1059 
1060  Bfilnode* fnode = NULL;
1061 
1062  for ( ; fil; fil=fil->next )
1063  for ( fnode=fil->node; fnode; fnode=fnode->next ) {
1064  if ( strcmp(tag, FILAMENT_ID) == 0 ) s = Bstring(fil->id, format);
1065  else if ( strcmp(tag, FILAMENT_NODE_ID) == 0 ) s = Bstring(fnode->id, format);
1066  else if ( strcmp(tag, FILAMENT_NODE_X) == 0 ) s = Bstring(fnode->loc[0], format);
1067  else if ( strcmp(tag, FILAMENT_NODE_Y) == 0 ) s = Bstring(fnode->loc[1], format);
1068  else if ( strcmp(tag, FILAMENT_NODE_Z) == 0 ) s = Bstring(fnode->loc[2], format);
1069  data = string_add(&data, s);
1070  if ( !item->data ) item->data = data;
1071  if ( item->maxlen < s.length() ) item->maxlen = s.length();
1072  }
1073 
1074  if ( verbose & VERB_DEBUG_STAR )
1075  cout << "DEBUG item_put_filament_list: " << tag << "=" << *(item->data) << endl;
1076 
1077  return 0;
1078 }
1079 
1081 {
1082  long loop;
1083 
1084  item_put_list(block, MICROGRAPH_FRAME, (char *) frame,
1085  (char *)&frame->id - (char *)frame, "%4d");
1086  item_put_list(block, MICROGRAPH_FRAME_SHIFT_X, (char *) frame,
1087  (char *)&frame->shift[0] - (char *)frame, "%7.3lf");
1088  item_put_list(block, MICROGRAPH_FRAME_SHIFT_Y, (char *) frame,
1089  (char *)&frame->shift[1] - (char *)frame, "%7.3lf");
1090  item_put_list(block, MICROGRAPH_FRAME_FOM, (char *) frame,
1091  (char *)&frame->fom - (char *)frame, "%7.4lf");
1092  item_put_list(block, MICROGRAPH_FRAME_SELECT, (char *) frame,
1093  (char *)&frame->sel - (char *)frame, "%4d");
1094  loop = item_index(block, MICROGRAPH_FRAME);
1097 
1098  return 0;
1099 }
1100 
1102  FOMType fom_tag[NFOM], int euler_flag, int omega_flag)
1103 {
1104  Bparticle* p;
1105  Bstar_item* item;
1106  Bstring* data = NULL;
1107 
1108  long j, f, npart, loop;
1109  Euler euler;
1110  char tag[128];
1111  float* psi = NULL;
1112  float* theta = NULL;
1113  float* phi = NULL;
1114 
1115  item_put_list(block, PARTICLE_ID, (char *) part,
1116  (char *)&part->id - (char *)part, "%4d");
1117  item_put_list(block, PARTICLE_GROUP, (char *) part,
1118  (char *)&part->group - (char *)part, "%4d");
1119  if ( part->def ) {
1120  item_put_list(block, PARTICLE_DEFOCUS, (char *) part,
1121  (char *)&part->def - (char *)part, "%7.0lf");
1122  item_put_list(block, PARTICLE_DEF_DEV, (char *) part,
1123  (char *)&part->dev - (char *)part, "%7.0lf");
1124  item_put_angle_list(block, PARTICLE_AST_ANG, (char *) part,
1125  (char *)&part->ast - (char *)part, "%7.2lf");
1126  }
1127  item_put_list(block, PARTICLE_MAGNIF, (char *) part,
1128  (char *)&part->mag - (char *)part, "%7.4lf");
1129  item_put_list(block, PARTICLE_X, (char *) part,
1130  (char *)&part->loc[0] - (char *)part, "%7.2lf");
1131  item_put_list(block, PARTICLE_Y, (char *) part,
1132  (char *)&part->loc[1] - (char *)part, "%7.2lf");
1133  item_put_list(block, PARTICLE_Z, (char *) part,
1134  (char *)&part->loc[2] - (char *)part, "%7.2lf");
1135  item_put_list(block, PARTICLE_PIXEL_X, (char *) part,
1136  (char *)&part->pixel_size[0] - (char *)part, "%7.4lf");
1137  item_put_list(block, PARTICLE_PIXEL_Y, (char *) part,
1138  (char *)&part->pixel_size[1] - (char *)part, "%7.4lf");
1139  item_put_list(block, PARTICLE_PIXEL_Z, (char *) part,
1140  (char *)&part->pixel_size[2] - (char *)part, "%7.4lf");
1141  item_put_list(block, PARTICLE_ORIGIN_X, (char *) part,
1142  (char *)&part->ori[0] - (char *)part, "%7.3lf");
1143  item_put_list(block, PARTICLE_ORIGIN_Y, (char *) part,
1144  (char *)&part->ori[1] - (char *)part, "%7.3lf");
1145  item_put_list(block, PARTICLE_ORIGIN_Z, (char *) part,
1146  (char *)&part->ori[2] - (char *)part, "%7.3lf");
1147  if ( euler_flag < 1 ) {
1148  item_put_list(block, PARTICLE_VIEW_X, (char *) part,
1149  (char *)&part->view[0] - (char *)part, "%7.4lf");
1150  item_put_list(block, PARTICLE_VIEW_Y, (char *) part,
1151  (char *)&part->view[1] - (char *)part, "%7.4lf");
1152  item_put_list(block, PARTICLE_VIEW_Z, (char *) part,
1153  (char *)&part->view[2] - (char *)part, "%7.4lf");
1154  item_put_angle_list(block, PARTICLE_VIEW_ANGLE, (char *) part,
1155  (char *)&part->view[3] - (char *)part, "%7.2lf");
1156  } else {
1157  npart = particle_count(part);
1158  psi = new float[npart];
1159  theta = new float[npart];
1160  phi = new float[npart];
1161  for ( j=0, p=part; p; p=p->next, j++ ) {
1162  euler = Euler(p->view);
1163  phi[j] = euler.phi()*180.0/M_PI;
1164  theta[j] = euler.theta()*180.0/M_PI;
1165  psi[j] = euler.psi()*180.0/M_PI;
1166  if ( omega_flag ) psi[j] = -euler.psi()*180.0/M_PI;
1167  }
1168  item_put_float_array(block, PARTICLE_PHI, npart, phi, "%7.2f");
1169  item_put_float_array(block, PARTICLE_THETA, npart, theta, "%7.2f");
1170  if ( omega_flag ) {
1171  item_put_float_array(block, PARTICLE_OMEGA, npart, psi, "%7.2f");
1173  } else {
1174  item_put_float_array(block, PARTICLE_PSI, npart, psi, "%7.2f");
1176  }
1177  if ( psi ) delete[] psi;
1178  if ( theta ) delete[] theta;
1179  if ( phi ) delete[] phi;
1180  }
1181  for ( f=0; f<NFOM; f++ ) if ( fom_tag[f] ) {
1182  get_fom_tag(fom_tag[f], tag);
1183  if ( strlen(tag) > 1 )
1184  item_put_list(block, tag, (char *) part,
1185  (char *)&part->fom[f] - (char *)part, "%7.4lf");
1186  }
1187  item_put_list(block, PARTICLE_SELECT, (char *) part,
1188  (char *)&part->sel - (char *)part, "%4d");
1189  if ( part->fpart.length() ) {
1190  item = item_find_or_make(block, PARTICLE_FILE);
1191  if ( item->data ) {
1192  string_kill(item->data);
1193  item->data = NULL;
1194  }
1195  for ( p=part; p; p=p->next ) {
1196  if ( p->fpart.length() < 1 ) data = string_add(&data, "?");
1197  else data = string_add(&data, p->fpart);
1198  if ( !item->data ) item->data = data;
1199  if ( item->maxlen < p->fpart.length() ) item->maxlen = p->fpart.length();
1200  }
1201  }
1202  loop = item_index(block, PARTICLE_ID);
1213  if ( part->fpart.length() ) loop_set_identifier(block, loop, 1, PARTICLE_FILE);
1214 
1215  return 0;
1216 }
1217 
1219 {
1220  long loop;
1221 
1222  item_put_list(block, PARTICLE_BAD_X, (char *) bad,
1223  (char *)&bad->loc[0] - (char *)bad, "%7.2lf");
1224  item_put_list(block, PARTICLE_BAD_Y, (char *) bad,
1225  (char *)&bad->loc[1] - (char *)bad, "%7.2lf");
1226  item_put_list(block, PARTICLE_BAD_Z, (char *) bad,
1227  (char *)&bad->loc[2] - (char *)bad, "%7.2lf");
1228  loop = item_index(block, PARTICLE_BAD_X);
1230 
1231  return 0;
1232 }
1233 
1235 {
1236  long loop;
1237 
1238  item_put_filament_list(block, FILAMENT_ID, fil, "%6d");
1239  item_put_filament_list(block, FILAMENT_NODE_ID, fil, "%6d");
1240  item_put_filament_list(block, FILAMENT_NODE_X, fil, "%7.2lf");
1241  item_put_filament_list(block, FILAMENT_NODE_Y, fil, "%7.2lf");
1242  item_put_filament_list(block, FILAMENT_NODE_Z, fil, "%7.2lf");
1243  loop = item_index(block, FILAMENT_ID);
1244  loop_set_identifier(block, loop, 5, FILAMENT_ID,
1246 
1247  return 0;
1248 }
1249 
1251 {
1252  long loop;
1253 
1254  item_put_list(block, MARKER_ID, (char *) mark,
1255  (char *)&mark->id - (char *)mark, "%5d");
1256  item_put_list(block, MARKER_X, (char *) mark,
1257  (char *)&mark->loc[0] - (char *)mark, "%7.2f");
1258  item_put_list(block, MARKER_Y, (char *) mark,
1259  (char *)&mark->loc[1] - (char *)mark, "%7.2f");
1260  item_put_list(block, MARKER_Z, (char *) mark,
1261  (char *)&mark->loc[2] - (char *)mark, "%7.2f");
1262  item_put_list(block, MARKER_ERROR_X, (char *) mark,
1263  (char *)&mark->err[0] - (char *)mark, "%7.2f");
1264  item_put_list(block, MARKER_ERROR_Y, (char *) mark,
1265  (char *)&mark->err[1] - (char *)mark, "%7.2f");
1266  item_put_list(block, MARKER_ERROR_Z, (char *) mark,
1267  (char *)&mark->err[2] - (char *)mark, "%7.2f");
1268  item_put_list(block, MARKER_RESIDUAL, (char *) mark,
1269  (char *)&mark->res - (char *)mark, "%7.4f");
1270  item_put_list(block, MARKER_FOM, (char *) mark,
1271  (char *)&mark->fom - (char *)mark, "%7.4f");
1272  item_put_list(block, MARKER_SELECT, (char *) mark,
1273  (char *)&mark->sel - (char *)mark, "%5d");
1274  loop = item_index(block, MARKER_X);
1275  loop_set_identifier(block, loop, 10, MARKER_ID,
1279 
1280  return 0;
1281 }
1282 
1284 {
1285  long loop;
1286 
1287  item_put_list(block, REFLEX_H, (char *) sf,
1288  (char *)&sf->index[0] - (char *)sf, "%4d");
1289  item_put_list(block, REFLEX_K, (char *) sf,
1290  (char *)&sf->index[1] - (char *)sf, "%4d");
1291  item_put_list(block, REFLEX_L, (char *) sf,
1292  (char *)&sf->index[2] - (char *)sf, "%4d");
1293  item_put_list(block, REFLEX_X, (char *) sf,
1294  (char *)&sf->loc[0] - (char *)sf, "%7.2lf");
1295  item_put_list(block, REFLEX_Y, (char *) sf,
1296  (char *)&sf->loc[1] - (char *)sf, "%7.2lf");
1297  item_put_list(block, REFLEX_Z, (char *) sf,
1298  (char *)&sf->loc[2] - (char *)sf, "%7.2lf");
1299  item_put_list(block, REFLEX_AMP, (char *) sf,
1300  (char *)&sf->amp - (char *)sf, "%7.2lf");
1301  item_put_list(block, REFLEX_SIGAMP, (char *) sf,
1302  (char *)&sf->sigamp - (char *)sf, "%7.2lf");
1303  item_put_list(block, REFLEX_PHI, (char *) sf,
1304  (char *)&sf->phi - (char *)sf, "%7.2lf");
1305  item_put_list(block, REFLEX_SIGPHI, (char *) sf,
1306  (char *)&sf->sigphi - (char *)sf, "%7.2lf");
1307  item_put_list(block, REFLEX_FOM, (char *) sf,
1308  (char *)&sf->fom - (char *)sf, "%7.4lf");
1309  item_put_list(block, REFLEX_STATUS, (char *) sf,
1310  (char *)&sf->sel - (char *)sf, "%4d");
1311  loop = item_index(block, REFLEX_H);
1312  loop_set_identifier(block, loop, 12, REFLEX_H, REFLEX_K, REFLEX_L,
1316 
1317  return 0;
1318 }
1319 
1321 {
1322  long loop;
1323 
1324  item_put_list(block, LAYERLINE_NUMBER, (char *) line,
1325  (char *)&line->number - (char *)line, "%4d");
1326  item_put_list(block, LAYERLINE_ORDER, (char *) line,
1327  (char *)&line->order - (char *)line, "%4d");
1328  item_put_list(block, LAYERLINE_DISTANCE, (char *) line,
1329  (char *)&line->distance - (char *)line, "%7.2lf");
1330  item_put_list(block, LAYERLINE_FREQ, (char *) line,
1331  (char *)&line->freq - (char *)line, "%7.4lf");
1332  item_put_list(block, LAYERLINE_AMP, (char *) line,
1333  (char *)&line->amp - (char *)line, "%7.2lf");
1334  item_put_list(block, LAYERLINE_FOM, (char *) line,
1335  (char *)&line->fom - (char *)line, "%7.4lf");
1336  item_put_list(block, LAYERLINE_SELECT, (char *) line,
1337  (char *)&line->sel - (char *)line, "%4d");
1338  loop = item_index(block, LAYERLINE_NUMBER);
1341 
1342  return 0;
1343 }
1344 
1346 {
1347  float angle;
1348  Bstring string;
1349 
1350  item_put_float(block, CTF_VOLTAGE, ctf->volt(), "%f");
1351  item_put_float(block, CTF_FOCAL, ctf->focal_length(), "%f");
1352  item_put_float(block, CTF_APERTURE, ctf->objective_aperture(), "%f");
1353  item_put_float(block, CTF_CS, ctf->Cs(), "%f");
1354  item_put_float(block, CTF_CC, ctf->Cc(), "%f");
1355  item_put_float(block, CTF_ALPHA, ctf->alpha(), "%f");
1356  item_put_float(block, CTF_DE, ctf->dE(), "%f");
1357  item_put_float(block, CTF_AMP_SHIFT, ctf->amp_shift(), "%f");
1358  item_put_float(block, CTF_DEF_AVG, ctf->defocus_average(), "%f");
1359  item_put_float(block, CTF_DEF_DEV, ctf->defocus_deviation(), "%f");
1360  angle = ctf->astigmatism_angle()*180.0/M_PI;
1361  item_put_float(block, CTF_AST_ANG, angle, "%f");
1362  item_put_float(block, CTF_ZERO, ctf->zero(1), "%f");
1363  if ( ctf->baseline_type() ) {
1364  string = ctf->baseline_equation();
1365  item_put_string(block, CTF_BASELINE, string);
1366  }
1367  if ( ctf->envelope(0) ) {
1368  string = ctf->envelope_equation();
1369  item_put_string(block, CTF_ENVELOPE, string);
1370  }
1371 
1372  return 0;
1373 }
1374 
1376  FOMType fom_tag[NFOM], int euler_flag, int omega_flag)
1377 {
1378  float angle;
1379 
1380  item_put_string(block, MICROGRAPH_ID, mg->id);
1381  block->tag = mg->id;
1382  item_put_integer(block, MICROGRAPH_NUMBER, mg->img_num, "%d");
1383  item_put_integer(block, MICROGRAPH_SELECT, mg->select, "%d");
1384  item_put_float(block, MICROGRAPH_FOM, mg->fom, "%f");
1385  if ( mg->fmg.length() ) item_put_string(block, MICROGRAPH_FILE, mg->fmg);
1386  if ( mg->fframe.length() ) item_put_string(block, MICROGRAPH_FRAMES_FILE, mg->fframe);
1387  if ( mg->fft.length() ) item_put_string(block, MICROGRAPH_TRANSFORM_FILE, mg->fft);
1388  if ( mg->fps.length() ) item_put_string(block, MICROGRAPH_POWERSPEC_FILE, mg->fps);
1389  if ( mg->fpart.length() && mg->part && !mg->part->fpart.length() )
1390  item_put_string(block, PARTICLE_FILE, mg->fpart);
1391  if ( mg->ffil.length() ) item_put_string(block, FILAMENT_FILE, mg->ffil);
1393  item_put_float(block, MICROGRAPH_SAMPLING, mg->sampling, "%f");
1394  item_put_float(block, MICROGRAPH_PIXEL_X, mg->pixel_size[0], "%f");
1395  item_put_float(block, MICROGRAPH_PIXEL_Y, mg->pixel_size[1], "%f");
1396  item_put_float(block, MICROGRAPH_DOSE, mg->dose, "%f");
1397  item_put_float(block, MICROGRAPH_INTENSITY, mg->intensity, "%f");
1398  item_put_float(block, MICROGRAPH_WATER_RING, mg->wri, "%f");
1399  angle = mg->tilt_axis*180.0/M_PI;
1400  item_put_float(block, MICROGRAPH_TILT_AXIS, angle, "%f");
1401  angle = mg->tilt_angle*180.0/M_PI;
1402  item_put_float(block, MICROGRAPH_TILT_ANGLE, angle, "%f");
1403  angle = mg->level_angle*180.0/M_PI;
1404  item_put_float(block, MICROGRAPH_LEVEL_ANGLE, angle, "%f");
1405  angle = mg->rot_angle*180.0/M_PI;
1406  item_put_float(block, MICROGRAPH_ROT_ANGLE, angle, "%f");
1407  item_put_float(block, MICROGRAPH_ORIGIN_X, mg->origin[0], "%f");
1408  item_put_float(block, MICROGRAPH_ORIGIN_Y, mg->origin[1], "%f");
1409  item_put_float(block, MICROGRAPH_ORIGIN_Z, mg->origin[2], "%f");
1410  item_put_float(block, MICROGRAPH_SCALE_X, mg->scale[0], "%f");
1411  item_put_float(block, MICROGRAPH_SCALE_Y, mg->scale[1], "%f");
1412  item_put_float(block, MICROGRAPH_SCALE_Z, mg->scale[2], "%f");
1413  item_put_float(block, MICROGRAPH_MATRIX_1_1, mg->matrix[0][0], "%f");
1414  item_put_float(block, MICROGRAPH_MATRIX_1_2, mg->matrix[0][1], "%f");
1415  item_put_float(block, MICROGRAPH_MATRIX_1_3, mg->matrix[0][2], "%f");
1416  item_put_float(block, MICROGRAPH_MATRIX_2_1, mg->matrix[1][0], "%f");
1417  item_put_float(block, MICROGRAPH_MATRIX_2_2, mg->matrix[1][1], "%f");
1418  item_put_float(block, MICROGRAPH_MATRIX_2_3, mg->matrix[1][2], "%f");
1419  item_put_float(block, MICROGRAPH_MATRIX_3_1, mg->matrix[2][0], "%f");
1420  item_put_float(block, MICROGRAPH_MATRIX_3_2, mg->matrix[2][1], "%f");
1421  item_put_float(block, MICROGRAPH_MATRIX_3_3, mg->matrix[2][2], "%f");
1422  item_put_float(block, MICROGRAPH_HVEC_X, mg->hvec[0], "%f");
1423  item_put_float(block, MICROGRAPH_HVEC_Y, mg->hvec[1], "%f");
1424  item_put_float(block, MICROGRAPH_HVEC_Z, mg->hvec[2], "%f");
1425  item_put_float(block, MICROGRAPH_KVEC_X, mg->kvec[0], "%f");
1426  item_put_float(block, MICROGRAPH_KVEC_Y, mg->kvec[1], "%f");
1427  item_put_float(block, MICROGRAPH_KVEC_Z, mg->kvec[2], "%f");
1428  item_put_float(block, MICROGRAPH_LVEC_X, mg->lvec[0], "%f");
1429  item_put_float(block, MICROGRAPH_LVEC_Y, mg->lvec[1], "%f");
1430  item_put_float(block, MICROGRAPH_LVEC_Z, mg->lvec[2], "%f");
1431  angle = mg->helix_axis*180.0/M_PI;
1432  item_put_float(block, MICROGRAPH_HELIX_AXIS, angle, "%f");
1433  item_put_float(block, MICROGRAPH_HELIX_RISE, mg->helix_rise, "%f");
1434  angle = mg->helix_angle*180.0/M_PI;
1435  item_put_float(block, MICROGRAPH_HELIX_ANGLE, angle, "%f");
1437  item_put_float(block, PARTICLE_BOX_SIZE_X, mg->box_size[0], "%f");
1438  item_put_float(block, PARTICLE_BOX_SIZE_Y, mg->box_size[1], "%f");
1439  item_put_float(block, PARTICLE_BOX_SIZE_Z, mg->box_size[2], "%f");
1440  item_put_float(block, PARTICLE_BAD_RADIUS, mg->bad_radius, "%f");
1441  item_put_float(block, FILAMENT_WIDTH, mg->filament_width, "%f");
1442  item_put_float(block, FILNODE_RADIUS, mg->fil_node_radius, "%f");
1443  item_put_float(block, REFLEX_RADIUS, mg->sf_radius, "%f");
1444  item_put_float(block, MARKER_RADIUS, mg->mark_radius, "%f");
1445 
1446  if ( mg->ctf ) ctf_to_starblock(mg->ctf, block);
1447 
1448  if ( mg->frame ) frame_to_starblock(mg->frame, block);
1449 
1450  long npart = particle_count(mg->part);
1451  long nfil = filament_node_count(mg->fil);
1452  long nbad = count_list((char *) mg->bad);
1453  long nmark = count_list((char *) mg->mark);
1454  long nsf = count_list((char *) mg->sf);
1455  long nline = count_list((char *) mg->layer);
1456 
1457  if ( npart > 0 )
1458  particle_to_starblock(mg->part, block, fom_tag,
1459  euler_flag, omega_flag);
1460 
1461  if ( nbad > 0)
1462  badarea_to_starblock(mg->bad, block);
1463 
1464  if ( nmark > 0 )
1465  marker_to_starblock(mg->mark, block);
1466 
1467  if ( nfil > 0 )
1468  filament_to_starblock(mg->fil, block);
1469 
1470  if ( nsf > 0 )
1471  strucfac_to_starblock(mg->sf, block);
1472 
1473  if ( nline > 0 )
1474  layerline_to_starblock(mg->layer, block);
1475 
1476  return 0;
1477 }
1478 
1480  FOMType fom_tag[NFOM], int euler_flag, int omega_flag)
1481 {
1482  float angle;
1483 
1484  item_put_string(block, MAP_ID, rec->id);
1485  block->tag = rec->id;
1486 
1487  if ( rec->frec.length() ) item_put_string(block, MAP_RECONSTRUCTION, rec->frec);
1488 
1489  if ( rec->fft.length() ) item_put_string(block, MAP_TRANSFORM_FILE, rec->fft);
1490 
1491  if ( rec->fps.length() ) item_put_string(block, MAP_POWERSPEC_FILE, rec->fps);
1492 
1493  if ( rec->fpart.length() && !rec->part->fpart.length() )
1494  item_put_string(block, PARTICLE_FILE, rec->fpart);
1495 
1496  if ( rec->ffil.length() ) item_put_string(block, FILAMENT_FILE, rec->ffil);
1497 
1498  if ( rec->model )
1499  item_put_list(block, MAP_MODEL, (char *)rec->model,
1500  (char *)rec->model->c_str() - (char *)rec->model, "%s");
1501 
1502  item_put_integer(block, MAP_SELECT, rec->select, "%d");
1503  item_put_float(block, MAP_FOM, rec->fom, "%f");
1504 
1505  item_put_float(block, MAP_ORIGIN_X, rec->origin[0], "%f");
1506  item_put_float(block, MAP_ORIGIN_Y, rec->origin[1], "%f");
1507  item_put_float(block, MAP_ORIGIN_Z, rec->origin[2], "%f");
1508  item_put_float(block, MAP_SCALE_X, rec->scale[0], "%f");
1509  item_put_float(block, MAP_SCALE_Y, rec->scale[1], "%f");
1510  item_put_float(block, MAP_SCALE_Z, rec->scale[2], "%f");
1511  item_put_float(block, MAP_VOXEL_SIZE_X, rec->voxel_size[0], "%f");
1512  item_put_float(block, MAP_VOXEL_SIZE_Y, rec->voxel_size[1], "%f");
1513  item_put_float(block, MAP_VOXEL_SIZE_Z, rec->voxel_size[2], "%f");
1514 
1515  if ( rec->symmetry.length() ) item_put_string(block, MAP_SYMMETRY, rec->symmetry);
1516 
1517  if ( rec->ctf ) ctf_to_starblock(rec->ctf, block);
1518 
1519  item_put_float(block, PARTICLE_BOX_SIZE_X, rec->box_size[0], "%f");
1520  item_put_float(block, PARTICLE_BOX_SIZE_Y, rec->box_size[1], "%f");
1521  item_put_float(block, PARTICLE_BOX_SIZE_Z, rec->box_size[2], "%f");
1522  item_put_float(block, PARTICLE_BAD_RADIUS, rec->bad_radius, "%f");
1523  item_put_float(block, FILAMENT_WIDTH, rec->filament_width, "%f");
1524  item_put_float(block, FILNODE_RADIUS, rec->fil_node_radius, "%f");
1525  item_put_float(block, REFLEX_RADIUS, rec->sf_radius, "%f");
1526  item_put_float(block, MARKER_RADIUS, rec->mark_radius, "%f");
1527 
1528  item_put_float(block, MAP_VIEW_X, rec->view[0], "%f");
1529  item_put_float(block, MAP_VIEW_Y, rec->view[1], "%f");
1530  item_put_float(block, MAP_VIEW_Z, rec->view[2], "%f");
1531  angle = rec->view.angle()*180.0/M_PI;
1532  item_put_float(block, MAP_VIEW_ANGLE, angle, "%f");
1533 
1534  long npart = particle_count(rec->part);
1535  long nfil = filament_node_count(rec->fil);
1536  long nbad = count_list((char *) rec->bad);
1537  long nmark = count_list((char *) rec->mark);
1538  long nsf = count_list((char *) rec->sf);
1539 
1540  if ( npart > 0 )
1541  particle_to_starblock(rec->part, block, fom_tag, euler_flag, omega_flag);
1542 
1543  if ( nbad > 0)
1544  badarea_to_starblock(rec->bad, block);
1545 
1546  if ( nfil > 0 )
1547  filament_to_starblock(rec->fil, block);
1548 
1549  if ( nmark > 0 )
1550  marker_to_starblock(rec->mark, block);
1551 
1552  if ( nsf > 0 )
1553  strucfac_to_starblock(rec->sf, block);
1554 
1555  return 0;
1556 }
1557 
1558 /*
1559 @brief Converts micrograph data from an image project structure to a
1560  STAR data base.
1561 @param *project project parameter structure.
1562 @param *star STAR data base.
1563 @param mg_select flag to only convert selected micrographs.
1564 @param rec_select flag to only convert selected reconstructions.
1565 @return int error code (<0 means failure).
1566 
1567  The function packes new micrograph data back into an existing STAR
1568  data base from which the old project parameters were obtained.
1569  All angles used internally are in radians, and are converted here
1570  to degrees for output. The angles within the micrograph structure
1571  are left in radians.
1572 **/
1573 int project_to_star(Bproject* project, Bstar* star, int mg_select, int rec_select)
1574 {
1575  int err(0);
1576 
1577  if ( verbose & VERB_DEBUG )
1578  cout << "DEBUG project_to_star:" << endl;
1579 
1580  star->comment = project->comment;
1581 
1582  star->split = project->split;
1583 
1584  Bstar_block* block = NULL;
1585 
1586  Bfield* field;
1587  Bmicrograph* mg;
1588  Breconstruction* rec;
1589  Bstring* file_list = NULL;
1590 
1591  if ( project->reference ) {
1592  block = (Bstar_block *) add_item((char **)&star->block, sizeof(Bstar_block));
1594  if ( verbose & VERB_DEBUG )
1595  for ( file_list=project->reference; file_list; file_list=file_list->next )
1596  cout << "DEBUG project_to_star: reference map = " << *file_list << endl;
1597  }
1598 
1599  long i, f, nfield(0), nmg(0), nrec(0), npart(0);
1600 
1601  for ( f=i=0; f<NFOM; f++ ) i += project->fom_tag[f];
1602  if ( i < 2 ) project->fom_tag[0] = FOM;
1603 
1604  if ( verbose & VERB_PROCESS )
1605  cout << "Converting a project into a STAR database" << endl;
1606 
1607  if ( project->euler_flag < 1 ) {
1612  } else {
1617  }
1618 
1619  for ( field=project->field; field; field=field->next ) if ( mg_select < 1 || field->select > 0 ) {
1620  for ( mg=field->mg; mg; mg=mg->next ) if ( mg_select < 1 || mg->select > 0 ) {
1621  if ( verbose & VERB_FULL )
1622  cout << "Writing field \"" << field->id << "\", micrograph \"" << mg->id << "\"" << endl;
1623  block = (Bstar_block *) add_item((char **)&star->block, sizeof(Bstar_block));
1624  item_put_string(block, MICROGRAPH_FIELD_ID, field->id);
1626  nmg++;
1627  }
1628  nfield++;
1629  }
1630 
1631  if ( project->class_avg ) {
1632  npart = particle_count(project->class_avg);
1633  if ( verbose & VERB_FULL )
1634  cout << "Writing " << npart << " class averages" << endl;
1635  block = (Bstar_block *) add_item((char **)&star->block, sizeof(Bstar_block));
1636  block->tag = CLASS_AVERAGE;
1639  }
1640 
1641  for ( rec = project->rec; rec; rec = rec->next ) if ( rec_select < 1 || rec->select > 0 ) {
1642  if ( verbose & VERB_FULL )
1643  cout << "Writing reconstruction \"" << rec->id << "\"" << endl;
1644  block = (Bstar_block *) add_item((char **)&star->block, sizeof(Bstar_block));
1647  nrec++;
1648  }
1649 
1650  if ( verbose & VERB_PROCESS )
1651  cout << nfield << " fields, " << nmg << " micrographs, " << nrec << " reconstructions written" << endl;
1652 
1653  return err;
1654 }
1655 
Bmicrograph::helix_rise
double helix_rise
Definition: mg_processing.h:230
Bmicrograph::scale
Vector3< double > scale
Definition: mg_processing.h:224
Bstar_item::data
Bstring * data
Definition: rwstar.h:43
Bstar_item
Definition: rwstar.h:36
REFLEX_STATUS
#define REFLEX_STATUS
Definition: mg_tags.h:311
MICROGRAPH_ROT_ANGLE
#define MICROGRAPH_ROT_ANGLE
Definition: mg_tags.h:98
MICROGRAPH_PIXEL
#define MICROGRAPH_PIXEL
Definition: mg_tags.h:81
Bstrucfac::fom
double fom
Definition: mg_processing.h:164
PARTICLE_CMP_CC
#define PARTICLE_CMP_CC
Definition: mg_tags.h:236
MARKER_Z
#define MARKER_Z
Definition: mg_tags.h:287
MAP_SCALE_X
#define MAP_SCALE_X
Definition: mg_tags.h:43
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
LAYERLINE_FOM
#define LAYERLINE_FOM
Definition: mg_tags.h:320
Bmicrograph
Definition: mg_processing.h:201
Breconstruction::part
Bparticle * part
Definition: mg_processing.h:307
MICROGRAPH_FRAMES_FILE
#define MICROGRAPH_FRAMES_FILE
Definition: mg_tags.h:64
Breconstruction::id
Bstring id
Definition: mg_processing.h:285
Breconstruction::mark
Bmarker * mark
Definition: mg_processing.h:310
Bmarker::fom
float fom
Definition: marker.h:28
MICROGRAPH_BOX_RADIUS_Z
#define MICROGRAPH_BOX_RADIUS_Z
Definition: mg_tags.h:142
mg_star_update_tags
int mg_star_update_tags(Bstar *star)
Replacing old STAR tags with new ones.
Definition: rwmgSTAR.cpp:83
Bstar_block::number
int number
Definition: rwstar.h:57
REFLEX_H
#define REFLEX_H
Definition: mg_tags.h:302
Bmicrograph::filament_width
double filament_width
Definition: mg_processing.h:234
MICROGRAPH_HVEC_Z
#define MICROGRAPH_HVEC_Z
Definition: mg_tags.h:114
Breconstruction::fpart
Bstring fpart
Definition: mg_processing.h:291
FOM_HAND_A
@ FOM_HAND_A
Definition: mg_processing.h:46
Bframe::shift
Vector3< double > shift
Definition: mg_processing.h:78
CTF_DE
#define CTF_DE
Definition: mg_tags.h:168
item_put_list
int item_put_list(Bstar_block *block, const char *tag, char *list, size_t offset, const char *format)
Writes a list of string or numeric values into a data item associated with a specific data block and ...
Definition: rwstar.cpp:1436
item_change_tag
int item_change_tag(Bstar *star, const char *tag, const char *newtag)
Replaces one tag with another in the STAR data base.
Definition: rwstar.cpp:966
MAP_ORIGIN_X
#define MAP_ORIGIN_X
Definition: mg_tags.h:40
Bstrucfac
Definition: mg_processing.h:156
Breconstruction::fil
Bfilament * fil
Definition: mg_processing.h:308
PARTICLE_BAD_Y
#define PARTICLE_BAD_Y
Definition: mg_tags.h:251
MARKER_RADIUS
#define MARKER_RADIUS
Definition: mg_tags.h:283
MICROGRAPH_CTF_CC
#define MICROGRAPH_CTF_CC
Definition: mg_tags.h:127
MICROGRAPH_FRAME
#define MICROGRAPH_FRAME
Definition: mg_tags.h:65
item_put_filament_list
int item_put_filament_list(Bstar_block *block, const char *tag, Bfilament *fil, const char *format)
Definition: rwmgSTAR.cpp:1040
CTFparam::zero
double zero(int i)
Definition: ctf.h:228
reconstruction_from_starblock
Breconstruction * reconstruction_from_starblock(Bstar_block *block, FOMType fom_tag[NFOM])
Definition: rwmgSTAR.cpp:751
Bproject::rec
Breconstruction * rec
Definition: mg_processing.h:347
Blayerline::sel
long sel
Definition: mg_processing.h:183
MICROGRAPH_POWERSPEC_FILE
#define MICROGRAPH_POWERSPEC_FILE
Definition: mg_tags.h:73
PARTICLE_PIXEL_X
#define PARTICLE_PIXEL_X
Definition: mg_tags.h:209
MICROGRAPH_MARKER_ERROR_Y
#define MICROGRAPH_MARKER_ERROR_Y
Definition: mg_tags.h:154
PARTICLE_PIXEL_Z
#define PARTICLE_PIXEL_Z
Definition: mg_tags.h:211
VERB_DEBUG
#define VERB_DEBUG
Definition: utilities.h:116
PARTICLE_RFACTORAB
#define PARTICLE_RFACTORAB
Definition: mg_tags.h:237
MICROGRAPH_ORIGIN_Z
#define MICROGRAPH_ORIGIN_Z
Definition: mg_tags.h:91
string_kill
int string_kill(Bstring *list)
Kills a string linked list.
Definition: Bstring.cpp:768
CTFparam::Cc
double Cc()
Definition: ctf.h:93
CTFparam::dE
double dE()
Definition: ctf.h:97
MARKER_RESIDUAL
#define MARKER_RESIDUAL
Definition: mg_tags.h:292
MICROGRAPH_MATRIX_3_1
#define MICROGRAPH_MATRIX_3_1
Definition: mg_tags.h:109
MICROGRAPH_PIXEL_X
#define MICROGRAPH_PIXEL_X
Definition: mg_tags.h:82
star_to_project
int star_to_project(Bstar *star, Bproject *project)
Definition: rwmgSTAR.cpp:898
PARTICLE_DEFOCUS
#define PARTICLE_DEFOCUS
Definition: mg_tags.h:212
item_index
int item_index(Bstar_block *block, const char *tag)
Gets the STAR item associated with a tag in a STAR data block.
Definition: rwstar.cpp:1029
badarea_from_starblock
Bbadarea * badarea_from_starblock(Bstar_block *block)
Definition: rwmgSTAR.cpp:359
REFLEX_PHI
#define REFLEX_PHI
Definition: mg_tags.h:308
item_get_integer
int item_get_integer(Bstar_block *block, const char *tag)
Gets an integer value associated with a tag in a STAR data block.
Definition: rwstar.cpp:1245
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
Bfilament
Definition: mg_processing.h:129
item_get_float
float item_get_float(Bstar_block *block, const char *tag)
Gets a floating point value associated with a tag in a STAR data block.
Definition: rwstar.cpp:1273
Bstring
Definition: Bstring.h:29
MICROGRAPH_CTF_ZERO
#define MICROGRAPH_CTF_ZERO
Definition: mg_tags.h:131
particle_to_starblock
int particle_to_starblock(Bparticle *part, Bstar_block *block, FOMType fom_tag[NFOM], int euler_flag, int omega_flag)
Definition: rwmgSTAR.cpp:1101
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
Breconstruction::voxel_size
Vector3< double > voxel_size
Definition: mg_processing.h:295
add_item
char * add_item(char **list, unsigned long size)
Adds an item to a linked list.
Definition: linked_list.cpp:26
MAP_ID
#define MAP_ID
Definition: mg_tags.h:32
Bproject::split
int split
Definition: mg_processing.h:340
REFLEX_FOM
#define REFLEX_FOM
Definition: mg_tags.h:310
Bparticle
Definition: mg_processing.h:90
PARTICLE_BOX_SIZE
#define PARTICLE_BOX_SIZE
Definition: mg_tags.h:240
CTF_AST_ANG
#define CTF_AST_ANG
Definition: mg_tags.h:176
Bproject::field
Bfield * field
Definition: mg_processing.h:346
PARTICLE_ORIGIN_X
#define PARTICLE_ORIGIN_X
Definition: mg_tags.h:196
base
string base(string &filename)
Definition: string_util.cpp:28
MICROGRAPH_MARKER_ID
#define MICROGRAPH_MARKER_ID
Definition: mg_tags.h:149
MICROGRAPH_CTF_ALPHA
#define MICROGRAPH_CTF_ALPHA
Definition: mg_tags.h:128
MICROGRAPH_BAD_Z
#define MICROGRAPH_BAD_Z
Definition: mg_tags.h:147
MICROGRAPH_FIELD_ID
#define MICROGRAPH_FIELD_ID
Definition: mg_tags.h:75
MICROGRAPH_SAMPLING
#define MICROGRAPH_SAMPLING
Definition: mg_tags.h:80
Bstring::integer
long integer()
Definition: Bstring.cpp:547
CTFparam::objective_aperture
double objective_aperture()
Definition: ctf.h:102
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
FOMType
FOMType
Definition: mg_processing.h:38
Breconstruction::filament_width
double filament_width
Definition: mg_processing.h:300
MICROGRAPH_HELIX_RISE
#define MICROGRAPH_HELIX_RISE
Definition: mg_tags.h:122
Bmicrograph::bad_radius
double bad_radius
Definition: mg_processing.h:236
Breconstruction::fom
double fom
Definition: mg_processing.h:305
CTFparam::astigmatism_angle
double astigmatism_angle()
Definition: ctf.h:110
Bmicrograph::tilt_angle
double tilt_angle
Definition: mg_processing.h:220
MICROGRAPH_FILE
#define MICROGRAPH_FILE
Definition: mg_tags.h:63
MICROGRAPH_NUMBER
#define MICROGRAPH_NUMBER
Definition: mg_tags.h:76
PARTICLE_PRJ_CC
#define PARTICLE_PRJ_CC
Definition: mg_tags.h:235
Bstar::comment
Bstring comment
Definition: rwstar.h:81
PARTICLE_VIEW_X
#define PARTICLE_VIEW_X
Definition: mg_tags.h:203
ctf_from_starblock
CTFparam * ctf_from_starblock(Bstar_block *block)
Definition: rwmgSTAR.cpp:572
Bparticle::ast
double ast
Definition: mg_processing.h:98
filament_add
Bfilament * filament_add(Bfilament **fil, int pid)
Adds a filament parameter structure to a linked list.
Definition: mg_processing.cpp:319
Bstrucfac::loc
Vector3< double > loc
Definition: mg_processing.h:158
MICROGRAPH_FOM
#define MICROGRAPH_FOM
Definition: mg_tags.h:78
MICROGRAPH_SCALE_X
#define MICROGRAPH_SCALE_X
Definition: mg_tags.h:92
Bmicrograph::helix_axis
double helix_axis
Definition: mg_processing.h:229
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
Breconstruction::sf_radius
double sf_radius
Definition: mg_processing.h:303
Bmicrograph::img_num
int img_num
Definition: mg_processing.h:212
PARTICLE_BOX_SIZE_X
#define PARTICLE_BOX_SIZE_X
Definition: mg_tags.h:241
PARTICLE_PFT_CC
#define PARTICLE_PFT_CC
Definition: mg_tags.h:234
CTF_ALPHA
#define CTF_ALPHA
Definition: mg_tags.h:167
Bmicrograph::helix_radius
double helix_radius
Definition: mg_processing.h:232
MICROGRAPH_FILAMENT_FILE
#define MICROGRAPH_FILAMENT_FILE
Definition: mg_tags.h:71
PARTICLE_X_ORIGIN
#define PARTICLE_X_ORIGIN
Definition: mg_tags.h:193
Bparticle::fom
double fom[NFOM]
Definition: mg_processing.h:103
MICROGRAPH_KVEC_X
#define MICROGRAPH_KVEC_X
Definition: mg_tags.h:115
Bframe::fom
double fom
Definition: mg_processing.h:79
PARTICLE_BAD_X
#define PARTICLE_BAD_X
Definition: mg_tags.h:250
FILNODE_RADIUS
#define FILNODE_RADIUS
Definition: mg_tags.h:267
MICROGRAPH_ORIGIN_X
#define MICROGRAPH_ORIGIN_X
Definition: mg_tags.h:89
loop_set_identifier
int loop_set_identifier(Bstar_block *block, int loop, int n,...)
Assigns a loop identification number to items.
Definition: rwstar.cpp:1803
Bmicrograph::sampling
double sampling
Definition: mg_processing.h:214
frame_from_starblock
Bframe * frame_from_starblock(Bstar_block *block)
Definition: rwmgSTAR.cpp:132
Breconstruction::box_size
Vector3< long > box_size
Definition: mg_processing.h:299
Bstring::real
double real()
Definition: Bstring.cpp:553
Bmicrograph::part
Bparticle * part
Definition: mg_processing.h:242
MICROGRAPH_CTF_DE
#define MICROGRAPH_CTF_DE
Definition: mg_tags.h:129
PARTICLE_OMEGA
#define PARTICLE_OMEGA
Definition: mg_tags.h:202
MICROGRAPH_ID
#define MICROGRAPH_ID
Definition: mg_tags.h:74
Bfield::id
Bstring id
Definition: mg_processing.h:262
FILAMENT_NODE_Y
#define FILAMENT_NODE_Y
Definition: mg_tags.h:264
badarea_to_starblock
int badarea_to_starblock(Bbadarea *bad, Bstar_block *block)
Definition: rwmgSTAR.cpp:1218
item_find_or_make
Bstar_item * item_find_or_make(Bstar_block *block, const char *tag)
Gets the STAR item associated with a tag in a STAR data block.
Definition: rwstar.cpp:1105
strucfac_to_starblock
int strucfac_to_starblock(Bstrucfac *sf, Bstar_block *block)
Definition: rwmgSTAR.cpp:1283
PARTICLE_X
#define PARTICLE_X
Definition: mg_tags.h:190
Bmicrograph::fpart
Bstring fpart
Definition: mg_processing.h:208
MAP_ORIGIN_Y
#define MAP_ORIGIN_Y
Definition: mg_tags.h:41
MAP_REFERENCE
#define MAP_REFERENCE
Definition: mg_tags.h:33
Breconstruction::mark_radius
double mark_radius
Definition: mg_processing.h:304
Bfield
Definition: mg_processing.h:260
Bmicrograph::lvec
Vector3< double > lvec
Definition: mg_processing.h:228
Blayerline::amp
double amp
Definition: mg_processing.h:181
VERB_PROCESS
#define VERB_PROCESS
Definition: utilities.h:111
MAP_VIEW_Y
#define MAP_VIEW_Y
Definition: mg_tags.h:54
count_list
long count_list(char *list)
Counts the number of items in a linked list.
Definition: linked_list.cpp:235
MARKER_ID
#define MARKER_ID
Definition: mg_tags.h:284
Bproject::omega_flag
int omega_flag
Definition: mg_processing.h:344
Blayerline::order
int order
Definition: mg_processing.h:178
Bmarker::res
float res
Definition: marker.h:27
LAYERLINE_ORDER
#define LAYERLINE_ORDER
Definition: mg_tags.h:316
MAP_SELECT
#define MAP_SELECT
Definition: mg_tags.h:50
MAP_POWERSPEC_FILE
#define MAP_POWERSPEC_FILE
Definition: mg_tags.h:36
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
MARKER_X
#define MARKER_X
Definition: mg_tags.h:285
Bbadarea
Definition: mg_processing.h:143
Bmicrograph::frame
Bframe * frame
Definition: mg_processing.h:240
Bstar_item::maxlen
int maxlen
Definition: rwstar.h:41
MICROGRAPH_BAD_RADIUS
#define MICROGRAPH_BAD_RADIUS
Definition: mg_tags.h:144
PARTICLE_AST_ANG
#define PARTICLE_AST_ANG
Definition: mg_tags.h:214
item_put_string_list
int item_put_string_list(Bstar_block *block, const char *tag, Bstring *list)
Writes a list of strings into a data item associated with a specific data block and tag in a STAR dat...
Definition: rwstar.cpp:1337
Bframe
Definition: mg_processing.h:75
REFLEX_AMP
#define REFLEX_AMP
Definition: mg_tags.h:305
Bmicrograph::dose
double dose
Definition: mg_processing.h:216
Bframe::id
int id
Definition: mg_processing.h:77
Bmarker
Definition: marker.h:21
PARTICLE_ORIGIN_Y
#define PARTICLE_ORIGIN_Y
Definition: mg_tags.h:197
CTFparam::parse_baseline_equation
int parse_baseline_equation(Bstring base_eq)
Extracts the coefficients from the baseline string.
Definition: ctf.cpp:244
item_put_float_array
int item_put_float_array(Bstar_block *block, const char *tag, int number, float *value, const char *format)
Writes a list of floating point numbers into a data item associated with a specific data block and ta...
Definition: rwstar.cpp:1486
strucfac_from_starblock
Bstrucfac * strucfac_from_starblock(Bstar_block *block)
Definition: rwmgSTAR.cpp:454
Bmicrograph::fil
Bfilament * fil
Definition: mg_processing.h:243
PARTICLE_Z
#define PARTICLE_Z
Definition: mg_tags.h:192
MICROGRAPH_MARKER_ERROR_Z
#define MICROGRAPH_MARKER_ERROR_Z
Definition: mg_tags.h:155
Bstar_item::loop
int loop
Definition: rwstar.h:40
PARTICLE_HANDA_FOM
#define PARTICLE_HANDA_FOM
Definition: mg_tags.h:230
PARTICLE_BOX_RADIUS_Y
#define PARTICLE_BOX_RADIUS_Y
Definition: mg_tags.h:246
item_put_float
int item_put_float(Bstar_block *block, const char *tag, float value, const char *format)
Writes a floating point value into a data item associated with a specific data block and tag in a STA...
Definition: rwstar.cpp:1401
Breconstruction::origin
Vector3< double > origin
Definition: mg_processing.h:296
MICROGRAPH_TRANSFORM_FILE
#define MICROGRAPH_TRANSFORM_FILE
Definition: mg_tags.h:72
Bstrucfac::sigamp
double sigamp
Definition: mg_processing.h:161
PARTICLE_MG_Z
#define PARTICLE_MG_Z
Definition: mg_tags.h:189
MICROGRAPH_BOX_RADIUS
#define MICROGRAPH_BOX_RADIUS
Definition: mg_tags.h:139
particle_from_starblock
Bparticle * particle_from_starblock(Bstar_block *block, FOMType fom_tag[NFOM])
Definition: rwmgSTAR.cpp:164
project
Bproject * project
Definition: bshow.cpp:33
PARTICLE_BOX_SIZE_Y
#define PARTICLE_BOX_SIZE_Y
Definition: mg_tags.h:242
MAP_MODEL
#define MAP_MODEL
Definition: mg_tags.h:58
Bstar_block::tag
Bstring tag
Definition: rwstar.h:58
marker_to_starblock
int marker_to_starblock(Bmarker *mark, Bstar_block *block)
Definition: rwmgSTAR.cpp:1250
Bframe::sel
long sel
Definition: mg_processing.h:80
micrograph_to_starblock
int micrograph_to_starblock(Bmicrograph *mg, Bstar_block *block, FOMType fom_tag[NFOM], int euler_flag, int omega_flag)
Definition: rwmgSTAR.cpp:1375
MARKER_FOM
#define MARKER_FOM
Definition: mg_tags.h:293
project_to_star
int project_to_star(Bproject *project, Bstar *star, int mg_select, int rec_select)
Definition: rwmgSTAR.cpp:1573
MICROGRAPH_MATRIX_1_2
#define MICROGRAPH_MATRIX_1_2
Definition: mg_tags.h:104
Bfilament::id
int id
Definition: mg_processing.h:132
Bmarker::next
Bmarker * next
Definition: marker.h:22
MICROGRAPH_BAD_X
#define MICROGRAPH_BAD_X
Definition: mg_tags.h:145
PARTICLE_BOX_SIZE_Z
#define PARTICLE_BOX_SIZE_Z
Definition: mg_tags.h:243
CTF_DEF_AVG
#define CTF_DEF_AVG
Definition: mg_tags.h:172
MICROGRAPH_CTF_DEF_MAX
#define MICROGRAPH_CTF_DEF_MAX
Definition: mg_tags.h:135
Bmicrograph::ffil
Bstring ffil
Definition: mg_processing.h:209
PARTICLE_VIEW_Y
#define PARTICLE_VIEW_Y
Definition: mg_tags.h:204
Bparticle::fpart
Bstring fpart
Definition: mg_processing.h:92
MARKER_Y
#define MARKER_Y
Definition: mg_tags.h:286
PARTICLE_BOX_RADIUS_Z
#define PARTICLE_BOX_RADIUS_Z
Definition: mg_tags.h:247
CTF_AMP
#define CTF_AMP
Definition: mg_tags.h:169
MICROGRAPH_BAD_Y
#define MICROGRAPH_BAD_Y
Definition: mg_tags.h:146
item_put_integer
int item_put_integer(Bstar_block *block, const char *tag, int value, const char *format)
Writes a integer into a data item associated with a specific data block and tag in a STAR data base.
Definition: rwstar.cpp:1368
MICROGRAPH_LVEC_Y
#define MICROGRAPH_LVEC_Y
Definition: mg_tags.h:119
PARTICLE_BAD_Z
#define PARTICLE_BAD_Z
Definition: mg_tags.h:252
PARTICLE_BAD_RADIUS
#define PARTICLE_BAD_RADIUS
Definition: mg_tags.h:249
MICROGRAPH_HVEC_Y
#define MICROGRAPH_HVEC_Y
Definition: mg_tags.h:113
REFLEX_SIGPHI
#define REFLEX_SIGPHI
Definition: mg_tags.h:309
Bmarker::id
int id
Definition: marker.h:23
StringItem
@ StringItem
Definition: rwstar.h:25
write_star
int write_star(const char *filename, Bstar *star)
Writes a STAR data base to one or more STAR format files.
Definition: rwstar.cpp:666
MICROGRAPH_BOX_RADIUS_Y
#define MICROGRAPH_BOX_RADIUS_Y
Definition: mg_tags.h:141
Bstrucfac::phi
double phi
Definition: mg_processing.h:162
PARTICLE_PIXEL_Y
#define PARTICLE_PIXEL_Y
Definition: mg_tags.h:210
MAP_RECONSTRUCTION
#define MAP_RECONSTRUCTION
Definition: mg_tags.h:34
MICROGRAPH_ORIGIN_Y
#define MICROGRAPH_ORIGIN_Y
Definition: mg_tags.h:90
Bmicrograph::level_angle
double level_angle
Definition: mg_processing.h:221
PARTICLE_FOM_SNR
#define PARTICLE_FOM_SNR
Definition: mg_tags.h:218
PARTICLE_FOM_CV
#define PARTICLE_FOM_CV
Definition: mg_tags.h:217
MICROGRAPH_MATRIX_1_3
#define MICROGRAPH_MATRIX_1_3
Definition: mg_tags.h:105
PARTICLE_PIXEL
#define PARTICLE_PIXEL
Definition: mg_tags.h:208
Bmicrograph::origin
Vector3< double > origin
Definition: mg_processing.h:223
PARTICLE_FILE
#define PARTICLE_FILE
Definition: mg_tags.h:182
FILAMENT_FILE
#define FILAMENT_FILE
Definition: mg_tags.h:259
PARTICLE_PSI
#define PARTICLE_PSI
Definition: mg_tags.h:199
Bfilnode::id
int id
Definition: mg_processing.h:118
get_fom_tag
Bstring get_fom_tag(FOMType fom_type)
Returns the tag associated with a particular FOM.
Definition: mg_processing.cpp:2612
MICROGRAPH_FRAME_FOM
#define MICROGRAPH_FRAME_FOM
Definition: mg_tags.h:69
Bmicrograph::hvec
Vector3< double > hvec
Definition: mg_processing.h:226
Bmicrograph::magnification
double magnification
Definition: mg_processing.h:213
Bmicrograph::tilt_axis
double tilt_axis
Definition: mg_processing.h:219
MICROGRAPH_VOLTAGE
#define MICROGRAPH_VOLTAGE
Definition: mg_tags.h:125
MAP_VIEW_X
#define MAP_VIEW_X
Definition: mg_tags.h:53
Bstrucfac::amp
double amp
Definition: mg_processing.h:160
MICROGRAPH_KVEC_Z
#define MICROGRAPH_KVEC_Z
Definition: mg_tags.h:117
CTFparam::envelope_equation
Bstring envelope_equation()
Generates an envelope equation string from 4 coefficients.
Definition: ctf.cpp:211
item_delete_all
int item_delete_all(Bstar *star, const char *tag)
Deletes all items associated with a given tag from the STAR data base.
Definition: rwstar.cpp:1603
MAP_SCALE_Z
#define MAP_SCALE_Z
Definition: mg_tags.h:45
Bfilament::node
Bfilnode * node
Definition: mg_processing.h:133
Bproject
Definition: mg_processing.h:336
item_get_number_for_block
long item_get_number_for_block(Bstar_block *block, const char *tag)
Gets the number of values associated with a tag in a STAR data block.
Definition: rwstar.cpp:1163
Bstrucfac::next
Bstrucfac * next
Definition: mg_processing.h:157
Bmarker::err
Vector3< float > err
Definition: marker.h:26
write_project_star
int write_project_star(const char *filename, Bproject *project, int mg_select, int rec_select)
Writing micrograph parameters to a STAR file.
Definition: rwmgSTAR.cpp:56
CTFparam::parse_envelope_equation
int parse_envelope_equation(Bstring env_eq)
Extracts the coefficients from the envelope string.
Definition: ctf.cpp:289
Bmicrograph::kvec
Vector3< double > kvec
Definition: mg_processing.h:227
Bbadarea::next
Bbadarea * next
Definition: mg_processing.h:144
PARTICLE_MG_X
#define PARTICLE_MG_X
Definition: mg_tags.h:187
Bparticle::sel
long sel
Definition: mg_processing.h:104
MAP_VOXEL_SIZE_Y
#define MAP_VOXEL_SIZE_Y
Definition: mg_tags.h:48
MICROGRAPH_LVEC_Z
#define MICROGRAPH_LVEC_Z
Definition: mg_tags.h:120
VERB_DEBUG_STAR
#define VERB_DEBUG_STAR
Definition: utilities.h:117
Bparticle::pixel_size
Vector3< double > pixel_size
Definition: mg_processing.h:99
MAP_TRANSFORM_FILE
#define MAP_TRANSFORM_FILE
Definition: mg_tags.h:35
REFLEX_L
#define REFLEX_L
Definition: mg_tags.h:304
CTFparam::volt
double volt()
Definition: ctf.h:87
MICROGRAPH_CTF_DEF_AVG
#define MICROGRAPH_CTF_DEF_AVG
Definition: mg_tags.h:132
MICROGRAPH_LVEC_X
#define MICROGRAPH_LVEC_X
Definition: mg_tags.h:118
MICROGRAPH_CTF_CS
#define MICROGRAPH_CTF_CS
Definition: mg_tags.h:126
MICROGRAPH_MAGNIFICATION
#define MICROGRAPH_MAGNIFICATION
Definition: mg_tags.h:79
MAP_ORIGIN_Z
#define MAP_ORIGIN_Z
Definition: mg_tags.h:42
CTFparam::defocus_deviation
double defocus_deviation()
Definition: ctf.h:108
MAP_FOM
#define MAP_FOM
Definition: mg_tags.h:51
PARTICLE_PHI
#define PARTICLE_PHI
Definition: mg_tags.h:201
Bmicrograph::mark_radius
double mark_radius
Definition: mg_processing.h:238
MICROGRAPH_MATRIX_2_1
#define MICROGRAPH_MATRIX_2_1
Definition: mg_tags.h:106
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
Bmarker::loc
Vector3< float > loc
Definition: marker.h:25
NumberItem
@ NumberItem
Definition: rwstar.h:26
PARTICLE_BOX_RADIUS
#define PARTICLE_BOX_RADIUS
Definition: mg_tags.h:244
MICROGRAPH_KVEC_Y
#define MICROGRAPH_KVEC_Y
Definition: mg_tags.h:116
PARTICLE_HANDB_FOM
#define PARTICLE_HANDB_FOM
Definition: mg_tags.h:231
Blayerline::next
Blayerline * next
Definition: mg_processing.h:176
FILAMENT_NODE_Z
#define FILAMENT_NODE_Z
Definition: mg_tags.h:265
Breconstruction::fft
Bstring fft
Definition: mg_processing.h:293
MICROGRAPH_FRAME_SHIFT_Y
#define MICROGRAPH_FRAME_SHIFT_Y
Definition: mg_tags.h:67
REFLEX_Z
#define REFLEX_Z
Definition: mg_tags.h:301
Euler::view
View view()
Definition: Euler.h:62
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
Breconstruction::fil_node_radius
double fil_node_radius
Definition: mg_processing.h:301
REFLEX_X
#define REFLEX_X
Definition: mg_tags.h:299
Bstrucfac::index
Vector3< int > index
Definition: mg_processing.h:159
Breconstruction::sf
Bstrucfac * sf
Definition: mg_processing.h:311
PARTICLE_THETA
#define PARTICLE_THETA
Definition: mg_tags.h:200
Bmicrograph::box_size
Vector3< long > box_size
Definition: mg_processing.h:233
filament_from_starblock
Bfilament * filament_from_starblock(Bstar_block *block)
Definition: rwmgSTAR.cpp:309
PARTICLE_ID
#define PARTICLE_ID
Definition: mg_tags.h:184
MICROGRAPH_MATRIX_2_3
#define MICROGRAPH_MATRIX_2_3
Definition: mg_tags.h:108
LAYERLINE_NUMBER
#define LAYERLINE_NUMBER
Definition: mg_tags.h:315
PARTICLE_MAGNIF
#define PARTICLE_MAGNIF
Definition: mg_tags.h:207
Breconstruction
Definition: mg_processing.h:283
Bstring::length
long length() const
Definition: Bstring.cpp:263
MICROGRAPH_SCALE_Z
#define MICROGRAPH_SCALE_Z
Definition: mg_tags.h:94
Breconstruction::select
long select
Definition: mg_processing.h:286
PARTICLE_VIEW_ANGLE
#define PARTICLE_VIEW_ANGLE
Definition: mg_tags.h:206
MICROGRAPH_CTF_DEF_MIN
#define MICROGRAPH_CTF_DEF_MIN
Definition: mg_tags.h:134
MICROGRAPH_SCALE_Y
#define MICROGRAPH_SCALE_Y
Definition: mg_tags.h:93
CTF_CC
#define CTF_CC
Definition: mg_tags.h:166
read_star
int read_star(const char *filename, Bstar *star)
Reads paramaters and data into a STAR data base from a list of files.
Definition: rwstar.cpp:224
MICROGRAPH_HELIX_ANGLE
#define MICROGRAPH_HELIX_ANGLE
Definition: mg_tags.h:123
Bparticle::def
double def
Definition: mg_processing.h:96
Bmicrograph::matrix
Matrix3 matrix
Definition: mg_processing.h:225
PARTICLE_CC
#define PARTICLE_CC
Definition: mg_tags.h:232
Bmicrograph::fmg
Bstring fmg
Definition: mg_processing.h:206
FILAMENT_ID
#define FILAMENT_ID
Definition: mg_tags.h:260
PARTICLE_MG_Y
#define PARTICLE_MG_Y
Definition: mg_tags.h:188
Bproject::class_avg
Bparticle * class_avg
Definition: mg_processing.h:348
MICROGRAPH_HELIX_AXIS
#define MICROGRAPH_HELIX_AXIS
Definition: mg_tags.h:121
MICROGRAPH_MARKER_Z
#define MICROGRAPH_MARKER_Z
Definition: mg_tags.h:152
MICROGRAPH_MATRIX_3_2
#define MICROGRAPH_MATRIX_3_2
Definition: mg_tags.h:110
MARKER_ERROR_X
#define MARKER_ERROR_X
Definition: mg_tags.h:288
PARTICLE_Z_ORIGIN
#define PARTICLE_Z_ORIGIN
Definition: mg_tags.h:195
REFLEX_K
#define REFLEX_K
Definition: mg_tags.h:303
CTFparam
Definition: ctf.h:28
Bmicrograph::fom
double fom
Definition: mg_processing.h:239
particle_add
Bparticle * particle_add(Bparticle **part, int pid)
Adds a particle parameter structure to a linked list.
Definition: mg_processing.cpp:221
PARTICLE_GROUP
#define PARTICLE_GROUP
Definition: mg_tags.h:185
MICROGRAPH_LEVEL_ANGLE
#define MICROGRAPH_LEVEL_ANGLE
Definition: mg_tags.h:97
kill_star
int kill_star(Bstar *star)
Destroys a STAR data base.
Definition: rwstar.cpp:132
Bmicrograph::ctf
CTFparam * ctf
Definition: mg_processing.h:241
Bproject::euler_flag
int euler_flag
Definition: mg_processing.h:343
MAP_SCALE_Y
#define MAP_SCALE_Y
Definition: mg_tags.h:44
CTF_FOCAL
#define CTF_FOCAL
Definition: mg_tags.h:163
Bparticle::dev
double dev
Definition: mg_processing.h:97
PARTICLE_VIEW_Z
#define PARTICLE_VIEW_Z
Definition: mg_tags.h:205
Bfield::next
Bfield * next
Definition: mg_processing.h:261
rwmgSTAR.h
Header file for reading and writing micrograph parameters from and to the STAR format.
MAP_VIEW_Z
#define MAP_VIEW_Z
Definition: mg_tags.h:55
Bstring::next
Bstring * next
Definition: Bstring.h:31
Bmicrograph::mark
Bmarker * mark
Definition: mg_processing.h:245
LAYERLINE_SELECT
#define LAYERLINE_SELECT
Definition: mg_tags.h:321
MICROGRAPH_CTF_AMP_CONT
#define MICROGRAPH_CTF_AMP_CONT
Definition: mg_tags.h:130
Bstar::line_length
int line_length
Definition: rwstar.h:80
Bparticle::ori
Vector3< double > ori
Definition: mg_processing.h:101
MARKER_SELECT
#define MARKER_SELECT
Definition: mg_tags.h:294
Bparticle::group
int group
Definition: mg_processing.h:94
CTF_BASELINE
#define CTF_BASELINE
Definition: mg_tags.h:177
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
MICROGRAPH_MATRIX_2_2
#define MICROGRAPH_MATRIX_2_2
Definition: mg_tags.h:107
MAP_VIEW_ANGLE
#define MAP_VIEW_ANGLE
Definition: mg_tags.h:56
PARTICLE_BOX_RADIUS_X
#define PARTICLE_BOX_RADIUS_X
Definition: mg_tags.h:245
Bmarker::sel
int sel
Definition: marker.h:29
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
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::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
PARTICLE_DEF_DEV
#define PARTICLE_DEF_DEV
Definition: mg_tags.h:213
MICROGRAPH_TILT_ANGLE
#define MICROGRAPH_TILT_ANGLE
Definition: mg_tags.h:96
linked_list.h
Header file for generalized linked list functions.
Bmicrograph::select
long select
Definition: mg_processing.h:204
CLASS_AVERAGE
#define CLASS_AVERAGE
Definition: mg_tags.h:255
Breconstruction::block
int block
Definition: mg_processing.h:287
CTF_ZERO
#define CTF_ZERO
Definition: mg_tags.h:171
CTF_DEF_DEV
#define CTF_DEF_DEV
Definition: mg_tags.h:173
Breconstruction::scale
Vector3< double > scale
Definition: mg_processing.h:297
Bmicrograph::helix_angle
double helix_angle
Definition: mg_processing.h:231
Bmicrograph::fps
Bstring fps
Definition: mg_processing.h:211
LAYERLINE_AMP
#define LAYERLINE_AMP
Definition: mg_tags.h:319
MICROGRAPH_CTF_DEF_DEV
#define MICROGRAPH_CTF_DEF_DEV
Definition: mg_tags.h:133
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
item_get_number
long item_get_number(Bstar *star, const char *tag)
Gets the number of values associated with a tag in a STAR data base.
Definition: rwstar.cpp:1134
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
MICROGRAPH_BOX_RADIUS_X
#define MICROGRAPH_BOX_RADIUS_X
Definition: mg_tags.h:140
FILAMENT_WIDTH
#define FILAMENT_WIDTH
Definition: mg_tags.h:266
item_find
Bstar_item * item_find(Bstar_block *block, const char *tag)
Gets the STAR item associated with a tag in a STAR data block.
Definition: rwstar.cpp:1083
MAP_VOXEL_SIZE_X
#define MAP_VOXEL_SIZE_X
Definition: mg_tags.h:47
Blayerline::freq
double freq
Definition: mg_processing.h:180
CTF_APERTURE
#define CTF_APERTURE
Definition: mg_tags.h:164
marker_from_starblock
Bmarker * marker_from_starblock(Bstar_block *block)
Definition: rwmgSTAR.cpp:391
frame_add
Bframe * frame_add(Bframe **frame, int pid)
Adds a movie frame parameter structure to a linked list.
Definition: mg_processing.cpp:189
item_put_angle_list
int item_put_angle_list(Bstar_block *block, const char *tag, char *list, size_t offset, const char *format)
Writes a list of angular values in degrees into a data item associated with a specific data block and...
Definition: rwstar.cpp:1528
Bstring::base
Bstring base()
Definition: Bstring.cpp:516
Bproject::reference
Bstring * reference
Definition: mg_processing.h:341
field_find_id
Bfield * field_find_id(Bfield *field, Bstring &field_id)
Finds a field-of-view based on its identifier.
Definition: mg_select.cpp:33
Bmicrograph::wri
double wri
Definition: mg_processing.h:218
Bmicrograph::pixel_size
Vector3< double > pixel_size
Definition: mg_processing.h:215
CTF_CS
#define CTF_CS
Definition: mg_tags.h:165
MICROGRAPH_CTF_BASELINE
#define MICROGRAPH_CTF_BASELINE
Definition: mg_tags.h:137
rwstar.h
A header file for STAR format files.
MICROGRAPH_MARKER_ERROR_X
#define MICROGRAPH_MARKER_ERROR_X
Definition: mg_tags.h:153
item_put_string
int item_put_string(Bstar_block *block, const char *tag, char *string)
Writes a string into a data item associated with a specific data block and tag in a STAR data base.
Definition: rwstar.cpp:1300
MICROGRAPH_PARTICLE_FILE
#define MICROGRAPH_PARTICLE_FILE
Definition: mg_tags.h:70
CTFparam::alpha
double alpha()
Definition: ctf.h:95
MARKER_ERROR_Z
#define MARKER_ERROR_Z
Definition: mg_tags.h:290
CTFparam::focal_length
double focal_length()
Definition: ctf.h:89
layerline_from_starblock
Blayerline * layerline_from_starblock(Bstar_block *block)
Definition: rwmgSTAR.cpp:523
CTFparam::amp_shift
double amp_shift()
Definition: ctf.h:99
FILAMENT_NODE_X
#define FILAMENT_NODE_X
Definition: mg_tags.h:263
Bstar::block
Bstar_block * block
Definition: rwstar.h:82
LAYERLINE_DISTANCE
#define LAYERLINE_DISTANCE
Definition: mg_tags.h:317
filament_to_starblock
int filament_to_starblock(Bfilament *fil, Bstar_block *block)
Definition: rwmgSTAR.cpp:1234
MICROGRAPH_MARKER_FOM
#define MICROGRAPH_MARKER_FOM
Definition: mg_tags.h:156
MICROGRAPH_MARKER_RADIUS
#define MICROGRAPH_MARKER_RADIUS
Definition: mg_tags.h:148
Bmicrograph::fil_node_radius
double fil_node_radius
Definition: mg_processing.h:235
MAP_VOXEL_SIZE_Z
#define MAP_VOXEL_SIZE_Z
Definition: mg_tags.h:49
MICROGRAPH_FRAME_SELECT
#define MICROGRAPH_FRAME_SELECT
Definition: mg_tags.h:68
Bproject::comment
Bstring comment
Definition: mg_processing.h:339
MICROGRAPH_MATRIX_3_3
#define MICROGRAPH_MATRIX_3_3
Definition: mg_tags.h:111
Blayerline::fom
double fom
Definition: mg_processing.h:182
Bmicrograph::layer
Blayerline * layer
Definition: mg_processing.h:247
PARTICLE_SELECT
#define PARTICLE_SELECT
Definition: mg_tags.h:215
Bfilnode
Definition: mg_processing.h:116
MICROGRAPH_INTENSITY
#define MICROGRAPH_INTENSITY
Definition: mg_tags.h:87
MICROGRAPH_HELIX_RADIUS
#define MICROGRAPH_HELIX_RADIUS
Definition: mg_tags.h:124
CTF_DEF_MIN
#define CTF_DEF_MIN
Definition: mg_tags.h:174
MAP_SYMMETRY
#define MAP_SYMMETRY
Definition: mg_tags.h:59
REFLEX_Y
#define REFLEX_Y
Definition: mg_tags.h:300
Bmicrograph::bad
Bbadarea * bad
Definition: mg_processing.h:244
FOM_CV
@ FOM_CV
Definition: mg_processing.h:42
reconstruction_add
Breconstruction * reconstruction_add(Breconstruction **rec, Bstring &rec_id)
Adds a reconstruction parameter structure to a linked list.
Definition: mg_processing.cpp:398
LAYERLINE_FREQ
#define LAYERLINE_FREQ
Definition: mg_tags.h:318
Breconstruction::fps
Bstring fps
Definition: mg_processing.h:294
frame_to_starblock
int frame_to_starblock(Bframe *frame, Bstar_block *block)
Definition: rwmgSTAR.cpp:1080
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
CTF_DEF_MAX
#define CTF_DEF_MAX
Definition: mg_tags.h:175
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
REFLEX_SIGAMP
#define REFLEX_SIGAMP
Definition: mg_tags.h:307
PARTICLE_Y
#define PARTICLE_Y
Definition: mg_tags.h:191
MICROGRAPH_TILT_AXIS
#define MICROGRAPH_TILT_AXIS
Definition: mg_tags.h:95
CTFparam::baseline_equation
Bstring baseline_equation()
Generates a baseline equation string from 4 to 10 coefficients.
Definition: ctf.cpp:167
MICROGRAPH_CTF_ENVELOPE
#define MICROGRAPH_CTF_ENVELOPE
Definition: mg_tags.h:138
reconstruction_to_starblock
int reconstruction_to_starblock(Breconstruction *rec, Bstar_block *block, FOMType fom_tag[NFOM], int euler_flag, int omega_flag)
Definition: rwmgSTAR.cpp:1479
MAP_VOXEL_SIZE
#define MAP_VOXEL_SIZE
Definition: mg_tags.h:46
CTF_AMP_SHIFT
#define CTF_AMP_SHIFT
Definition: mg_tags.h:170
MICROGRAPH_PIXEL_Y
#define MICROGRAPH_PIXEL_Y
Definition: mg_tags.h:83
Bstar_block
Definition: rwstar.h:55
verbose
int verbose
CTFparam::envelope
vector< double > & envelope()
Definition: ctf.h:121
Bstar_block::next
Bstar_block * next
Definition: rwstar.h:56
View::angle
double angle()
Definition: View.h:98
Euler
Definition: Euler.h:28
MARKER_ERROR_Y
#define MARKER_ERROR_Y
Definition: mg_tags.h:289
Bframe::next
Bframe * next
Definition: mg_processing.h:76
Bmicrograph::next
Bmicrograph * next
Definition: mg_processing.h:202
micrograph_from_starblock
Bmicrograph * micrograph_from_starblock(Bstar_block *block, Bstring &mg_id, FOMType fom_tag[NFOM])
Definition: rwmgSTAR.cpp:619
CTF_ENVELOPE
#define CTF_ENVELOPE
Definition: mg_tags.h:178
Bstar::split
int split
Definition: rwstar.h:79
FILAMENT_NODE_ID
#define FILAMENT_NODE_ID
Definition: mg_tags.h:262
Blayerline
Definition: mg_processing.h:175
MICROGRAPH_DOSE
#define MICROGRAPH_DOSE
Definition: mg_tags.h:86
string_add
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
Definition: Bstring.cpp:713
init_star
Bstar * init_star()
Creates a STAR data base.
Definition: rwstar.cpp:111
Bfield::mg
Bmicrograph * mg
Definition: mg_processing.h:267
read_project_star
int read_project_star(Bstring &filename, Bproject *project)
Reading micrograph parameters from STAR files.
Definition: rwmgSTAR.cpp:29
Bmicrograph::sf_radius
double sf_radius
Definition: mg_processing.h:237
Bparticle::id
int id
Definition: mg_processing.h:93
layerline_to_starblock
int layerline_to_starblock(Blayerline *line, Bstar_block *block)
Definition: rwmgSTAR.cpp:1320
PARTICLE_NUMBER
#define PARTICLE_NUMBER
Definition: mg_tags.h:183
Blayerline::number
int number
Definition: mg_processing.h:177
MICROGRAPH_CTF_AST_ANG
#define MICROGRAPH_CTF_AST_ANG
Definition: mg_tags.h:136
PARTICLE_Y_ORIGIN
#define PARTICLE_Y_ORIGIN
Definition: mg_tags.h:194
MICROGRAPH_MARKER_X
#define MICROGRAPH_MARKER_X
Definition: mg_tags.h:150
MICROGRAPH_FRAME_SHIFT_X
#define MICROGRAPH_FRAME_SHIFT_X
Definition: mg_tags.h:66
MICROGRAPH_HVEC_X
#define MICROGRAPH_HVEC_X
Definition: mg_tags.h:112
MICROGRAPH_SELECT
#define MICROGRAPH_SELECT
Definition: mg_tags.h:77
PARTICLE_ORIGIN_Z
#define PARTICLE_ORIGIN_Z
Definition: mg_tags.h:198
Bstar_item::type
StarType type
Definition: rwstar.h:39
Bstar
Definition: rwstar.h:78
FOM
@ FOM
Definition: mg_processing.h:40
ctf_to_starblock
int ctf_to_starblock(CTFparam *ctf, Bstar_block *block)
Definition: rwmgSTAR.cpp:1345
CTFparam::Cs
double Cs()
Definition: ctf.h:91
MICROGRAPH_MATRIX_1_1
#define MICROGRAPH_MATRIX_1_1
Definition: mg_tags.h:103
MICROGRAPH_MARKER_Y
#define MICROGRAPH_MARKER_Y
Definition: mg_tags.h:151
MICROGRAPH_WATER_RING
#define MICROGRAPH_WATER_RING
Definition: mg_tags.h:88
Bmicrograph::fft
Bstring fft
Definition: mg_processing.h:210
CTFparam::baseline_type
long baseline_type()
Definition: ctf.h:112
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
block_find_with_tag
Bstar_block * block_find_with_tag(Bstar *star, const char *tag)
Gets the first block associated with a tag in a STAR data base.
Definition: rwstar.cpp:1050
item_delete_from_block
int item_delete_from_block(Bstar_block *block, const char *tag)
Deletes an item associated with a given tag from a block in the STAR data base.
Definition: rwstar.cpp:1626
CTF_VOLTAGE
#define CTF_VOLTAGE
Definition: mg_tags.h:162
REFLEX_RADIUS
#define REFLEX_RADIUS
Definition: mg_tags.h:298