Bsoft  2.1.0
Bernard's software package
tcltk_bhelix.cpp
Go to the documentation of this file.
1 
9 // Tk must be included before anything else to remedy symbol conflicts
10 #include <tk.h>
11 
12 #include "tcltk_bhelix.h"
13 #include "mg_helix.h"
14 #include "linked_list.h"
15 #include "timer.h"
16 #include "utilities.h"
17 
18 #include <sys/stat.h>
19 
20 // Declaration of global variables
21 extern int verbose; // Level of output to the screen
22 extern Bimage* imglist;
23 
24 // Internal function prototypes
25 Tcl_Obj* layerline_count(Bmicrograph* mg);
26 Tcl_Obj* layerline_ids(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[]);
27 Tcl_Obj* layerline_renumber(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[]);
28 Tcl_Obj* layerline_distance(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[]);
29 Tcl_Obj* layerline_fom(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[]);
30 Tcl_Obj* layerline_select(Bmicrograph* mg, Bimage* p, int objc, Tcl_Obj *CONST objv[]);
31 Tcl_Obj* layerline_move(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[]);
32 Tcl_Obj* layerline_create(Bmicrograph* mg, Bimage* p, int objc, Tcl_Obj *CONST objv[]);
33 Tcl_Obj* layerline_delete(Bproject* project, int objc, Tcl_Obj *CONST objv[]);
34 Tcl_Obj* layerline_delete(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[]);
35 Tcl_Obj* layerline_order(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[]);
36 Tcl_Obj* layerline_generate(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[]);
37 Tcl_Obj* layerline_mask(Bmicrograph* mg, Bimage* p, int objc, Tcl_Obj *CONST objv[]);
38 Tcl_Obj* layerline_plot(Bmicrograph* mg, Bimage* p, int objc, Tcl_Obj *CONST objv[]);
39 Tcl_Obj* layerline_bessel_function(double realsizeX, int objc, Tcl_Obj *CONST objv[]);
40 
41 
42 /*
43 @brief Functions for helical indexing.
44  Layer line interface syntax:
45  Bmg layerline [item] [action] [params]
46  Actions:
47  count counts the number of layer lines
48  ids returns the identifiers of the layer lines
49  location [id] returns the location of a layer line
50  fom [id] returns the figure-of-merit of a layer line
51  select [x] [y] returns the layer line identifier at the given location
52  move [id] [dx] [dy] updates a layer line location by the given vector
53  create [x] [y] [id] creates a new layer line at the given location
54  delete [all|mg|id] deletes layer lines
55  order [id] [dx] [dy] sets or returns the order of a layer line
56  generate [m] generates all layer lines
57  mask [w] masks layer lines
58  plot [id] [l] retrieves one layer line's values as an array of length l
59  bessel [o] [r] [l] retrieves a bessel function of given order and radius as an array of length l
60  Parameters:
61  id layer line identifier
62  x x location
63  y y location
64  dx change in x
65  dy change in y
66  m index limit
67  w mask width
68  l array length
69  o Bessel order
70 */
71 Tcl_Obj* do_layerline(Bproject* project, int objc, Tcl_Obj *CONST objv[])
72 {
73  Tcl_Obj* returnObj = NULL;
74 
75  Bstring item = Tcl_GetStringFromObj(objv[2], NULL);
76  if ( verbose & VERB_DEBUG )
77  cout << "DEBUG do_layerline: Item: " << item << " (" << item.length() << ")" << endl;
78 
79  Bstring id = item.post(':');
80  id = id.remove(' ');
81  item = item.pre(':');
82 
83  if ( !item.contains("Field") && !item.contains("Micrograph") ) {
84  cerr << "Error in do_layerline: Item " << item << " must be a micrograph!" << endl;
85  returnObj = Tcl_NewObj();
86  return returnObj;
87  }
88 
89  Bfield* field = NULL;
90  Bmicrograph* mg = NULL;
91  Bimage* p = NULL;
92  Bstring filename, filename2, base, delete_what;
93  char string[MAXLINELEN] = "";
94 
95  if ( item.contains("Field") ) {
96  for ( field = project->field; field && field->id != id; field = field->next ) ;
97  if ( field ) mg = field->mg;
98  } else if ( item.contains("Micrograph") ) {
99  for ( field = project->field; field; field = field->next ) {
100  for ( mg = field->mg; mg && mg->id != id; mg = mg->next ) ;
101  if ( mg ) break;
102  }
103  }
104 
105  if ( mg ) {
106  filename = mg->fft;
107  if ( filename.length() < 1 ) filename = mg->fps;
108  if ( filename.length() < 1 ) filename = mg->fmg;
109  if ( filename.length() < 1 ) filename = mg->fframe;
110  }
111 
112  if ( filename.length() ) {
113  base = filename.base();
114  for ( p = imglist; p; p = p->next ) {
115  filename2 = p->file_name();
116  if ( filename2.base() == base ) break;
117  }
118  }
119 
120  if ( !p ) {
121  returnObj = Tcl_NewObj();
122  sprintf(string, "Image %s not found!", filename.c_str());
123  Tcl_AppendToObj(returnObj, string, strlen(string));
124  }
125 
126  Bstring action = Tcl_GetStringFromObj(objv[3], NULL);
127  if ( verbose & VERB_DEBUG )
128  cout << "DEBUG do_layerline: Action: " << action << " (" << action.length() << ")" << endl;
129 
130  if ( action == "count" ) {
131  returnObj = layerline_count(mg);
132  } else if ( action == "ids" ) {
133  returnObj = layerline_ids(mg, objc, objv);
134  } else if ( action == "renumber" ) {
135  returnObj = layerline_renumber(mg, objc, objv);
136  } else if ( action == "distance" ) {
137  returnObj = layerline_distance(mg, objc, objv);
138  } else if ( action == "fom" ) {
139  returnObj = layerline_fom(mg, objc, objv);
140  } else if ( action == "select" ) {
141  if ( p ) returnObj = layerline_select(mg, p, objc, objv);
142  } else if ( action == "move" ) {
143  returnObj = layerline_move(mg, objc, objv);
144  } else if ( action == "create" ) {
145  if ( p ) returnObj = layerline_create(mg, p, objc, objv);
146  } else if ( action == "delete" ) {
147  if ( mg ) returnObj = layerline_delete(mg, objc, objv);
148  else returnObj = layerline_delete(project, objc, objv);
149  } else if ( action == "order" ) {
150  returnObj = layerline_order(mg, objc, objv);
151  } else if ( action == "generate" ) {
152  returnObj = layerline_generate(mg, objc, objv);
153  } else if ( action == "mask" ) {
154  if ( p ) returnObj = layerline_mask(mg, p, objc, objv);
155  } else if ( action == "plot" ) {
156  if ( p ) returnObj = layerline_plot(mg, p, objc, objv);
157  } else if ( action == "bessel" ) {
158  if ( p ) returnObj = layerline_bessel_function(p->sampling(0)[0]*p->sizeX(), objc, objv);
159  } else {
160  cerr << "Error: Action " << action << " not recognized!" << endl;
161  }
162 
163  if ( !returnObj ) {
164  returnObj = Tcl_NewObj();
165  Tcl_SetIntObj(returnObj, 0);
166  }
167 
168  return returnObj;
169 }
170 
172 {
173  Tcl_Obj* returnObj = Tcl_NewObj();
174 
175  int nll(0);
176  Blayerline* line;
177 
178  if ( mg )
179  for ( line = mg->layer; line; line = line->next ) nll++;
180 
181  Tcl_SetIntObj(returnObj, nll);
182 
183  return returnObj;
184 }
185 
186 Tcl_Obj* layerline_ids(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[])
187 {
188  Tcl_Obj* returnObj = Tcl_NewObj();
189 
190  double fom_cut(-1);
191  char string[MAXLINELEN] = "";
192  Blayerline* line;
193 
194  if ( objc > 4 ) Tcl_GetDoubleFromObj(NULL, objv[4], &fom_cut);
195 
196  if ( mg ) {
197  for ( line = mg->layer; line; line = line->next ) if ( line->fom >= fom_cut ) {
198  sprintf(string, " %d", line->number);
199  Tcl_AppendToObj(returnObj, string, strlen(string));
200  }
201  }
202 
203  return returnObj;
204 }
205 
206 Tcl_Obj* layerline_renumber(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[])
207 {
208  Tcl_Obj* returnObj = Tcl_NewObj();
209 
210  int id1, id2;
211 
212  if ( objc > 4 ) Tcl_GetIntFromObj(NULL, objv[4], &id1);
213  if ( objc > 5 ) Tcl_GetIntFromObj(NULL, objv[5], &id2);
214 
215  Blayerline* line = NULL;
216 
217  if ( mg ) {
218  for ( line = mg->layer; line && line->number != id2; line = line->next ) ;
219  if ( line ) {
220  id2 = id1;
221  } else {
222  for ( line = mg->layer; line && line->number != id1; line = line->next ) ;
223  if ( line ) line->number = id2;
224  }
225  }
226 
227  Tcl_SetIntObj(returnObj, id2);
228 
229  return returnObj;
230 }
231 
232 Tcl_Obj* layerline_distance(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[])
233 {
234  Tcl_Obj* returnObj = Tcl_NewObj();
235 
236  int id;
237  double d(0);
238  Blayerline* line = NULL;
239 
240  if ( objc > 4 ) Tcl_GetIntFromObj(NULL, objv[4], &id);
241 
242  if ( mg )
243  for ( line = mg->layer; line && line->number != id; line = line->next ) ;
244 
245  if ( line ) d = line->distance;
246 
247  Tcl_SetDoubleObj(returnObj, d);
248 
249  return returnObj;
250 }
251 
252 Tcl_Obj* layerline_fom(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[])
253 {
254  Tcl_Obj* returnObj = Tcl_NewObj();
255 
256  int id;
257  double fom(1);
258  Blayerline* line = NULL;
259 
260  if ( objc > 4 ) Tcl_GetIntFromObj(NULL, objv[4], &id);
261 
262  if ( mg )
263  for ( line = mg->layer; line && line->number != id; line = line->next ) ;
264 
265  if ( line ) fom = line->fom;
266 
267  Tcl_SetDoubleObj(returnObj, fom);
268 
269  return returnObj;
270 }
271 
272 Tcl_Obj* layerline_select(Bmicrograph* mg, Bimage* p, int objc, Tcl_Obj *CONST objv[])
273 {
274  Tcl_Obj* returnObj = Tcl_NewObj();
275 
276  int i(0), id(-1);
277  unsigned long n = mg->img_num;
278  double x(0), y(0), w(0);
279 
280  if ( objc > 4 ) Tcl_GetDoubleFromObj(NULL, objv[4], &x);
281  if ( objc > 5 ) Tcl_GetDoubleFromObj(NULL, objv[5], &y);
282  if ( objc > 6 ) Tcl_GetDoubleFromObj(NULL, objv[6], &w);
283 
284  double d, ds, dmin;
285 // Vector3<float> loc(x, y, 0);
286  Blayerline* line;
287 
288  if ( mg ) {
289  ds = cos(mg->helix_axis)*(x - p->image[n].origin()[0]) + sin(mg->helix_axis)*(y - p->image[n].origin()[1]);
290  dmin = 2*w;
291  for ( line = mg->layer; line; line = line->next ) {
292  d = fabs(ds - line->distance);
293  if ( dmin > d ) {
294  dmin = d;
295  i = line->number;
296  }
297  }
298  if ( dmin <= w ) id = i;
299  }
300 
301  Tcl_SetIntObj(returnObj, id);
302 
303  return returnObj;
304 }
305 
306 Tcl_Obj* layerline_move(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[])
307 {
308  Tcl_Obj* returnObj = Tcl_NewObj();
309 
310  int id(-1);
311  double d(0), dx(0), dy(0);
312 
313  if ( objc > 4 ) Tcl_GetIntFromObj(NULL, objv[4], &id);
314  if ( objc > 5 ) Tcl_GetDoubleFromObj(NULL, objv[5], &dx);
315  if ( objc > 6 ) Tcl_GetDoubleFromObj(NULL, objv[6], &dy);
316 
317  Blayerline* line;
318 
319  if ( mg ) {
320  for ( line = mg->layer; line && line->number != id; line = line->next ) ;
321  if ( line ) {
322  d = cos(mg->helix_axis)*dx + sin(mg->helix_axis)*dy;
323  line->distance += d;
324  }
325  }
326 
327  Tcl_SetIntObj(returnObj, id);
328 
329  return returnObj;
330 }
331 
332 Tcl_Obj* layerline_create(Bmicrograph* mg, Bimage* p, int objc, Tcl_Obj *CONST objv[])
333 {
334  Tcl_Obj* returnObj = Tcl_NewObj();
335 
336  int id(0);
337  unsigned long n = mg->img_num;
338  double x, y;
339 
340  if ( objc > 4 ) Tcl_GetIntFromObj(NULL, objv[4], &id);
341  if ( objc > 5 ) Tcl_GetDoubleFromObj(NULL, objv[5], &x);
342  if ( objc > 6 ) Tcl_GetDoubleFromObj(NULL, objv[6], &y);
343 
344  Blayerline* line = NULL;
345 
346  if ( mg )
347  line = (Blayerline *) add_item((char **) &mg->layer, sizeof(Blayerline));
348 
349  if ( line ) {
350  line->number = id;
351  line->distance = fabs(cos(mg->helix_axis)*(x - p->image[n].origin()[0]) + sin(mg->helix_axis)*(y - p->image[n].origin()[1]));
352  line->freq = fabs(line->distance/(p->sizeY()*mg->pixel_size[1]));
353  line->amp = 1;
354  line->fom = 1;
355  line->sel = 1;
356  }
357 
358  Tcl_SetIntObj(returnObj, id);
359 
360  return returnObj;
361 }
362 
363 Tcl_Obj* layerline_delete(Bproject* project, int objc, Tcl_Obj *CONST objv[])
364 {
365  Tcl_Obj* returnObj = Tcl_NewObj();
366 
367  int id(0), n(-1);
368  double fom_cut(0);
369 
370  Bstring action = Tcl_GetStringFromObj(objv[3], NULL);
371 
372  Bfield* field = project->field;
373  Bmicrograph* mg = NULL;
374  Blayerline* line;
375 
376  if ( action == "all" || action == "mg" ) {
377  for ( field = project->field; field; field = field->next ) {
378  for ( mg = field->mg; mg; mg = mg->next ) {
379  kill_list((char *) mg->layer, sizeof(Blayerline));
380  mg->layer = NULL;
381  }
382  }
383  }
384 
385  if ( action == "fom" ) {
386  if ( objc > 4 ) Tcl_GetDoubleFromObj(NULL, objv[4], &fom_cut);
387  if ( objc > 5 ) Tcl_GetIntFromObj(NULL, objv[5], &n);
388  if ( n < 0 ) {
389  if ( field ) for ( mg = field->mg; mg; mg = mg->next ) {
390  for ( line = mg->layer; line; line = line->next )
391  if ( line->fom < fom_cut ) line->sel = 0;
392 // layerline_delete_non_selected(&mg->layer);
393  }
394  } else {
395  if ( field ) for ( mg = field->mg; mg && mg->img_num != n; mg = mg->next ) ;
396  if ( mg ) {
397  for ( line = mg->layer; line; line = line->next )
398  if ( line->fom < fom_cut ) line->sel = 0;
399 // layerline_delete_non_selected(&mg->layer);
400  }
401  }
402  } else {
403  if ( objc > 3 ) Tcl_GetIntFromObj(NULL, objv[3], &id);
404  if ( objc > 4 ) Tcl_GetIntFromObj(NULL, objv[4], &n);
405  if ( id > 0 ) {
406  if ( n < 0 ) {
407  if ( field ) for ( mg = field->mg; mg; mg = mg->next ) {
408  for ( line = mg->layer; line && line->number != id; line = line->next ) ;
409  if ( line )
410  remove_item((char **)&mg->layer, (char *)line, sizeof(Blayerline));
411  }
412  } else {
413  if ( field ) for ( mg = field->mg; mg && mg->img_num != n; mg = mg->next ) ;
414  if ( mg ) {
415  for ( line = mg->layer; line && line->number != id; line = line->next ) ;
416  if ( line )
417  remove_item((char **)&mg->layer, (char *)line, sizeof(Blayerline));
418  }
419  }
420  }
421  }
422 
423  Tcl_SetIntObj(returnObj, id);
424 
425  return returnObj;
426 }
427 
428 Tcl_Obj* layerline_delete(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[])
429 {
430  Tcl_Obj* returnObj = Tcl_NewObj();
431 
432  int id(0);
433 
434  Bstring action = Tcl_GetStringFromObj(objv[4], NULL);
435 
436  Blayerline* line;
437 
438  if ( action == "all" ) {
439  kill_list((char *) mg->layer, sizeof(Blayerline));
440  mg->layer = NULL;
441  } else {
442  if ( objc > 4 ) Tcl_GetIntFromObj(NULL, objv[4], &id);
443  if ( id > 0 ) {
444  if ( mg ) {
445  for ( line = mg->layer; line && line->number != id; line = line->next ) ;
446  if ( line )
447  remove_item((char **)&mg->layer, (char *)line, sizeof(Blayerline));
448  }
449  }
450  }
451 
452  Tcl_SetIntObj(returnObj, id);
453 
454  return returnObj;
455 }
456 
457 Tcl_Obj* layerline_order(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[])
458 {
459  Tcl_Obj* returnObj = Tcl_NewObj();
460 
461  int id(-1), order(0), set_order(0);
462 
463  if ( objc > 4 ) Tcl_GetIntFromObj(NULL, objv[4], &id);
464  if ( objc > 5 ) {
465  Tcl_GetIntFromObj(NULL, objv[5], &order);
466  set_order = 1;
467  }
468 
469  Blayerline* line;
470 
471  if ( mg ) {
472  for ( line = mg->layer; line && line->number != id; line = line->next ) ;
473  if ( line ) {
474  if ( set_order ) line->order = order;
475  else order = line->order;
476  }
477  }
478 
479  Tcl_SetIntObj(returnObj, order);
480 
481  return returnObj;
482 }
483 
484 Tcl_Obj* layerline_generate(Bmicrograph* mg, int objc, Tcl_Obj *CONST objv[])
485 {
486  Tcl_Obj* returnObj = Tcl_NewObj();
487 
488  int n(0), ind_lim(3);
489 
490  if ( objc > 4 ) Tcl_GetIntFromObj(NULL, objv[4], &ind_lim);
491 
492  if ( mg )
493  n = mg_generate_layer_lines(mg, ind_lim);
494 
495  Tcl_SetIntObj(returnObj, n);
496 
497  return returnObj;
498 }
499 
500 Tcl_Obj* layerline_mask(Bmicrograph* mg, Bimage* p, int objc, Tcl_Obj *CONST objv[])
501 {
502  Tcl_Obj* returnObj = Tcl_NewObj();
503 
504  int n(0);
505  double width(5);
506 
507  if ( objc > 4 ) Tcl_GetDoubleFromObj(NULL, objv[4], &width);
508 
509  if ( mg )
510  n = img_mask_layer_lines(p, mg->layer, mg->helix_axis, width);
511 
512  Tcl_SetIntObj(returnObj, n);
513 
514  return returnObj;
515 }
516 
517 Tcl_Obj* layerline_plot(Bmicrograph* mg, Bimage* p, int objc, Tcl_Obj *CONST objv[])
518 {
519  Tcl_Obj* returnObj = Tcl_NewObj();
520 
521  int l(0), len(p->sizeX()), i;
522  Blayerline* line;
523  double* plot;
524  char string[100];
525 
526  if ( objc > 4 ) Tcl_GetIntFromObj(NULL, objv[4], &l);
527  if ( objc > 5 ) Tcl_GetIntFromObj(NULL, objv[5], &len);
528 
529  if ( mg ) {
530  for ( line = mg->layer; line && line->number != l; line = line->next ) ;
531  if ( line ) {
532  plot = img_extract_layer_line(p, line, mg->helix_axis, len);
533  sprintf(string, "%d", len);
534  Tcl_AppendToObj(returnObj, string, strlen(string));
535  for ( i=0; i<p->sizeX(); i++ ) {
536  sprintf(string, " %g", plot[i]);
537  Tcl_AppendToObj(returnObj, string, strlen(string));
538  }
539  delete[] plot;
540  }
541  }
542 
543  return returnObj;
544 }
545 
546 Tcl_Obj* layerline_bessel_function(double realsizeX, int objc, Tcl_Obj *CONST objv[])
547 {
548  Tcl_Obj* returnObj = Tcl_NewObj();
549 
550  int n(0), len(100);
551  double radius(0);
552 
553  if ( objc > 4 ) Tcl_GetIntFromObj(NULL, objv[4], &n);
554  if ( objc > 5 ) Tcl_GetDoubleFromObj(NULL, objv[5], &radius);
555  if ( objc > 6 ) Tcl_GetIntFromObj(NULL, objv[6], &len);
556 
557  if ( radius < 1 ) return returnObj;
558 
559  int x;
560  char string[100];
561  double j, scale = TWOPI*radius/realsizeX;
562 
563  sprintf(string, "%d", len);
564  Tcl_AppendToObj(returnObj, string, strlen(string));
565  for ( x=0; x<len; x++ ) {
566  j = jn(n, (x - len/2)*scale);
567  sprintf(string, " %g", j*j);
568  Tcl_AppendToObj(returnObj, string, strlen(string));
569  }
570 
571  return returnObj;
572 }
573 
574 
layerline_generate
Tcl_Obj * layerline_generate(Bmicrograph *mg, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bhelix.cpp:484
Bmicrograph::id
Bstring id
Definition: mg_processing.h:203
Bmicrograph
Definition: mg_processing.h:201
MAXLINELEN
#define MAXLINELEN
Definition: utilities.h:45
Bstring::remove
Bstring remove(const char c)
Definition: Bstring.cpp:473
Blayerline::sel
long sel
Definition: mg_processing.h:183
VERB_DEBUG
#define VERB_DEBUG
Definition: utilities.h:116
layerline_create
Tcl_Obj * layerline_create(Bmicrograph *mg, Bimage *p, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bhelix.cpp:332
kill_list
long kill_list(char *list, unsigned long size)
Frees all the items in a linked list.
Definition: linked_list.cpp:214
Bstring
Definition: Bstring.h:29
Bimage::next
Bimage * next
Definition: Bimage.h:179
add_item
char * add_item(char **list, unsigned long size)
Adds an item to a linked list.
Definition: linked_list.cpp:26
Bproject::field
Bfield * field
Definition: mg_processing.h:346
base
string base(string &filename)
Definition: string_util.cpp:28
Bimage::sizeX
void sizeX(long nx)
Definition: Bimage.h:390
Bmicrograph::helix_axis
double helix_axis
Definition: mg_processing.h:229
Bmicrograph::img_num
int img_num
Definition: mg_processing.h:212
layerline_move
Tcl_Obj * layerline_move(Bmicrograph *mg, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bhelix.cpp:306
Bfield::id
Bstring id
Definition: mg_processing.h:262
Bstring::post
Bstring post(char c)
Definition: Bstring.cpp:402
Bfield
Definition: mg_processing.h:260
Blayerline::amp
double amp
Definition: mg_processing.h:181
Bimage::image
Bsub_image * image
Definition: Bimage.h:202
Blayerline::order
int order
Definition: mg_processing.h:178
Bstring::c_str
const char * c_str()
Definition: Bstring.h:70
Bmicrograph::fframe
Bstring fframe
Definition: mg_processing.h:207
layerline_delete
Tcl_Obj * layerline_delete(Bproject *project, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bhelix.cpp:363
do_layerline
Tcl_Obj * do_layerline(Bproject *project, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bhelix.cpp:71
mg_generate_layer_lines
int mg_generate_layer_lines(Bmicrograph *mg, int rad_lim)
Generates layer lines given the unit cell vectors.
Definition: mg_helix.cpp:456
project
Bproject * project
Definition: bshow.cpp:33
img_mask_layer_lines
int img_mask_layer_lines(Bimage *p, Blayerline *layer_line, float helix_axis, float width)
Masks the image using the list of layer lines.
Definition: mg_helix.cpp:499
Bsub_image::origin
void origin(double x, double y, double z)
Definition: Bimage.h:136
Bimage::sizeY
void sizeY(long ny)
Definition: Bimage.h:391
Bstring::pre
Bstring pre(char c)
Definition: Bstring.cpp:389
layerline_bessel_function
Tcl_Obj * layerline_bessel_function(double realsizeX, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bhelix.cpp:546
Bimage
General image parameter class.
Definition: Bimage.h:177
timer.h
Utilities for timing functions.
Bproject
Definition: mg_processing.h:336
remove_item
char * remove_item(char **list, char *item, unsigned long size)
Finds the given item and deletes it from the linked list.
Definition: linked_list.cpp:114
layerline_order
Tcl_Obj * layerline_order(Bmicrograph *mg, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bhelix.cpp:457
layerline_renumber
Tcl_Obj * layerline_renumber(Bmicrograph *mg, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bhelix.cpp:206
img_extract_layer_line
double * img_extract_layer_line(Bimage *p, Blayerline *line, float helix_axis, int length)
Extracts one layer line from an image.
Definition: mg_helix.cpp:551
tcltk_bhelix.h
layerline_ids
Tcl_Obj * layerline_ids(Bmicrograph *mg, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bhelix.cpp:186
Bimage::file_name
void file_name(string s)
Definition: Bimage.h:245
Blayerline::next
Blayerline * next
Definition: mg_processing.h:176
imglist
Bimage * imglist
Definition: bshow.cpp:32
utilities.h
Header file for general utilities.
Bstring::length
long length() const
Definition: Bstring.cpp:263
Bmicrograph::fmg
Bstring fmg
Definition: mg_processing.h:206
verbose
int verbose
Bfield::next
Bfield * next
Definition: mg_processing.h:261
layerline_mask
Tcl_Obj * layerline_mask(Bmicrograph *mg, Bimage *p, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bhelix.cpp:500
layerline_distance
Tcl_Obj * layerline_distance(Bmicrograph *mg, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bhelix.cpp:232
linked_list.h
Header file for generalized linked list functions.
layerline_count
Tcl_Obj * layerline_count(Bmicrograph *mg)
Definition: tcltk_bhelix.cpp:171
Bmicrograph::fps
Bstring fps
Definition: mg_processing.h:211
Blayerline::distance
double distance
Definition: mg_processing.h:179
Blayerline::freq
double freq
Definition: mg_processing.h:180
Bstring::base
Bstring base()
Definition: Bstring.cpp:516
Bmicrograph::pixel_size
Vector3< double > pixel_size
Definition: mg_processing.h:215
Bimage::sampling
void sampling(long nn, Vector3< double > u)
Definition: Bimage.h:514
Blayerline::fom
double fom
Definition: mg_processing.h:182
Bmicrograph::layer
Blayerline * layer
Definition: mg_processing.h:247
Bstring::contains
bool contains(const Bstring &s)
Definition: Bstring.cpp:592
mg_helix.h
Header file for functions to process helical data.
Bmicrograph::next
Bmicrograph * next
Definition: mg_processing.h:202
Blayerline
Definition: mg_processing.h:175
Bfield::mg
Bmicrograph * mg
Definition: mg_processing.h:267
layerline_select
Tcl_Obj * layerline_select(Bmicrograph *mg, Bimage *p, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bhelix.cpp:272
Blayerline::number
int number
Definition: mg_processing.h:177
layerline_fom
Tcl_Obj * layerline_fom(Bmicrograph *mg, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bhelix.cpp:252
Bmicrograph::fft
Bstring fft
Definition: mg_processing.h:210
layerline_plot
Tcl_Obj * layerline_plot(Bmicrograph *mg, Bimage *p, int objc, Tcl_Obj *CONST objv[])
Definition: tcltk_bhelix.cpp:517
TWOPI
#define TWOPI
Definition: utilities.h:72