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