Bsoft  2.1.0
Bernard's software package
Bimage.h
Go to the documentation of this file.
1 
9 //#include <time.h>
10 
11 #include "json.h"
12 #include "string_util.h"
13 #include "Bstring.h"
14 #include "Complex.h"
15 #include "fft.h"
16 #include "FSI_Kernel.h"
17 #include "Matrix.h"
18 #include "Vector3.h"
19 #include "View.h"
20 #include "Color.h"
21 #include "UnitCell.h"
22 #include "symmetry.h"
23 #include "ps_plot.h"
24 #include "Bsuperpixel.h"
25 
26 
27 #include <fstream>
28 #include <ctime>
29 
30 #define NPOLANG 720
31 
32 #ifndef _fouriertype_
33 
41  NoTransform = 0, // No transform
42  Standard = 1, // Standard transform: origin = (0,0,0)
43  Centered = 2, // Centered transform: origin = (nx/2,ny/2,nz/2)
44  Hermitian = 3, // Hermitian half: origin = (0,0,0)
45  CentHerm = 4 // Centered hermitian: origin = (0,ny/2,nz/2)
46 } ;
47 #define _fouriertype_
48 #endif
49 
50 #ifndef _Bimage_
51 
59  TSimple = 0, // Single value data type
60  TComplex = 1, // 2-value complex type
61  TVector3 = 3, // 3-value vector type
62  TView = 4, // 4-value view type
63  TRGB = 10, // Red-green-blue interleaved
64  TRGBA = 11, // Red-green-blue-alpha interleaved
65  TCMYK = 12, // Cyan-magenta-yellow-black interleaved
66  TMulti = 99 // Arbitrary number of channels
67 } ;
68 
69 union TypePointer {
70  unsigned char* uc;
71  signed char* sc;
72  unsigned short* us;
73  short* ss;
74  unsigned int* ui;
75  int* si;
76  unsigned long* ul;
77  long* sl;
78  float* f;
79  double* d;
80 } ;
81 
82 
89 class Bsub_image {
90 private:
91  double min, max; // Image extremes
92  double avg, std; // Average and standard deviation
93  double bkg; // Image background
94  double ux, uy, uz; // Sampling (in Angstrom/pixel)
95  double ox, oy, oz; // Origin (position of object origin in voxel coordinates)
96  double vx, vy, vz; // View orientation unit vector
97  double angle; // Rotation around view vector in radians
98  double mag; // Magnification
99  double fom; // Figure-of-merit associated with the image
100  long sel; // Selection
101  void check_sampling() {
102  if ( !isfinite(ux) ) ux = 1;
103  if ( !isfinite(uy) ) uy = 1;
104  if ( !isfinite(uz) ) uz = 1;
105  if ( ux <= 1e-10 ) ux = 1;
106  if ( uy <= 1e-10 ) uy = 1;
107  if ( uz <= 1e-10 ) uz = 1;
108  }
109  void check_origin() {
110  if ( !isfinite(ox) ) ox = 0;
111  if ( !isfinite(oy) ) oy = 0;
112  if ( !isfinite(oz) ) oz = 0;
113  }
114 public:
115  Bsub_image();
116 // ~Bsub_image();
117  double minimum() { return min; }
118  double maximum() { return max; }
119  double average() { return avg; }
120  double standard_deviation() { return std; }
121  void minimum(double d) { min = d; }
122  void maximum(double d) { max = d; }
123  void average(double d) { avg = d; }
124  void standard_deviation(double d) { std = d; }
125  double background() { return bkg; }
126  void background(double d) { bkg = d; }
127  void sampling(double x, double y, double z) { ux=x; uy=y; uz=z; check_sampling(); }
128  void sampling(Vector3<double> vec) { ux=vec[0]; uy=vec[1]; uz=vec[2]; check_sampling(); }
129  void sampling(vector<double> vec) {
130  ux=uy=uz=vec[0];
131  if ( vec.size() > 1 ) uy=vec[1];
132  if ( vec.size() > 2 ) uz=vec[2];
133  check_sampling();
134  }
135  Vector3<double> sampling() { return Vector3<double>(ux, uy, uz); }
136  void origin(double x, double y, double z) { ox=x; oy=y; oz=z; check_origin(); }
137  void origin(Vector3<double> vec) { ox=vec[0]; oy=vec[1]; oz=vec[2]; check_origin(); }
138  void origin(vector<double> vec) {
139  ox=oy=oz=vec[0];
140  if ( vec.size() > 1 ) oy=vec[1];
141  if ( vec.size() > 2 ) oz=vec[2];
142  check_origin();
143  }
144  Vector3<double> origin() { return Vector3<double>(ox, oy, oz); }
145  Vector3<double> real_coordinates(long ix, long iy, long iz) {
146  return Vector3<double>(ux*(ix - ox), uy*(iy - oy), uz*(iz - oz));
147  }
149  return real_coordinates(ic[0], ic[1], ic[2]);
150  }
151  Vector3<long> image_coordinates(double xx, double yy, double zz) {
152  return Vector3<long>(xx/ux + ox, yy/uy + oy, zz/uz + oz);
153  }
155  return real_coordinates(rc[0], rc[1], rc[2]);
156  }
157  void view(double x, double y, double z, double a) { vx=x; vy=y; vz=z; angle=a; }
158  void view(View vw) { vx=vw[0]; vy=vw[1]; vz=vw[2]; angle=vw.angle(); }
159  void view(vector<double> vw) { vx=vw[0]; vy=vw[1]; vz=vw[2]; angle=vw[3]; }
160  View view() { return View(vx, vy, vz, angle); }
161  void view_angle(double d) { angle = d; }
162  double view_angle() { return angle; }
163  double magnification() { return mag; }
164  void magnification(double d) { mag = d; }
165  double FOM() { return fom; }
166  void FOM(double d) { fom = d; }
167  long select() { return sel; }
168  void select(long i) { sel = i; }
169 } ;
170 
177 class Bimage {
178 public:
179  Bimage* next; // Pointer for linked lists
180 private:
181  Bstring id; // Internal identifier
182  long c; // Number of channels
183  long x, y, z; // Dimensions, xyz
184  long n; // Number of images
185  long px, py, pz; // Page dimensions
186  long sn, sz; // Sub-image number and slice for display
187  long offset; // Data offset
188  long datasize; // Number of data elements c*x*y*z*n
189  DataType datatype; // Base data type
190  double dtmin; // Data type minimum
191  double dtmax; // Data type maximum
192  CompoundType compoundtype; // Compound data type
193  FourierType fouriertype; // Transform type
194  double min, max; // Limits
195  double avg, std; // Average and standard deviation
196  double smin, smax; // Limits for display
197  double ss; // Display scale
198  UnitCell ucell; // Unit cell dimensions (angstrom) and angles (radian)
199  TypePointer d; // Unioned data pointer
200  JSvalue metadata; // Miscelaneous parameters/Metadata
201 public:
202  Bsub_image* image; // Sub-images
203 private:
204  void initialize();
205  void initialize(long nc, long nx,
206  long ny, long nz, long nn);
207  void initialize(CompoundType ctype, long nx,
208  long ny, long nz, long nn);
209  void internal_copy(const Bimage& p);
210 public:
211  // Construction and destruction
212  Bimage();
213  Bimage(const Bimage& p);
214  Bimage(Bstring& fn, int readdata, int img_select);
215  Bimage(DataType type, CompoundType ctype, long nx, long ny,
216  long nz, long nn);
217  Bimage(DataType type, CompoundType ctype, Vector3<long> size, long nn);
218  Bimage(DataType type, CompoundType ctype, vector<long> size, long nn);
219  Bimage(DataType type, long nc, long nx, long ny,
220  long nz, long nn);
221  Bimage(DataType type, long nc, Vector3<long> size, long nn);
222  Bimage(Matrix& mat, long scale);
223  ~Bimage();
224  void check();
225  bool check_if_same_size(Bimage* p);
227  void check_sampling();
228  void check_resolution(double& resolution);
229  bool compatible(Bimage* p);
230  // Informational strings
231  void identifier(Bstring s) { id = s; }
232  Bstring& identifier() { return id; }
233  // Metadata
234  JSvalue& meta_data() { return metadata; }
235  JSvalue& operator[](string tag) {
236  return metadata[tag];
237  }
238  vector<JSvalue*> query(string& path) {
239  return metadata(path);
240  }
241  long erase(string tag) { return metadata.erase(tag); }
242  void meta_data_update();
243  void update_from_meta_data();
244  void meta_data_retain_one_image(long img_num);
245  void file_name(string s) { metadata["filename"] = s; }
246  string& file_name() {
247  if ( !metadata.exists("filename") ) metadata["filename"] = "?";
248  return metadata["filename"].value();
249  }
250  void label(string s) { metadata["label"] = s; }
251  string& label() {
252  if ( !metadata.exists("label") ) metadata["label"] = "?";
253  return metadata["label"].value();
254  }
255  // Time parameter management: Seconds since 00:00:00 January 1, 1970, (UTC)
256  time_t get_time() {
257  if ( !metadata.exists("time") ) metadata["time"] = time(NULL);
258  return metadata["time"].integer();
259  }
261  time_t time_sec = get_time();
262  return localtime(&time_sec);
263  }
264  void set_time(time_t t) { metadata["time"] = t; }
265  void set_time(tm* t) { metadata["time"] = mktime(t); }
266  // Data allocation and assignment
267  long alloc_size() const {
268  return ( datatype == Bit )? (px/8)*y*z*n: c*x*y*z*n*data_type_size();
269  }
270  long data_size() { datasize = c*x*y*z*n; return datasize; }
271  unsigned char* data_alloc() { return data_alloc(alloc_size()); }
272  unsigned char* data_alloc_and_clear() { data_alloc(); clear(); return d.uc; }
273  unsigned char* data_alloc(long nbytes);
274  unsigned char* data_alloc_and_clear(long nbytes) { data_alloc(nbytes); clear(); return d.uc; }
275  unsigned char* data_alloc(DataType type, CompoundType ctype, long nx,
276  long ny, long nz, long nn);
277  unsigned char* data_alloc_and_clear(DataType type, CompoundType ctype, long nx,
278  long ny, long nz, long nn) {
279  data_alloc(type, ctype, nx, ny, nz, nn);
280  clear();
281  return d.uc;
282  }
283  unsigned char* data_assign(unsigned char* nudata);
284  unsigned char* data_pointer() { return d.uc; }
285  unsigned char* data_pointer(long offset) { return &d.uc[offset*data_type_size()]; }
286  void data_pointer(unsigned char* ptr) { d.uc = ptr; }
287  void data_delete();
288  long data_offset() { return offset; }
289  void data_offset(long doff) { offset = doff; }
290  long image_size() { return x*y*z; }
291  // Assignment
292  Bimage& operator=(const Bimage& p);
293  // Element manipulations
294  double operator[](long j) const;
295  double get(long nn, long xx, long yy, long zz, long cc=0);
296  double get(long nn, Vector3<double> vox, long cc=0);
297  vector<double> values(long i) {
298  long cc;
299  vector<double> val(c);
300  for ( i*=c, cc=0; cc<c; cc++, i++ ) val[cc] = (*this)[i];
301  return val;
302  }
303  void values(long i, vector<double> val) {
304  long cc;
305  for ( i*=c, cc=0; cc<c; cc++, i++ ) val[cc] = (*this)[i];
306  }
307  vector<double> values(long nn, Vector3<double> vox);
308  Complex<double> complex(long j);
309  Vector3<double> vector3(long j);
310  RGB<double> rgb(long j);
311  RGBA<double> rgba(long j);
312  CMYK<double> cmyk(long j);
313  TypePointer fill_value(double v);
314  void set(long j, double v);
315  void set(long j, Complex<double> cv);
316  void set(long j, RGB<double> color);
317  void set(long j, RGBA<double> color);
318  void set(long j, CMYK<double> color);
319  void set(long j, Vector3<double> vec);
320  void set(long j, View view);
321  void add(long j, double v) { set(j, (*this)[j] + v); }
322  void add(long j, Complex<double> cv) { set(j, complex(j) + cv); }
323  void add(double xx, double yy, double zz, long nn, double v);
324  void set_max(double xx, double yy, double zz, long nn, double v);
325  void multiply(long j, Complex<double> cv) { set(j, complex(j) * cv); }
326  double average2D(long cc, double xf, double yf,
327  double zf, long nn, double iscale);
328  double average(long cc, double xf, double yf,
329  double zf, long nn, double iscale);
330  double interpolate(long cc, double xx,
331  double yy=0, double zz=0, long nn=0, double fill=0) const;
332  double interpolate(double xx, double yy=0, double zz=0,
333  long nn=0, double fill=0) const {
334  return interpolate(0, xx, yy, zz, nn, fill);
335  }
336  double interpolate(long cc, Vector3<double> vec,
337  long nn=0, double fill=0) const {
338  return interpolate(cc, vec[0], vec[1], vec[2], nn, fill);
339  }
341  long nn=0, double fill=0) const {
342  return interpolate(0, vec[0], vec[1], vec[2], nn, fill);
343  }
344  double interpolate(vector<double> vec,
345  long nn=0, double fill=0) const {
346  return interpolate(0, vec[0], vec[1], vec[2], nn, fill);
347  }
348  double interpolate_wrap(long cc, double xx,
349  double yy=0, double zz=0, long nn=0) const;
350  double interpolate_wrap(double xx, double yy=0, double zz=0,
351  long nn=0) const {
352  return interpolate_wrap(0, xx, yy, zz, nn);
353  }
354  double interpolate_wrap(long cc,
355  Vector3<double> vec, long nn=0) const {
356  return interpolate_wrap(cc, vec[0], vec[1], vec[2], nn);
357  }
358  double interpolate_wrap(Vector3<double> vec, long nn=0) const {
359  return interpolate_wrap(0, vec[0], vec[1], vec[2], nn);
360  }
361  // Type management
362  DataType data_type() { return datatype; }
363  void data_type(DataType dt) { datatype = dt; dtmin = data_type_min(); dtmax = data_type_max(); }
364  CompoundType compound_type() { return compoundtype; }
365  void compound_type(CompoundType ct) { compoundtype = ct; }
366  long data_type_bits() const;
367  long data_type_size() const;
368  long compound_type_size() { return c; }
369  double data_type_min();
370  double data_type_max();
373  void fix_type();
374  void change_type(char letter);
375  void change_type(char* string);
376  void change_type(DataType nutype);
377  void split_channels();
378  void combine_channels(long nc);
379  // Fourier transform management
380  FourierType fourier_type() { return fouriertype; }
381  void fourier_type(FourierType tf) { fouriertype = tf; }
382  void zero_fourier_origin();
383  // Data parameters
384  long channels() { return c; }
385  void channels(long cc) { c = cc; }
386  Vector3<long> size() const { return Vector3<long>(x, y, z); }
387  void size(long nx, long ny, long nz) { x=nx; y=ny; z=nz; }
388  void size(Vector3<long> vec) { x=vec[0]; y=vec[1]; z=vec[2]; data_size(); }
389  void size(vector<long> vec) { x=vec[0]; y=vec[1]; z=vec[2]; data_size(); }
390  void sizeX(long nx) { x = nx; }
391  void sizeY(long ny) { y = ny; }
392  void sizeZ(long nz) { z = nz; }
393  long sizeX() const { return x; }
394  long sizeY() const { return y; }
395  long sizeZ() const { return z; }
396  long index(long nx, long ny) const {
397  return ny*x + nx;
398  }
399  long index(long nx, long ny, long nz) const {
400  return (nz*y + ny)*x + nx;
401  }
402  long index(long nx, long ny, long nz, long nn) const {
403  return ((nn*z + nz)*y + ny)*x + nx;
404  }
405  long index(long nc, long nx, long ny, long nz, long nn) const {
406  return (((nn*z + nz)*y + ny)*x + nx)*c + nc;
407  }
408  long index(Vector3<long> vox, long nn) const {
409  return ((nn*z + vox[2])*y + vox[1])*x + vox[0];
410  }
411  long index(vector<long> vox, long nn) const {
412  return ((nn*z + vox[2])*y + vox[1])*x + vox[0];
413  }
414  long index_wrap(long nx, long ny, long nz) const {
415  while ( nx < 0 ) nx += x;
416  while ( ny < 0 ) ny += y;
417  while ( nz < 0 ) nz += z;
418  while ( nx >= x ) nx -= x;
419  while ( ny >= y ) ny -= y;
420  while ( nz >= z ) nz -= z;
421  return (nz*y + ny)*x + nx;
422  }
423  long index_wrap(Vector3<long> coor) const {
424  return index_wrap(coor[0], coor[1], coor[2]);
425  }
426  long index_wrap(vector<long> coor) const {
427  return index_wrap(coor[0], coor[1], coor[2]);
428  }
429  void coordinates(long i, long &nx, long &ny, long &nz) {
430  nx = i%x;
431  i = (i - nx)/x;
432  ny = i%y;
433  i = (i - ny)/y;
434  nz = i%z;
435  }
436  void coordinates(long i, long &nx, long &ny, long &nz, long &nn) {
437  nx = i%x;
438  i = (i - nx)/x;
439  ny = i%y;
440  i = (i - ny)/y;
441  nz = i%z;
442  i = (i - nz)/z;
443  nn = i%n;
444  }
445  void coordinates(long i, long &nc, long &nx, long &ny, long &nz, long &nn) {
446  nc = i%c;
447  i = (i - nc)/c;
448  nx = i%x;
449  i = (i - nx)/x;
450  ny = i%y;
451  i = (i - ny)/y;
452  nz = i%z;
453  i = (i - nz)/z;
454  nn = i%n;
455  }
457  long nc, nx, ny, nz, nn;
458  coordinates(i, nc, nx, ny, nz, nn);
459  return Vector3<long>(nx,ny,nz);
460  }
462  if ( loc[0] >= 0 && loc[0] < x && loc[1] >= 0 && loc[1] < y &&
463  loc[2] >= 0 && loc[2] < z ) return 1;
464  return 0;
465  }
466  bool within_boundaries(long xx, long yy, long zz) {
467  if ( xx >= 0 && xx < x && yy >= 0 && yy < y && zz >= 0 && zz < z ) return 1;
468  return 0;
469  }
470  Vector3<long> kernel_low(long i, long k=1) {
471  Vector3<long> lo(coordinates(i));
472  for ( long j=0; j<3; j++ )
473  lo[j] = ( lo[j] < k )? 0: lo[j] -= k;
474  return lo;
475  }
476  Vector3<long> kernel_high(long i, long k=1) {
477  Vector3<long> hi(coordinates(i)+k);
478  return hi.min(size()-1);
479  }
481  Vector3<long> lo(coordinates(i));
482  for ( long j=0; j<3; j++ )
483  lo[j] = ( lo[j] < k[j] )? 0: lo[j] -= k[j];
484  return lo;
485  }
487  Vector3<long> hi(coordinates(i)+k);
488  return hi.min(size()-1);
489  }
490  long kernel_max(long idx, long ksize);
491  long kernel_max_neigbor(long idx, long ksize);
492  long kernel_max_wrap(long idx, long ksize);
493  Vector3<long> page_size() { return Vector3<long>(px, py, pz); }
494  void page_size(long nx, long ny, long nz) {
495  px=nx; py=ny; pz=nz;
496  if ( datatype==Bit ) px = 8*((x-1)/8 + 1);
497  }
498  void page_size(Vector3<long> vec) { page_size(vec[0], vec[1], vec[2]); }
499  void page_size(vector<long> vec) { page_size(vec[0], vec[1], vec[2]); }
502  return Vector3<double>(u[0]*x, u[1]*y, u[2]*z);
503  }
504  long images() { return n; }
505  void images(long nn);
506  double voxel_size() {
508  double vs(1);
509  if ( x ) vs *= u[0];
510  if ( y ) vs *= u[1];
511  if ( z ) vs *= u[2];
512  return vs;
513  }
514  void sampling(long nn, Vector3<double> u) {
515  image[nn].sampling(u);
516  }
517  void sampling(long nn, double ux, double uy, double uz) {
518  image[nn].sampling(ux, uy, uz);
519  }
521  for ( long nn=0; nn<n; ++nn ) image[nn].sampling(u);
522  }
523  void sampling(double ux, double uy, double uz) {
524  for ( long nn=0; nn<n; ++nn ) image[nn].sampling(ux, uy, uz);
525  }
527  return image[nn].sampling();
528  }
529  vector<Vector3<double>> sampling() {
530  vector<Vector3<double>> sam;
531  for ( long nn=0; nn<n; ++nn ) sam.push_back(sampling(nn));
532  return sam;
533  }
534  void sampling(vector<Vector3<double>> sam) {
535  if ( n != sam.size() )
536  cerr << "Error in Bimage::sampling: number of images are not the same! ("
537  << n << " != " << sam.size() << ")" << endl;
538  for ( long nn=0; nn<n && nn<sam.size(); ++nn ) image[nn].sampling(sam[nn]);
539  }
540  // Statistics
541  double minimum() { return min; }
542  double maximum() { return max; }
543  double average() { return avg; }
544  double standard_deviation() { return std; }
545  void minimum(double d) { min = d; }
546  void maximum(double d) { max = d; }
547  void average(double d) { avg = d; }
548  void standard_deviation(double d) { std = d; }
549  double background(long nn) {
550  return image[nn].background();
551  }
552  void background(long nn, double bkg) {
553  image[nn].background(bkg);
554  }
555  void background(double bkg) {
556  for ( long nn=0; nn<n; ++nn ) image[nn].background(bkg);
557  }
558  // Variables for image display
559  long show_image() { return sn; }
560  void show_image(long nn) { sn = nn; }
561  long show_slice() { return sz; }
562  void show_slice(long nz) { sz = nz; }
563  double show_scale() { return ss; }
564  void show_scale(double scale) { ss = scale; }
565  double show_minimum() { return smin; }
566  double show_maximum() { return smax; }
567  void show_minimum(double v) { smin = v; }
568  void show_maximum(double v) { smax = v; }
569  // Geometry
570  void origin(double ox, double oy, double oz) {
571  for ( long nn=0; nn<n; ++nn )
572  image[nn].origin(ox, oy, oz);
573  }
574  void origin(vector<double> vec) {
575  for ( long nn=0; nn<n; ++nn )
576  image[nn].origin(vec);
577  }
579  for ( long nn=0; nn<n; ++nn )
580  image[nn].origin(vec);
581  }
582  void origin(long nn, Vector3<double> vec) {
583  image[nn].origin(vec);
584  }
585  void origin(long nn, vector<double> ori) {
586  while ( ori.size() < 3 ) ori.push_back(0);
587  image[nn].origin(ori);
588  }
589  void origin(long nn, double ox, double oy, double oz) {
590  image[nn].origin(ox, oy, oz);
591  }
593  Vector3<double> ori(double(x/2), double(y/2), double(z/2));
594  return ori;
595  }
596  void view(double vx, double vy, double vz, double va) { for ( long j=0; j<n; j++ ) image[j].view(vx, vy, vz, va); }
597  void view(View vw) { for ( long j=0; j<n; j++ ) image[j].view(vw); }
598  long space_group() {
599  if ( !metadata.exists("spacegroup") ) metadata["spacegroup"] = 1;
600  return metadata["spacegroup"].integer();
601  }
602  void space_group(unsigned int grp) { metadata["spacegroup"] = grp; }
603  string& symmetry() {
604  if ( !metadata.exists("pointgroup") ) metadata["pointgroup"] = "C1";
605  return metadata["pointgroup"].value();
606  }
607  void symmetry(string grp) { metadata["pointgroup"] = grp; }
608  void unit_cell(UnitCell uc) {
610  ucell = uc;
611  if ( !isfinite(ucell.a()) || ucell.a() < u[0]*x ) ucell.a(u[0]*x);
612  if ( !isfinite(ucell.b()) || ucell.b() < u[1]*y ) ucell.b(u[1]*y);
613  if ( !isfinite(ucell.c()) || ucell.c() < u[2]*z ) ucell.c(u[2]*z);
614  }
615  UnitCell unit_cell() { return ucell; }
616  double maximum_included_radius();
617  // Data organization changes
618  int slices_to_images();
619  int images_to_slices();
620  long delete_images(Bstring list, int retain=0);
621  long select_images(Bstring list);
622  // Data I/O
623  unsigned char* read_data(ifstream* fimg, int img_select, int sb, int vax, long pad);
624  int write(Bstring& fn);
625  int unpack_transform(unsigned char* data, FourierType tf);
626  int unpack_transform(int img_select, unsigned char* data, FourierType tf);
627  int pack_transform(unsigned char* data, FourierType tf);
628  int pack_transform(int img_select, unsigned char* data, FourierType tf);
629  // Data parameter information
630  long statistics();
631  long statistics(long img_num);
632  long statistics(Bimage* pmask, double& regavg, double& regstd);
633  long stats_within_radii(long nn, Vector3<double> loc,
634  double rad_min, double rad_max, double& vavg, double& vstd);
635  long stats_in_shape(long nn, int type, Vector3<long> start,
636  Vector3<long> end, double& vavg, double& vstd);
637  long stats_in_poly(long nn, int nvert, Vector3<double>* poly,
638  double& vavg, double& vstd);
639  long stats_in_mask(long nn, Bimage* pmask);
640 private:
641  int kernel_sums(long n, long i, long ik, long nk);
642  int line_sums(long n, long ik, long nk);
643 public:
644  int variance(long kernel_size, int flag=0);
645  int variance(Vector3<long> kernel_size, int flag=0);
646 private:
647  int kernel_sums(long nn, long i, Bimage* pweight);
648 public:
649  int variance(Bimage* pweight);
650  int information();
651  int subimage_information();
652  int moments(long max_order);
653  int moments(long max_order, long nn);
654  void get(Bstring tag);
655  // New image generation and obtaining data from other images
656  Bimage* copy();
657  Bimage* copy(long nu_nimg);
658  Bimage* copy_header() { return copy_header(n); }
659  Bimage* copy_header(long nu_nimg);
660  Bimage* extract(long nn);
661  Bimage* extract(long n1, long n2);
662  Bimage* extract(long nn, Vector3<long> coords, Vector3<long> size,
663  int fill_type=0, double fill=0);
666  Matrix3 mat(1);
667  return extract(nn, loc, size, origin, mat);
668  }
673  return extract(nn, loc, size, origin, view.matrix());
674  }
678  Vector3<double> v;
679  return extract_wrap(nn, v, size, v, mat);
680  }
681  Bimage* extract_shell(long nn, double minrad, double maxrad);
682  vector<Vector3<long>> tile_coordinates(Vector3<long>& start,
683  Vector3<long>& region, Vector3<long>& tile_size,
684  Vector3<long>& step_size, int exceed);
685  Bimage* extract_tiles(long nn, vector<Vector3<long>>& coords, Vector3<long> tile_size);
686  Bimage* extract_tiles(long nn, Vector3<long> start,
687  Vector3<long> region, Vector3<long> tile_size,
688  Vector3<long> step_size, int exceed);
689  Bimage* extract_tiles(long nn, Vector3<long> tile_size, double fraction=0.2);
690  Bimage* extract_line(long nn, Vector3<double> start, Vector3<double> end, long width);
691  Bimage* extract_tetrahedron(Vector3<double>* tet, int fill_type=0, double fill=0);
692  Bimage* orthogonal_slices(long nn, Vector3<long> voxel,
693  Vector3<long> ext_size);
694  int extract_show_chunk(Bimage* pshow, int aflag, long i, long len);
695  Bimage* extract_show(int aflag);
697  Vector3<long> ext_size, double scale);
698  Bimage* extract_slice(long nz);
699  Bimage* extract_filament(long img_num, double width,
700  int axis, long nspline, Vector3<double>* spline);
701  int replace(Bimage* img);
702  int replace(long nn, Bimage* img, long nr=0);
703  int replace(long nn, Bimage* img, long nr, double fill);
704  // Whole image manipulations
705  void clear() { data_size(); for ( long j=0; j<datasize; j++ ) set(j, 0); }
706  void fill(double v) {
707  data_size(); for ( long j=0; j<datasize; j++ ) set(j, v);
708  }
709  // Density methods
710  double density(long nn, Vector3<double> coord, double radius, double& sigma);
711  double density(long nn, Vector3<double> coord, double radius) {
712  double sigma(0);
713  return density(nn, coord, radius, sigma);
714  }
715  double relative_density(Bimage* pmask);
716  void invert();
717  void reslice(const char* order) { Bstring s(order); reslice(s); s=0; }
718  void reslice(Bstring order);
719  void add(double v);
720  void multiply(double v);
721  void multiply(long nn, double v);
722  void power(double v);
723  void sum_images();
724  void average_images() { double w(1.0/n); sum_images(); multiply(w); }
725  Bimage* average_images(bool sd);
726  void add(Bimage* p);
727  void add(long nn, Bimage* p);
728  void subtract(Bimage* p);
729  void add(Bimage* p, double scale, double shift);
730  void add(long nn, Bimage* p, double scale, double shift);
731  void multiply(Bimage* p, double scale, double shift=0);
732  void multiply(long nn, Bimage* p);
733  void multiply(Bimage* p);
734  void divide(Bimage* p, double scale=1, double shift=0);
735  void divide_one(Bimage* p, double scale=1, double shift=0);
736  void inverse(double minval=0);
737  void largest(Bimage* p);
738  void smallest(Bimage* p);
739  Bimage* operator+(Bimage& p);
740  Bplot* plot();
741  void sum(long m, Bimage** p);
742  void catenate(long m, Bimage** p);
743  Bimage* blend(Bimage* p, long number);
744  int place(long nn, Bimage* p, Vector3<double> loc,
745  double radius=0, double scale=1, double shift=0, int operation=0);
746  int place_with_addition(Bimage* p, long nn);
747  int place_with_overlap(Bimage* p, long nn);
748  int place_central_part(Bimage* p, long nn);
749  int assemble_tiles(Bimage* pt, int flag=0);
750  double linear_fit(Bimage* p, Bimage* pmask, double max_exclude);
751  int histomatch(Bimage* p, long bins);
752  // Filter methods
753  int kernel_gaussian(double sigma, double max);
754  int kernel_laplacian_of_gaussian(double sigma, double max);
755 private:
756  int average_line_sum(long n, long i, long ik, long nk);
757  int average_line_sums(long n, long ik, long nk);
758 public:
759  int filter_average(long kernel_size);
761 private:
762  int gaussian_line_sum(long nn, long i, long ik, Bimage* pk);
763  int gaussian_line_sums(long nn, long ik, Bimage* pk);
764 public:
765  int filter_gaussian(long kernel_size, double sigma);
766  int filter_sinc();
767  int convolve_chunk(Bimage* pkernel, float* nudata, long i, long len);
768  int convolve(Bimage* pkernel);
769  int filter_ortho(int type);
770  int filter_dog(double sigma1, double sigma2);
771  int filter_bilateral_chunk(Bimage* pkernel, double sigma2,
772  int kernel_type, float* nudata, long i, long len, int first);
773  int filter_bilateral(double sigma1, double sigma2,
774  int kernel_type, long kernel_radius);
775  int filter_rolling_ball(long radius, double scale);
776  int filter_rank_chunk(long kernel_size, double rank, float* nudata, long i, long len);
777  int filter_rank(long kernel_size, double rank);
778  Bimage* filter_peak(long kernel_size);
780 private:
781  Bimage* structure_tensor_2D(long nn=0);
782  Bimage* structure_tensor(long zs, long zw);
783  int diffusion_tensor_2D(double lambda, double C, double alpha);
784  int diffusion_tensor(double lambda, double C, double alpha);
785  int diffuse_2D(Bimage* pdn, Bimage* pd, double ht, long nn=0);
786  int diffuse(Bimage* pdn, Bimage* pd, double ht, long zs);
787  int nad_chunk_2D(Bimage* pdn, double lambda, double C,
788  double alpha, double ht, long nn=0);
789  int nad_chunk(Bimage* pdn, double lambda, double C,
790  double alpha, double ht, long zs, long zw);
791 public:
792  Bimage* nad_2D(double ht, double lambda, double C, double alpha);
793  Bimage* nad(double ht, long zw, double lambda, double C, double alpha);
794  // Complex type methods
795  void simple_to_complex();
796  void complex_to_real();
797  void complex_to_imaginary();
798  void complex_to_intensities();
799  void complex_to_amplitudes();
801  void complex_to_phases();
802  void complex_conjugate();
803  double complex_power();
804  double complex_normalize();
806  int phase_shift(long nn, Vector3<double> shift);
807  int phase_shift_to_origin();
808  int phase_shift_to_center();
809  int complex_multiply(Bimage* p);
810  int complex_product(Bimage* p);
813  int complex_apply_mask(Bimage* pmask);
815  int complex_apply_dual_mask(Bimage* pmask);
816  int complex_bandpass(double hires, double lores);
820  int combined_complex_product(Bimage* pmask);
821  int combined_complex_product(double hires, double lores);
822  int combined_complex_product(double hires, double lores, Bimage* pmask);
823  int combined_complex_product_implicit_mask(double hires, double lores);
824  double merge_amplitudes_and_phases(Bimage* pamp);
825  double merge_amplitudes_and_phases(Bimage* pref, double res_hi, double res_lo);
826  Bimage* intensities_phase_colored(double scale);
827  int phase_colour_wheel();
828  // FFT methods
829  fft_plan fft_setup(fft_direction dir, int opt=0);
830  int fft() { return fft(FFTW_FORWARD); }
831  int fft_back() {
832  fft(FFTW_BACKWARD);
834  complex_to_real();
835  return 0;
836  }
837  int fft(fft_direction dir);
838  int fft_back(fft_plan plan, bool norm_flag=1) {
839  fft(plan, norm_flag);
841  complex_to_real();
842  return 0;
843  }
844  int fft(fft_direction dir, bool norm_flag);
845  int fft(fft_plan plan, bool norm_flag=1);
847  // Power spectrum methods
848  int power_spectrum(int flags=0);
849  Bimage* powerspectrum_tiled(long img_num, Vector3<long> tile_size, int flags=0);
850  Bimage* powerspectrum_tilt_axis(long img_num, Vector3<long> tile_size,
851  double tilt_axis, double tilt_offset, int flags=0);
852  Bimage* defocus_scale(long nn, double df, double df2, double iCL2, int fill_type);
853  Bimage* powerspectrum_tilted(long img_num, Vector3<long> tile_size,
854  double tilt_axis, double tilt_angle, double defocus, double iCL2, int flags=0);
856  double tilt_axis, double tilt_angle, double tilt_offset,
857  double defocus, double iCL2, int flags=0);
858  // Frequency space interpolation and reconstruction
859  long fspace_maximum_radius(double resolution, double sampling_ratio=1);
860  int fspace_background();
863  double part_weight, int interp_type);
864  int fspace_pack_2D(Bimage* p, Matrix3 mat, double hi_res,
865  double lo_res, Vector3<double> scale, double part_weight=1, int interp_type=0);
866  int fspace_pack_2D(Bimage* p, View asu_view, Bsymmetry* sym, double hi_res,
867  double lo_res, Vector3<double> scale, double part_weight=1, int interp_type=0);
869  long ft_size, double scale, double hi_res, double lo_res,
870  Matrix3 matr, Matrix3 mat);
871  int fspace_pack_3D(Bimage* p, double hi_res=0, double threshold=0);
874  int fspace_reconstruction_stats(double resolution, double sampling_ratio=1);
877  int fspace_translate(long nn, Vector3<double> shift);
878  int fspace_resize(double scale, double res_hi, double res_lo);
879  Bimage* fspace_resize(Bimage* pref);
880  // Amplitude weighting methods
881  int fspace_amp_one();
882  int fspace_amp_threshold(double threshold);
883  int fspace_sqrt_amp();
884  int fspace_square_amp();
885  int fspace_bandpass(double res_hi, double res_lo=0, double width=0);
886  int fspace_bandpass(double res_hi, double res_lo, double width, fft_plan planf, fft_plan planb);
887  Bimage* fspace_radial_power(double resolution, double sampling_ratio=1);
888  double* fspace_radial(long nn, long maxrad, int flag=0);
889  int fspace_weigh(long maxrad, double* curve, int flag=0);
890  int fspace_weigh(vector<double>& curve, int flag=0);
891  int fspace_scale(long maxrad, double* scale, Bimage* pmask=NULL);
892  int fspace_scale(long nn, long maxrad, double* scale, Bimage* pmask=NULL);
893  int fspace_scale(vector<double>& scale, Bimage* pmask=NULL);
894  int fspace_scale(long nn, vector<double>& scale, Bimage* pmask=NULL);
895  double fspace_fit_B_factor(double res_hi=0);
896  int fspace_weigh_ramp(double resolution, fft_plan planf, fft_plan planb);
897  int fspace_weigh_ramp(double resolution, double axis, fft_plan planf, fft_plan planb);
898  int fspace_weigh_B_factor(double B, double resolution=0);
899  int fspace_weigh_C_curve(double resolution=0);
900  int fspace_weigh_LoG(double resolution, double sigma);
901  int fspace_weigh_RPS_curve(Bplot* plot, double resolution=0);
902  int fspace_weigh_FSC_curve(Bplot* plot, double resolution=0);
903  int fspace_weigh(Bimage* pref, Bimage* pmask, double resolution=0);
904  int fspace_weigh_dose(long nn, double dose_per_frame, vector<double> critdose);
905  int fspace_weigh_dose(double dose_per_frame, int flag=0);
906  int fspace_weigh_accumulated_dose(vector<double> dose);
907  int fspace_normalize();
908  int fspace_normalize_radial(Bimage* pmask, double resolution=0, int flag=0);
909  int fspace_positive();
910  // Friedel symmetry
911  double friedel_check();
912  int friedel_apply();
913  // Projection methods
914  Bimage* project(char axis, int flags=1);
916  double radial_cutoff, int norm_flag=1);
917  Bimage* project(View* view, int norm_flag=1);
918  Bimage* central_section(Matrix3 mat, double resolution, FSI_Kernel* kernel);
919  Bimage* project(View* view, double resolution, FSI_Kernel* kernel);
920  int back_project(Bimage* p, double resolution, double axis,
922  // Resolution measures
925  Bplot* fsc_dpr(double hi_res, double sampling_ratio=1, int flag=0);
926  Bplot* fsc(double hi_res, double sampling_ratio=1);
927  Bplot* fsc(Bimage* p, double hi_res, double sampling_ratio=1);
928  Bimage* fsc_shell(Bimage* p, double hi_res, double* cutoff,
929  int thickness, int step, int minrad, int maxrad,
930  int pad=1, int smooth=0, double fill=0);
931 private:
932  double* fsc_local_voxel(Bimage* p, double resolution, int size,
933  int pad, int taper, double* cutoff, fft_plan plan, long i);
934  double local_filter_voxel(Bimage* resmap, long size,
935  fft_plan planf, fft_plan planb, long i);
936 public:
937  Bimage* fsc_local(Bimage* p, Bimage* pmask, double resolution, double* cutoff,
938  int mask_level, int size, int pad, Vector3<long> vedge,
939  int step=1, int taper=1, double fill=0);
940  Bimage* local_filter(Bimage* pmask, int mask_level, Bimage* resmap,
941  int size, Vector3<long> vedge);
942  // Phase difference
943  Bimage* phase_difference(Bimage* p, int type=0, double res_hi=0, double res_lo=0);
944  double average_phase_difference(Bimage* p, double res_hi, double res_lo, int weighting=1);
945  int phase_flip(Bimage* pd);
946  // Correlation methods
947  double correlate(Bimage* p);
948  double correlate(Bimage* p, double rmin, double rmax, Bimage* pmask=NULL, int flag=0);
949  double rotate_correlate(Vector3<double> axis, double angle);
950  double R_factor(Bimage* p);
951  int auto_correlate(double hires, double lores);
952  Bimage* cross_correlate(Bimage* p, double hires, double lores,
954  Bimage* cross_correlate(Bimage* p, Bimage* pmask=NULL) {
955  return cross_correlate(p, 0, 0, pmask);
956  }
957  Bimage* cross_correlate(Bimage* p, double hires, double lores, Bimage* pmask=NULL);
958 /* Bimage* cross_correlate(Bimage* p, double hires, double lores,
959  fft_plan planf, fft_plan planb) {
960  return cross_correlate(p, hires, lores, NULL, planf, planb);
961  }*/
963  Vector3<double> find_shift_in_transform(double shift_limit);
964  Bimage* cross_correlate_fspace(Bimage* p, double hires, double lores, double shift_limit);
965  Bimage* cross_correlate(Bimage* p, double hires, double lores,
966  Bimage* pmask, fft_plan planf, fft_plan planb);
967  Bimage* cross_correlate_two_way(Bimage* p, double hires,
968  double lores, fft_plan planf, fft_plan planb);
971  double hires, double lores, double search_radius, Bimage* pmask,
972  double& cc, fft_plan planf, fft_plan planb);
974  double angle, double res_hi, double res_lo, double shift_limit,
976  int find_shift(Bimage* pref, Bimage* pmask, double hires,
977  double lores, double radius, double sigma, int refine_flag);
978  Vector3<double> find_shift(Bimage* pref, Bimage* pmask, double hires,
979  double lores, double radius, double sigma, int refine_flag, double& cc);
980  Vector3<double> find_shift(Bimage* pref, double hires,
981  double lores, double radius, double sigma, int refine_flag,
983  Vector3<double> find_shift(Bimage* pref, Bimage* pmask, double hires,
984  double lores, double radius, double sigma, int refine_flag,
985  fft_plan planf, fft_plan planb, double& cc);
986  Vector3<double> find_shift(long nn, Bimage* pref, Bimage* pmask,
987  double hi_res, double lo_res, double shift_limit,
989  Bimage* find_template(Bimage* ptemp, Bimage* pmask,
990  double hires, double lores, int bin, fft_plan planf, fft_plan planb);
991  int find_center(Bimage* pmask, double hires,
992  double lores, double radius, double sigma, int refine_flag);
994  double hires, double lores, double radius, double sigma,
995  int refine_flag, fft_plan planf, fft_plan planb, double& cc);
996  int find_peak(double radius=1e30, double sigma=0);
998  int refine_peak_new();
999  int refine_peak();
1000  Bimage* find_peaks(long kernelsize);
1001  Vector3<double>* find_peaks(double excl_dist, long& ncoor, double& threshold_min,
1002  double& threshold_max, double pix_min=2, double pix_max=10);
1003  double ccmap_confidence(long nn);
1004  double peak_sigma(long nn, Vector3<long> coor, long kernel_size);
1005  double search_views(Bimage* ptemp, View* view,
1006  double hires, double lores, double search_radius,
1007  Bimage* pmask, View& currview, Vector3<double>& currshift);
1008  double search_volume_view(Bimage* ptemp, View view,
1009  double hires, double lores, Bimage* pmask,
1010  double threshold, Bimage* pfit);
1011  Bimage* search_volume(Bimage* ptemp, View* view, double alpha,
1012  double alpha_step, double hires, double lores,
1013  Bimage* pmask, double threshold);
1014  // Alignment methods
1015  Vector3<double> find_shift_in_transform(long nn, Bimage* pref, double shift_limit);
1016  Bimage* align_progressive_fast(long nref, double shift_limit);
1017  Bimage* align_progressive(long nref, Bimage* pmask,
1018  double hi_res, double lo_res, double shift_limit,
1020  JSvalue align(long ref_num, Bimage* pmask,
1021  double hi_res, double lo_res, double shift_limit,
1022  double edge_width, double gauss_width, Vector3<long> bin);
1023  JSvalue align_fast(long ref_num, Bimage* pmask,
1024  double hi_res, double lo_res, double shift_limit,
1025  double edge_width, double gauss_width);
1026  double correlate_annuli(Bimage* polref,
1027  int ann_min, int ann_max, double ang_min, double ang_max,
1028  fft_plan planf, fft_plan planb, double& cc_max);
1029  vector<double> pps_angular_correlation(Bimage* pref,
1030  double res_hi, double res_lo, long nang, fft_plan planf);
1031  double align2D_pps(Bimage* pref,
1032  double res_hi, double res_lo, double shift_limit, double angle_limit,
1034  double align2D(Bimage* pref, double res_polar,
1035  int ann_min, int ann_max, Bimage* prs_mask, double shift_limit, double angle_limit,
1036  fft_plan planf_1D, fft_plan planb_1D, fft_plan planf_2D, fft_plan planb_2D);
1037  int align2D(Bimage* pref, int ann_min, int ann_max,
1038  double res_lo, double res_hi, double shift_limit, double angle_limit);
1039  // Color type methods
1040  void simple_to_rgb();
1041  void simple_to_rgba();
1042  void color_to_simple();
1043  void rgb_to_rgba();
1044  void rgba_to_rgb();
1045  void rgb_to_cmyk();
1046  void cmyk_to_rgb();
1047  int one_color(int color, double cmin, double cmax, int flag=0);
1048  int color_red(double cmin, double cmax, int flag=0);
1049  int color_green(double cmin, double cmax, int flag=0);
1050  int color_blue(double cmin, double cmax, int flag=0);
1051  int pure_color();
1052  int color_combine(Bimage* p);
1053  Bimage* color_spectrum(double cmin, double cmax);
1054  Bimage* red_white_blue(double red_min, double white_min,
1055  double white_max, double blue_max);
1056  // Rescaling methods
1057  int rescale(double scale, double shift);
1058  int rescale(long nn, double scale, double shift);
1059  int rescale_to_min_max(double numin, double numax);
1060  int rescale_to_min_max(long nn, double numin, double numax);
1061  int rescale_to_avg_std(double nuavg, double nustd);
1062  int rescale_to_avg_std(long nn, double nuavg, double nustd);
1063  int rescale_to_avg_std(double nuavg, double nustd, Bimage* pmask);
1064  int truncate(double minim, double maxim, double setmin, double setmax);
1065  int truncate_to_min_max(double minim, double maxim);
1066  int truncate_to_avg(double minim, double maxim);
1067  int truncate_to_background(double minim, double maxim);
1068  int limit_levels(int nlevels);
1069  int normalize(long imgnum, double average, double stdev, int norm_type, long bins);
1070  int normalize(double average, double stdev, int norm_type);
1071  int normalize_local(long kernel_size);
1073  void square();
1074  void square_root();
1075  void logarithm();
1076  int gradient_correction();
1077  int quadric_correct(vector<double> param);
1078  vector<double> quadric_fit();
1079  Bimage* thickness(double reference, double lambda);
1080  // Background methods
1081  int calculate_background(long nn, int flag);
1082  int calculate_background(int flag=0);
1083  int calculate_background(Bimage* pmask, long nn, int flag=0);
1084  int calculate_background(Bimage* pmask, int flag=0);
1085  int correct_background(long nn, int flag);
1086  int correct_background(int flag=0);
1087  int correct_background(Bimage* pmask, int flag=0);
1088  int subtract_background();
1089  int shift_background(double bkg);
1090  // Histogram methods
1091  vector<long> histogram(long bins, double& scale, double& offset);
1092  Bplot* histogram(long bins);
1093  Bplot* histogram_counts(int flags=0);
1094  Bplot* percentiles();
1095  int histogram_thresholds(double& tmin, double& tmax);
1096  double otsu_threshold(long bins);
1097  vector<double> histogram_gauss_fit(long bins, long ngauss=1);
1098  Bplot* histogram_gauss_plot(long bins, long ngauss=1);
1099  Bplot* histogram_poisson_fit(long bins, int flag=0);
1100  // Resizing methods
1101  int resize(Vector3<long> nusize, Vector3<long> translate,
1102  int fill_type=0, double fill=0);
1103  Bimage* resize_copy(Vector3<long> nusize, Vector3<long> translate,
1104  int fill_type=0, double fill=0);
1105  int resize_wrap(Vector3<long> nusize, Vector3<long> translate);
1106  Bimage* resize_wrap_copy(Vector3<long> nusize, Vector3<long> translate);
1107  int pad(long sz, int fill_type=0, double fill=0);
1108  int pad(Vector3<long> sz, int fill_type=0, double fill=0);
1109  Bimage* pad_copy(long sz, int fill_type=0, double fill=0);
1110  Bimage* pad_copy(Vector3<long> sz, int fill_type=0, double fill=0);
1111  int shrink_wrap(Vector3<long> nusize, Vector3<long> translate);
1112  int enlarge(Vector3<long> scale);
1113  // Montaging methods
1114 private:
1115  int montage_one(Bimage* pm, long zz, long mi, long cols, long rows, int flipy);
1116 public:
1117  Bimage* montage(int first, int cols, int rows, int skip=0, int flipy=0);
1118  // Editing methods
1119  int shape(int type, Vector3<long> rect, Vector3<double> start,
1120  double width, int fill_type=0, double fill=0);
1121  int shape(long nn, int type, Vector3<long> rect, Vector3<double> start,
1122  double width, int fill_type=0, double fill=0);
1123  Bimage* edge_mask(int type, Vector3<long> rect,
1124  Vector3<double> start, double width);
1125  int edge(int type, Vector3<long> rect, Vector3<double> start,
1126  double width, int fill_type=0, double fill=0);
1127  int edge(long nn, int type, Vector3<long> rect, Vector3<double> start,
1128  double width, int fill_type=0, double fill=0);
1129  int hanning_taper(double fill=0);
1130  int sphere(Vector3<double> center, double radius,
1131  double width=0, int fill_type=0, double fill=0);
1132  int cylinder(Vector3<double> center, double radius,
1133  double height, double width, int fill_type=0, double fill=0);
1134  int gaussian_sphere(long nn, Vector3<double> center, double sigma, double amp);
1135  int shell(Vector3<double> center, double minrad,
1136  double maxrad, double width, int fill_type=0, double fill=0);
1137  int shell(long nn, Vector3<double> center, double minrad,
1138  double maxrad, double width, int fill_type=0, double fill=0);
1139  int shell_wrap(long nn, Vector3<double> center, double minrad,
1140  double maxrad, double width, int fill_type=0, double fill=0);
1141  int bar(Vector3<double> start, Vector3<double> end,
1142  double width, double edge_width, int fill_type=0, double fill=0);
1143  int bar(long nn, Vector3<double> start, Vector3<double> end,
1144  double width, double edge_width, int fill_type=0, double fill=0);
1145  int quadric(double* param);
1146  int fill_gaps(long step);
1147  int interpolate_gaps(long step);
1148  // Transformation methods
1149  int transform(Vector3<double> scale,
1151  Matrix3 mat, int fill_type=0, double fill=0);
1154  Matrix3 mat, int fill_type=0, double fill=0);
1155  void transform_voxel(long i, Bimage* pt, long nn, Vector3<double> oldorigin,
1156  Vector3<double> nuorigin, Matrix3 affmat, double fill);
1157  Bimage* transform(long nn, Vector3<long> nusize, Vector3<double> scale,
1159  Matrix3 mat, int fill_type=0, double fill=0);
1160  int rotate();
1161  int rotate(double angle);
1162  int rotate(Vector3<double> axis, double angle);
1163  int rotate(View view);
1164  int rotate(Vector3<double> translate, View view);
1165  int rotate(Matrix3 mat);
1166  int rotate(Vector3<double> translate, Matrix3 mat);
1167  Bimage* rotate(Vector3<long> nusize);
1168  Bimage* rotate(Vector3<long> nusize, double angle);
1169  Bimage* rotate(Vector3<long> nusize, Vector3<double> axis, double angle);
1170  Bimage* rotate(Vector3<long> nusize, View view);
1171  Bimage* rotate(Vector3<long> nusize, Vector3<double> translate, View view);
1172  Bimage* rotate(Vector3<long> nusize, Matrix3 mat);
1174  Bimage* orient(View* views);
1175  int mirror();
1176  int shift(Vector3<double> vec, int fill_type=0, double fill=0);
1177  int shift(long nn, Vector3<double> vec, int fill_type=0, double fill=0);
1178  int shift_wrap(Vector3<double> vec);
1179  int shift_wrap(long nn, Vector3<double> vec);
1180  int center(int fill_type=0, double fill=0);
1181  int center_wrap();
1182  int zero_origin();
1184  Bimage* scale_to_reference(Bimage* pref, Bimage* pmask, double scalemin,
1185  double scalemax, double step);
1186  Bimage* scale_to_reference(Bimage* pref, Bimage* pmask=NULL);
1187  // Symmetry methods
1188  double symmetrize(Bstring& symmetry_string, int flag) {
1189  View ref_view;
1190  return symmetrize(symmetry_string, ref_view, flag);
1191  }
1192  double symmetrize(Bsymmetry* sym, int flag) {
1193  View ref_view;
1194  return symmetrize(sym, ref_view, flag);
1195  }
1196  double symmetrize(Bstring& symmetry_string, View ref_view, int flag) {
1197  Bsymmetry* sym = init_point_group_symmetry(symmetry_string);
1198  double FOM = symmetrize(sym, ref_view, flag);
1199  kill_symmetry(sym);
1200  return FOM;
1201  }
1202  double symmetrize(Bsymmetry* sym, View ref_view, int flag);
1203  double check_point_group(Bstring& check_string);
1204  double find_cyclic_point_group(Bsymmetry* sym,
1205  int binfac, double hires, double lores);
1206  double find_point_group(Bsymmetry* sym, double angle_step,
1207  int binfac, double hires, double lores, int flags);
1208  long rotate_to_axis(Bsymmetry* sym, long axis, long axis_flag);
1209  int change_symmetry(Bsymmetry* symold, Bsymmetry* symnu,
1210  double radius, double z_slope);
1211  Matrix3 symmetry_equivalent(Bimage* ptemp, Bimage* pmask, Bsymmetry* sym);
1216  double phi_step, double theta_step, double alpha_step, Vector3<double> shift);
1217  // Helical methods
1218  double helix_interpolate(long i, double helix_rise, double helix_angle,
1219  int zmin, int zmax, double radius, int norm_flag=1);
1220  double dyad_interpolate(long i, int norm_flag=1);
1221  double tube_interpolate(long i, int h, int k,
1222  double latconst, int zmin, int zmax, double radius, int norm_flag=1);
1223  double helix_symmetrize(double helix_rise, double helix_angle,
1224  int dyad_axis, int zmin, int zmax, double radius, int norm_flag=1);
1225  Bplot* seamed_helix_symmetrize(double helix_rise, double helix_angle,
1226  double seam_shift, int dyad_axis, int zmin, int zmax,
1227  double radius, int norm_flag);
1228  Bimage* symmetrize_cylinder(int flag);
1229  int symmetrize_cylinder();
1230  double tube_symmetrize(int h, int k, double latconst,
1231  int zmin, int zmax, double radius, int norm_flag=1);
1232  double convert_to_helix(double helix_rise, double helix_angle,
1233  Vector3<double> offset);
1234  int distort_elliptically(double angle, double shift);
1235  Bplot* find_helix_parameters(double angle_start, double angle_end,
1236  double angle_step, int bin, double hires, double lores, double radius);
1237  Bplot* find_helix_parameters(double rise_start, double rise_end,
1238  double rise_step, double angle_start, double angle_end, double angle_step,
1239  int bin, double radius);
1240  int helix_segment_correlation_one(long i,
1241  double angle_start, double angle_end, double angle_step,
1242  int bin, double hires, double lores, double radius,
1243  fft_plan planf, fft_plan planb, double* cc);
1245  double angle_start, double angle_end, double angle_step,
1246  int bin, double hires, double lores, double radius);
1247  int transform_lines();
1248  Bimage* helical_cross_section(double helix_rise, double helix_angle,
1249  double scale, double hires);
1250  double snvariance(double snradius);
1251  int extrude_cross_section(long length, double helix_rise,
1252  double helix_angle, int fill_type, double fill);
1253  Bplot* filament_width(long width, long lim_lo, long lim_hi);
1254  Bimage* filament_density(double width);
1255  // Polar methods
1256  Bimage* radial(long minrad, long maxrad, double rad_step=1, int wrap=0);
1257  Bimage* radial(long minrad, long maxrad, double rad_step, Bimage* pmask, int wrap=0);
1258  Bimage* radial(long minrad, long maxrad, double rad_step,
1259  double ellipticity, double angle, Bimage* pmask, int wrap=0);
1260  Bimage* radial_symmetry_adjusted(double rad_start,
1261  double rad_end, double rad_step,
1262  double spherical_fraction, Bsymmetry* sym);
1263  double* radial_fit(Bimage* pref);
1265  Bimage* cartesian_to_spherical(long nannuli, long nphi, long ntheta);
1266  Bimage* cartesian_to_cylindrical(long nannuli, long nphi, int flag=0);
1267  Bimage* polar_transform(long nangles, long ann_min, long ann_max,
1268  long dann, long zmin, long zmax, long zinc);
1269  Bimage* polar_power_spectrum(double resolution, long num_angle);
1270  int line_powerspectra(fft_plan plan);
1271  int radial_shells();
1272  int cylindrical_shells();
1273 private:
1274  int set_radial_distances(double spherical_fraction, Bsymmetry* sym);
1275  int radial_section(Bimage* prad, long nn,
1276  long zr, double rad_start, double rad_step, double fill=0);
1277 public:
1278  Bimage* radial_sections(double rad_start, double rad_end,
1279  double rad_step, double spherical_fraction,
1280  Bsymmetry* sym, int fill_type=FILL_USER, double fill=0);
1281  Bimage* radial_coverage(double threshold, double rad_step=1);
1282  // Topological methods
1283  Bimage* topograph_to_surface(Bimage* psd, long nz, double density, double resolution);
1284  Bimage* surface_to_topograph(double threshold, int dir=0);
1285  Bimage* rotate_height(Matrix3 mat, Vector3<double> translate, double threshold=0);
1286  Bimage* height(View* views, double threshold=0);
1287  // Binning methods
1288  int integer_interpolation(int integer_factor);
1289  int integer_interpolation(int integer_factor, int odd);
1290 private:
1291  int bin(long i, Vector3<long> bk, Bimage* pb);
1292 public:
1293  int bin(long b) {
1294  Vector3<long> v = {b,b,b};
1295  return bin(v);
1296  }
1297  int bin(Vector3<long> bk);
1298  Bimage* bin_copy(long b) {
1299  Vector3<long> v = {b,b,b};
1300  return bin_copy(v);
1301  }
1303  Bimage* bin_around_origin(int bin);
1304  int median_bin(int binning);
1305  // Noise generation methods
1306  int noise_uniform(double rmin, double rmax);
1307  int noise_gaussian(double ravg=0, double rstd=1);
1308  int noise_poisson(double ravg);
1309  int noise_logistical(double ravg, double rstd);
1310  int noise_spectral(double alpha);
1311  // Binary masks
1312  long mask(Bimage* pmask, double fill);
1313  long to_mask() { return to_mask((max + min)/2); }
1314  long to_mask(double threshold);
1315  Bimage* mask_by_threshold(double threshold);
1316  Bimage* mask_by_thresholds(vector<double> threshold);
1317  long mask_stats();
1318  long mask_invert();
1319  long mask_combine(Bimage* p, int operation);
1320  Bimage* mask_extract(Bimage* pmask);
1321  int max_in_kernel(long ksize);
1322  long mask_dilate_erode(unsigned char dir);
1323  long mask_dilate(long times=1);
1324  long mask_erode(long times=1);
1325  long mask_open(int times=1);
1326  long mask_close(int times=1);
1327  long mask_fill(Vector3<long> voxel);
1328  long mask_shell(Vector3<double> origin, double rad_min, double rad_max) {
1329  return shell(origin, rad_min, rad_max, 0.1, FILL_USER, 1.99);
1330  }
1332  long mask_rectangle(double length, double width,
1333  double rect_angle, int wrap);
1334  long mask_symmetrize(Bsymmetry* sym);
1336  vector<double> fspace_default_bands(double res_lo, double res_hi);
1337  int mask_fspace_banded(vector<double>& band);
1338  long mask_missing_wedge(Vector3<double> origin, double tilt_axis,
1339  double tilt_neg, double tilt_pos, double resolution);
1340  long mask_missing_pyramid(Vector3<double> origin, double tilt_axis1,
1341  double tilt_axis2, double tilt_neg1, double tilt_pos1,
1342  double tilt_neg2, double tilt_pos2, double resolution);
1344  double mis_ang, double resolution);
1345  long mask_missing_find(Vector3<double> ori, double resolution, Bstring& mis_type);
1346  long mask_pack_plane(Matrix3 mat, double hi_res, double scale);
1347  // Ternary masks
1348  double variance_threshold(double lowvar);
1349  Bimage* variance_mask(long kernel_size, double lowvar=1e-6, int bkg_flag=0);
1350  // Level masks
1351  Bimage* tile_mask(long step);
1352  long mask_split(long voxels_per_level);
1353  long levelmask_collapse();
1354  long levelmask_add(Bimage* pmask, int add_level=1);
1355  long levelmask_dilate(int times);
1356  long levelmask_dilate();
1357  long levelmask_select(Bstring& select_list, int flag=0);
1358  long levelmask_select(long nn, Vector3<long> voxel);
1359  long levelmask_select(Bimage* pmask);
1360  long levelmask_switch(long index1, long index2);
1361  int level_masked_stats(Bimage* pmask);
1362  long levelmask_symmetrize(Bsymmetry* sym);
1363  Bimage* level_mask_extract(Bimage* pmask);
1365  long levelmask_clean();
1366  long levelmask_colorize();
1368  int levelmask_region_size();
1370  Matrix mask_interface_matrix(int img_num);
1371  long mask_region_interfaces(int reg_num);
1372  long mask_merge_delete(long min_size, long min_if);
1373  // Soft masks
1374  long apply_soft_mask(long nn, Bimage* pmask, int fill_type, double fill);
1375  // Segmentation
1376  Bimage* regions(double threshold, int sign);
1377  long region_assign(Bimage* pmask, long idx,
1378  long region_number, double threshold, int sign);
1379  int region_threshold_series(double threshold_first,
1380  double threshold_last, double threshold_step);
1381  long region_flood(Bimage* pmask, double threshold_hi,
1382  double threshold_lo, double threshold_step, int fill_borders);
1383  long check_neighbors(long idx);
1384  Bimage* region_peaks(long kernel_size, double threshold, int flood=0, int wrap=0);
1385  long blobs(double threshold, double min_size, double max_size,
1386  double setvalue, int sign);
1387  int filter_extremes();
1388  int filter_extremes(int mod_flag);
1389  long replace_maxima(double threshold);
1390  double mass_threshold(long img_num, double mol_weight, double rho);
1391  double mass_at_threshold(long img_num, double threshold, double rho);
1392  Bimage* internal_volume(double threshold);
1393  Bimage* internal_volume(double threshold, int mask_out_freq);
1394  Bimage* kmeans_segment(long nregion=2, long max_iter=10, double ratio=1);
1395  Bimage* graph_segment(int type=1, Bimage* pmask=NULL, int connect_type=0,
1396  double complexity=0, long min_size=0, int return_type=0);
1397  int superpixels_update(Bimage* pmask, vector<long> vstep,
1398  double colorweight, vector<Bsuperpixel>& seg);
1399  vector<Bsuperpixel> superpixels_from_mask(long cc, long step);
1400  vector<Bsuperpixel> superpixels(long step, double colorweight=0.2, long iterations=10, double stop=1);
1401  vector<Bsuperpixel> superpixels(long step, double colorweight=0.2, long iterations=10, long bin_levels=1, double stop=1);
1402  int impose_superpixels(Bimage* pmask, vector<Bsuperpixel>& seg, int impose);
1403 } ;
1404 #define _Bimage_
1405 #endif
1406 
1407 // Function prototypes
Bimage::regions
Bimage * regions(double threshold, int sign)
Segments an image into contiguous regions.
Definition: Bimage_segment.cpp:56
Bimage::R_factor
double R_factor(Bimage *p)
Calculates an R factor between two images.
Definition: Bimage_correlate.cpp:218
Bimage::coordinates
void coordinates(long i, long &nx, long &ny, long &nz)
Definition: Bimage.h:429
Bimage::color_green
int color_green(double cmin, double cmax, int flag=0)
Converts a gray-scale image to green.
Definition: Bimage_color.cpp:322
Bsub_image::average
double average()
Definition: Bimage.h:119
Bimage::data_pointer
unsigned char * data_pointer(long offset)
Definition: Bimage.h:285
Bimage::extract_filament
Bimage * extract_filament(long img_num, double width, int axis, long nspline, Vector3< double > *spline)
Extracts a filament defined by a series of coordinates.
Definition: Bimage_extract.cpp:1128
CentHerm
@ CentHerm
Definition: Bimage.h:45
Bimage::mask_fill
long mask_fill(Vector3< long > voxel)
Fills an empty part of a mask indicated by the given voxel.
Definition: Bimage_mask.cpp:499
Bimage::height
Bimage * height(View *views, double threshold=0)
Calculates a set of height images from a 3D density map.
Definition: Bimage_topo.cpp:230
Bimage::fft_setup
fft_plan fft_setup(fft_direction dir, int opt=0)
Sets up a plan for fast Fourier transforms.
Definition: Bimage_fft.cpp:29
Bimage::level_masked_stats
int level_masked_stats(Bimage *pmask)
Caclulates statistics for all the regions defined by a multi-level mask.
Definition: Bimage_mask.cpp:1800
Bimage::coordinates
void coordinates(long i, long &nx, long &ny, long &nz, long &nn)
Definition: Bimage.h:436
Bimage::complex_multiply
int complex_multiply(Bimage *p)
Calculates the product of a complex image with a simple image.
Definition: Bimage_complex.cpp:400
Bimage::view
void view(View vw)
Definition: Bimage.h:597
Bimage::symmetry
void symmetry(string grp)
Definition: Bimage.h:607
Bimage::rgb_to_cmyk
void rgb_to_cmyk()
Converts an RGB color image to CMYK.
Definition: Bimage_color.cpp:176
Bimage::rescale
int rescale(double scale, double shift)
Rescales the image data with a given multiplier and offset.
Definition: Bimage_rescale.cpp:27
Bimage::complex_to_intensities
void complex_to_intensities()
The intensities from a complex image is written to a simple image.
Definition: Bimage_complex.cpp:92
Bimage::scale_to_same_size
Bimage * scale_to_same_size(Bimage *pref)
Scales and image to the given reference.
Definition: Bimage_transform.cpp:735
Bimage::mask_missing_pyramid
long mask_missing_pyramid(Vector3< double > origin, double tilt_axis1, double tilt_axis2, double tilt_neg1, double tilt_pos1, double tilt_neg2, double tilt_pos2, double resolution)
Generates a mask with a missing pyramid.
Definition: Bimage_mask.cpp:976
Bimage::mask_erode
long mask_erode(long times=1)
Erodes a binary mask.
Definition: Bimage_mask.cpp:443
TView
@ TView
Definition: Bimage.h:62
Bimage::sampling
void sampling(double ux, double uy, double uz)
Definition: Bimage.h:523
Bimage::mirror
int mirror()
Inverts/mirrors each image through its origin.
Definition: Bimage_transform.cpp:563
Bimage::region_threshold_series
int region_threshold_series(double threshold_first, double threshold_last, double threshold_step)
Segments a map through a series of thresholds and reports results.
Definition: Bimage_segment.cpp:200
Bimage::real_size
Vector3< double > real_size()
Definition: Bimage.h:500
Bimage::sizeZ
void sizeZ(long nz)
Definition: Bimage.h:392
Bimage::fspace_radial_power
Bimage * fspace_radial_power(double resolution, double sampling_ratio=1)
Calculates the radial power spectrum from a Fourier transform.
Definition: Bimage_fspace.cpp:610
Bimage::tube_symmetrize
double tube_symmetrize(int h, int k, double latconst, int zmin, int zmax, double radius, int norm_flag=1)
Symmetrizes an image given tubular lattice parameters.
Definition: Bimage_helix.cpp:633
Bimage::compound_type
void compound_type(CompoundType ct)
Definition: Bimage.h:365
Bimage::cross_correlate
Bimage * cross_correlate(Bimage *p, Bimage *pmask=NULL)
Definition: Bimage.h:954
Bimage::background
void background(double bkg)
Definition: Bimage.h:555
Bimage::resize_wrap_copy
Bimage * resize_wrap_copy(Vector3< long > nusize, Vector3< long > translate)
Resizes with wrapping without interpolation or rescaling.
Definition: Bimage_resize.cpp:280
Bsub_image::view
void view(vector< double > vw)
Definition: Bimage.h:159
Bimage::symmetry
string & symmetry()
Definition: Bimage.h:603
Bimage::combine_channels
void combine_channels(long nc)
The channels are composed from individual images.
Definition: Bimage.cpp:1987
Bimage::friedel_apply
int friedel_apply()
Applies Friedel symmetry.
Definition: Bimage_fspace.cpp:1806
Bimage::coordinates
Vector3< long > coordinates(long i)
Definition: Bimage.h:456
Bimage::filter_gaussian
int filter_gaussian(long kernel_size, double sigma)
Applies a gaussian filter to an image.
Definition: Bimage_filter.cpp:324
Bimage::interpolate_wrap
double interpolate_wrap(double xx, double yy=0, double zz=0, long nn=0) const
Definition: Bimage.h:350
Bimage::edge_mask
Bimage * edge_mask(int type, Vector3< long > rect, Vector3< double > start, double width)
Creates a mask with the edge approaching zero.
Definition: Bimage_edit.cpp:233
Bimage::variance_threshold
double variance_threshold(double lowvar)
Calculates a threshold for a local variance image.
Definition: Bimage_mask.cpp:1305
Bimage::symmetrize
double symmetrize(Bstring &symmetry_string, int flag)
Definition: Bimage.h:1188
Bsub_image::origin
Vector3< double > origin()
Definition: Bimage.h:144
Bimage::find_cyclic_point_group
double find_cyclic_point_group(Bsymmetry *sym, int binfac, double hires, double lores)
Finds the orientation for an image with a cyclic point group symmetry.
Definition: Bimage_symmetry.cpp:234
Bimage::histogram_gauss_fit
vector< double > histogram_gauss_fit(long bins, long ngauss=1)
Fits a gaussian function to a histogram of an image.
Definition: Bimage_histogram.cpp:590
Bimage::align
JSvalue align(long ref_num, Bimage *pmask, double hi_res, double lo_res, double shift_limit, double edge_width, double gauss_width, Vector3< long > bin)
Aligns and sums a set of sub-images, first progressively and then iteratively.
Definition: Bimage_align.cpp:203
Bimage::shrink_wrap
int shrink_wrap(Vector3< long > nusize, Vector3< long > translate)
Shrinks an image to a new size with wrapping of the excluded edges.
Definition: Bimage_resize.cpp:432
Bimage::seamed_helix_symmetrize
Bplot * seamed_helix_symmetrize(double helix_rise, double helix_angle, double seam_shift, int dyad_axis, int zmin, int zmax, double radius, int norm_flag)
Symmetrizes an image given helical symmetry parameters and seam shift parameter.
Definition: Bimage_helix.cpp:280
Bimage::page_size
void page_size(long nx, long ny, long nz)
Definition: Bimage.h:494
Bimage::correlation_coefficient
double correlation_coefficient(Vector3< double > shift)
Calculates a coefficient from a Fourier correlation transform given a shift.
Definition: Bimage_correlate.cpp:466
Bimage::get_localtime
tm * get_localtime()
Definition: Bimage.h:260
Bimage::truncate
int truncate(double minim, double maxim, double setmin, double setmax)
Truncates image data to a given minimum and maximum.
Definition: Bimage_rescale.cpp:277
Bimage::operator+
Bimage * operator+(Bimage &p)
Adds two images together, adjusting for size difference.
Definition: Bimage.cpp:3762
Bimage::inverse
void inverse(double minval=0)
Calculates the inverse of the image.
Definition: Bimage.cpp:3685
Bit
@ Bit
Definition: utilities.h:152
Bimage::fspace_radial
double * fspace_radial(long nn, long maxrad, int flag=0)
Calculates the radial power spectrum from a Fourier transform.
Definition: Bimage_fspace.cpp:729
Bimage::show_maximum
void show_maximum(double v)
Definition: Bimage.h:568
FourierType
FourierType
Fourier transform format specifier.
Definition: Bimage.h:40
Bimage::find_peaks
Bimage * find_peaks(long kernelsize)
Finds peaks in a map with periodic boundaries.
Definition: Bimage_correlate.cpp:1739
Bsuperpixel.h
Super pixel segmentation.
Bimage::set_time
void set_time(tm *t)
Definition: Bimage.h:265
Bimage::mask_dilate
long mask_dilate(long times=1)
Dilates a binary mask.
Definition: Bimage_mask.cpp:423
Bimage::fspace_reconstruction_weigh
long fspace_reconstruction_weigh()
Weighs a reconstruction.
Definition: Bimage_reconstruct.cpp:412
Bimage::fspace_weigh_ramp
int fspace_weigh_ramp(double resolution, fft_plan planf, fft_plan planb)
Weighs a transform with a ramp.
Definition: Bimage_fspace.cpp:1062
Bimage::voxel_size
double voxel_size()
Definition: Bimage.h:506
Bimage::label
string & label()
Definition: Bimage.h:251
Bimage::shift
int shift(Vector3< double > vec, int fill_type=0, double fill=0)
Shifts an image.
Definition: Bimage_transform.cpp:589
Bimage::within_boundaries
bool within_boundaries(long xx, long yy, long zz)
Definition: Bimage.h:466
Bimage::interpolate
double interpolate(Vector3< double > vec, long nn=0, double fill=0) const
Definition: Bimage.h:340
Bimage::merge_amplitudes_and_phases
double merge_amplitudes_and_phases(Bimage *pamp)
Merges the amplitudes from one map with the phases of another.
Definition: Bimage_complex.cpp:1223
Bimage::helix_symmetrize
double helix_symmetrize(double helix_rise, double helix_angle, int dyad_axis, int zmin, int zmax, double radius, int norm_flag=1)
Symmetrizes an image given helical symmetry parameters.
Definition: Bimage_helix.cpp:133
Bimage::sampling
void sampling(Vector3< double > u)
Definition: Bimage.h:520
Bimage::get
double get(long nn, long xx, long yy, long zz, long cc=0)
Returns the data value at the given coordinates.
Definition: Bimage.cpp:960
Bimage::fsc_dpr
Bplot * fsc_dpr(double hi_res, double sampling_ratio=1, int flag=0)
Calculates an FSC and DPR curves from two images.
Definition: Bimage_resolution.cpp:92
Bimage::fill_gaps
int fill_gaps(long step)
Fill the voxels that are not calculated.
Definition: Bimage_edit.cpp:855
Complex
Definition: Complex.h:23
Bimage::reslice
void reslice(const char *order)
Definition: Bimage.h:717
Bimage::average
double average()
Definition: Bimage.h:543
Bimage::cross_correlate
Bimage * cross_correlate(Bimage *p, double hires, double lores, fft_plan planf, fft_plan planb)
Calculates a cross-correlation map by Fast Fourier transformation.
Definition: Bimage_correlate.cpp:363
Bsub_image
General sub-image parameter class.
Definition: Bimage.h:89
JSvalue::erase
vector< JSvalue >::iterator erase(long j)
Definition: json.h:189
Bimage::set
void set(long j, double v)
Sets a single value at the given index.
Definition: Bimage.cpp:1118
Bimage::fspace_positive
int fspace_positive()
Sets the image to positive definite.
Definition: Bimage_fspace.cpp:1703
Bstring
Definition: Bstring.h:29
Bimage::levelmask_color_by_size
Bimage * levelmask_color_by_size()
Color a multi-level mask based on the volumes of regions.
Definition: Bimage_mask.cpp:2131
UnitCell::c
void c(double d)
Definition: UnitCell.h:38
Bimage::next
Bimage * next
Definition: Bimage.h:179
Bimage::superpixels_from_mask
vector< Bsuperpixel > superpixels_from_mask(long cc, long step)
Create superpixels from a multilevel mask.
Definition: Bimage_segment.cpp:1821
Bimage::page_size
void page_size(vector< long > vec)
Definition: Bimage.h:499
Bsub_image::image_coordinates
Vector3< long > image_coordinates(Vector3< double > rc)
Definition: Bimage.h:154
Bimage::extract_tetrahedron
Bimage * extract_tetrahedron(Vector3< double > *tet, int fill_type=0, double fill=0)
Extracts a tetrahedral part of the image.
Definition: Bimage_extract.cpp:542
Bsub_image::select
long select()
Definition: Bimage.h:167
Bimage::zero_fourier_origin
void zero_fourier_origin()
Zeroes the first voxel in each image.
Definition: Bimage.cpp:2033
Bimage::cylindrical_shells
int cylindrical_shells()
Calculates an image with slices representing cylindrical shell projections.
Definition: Bimage_polar.cpp:928
Bimage::level_mask_extract
Bimage * level_mask_extract(Bimage *pmask)
Extracts all the regions associated with a multi-level mask.
Definition: Bimage_mask.cpp:1998
Bimage::relative_density
double relative_density(Bimage *pmask)
Calculates the relative density in a region defined by a mask.
Definition: Bimage.cpp:3071
Bimage::show_image
long show_image()
Definition: Bimage.h:559
Bsub_image::standard_deviation
double standard_deviation()
Definition: Bimage.h:120
Bimage::compound_type_string
Bstring compound_type_string()
Get the string representation of a datatype.
Definition: Bimage.cpp:1715
Bimage::fspace_background
int fspace_background()
Calculates the background for a Fourier transform.
Definition: Bimage_fspace.cpp:46
Bimage::extract
Bimage * extract(long nn, Vector3< double > loc, Vector3< long > size, Vector3< double > origin, View view)
Definition: Bimage.h:671
Bsub_image::view_angle
void view_angle(double d)
Definition: Bimage.h:161
Bimage::size
void size(Vector3< long > vec)
Definition: Bimage.h:388
Bimage::find_center
int find_center(Bimage *pmask, double hires, double lores, double radius, double sigma, int refine_flag)
Finds the center of mass of an image by cross-correlation with its inverse.
Definition: Bimage_correlate.cpp:1235
Bimage::interpolate
double interpolate(vector< double > vec, long nn=0, double fill=0) const
Definition: Bimage.h:344
Bimage::central_section
Bimage * central_section(Matrix3 mat, double resolution, FSI_Kernel *kernel)
Calculates a central section of a 3D fourier transform.
Definition: Bimage_project.cpp:287
Bimage::shell
int shell(Vector3< double > center, double minrad, double maxrad, double width, int fill_type=0, double fill=0)
Fills a shell within an image with a uniform value.
Definition: Bimage_edit.cpp:546
Bimage::Bimage
Bimage()
Initializes an image.
Definition: Bimage.cpp:43
Bimage::operator=
Bimage & operator=(const Bimage &p)
Assigns an image.
Definition: Bimage.cpp:911
Bimage::find_template
Bimage * find_template(Bimage *ptemp, Bimage *pmask, double hires, double lores, int bin, fft_plan planf, fft_plan planb)
Finds one or more matches to a template.
Definition: Bimage_correlate.cpp:1177
Bimage::erase
long erase(string tag)
Definition: Bimage.h:241
Bimage::set_time
void set_time(time_t t)
Definition: Bimage.h:264
Bimage::extract_wrap
Bimage * extract_wrap(long nn, Vector3< double > loc, Vector3< long > size, Vector3< double > origin, Matrix3 mat)
Extracts a region of one sub-image into new image structure with wrapping.
Definition: Bimage_extract.cpp:151
Bimage::mask_symmetrize
long mask_symmetrize(Bsymmetry *sym)
Symetrizes a mask.
Definition: Bimage_mask.cpp:620
TypePointer::sc
signed char * sc
Definition: Bimage.h:71
Bimage::copy
Bimage * copy()
Copies the header information and data of an image into a new image structure.
Definition: Bimage.cpp:2702
Bimage::origin
void origin(long nn, double ox, double oy, double oz)
Definition: Bimage.h:589
symmetry.h
Header file for general symmetry functions.
Bimage::filter_sinc
int filter_sinc()
Weighs an image with a sinc function.
Definition: Bimage_filter.cpp:365
Bimage::center
int center(int fill_type=0, double fill=0)
Centers an image.
Definition: Bimage_transform.cpp:694
Bimage::sampling
Vector3< double > sampling(long nn)
Definition: Bimage.h:526
Bimage::truncate_to_background
int truncate_to_background(double minim, double maxim)
Sets voxels in image data exceeding a given minimum and maximum to the image background.
Definition: Bimage_rescale.cpp:367
Bimage::extract_wrap
Bimage * extract_wrap(long nn, Vector3< long > size, Matrix3 mat)
Definition: Bimage.h:677
Bimage::levelmask_select
long levelmask_select(Bstring &select_list, int flag=0)
Retains the selected levels in a multi-level mask.
Definition: Bimage_mask.cpp:1650
Bimage::helix_interpolate
double helix_interpolate(long i, double helix_rise, double helix_angle, int zmin, int zmax, double radius, int norm_flag=1)
Definition: Bimage_helix.cpp:18
Bimage::find_shift_in_transform
Vector3< double > find_shift_in_transform(double shift_limit)
Finds the shift by brute force backtransformation for selected shifts.
Definition: Bimage_correlate.cpp:501
Bimage::simple_to_complex
void simple_to_complex()
A simple image is converted to a complex image.
Definition: Bimage_complex.cpp:22
Bimage::variance
int variance(long kernel_size, int flag=0)
Calculates the local variance within the given kernel.
Definition: Bimage_stats.cpp:625
Bimage::page_size
Vector3< long > page_size()
Definition: Bimage.h:493
Vector3< double >
Bimage::sizeX
void sizeX(long nx)
Definition: Bimage.h:390
TypePointer::ui
unsigned int * ui
Definition: Bimage.h:74
Bimage::unit_cell
void unit_cell(UnitCell uc)
Definition: Bimage.h:608
Bimage::resize_copy
Bimage * resize_copy(Vector3< long > nusize, Vector3< long > translate, int fill_type=0, double fill=0)
Resizes without interpolation or rescaling.
Definition: Bimage_resize.cpp:124
Bimage::pack_two_in_complex
Bimage * pack_two_in_complex(Bimage *p)
Packs two real images into one complex image.
Definition: Bimage_complex.cpp:679
Bimage::find_peak
int find_peak(double radius=1e30, double sigma=0)
Finds the peak in an image to the nearest voxel.
Definition: Bimage_correlate.cpp:1340
Bimage::complex_to_imaginary
void complex_to_imaginary()
The imaginary part of a complex image is written to a simple image.
Definition: Bimage_complex.cpp:71
Bimage::data_alloc_and_clear
unsigned char * data_alloc_and_clear(long nbytes)
Definition: Bimage.h:274
TypePointer::uc
unsigned char * uc
Definition: Bimage.h:70
Bimage::fspace_weigh_dose
int fspace_weigh_dose(long nn, double dose_per_frame, vector< double > critdose)
Definition: Bimage_fspace.cpp:1460
Bimage::sum
void sum(long m, Bimage **p)
Sums an array of images with their FOM blocks.
Definition: Bimage_combine.cpp:23
Bimage::default_origin
Vector3< double > default_origin()
Definition: Bimage.h:592
Bimage::histogram_counts
Bplot * histogram_counts(int flags=0)
Finds the peaks in a quantized image from the histogram.
Definition: Bimage_histogram.cpp:207
Bimage::scale_to_reference
Bimage * scale_to_reference(Bimage *pref, Bimage *pmask, double scalemin, double scalemax, double step)
Scales and image to the given reference, searching for the correct scale.
Definition: Bimage_transform.cpp:759
Bimage::values
vector< double > values(long i)
Definition: Bimage.h:297
Bimage::mass_at_threshold
double mass_at_threshold(long img_num, double threshold, double rho)
Calculates the mass from the density threshold.
Definition: Bimage_segment.cpp:904
Bimage::line_powerspectra
int line_powerspectra(fft_plan plan)
Calculates the 1D power spectrum of each line in an image.
Definition: Bimage_polar.cpp:814
Bimage::fspace_fit_B_factor
double fspace_fit_B_factor(double res_hi=0)
Determines the overall B-factor of an image.
Definition: Bimage_fspace.cpp:994
Bimage::fspace_square_amp
int fspace_square_amp()
Change the amlitudes to their squares.
Definition: Bimage_fspace.cpp:455
Bimage::fspace_reconstruction_snr
long fspace_reconstruction_snr()
Calculates the SNR map.
Definition: Bimage_reconstruct.cpp:536
FSI_Kernel.h
Header file for frequency space interpolation kernel.
Bimage::sampling
void sampling(vector< Vector3< double >> sam)
Definition: Bimage.h:534
Bimage::cross_correlate_validate
Bimage * cross_correlate_validate(Bimage *p, Bimage *pmask)
Calculates a masked cross-correlation map by Fast Fourier transformation.
Definition: Bimage_correlate.cpp:748
Complex.h
Class for complex numbers.
Bimage::information
int information()
Prints out header information for an image.
Definition: Bimage.cpp:2508
Bimage::data_type_bits
long data_type_bits() const
Returns the size of the datatype in bits.
Definition: Bimage.cpp:1582
Bimage::add
void add(long j, Complex< double > cv)
Definition: Bimage.h:322
Bimage::radial
Bimage * radial(long minrad, long maxrad, double rad_step=1, int wrap=0)
Calculates the radial average of an image.
Definition: Bimage_polar.cpp:33
TComplex
@ TComplex
Definition: Bimage.h:60
Bimage::complex_apply_negative_mask
int complex_apply_negative_mask(Bimage *pmask)
Applies a negative mask to a complex image.
Definition: Bimage_complex.cpp:550
Bimage::normalize
int normalize(long imgnum, double average, double stdev, int norm_type, long bins)
Normalizes a sub-image to a desired average and standard deviation.
Definition: Bimage_rescale.cpp:481
Bimage::background
double background(long nn)
Definition: Bimage.h:549
FILL_USER
#define FILL_USER
Definition: utilities.h:176
Bimage::size
Vector3< long > size() const
Definition: Bimage.h:386
Bimage::phase_difference
Bimage * phase_difference(Bimage *p, int type=0, double res_hi=0, double res_lo=0)
Calculates the cosine of the phase difference between two images.
Definition: Bimage_fspace.cpp:1888
Bimage::meta_data_retain_one_image
void meta_data_retain_one_image(long img_num)
Erases all sub-image records from the meta data except one.
Definition: Bimage.cpp:771
UnitCell.h
Header file for unit cell functions.
Bimage::levelmask_average_region_size
double levelmask_average_region_size()
Calculates the average size of regions in a level mask.
Definition: Bimage_mask.cpp:2022
sb
int sb(0)
Bplot
Definition: Bplot.h:146
Bimage::write
int write(Bstring &fn)
Definition: Bimage.cpp:2339
Bimage::mask_missing_find
long mask_missing_find(Vector3< double > ori, double resolution, Bstring &mis_type)
Generates a missing mask from an example image.
Definition: Bimage_mask.cpp:1137
Bimage::values
void values(long i, vector< double > val)
Definition: Bimage.h:303
UnitCell::b
void b(double d)
Definition: UnitCell.h:37
Bimage::data_type_size
long data_type_size() const
Returns the size of the datatype in bytes.
Definition: Bimage.cpp:1607
Bimage::levelmask_symmetrize
long levelmask_symmetrize(Bsymmetry *sym)
Symetrizes a multi-level mask.
Definition: Bimage_mask.cpp:1852
Bimage::symmetrize
double symmetrize(Bsymmetry *sym, int flag)
Definition: Bimage.h:1192
RGB
Definition: Color.h:24
Bimage::split_channels
void split_channels()
The channels are split into individual images.
Definition: Bimage.cpp:1946
Bimage::calculate_background
int calculate_background(long nn, int flag)
Calculates the background for one sub-image.
Definition: Bimage_background.cpp:27
Bimage::place_with_addition
int place_with_addition(Bimage *p, long nn)
Packs a tile into a new composite image with addition within overlap.
Definition: Bimage_combine.cpp:240
Bimage::rotate_project
Bimage * rotate_project(Matrix3 mat, Vector3< double > translate, double radial_cutoff, int norm_flag=1)
Rotates a 3D map and projects it along the z-axis.
Definition: Bimage_project.cpp:118
Bimage::surface_to_topograph
Bimage * surface_to_topograph(double threshold, int dir=0)
Converts a 3D image to a 2D height image.
Definition: Bimage_topo.cpp:119
Bimage::transform
int transform(Vector3< double > scale, Vector3< double > origin, Vector3< double > translate, Matrix3 mat, int fill_type=0, double fill=0)
Transforms an image by translation, rotation, scaling and skewing, in place.
Definition: Bimage_transform.cpp:37
Bimage::kmeans_segment
Bimage * kmeans_segment(long nregion=2, long max_iter=10, double ratio=1)
Segments an image based on K-means.
Definition: Bimage_segment.cpp:1125
Bimage::fft_back
int fft_back()
Definition: Bimage.h:831
Bimage::levelmask_dilate
long levelmask_dilate()
Dilates a level mask.
Definition: Bimage_mask.cpp:1580
View
Definition: View.h:26
Bimage::fspace_weigh_accumulated_dose
int fspace_weigh_accumulated_dose(vector< double > dose)
Weighs an image's amplitudes with the accumulated dose.
Definition: Bimage_fspace.cpp:1561
Bsub_image::view
void view(double x, double y, double z, double a)
Definition: Bimage.h:157
Bimage::shift_wrap
int shift_wrap(Vector3< double > vec)
Shifts an image.
Definition: Bimage_transform.cpp:641
TypePointer::f
float * f
Definition: Bimage.h:78
Bimage::data_type_min
double data_type_min()
Get the minimum of a datatype.
Definition: Bimage.cpp:1633
Bimage::noise_uniform
int noise_uniform(double rmin, double rmax)
Generates an image with a uniform random distribution of densities.
Definition: Bimage_noise.cpp:34
fft_direction
int fft_direction
Definition: fft.h:19
Bimage::zero_origin
int zero_origin()
Shifts the origins to zero with wrapping.
Definition: Bimage_transform.cpp:722
Bimage::thickness
Bimage * thickness(double reference, double lambda)
Calculates a thickness based on intensities with respect to a reference.
Definition: Bimage_rescale.cpp:920
Bimage::find_shift
int find_shift(Bimage *pref, Bimage *pmask, double hires, double lores, double radius, double sigma, int refine_flag)
Calculates a cross-correlation map to find the shift for the pair of images.
Definition: Bimage_correlate.cpp:929
Bsub_image::FOM
double FOM()
Definition: Bimage.h:165
Bimage::rotate_find_shift
Vector3< double > rotate_find_shift(Matrix3 mat, double hires, double lores, double radius, double sigma, int refine_flag, fft_plan planf, fft_plan planb, double &cc)
Rotates and find shift by cross-correlation.
Definition: Bimage_correlate.cpp:1308
length
double length(vector< T > v)
Definition: Vector3.h:530
Bimage::region_flood
long region_flood(Bimage *pmask, double threshold_hi, double threshold_lo, double threshold_step, int fill_borders)
Creates and expands a region map from a starting to ending threshold value.
Definition: Bimage_segment.cpp:256
Bimage::image
Bsub_image * image
Definition: Bimage.h:202
Bimage::correct_background
int correct_background(long nn, int flag)
Corrects the background for one sub-image.
Definition: Bimage_background.cpp:202
Bsymmetry
Definition: symmetry.h:38
Bimage::maximum
double maximum()
Definition: Bimage.h:542
Bimage::symmetrize
double symmetrize(Bstring &symmetry_string, View ref_view, int flag)
Definition: Bimage.h:1196
Hermitian
@ Hermitian
Definition: Bimage.h:44
Bimage::tube_interpolate
double tube_interpolate(long i, int h, int k, double latconst, int zmin, int zmax, double radius, int norm_flag=1)
Definition: Bimage_helix.cpp:73
Bimage::enlarge
int enlarge(Vector3< long > scale)
Enlarges an image by an inetger scale.
Definition: Bimage_resize.cpp:499
Bimage::internal_volume
Bimage * internal_volume(double threshold)
Calculates the internal volume of a shell.
Definition: Bimage_segment.cpp:934
Bimage::bin_around_origin
Bimage * bin_around_origin(int bin)
Bins by an integer size making sure the origin falls on a binned voxel, and returns a new image.
Definition: Bimage_bin.cpp:331
TVector3
@ TVector3
Definition: Bimage.h:61
Bimage::phase_colour_wheel
int phase_colour_wheel()
Generates a phase color wheel.
Definition: Bimage_color.cpp:574
Bimage::filter_rank
int filter_rank(long kernel_size, double rank)
Applies a median filter to an image.
Definition: Bimage_filter.cpp:1021
Bimage::symmetry_equivalent_cyclic
Matrix3 symmetry_equivalent_cyclic(Bimage *pref, Bimage *pmask, Bsymmetry *sym)
Finds the cyclic symmetry equivalent orientation of a particle with respect to a template.
Definition: Bimage_symmetry.cpp:776
Bimage::place_central_part
int place_central_part(Bimage *p, long nn)
Packs a tile into a new composite image, retaining only the central part.
Definition: Bimage_combine.cpp:356
Bimage::radial_shells
int radial_shells()
Calculates an image with slices representing radial shell projections.
Definition: Bimage_polar.cpp:856
Bimage::standard_deviation
double standard_deviation()
Definition: Bimage.h:544
Bimage::integer_interpolation
int integer_interpolation(int integer_factor)
Definition: Bimage_bin.cpp:16
Bimage::rgba
RGBA< double > rgba(long j)
Returns a color value at the given index.
Definition: Bimage.cpp:1069
ps_plot.h
Header file for postscript output functions.
Bimage::ccmap_confidence
double ccmap_confidence(long nn)
Calculates a confidence level to associate with a cross-correlation peak.
Definition: Bimage_correlate.cpp:1950
Bimage::mask_by_thresholds
Bimage * mask_by_thresholds(vector< double > threshold)
Generates a mask based on an image at a given threshold.
Definition: Bimage_mask.cpp:129
Bimage::fft_back
int fft_back(fft_plan plan, bool norm_flag=1)
Definition: Bimage.h:838
Bimage::mask_dilate_erode
long mask_dilate_erode(unsigned char dir)
Dilates or erodes a binary mask.
Definition: Bimage_mask.cpp:366
Bimage::sampling
void sampling(long nn, double ux, double uy, double uz)
Definition: Bimage.h:517
Bsub_image::sampling
void sampling(vector< double > vec)
Definition: Bimage.h:129
Bimage::kernel_low
Vector3< long > kernel_low(long i, Vector3< long > k)
Definition: Bimage.h:480
Bimage::color_spectrum
Bimage * color_spectrum(double cmin, double cmax)
Colorizes an image to a spectrum.
Definition: Bimage_color.cpp:415
Bimage::cartesian_to_cylindrical
Bimage * cartesian_to_cylindrical(long nannuli, long nphi, int flag=0)
Calculates an image with cylindrical coordinates.
Definition: Bimage_polar.cpp:592
Bimage::refine_peak
int refine_peak()
Refines the position of a peak to sub-voxel resolution.
Definition: Bimage_correlate.cpp:1615
Bimage::fspace_weigh_FSC_curve
int fspace_weigh_FSC_curve(Bplot *plot, double resolution=0)
Weighs an image's amplitudes with a given FSC curve.
Definition: Bimage_fspace.cpp:1365
Bimage::complex_apply_dual_mask
int complex_apply_dual_mask(Bimage *pmask)
Applies a dual mask to a complex image.
Definition: Bimage_complex.cpp:581
Standard
@ Standard
Definition: Bimage.h:42
Bimage::extract_slice
Bimage * extract_slice(long nz)
Extracts a given slice or slices from an image.
Definition: Bimage_extract.cpp:1036
planf
fft_plan planf
Definition: bico.cpp:24
Bimage::convolve
int convolve(Bimage *pkernel)
Convolves an image with an arbitrary size convolution filter.
Definition: Bimage_filter.cpp:473
Bimage::filament_density
Bimage * filament_density(double width)
Estimates the density per pixel length of a filament.
Definition: Bimage_helix.cpp:1688
Bimage::rotate_and_add
int rotate_and_add(Bimage *p, Vector3< double > origin, View view)
Rotates an image to a specified view and adds it to another image.
Definition: Bimage_transform.cpp:512
Bimage::shell_wrap
int shell_wrap(long nn, Vector3< double > center, double minrad, double maxrad, double width, int fill_type=0, double fill=0)
Fills a shell within an image with a uniform value with wrapping.
Definition: Bimage_edit.cpp:656
Bimage::radial_fit
double * radial_fit(Bimage *pref)
Fits a radial profile to a reference radial profile.
Definition: Bimage_polar.cpp:328
Bimage::phase_shift
int phase_shift(Vector3< double > shift)
Phase shifts a complex image.
Definition: Bimage_complex.cpp:256
Bimage::complex_conjugate_product_one2many
Bimage * complex_conjugate_product_one2many(Bimage *p)
Calculates the product of a complex image with the conjugate of a second.
Definition: Bimage_complex.cpp:490
Bimage::rgba_to_rgb
void rgba_to_rgb()
The alpha channel is delete from an RGBA color image.
Definition: Bimage_color.cpp:149
Bimage::kernel_max_wrap
long kernel_max_wrap(long idx, long ksize)
Finds the highest value in a kernel with wrapping.
Definition: Bimage.cpp:2965
Bimage::fspace_normalize
int fspace_normalize()
Normalizes an image's amplitudes.
Definition: Bimage_fspace.cpp:1634
Bimage::vector3
Vector3< double > vector3(long j)
Returns a 3-value vector at the given index.
Definition: Bimage.cpp:1041
Bimage::mask_fspace_resize
Vector3< double > mask_fspace_resize(Vector3< long > nusize)
Resizes a reciprocal space mask.
Definition: Bimage_mask.cpp:684
Bimage::delete_images
long delete_images(Bstring list, int retain=0)
Retains or deletes sub-images from a multi-image structure.
Definition: Bimage.cpp:2156
Bsub_image::Bsub_image
Bsub_image()
Initializes a sub-image.
Definition: Bimage.cpp:24
Color.h
Classes for color objects.
Bimage::density
double density(long nn, Vector3< double > coord, double radius, double &sigma)
Calculates the density in a sphere around a coordinate in an image.
Definition: Bimage.cpp:3012
Bimage::fspace_2D_interpolate
int fspace_2D_interpolate(Complex< float > cv, Vector3< double > m, double part_weight, int interp_type)
Interpolates a 2D image for packing ito a 3D reciprocal space volume.
Definition: Bimage_reconstruct.cpp:25
Bimage::images_to_slices
int images_to_slices()
Changes the 2D images to slices in a 3D image.
Definition: Bimage.cpp:2115
Bimage::local_filter
Bimage * local_filter(Bimage *pmask, int mask_level, Bimage *resmap, int size, Vector3< long > vedge)
Applies a local resolution filter to a map.
Definition: Bimage_resolution.cpp:782
Bimage::radial_coverage
Bimage * radial_coverage(double threshold, double rad_step=1)
Calculates the coverage in each radial shell.
Definition: Bimage_polar.cpp:1193
Bimage::index_wrap
long index_wrap(Vector3< long > coor) const
Definition: Bimage.h:423
Bimage::images
long images()
Definition: Bimage.h:504
Bimage::red_white_blue
Bimage * red_white_blue(double red_min, double white_min, double white_max, double blue_max)
Colorizes an image with blue positive and red negative.
Definition: Bimage_color.cpp:478
Bsub_image::background
double background()
Definition: Bimage.h:125
Bsub_image::maximum
double maximum()
Definition: Bimage.h:118
Bimage::unpack_combined_transform
Bimage * unpack_combined_transform()
Unpacks a complex transform obtained from two real images.
Definition: Bimage_complex.cpp:749
Bimage::mass_threshold
double mass_threshold(long img_num, double mol_weight, double rho)
Finds the density threshold associated with a particular molecular weight.
Definition: Bimage_segment.cpp:820
Matrix3
Definition: Matrix3.h:18
Bsub_image::origin
void origin(double x, double y, double z)
Definition: Bimage.h:136
Bimage::levelmask_clean
long levelmask_clean()
Removes empty levels from a multi-level mask.
Definition: Bimage_mask.cpp:2061
Bimage::data_offset
void data_offset(long doff)
Definition: Bimage.h:289
Bimage::multiply
void multiply(long j, Complex< double > cv)
Definition: Bimage.h:325
TSimple
@ TSimple
Definition: Bimage.h:59
Bimage::background
void background(long nn, double bkg)
Definition: Bimage.h:552
Bimage::fspace_default_bands
vector< double > fspace_default_bands(double res_lo, double res_hi)
Sets up default frequency space bands to generate a mask.
Definition: Bimage_mask.cpp:773
Bimage::project
Bimage * project(char axis, int flags=1)
Projects a 3D image to a 2D image down one of the three major axes.
Definition: Bimage_project.cpp:31
Bimage::change_transform_size
Vector3< double > change_transform_size(Vector3< long > nusize)
Resizes a "standard" transform.
Definition: Bimage_fft.cpp:239
Bsub_image::real_coordinates
Vector3< double > real_coordinates(Vector3< long > ic)
Definition: Bimage.h:148
Bimage::shift_background
int shift_background(double bkg)
Sets the background for each sub-image to a given value.
Definition: Bimage_background.cpp:351
Bimage::kernel_max
long kernel_max(long idx, long ksize)
Finds the highest value in a kernel.
Definition: Bimage.cpp:2899
Bimage::orient
Bimage * orient(View *views)
Calculates multiple copies oriented according to views.
Definition: Bimage_transform.cpp:529
Bimage::fspace_weigh_C_curve
int fspace_weigh_C_curve(double resolution=0)
Weighs an image's amplitudes with the carbon scattering curve.
Definition: Bimage_fspace.cpp:1226
Bimage::add
void add(long j, double v)
Definition: Bimage.h:321
Bimage::quadric_correct
int quadric_correct(vector< double > param)
Corrects for a quadric surface.
Definition: Bimage_rescale.cpp:826
Bimage::distort_elliptically
int distort_elliptically(double angle, double shift)
Transforms a tubular cylinder to an elliptical profile.
Definition: Bimage_helix.cpp:779
Bimage::gradient_correction
int gradient_correction()
Calculates and corrects for a linear gradient across an image.
Definition: Bimage_rescale.cpp:752
Bimage::align_progressive_fast
Bimage * align_progressive_fast(long nref, double shift_limit)
Aligns and sums a set of sub-images using a progressive algorithm.
Definition: Bimage_align.cpp:138
Bimage::nad_2D
Bimage * nad_2D(double ht, double lambda, double C, double alpha)
Denoises a 2D image by non-linear anisotropic diffusion.
Definition: Bimage_nad.cpp:552
Bimage::index
long index(long nx, long ny, long nz) const
Definition: Bimage.h:399
Bimage::combined_complex_product_implicit_mask
int combined_complex_product_implicit_mask(double hires, double lores)
Calculates the complex conjugate product of a complex image resulting from combining and Fourier tran...
Definition: Bimage_complex.cpp:1090
Bimage::origin
void origin(long nn, vector< double > ori)
Definition: Bimage.h:585
Bimage::pack_transform
int pack_transform(unsigned char *data, FourierType tf)
Definition: Bimage.cpp:2441
Bimage::replicate_asymmetric_unit
int replicate_asymmetric_unit(Bsymmetry *sym)
Calculates a full map from one asymmetric unit.
Definition: Bimage_symmetry.cpp:971
Bimage::sizeY
void sizeY(long ny)
Definition: Bimage.h:391
Bimage::alloc_size
long alloc_size() const
Definition: Bimage.h:267
Bimage::file_name
string & file_name()
Definition: Bimage.h:246
Bimage::radial_symmetry_adjusted
Bimage * radial_symmetry_adjusted(double rad_start, double rad_end, double rad_step, double spherical_fraction, Bsymmetry *sym)
Calculates the symmetry-adjusted radial average of an image.
Definition: Bimage_polar.cpp:209
Bimage::resize_wrap
int resize_wrap(Vector3< long > nusize, Vector3< long > translate)
Resizes without interpolation or rescaling.
Definition: Bimage_resize.cpp:202
Bimage::correlate
double correlate(Bimage *p)
Calculates correlation coefficient between two images.
Definition: Bimage_correlate.cpp:36
Bimage::slices_to_images
int slices_to_images()
Changes the slices in a 3D image into a set of 2D images.
Definition: Bimage.cpp:2074
Bimage::average
void average(double d)
Definition: Bimage.h:547
Bimage::helix_segment_correlation_one
int helix_segment_correlation_one(long i, double angle_start, double angle_end, double angle_step, int bin, double hires, double lores, double radius, fft_plan planf, fft_plan planb, double *cc)
Definition: Bimage_helix.cpp:1133
Bsub_image::view
View view()
Definition: Bimage.h:160
Bimage::fft
int fft()
Definition: Bimage.h:830
JSvalue::exists
bool exists(string tag)
Definition: json.h:221
Bimage::fspace_translate
int fspace_translate(Vector3< double > shift)
Translates an image in frequency space to avoid interpolation.
Definition: Bimage_fspace.cpp:147
Bimage::sizeZ
long sizeZ() const
Definition: Bimage.h:395
Bimage::noise_logistical
int noise_logistical(double ravg, double rstd)
Generates an image with a gaussian random distribution of densities.
Definition: Bimage_noise.cpp:156
Bimage::mask_stats
long mask_stats()
Calculates statistics for a mask.
Definition: Bimage_mask.cpp:165
Bimage::image_size
long image_size()
Definition: Bimage.h:290
TRGBA
@ TRGBA
Definition: Bimage.h:64
Bimage::mask_shell
long mask_shell(Vector3< double > origin, double rad_min, double rad_max)
Definition: Bimage.h:1328
Bimage::histogram_thresholds
int histogram_thresholds(double &tmin, double &tmax)
Calculates minimum and maximum thresholds for truncation.
Definition: Bimage_histogram.cpp:421
Bsub_image::standard_deviation
void standard_deviation(double d)
Definition: Bimage.h:124
Bimage::interpolate_gaps
int interpolate_gaps(long step)
Interpolate the voxels that are not calculated.
Definition: Bimage_edit.cpp:933
Bimage::data_offset
long data_offset()
Definition: Bimage.h:288
Bimage::operator[]
JSvalue & operator[](string tag)
Definition: Bimage.h:235
Bimage::rotate
int rotate()
Rotates an image using parameters defined in the image in place.
Definition: Bimage_transform.cpp:255
Bimage::radial_to_full
Bimage * radial_to_full(Vector3< long > nusize, Vector3< double > origin)
Generates a full 2D or 3D image from a radial profile in a 1D image.
Definition: Bimage_polar.cpp:412
Bimage::normalize_local
int normalize_local(long kernel_size)
Normalizes by subtracting local average and dividing by local standard deviation.
Definition: Bimage_rescale.cpp:608
Bimage::fourier_type
FourierType fourier_type()
Definition: Bimage.h:380
Bimage::complex_conjugate
void complex_conjugate()
Calculates the complex conjugate image.
Definition: Bimage_complex.cpp:183
Bimage::noise_gaussian
int noise_gaussian(double ravg=0, double rstd=1)
Generates an image with a gaussian random distribution of densities.
Definition: Bimage_noise.cpp:72
Bimage::levelmask_region_size
int levelmask_region_size()
Convert a mask to reflect region sizes.
Definition: Bimage_mask.cpp:2184
Bimage::bin_copy
Bimage * bin_copy(long b)
Definition: Bimage.h:1298
Bimage::cross_correlate_fspace
Bimage * cross_correlate_fspace(Bimage *p, double hires, double lores, double shift_limit)
Calculates a cross-correlation map by Fast Fourier transformation.
Definition: Bimage_correlate.cpp:559
Bimage::power_spectrum
int power_spectrum(int flags=0)
Calculates a power spectrum.
Definition: Bimage_powerspectrum.cpp:48
Bimage::mask_by_threshold
Bimage * mask_by_threshold(double threshold)
Generates a mask based on an image at a given threshold.
Definition: Bimage_mask.cpp:93
Bimage::superpixels
vector< Bsuperpixel > superpixels(long step, double colorweight=0.2, long iterations=10, double stop=1)
Segment the image into superpixels.
Definition: Bimage_segment.cpp:1872
Bimage::rotate_cross_correlate
Vector3< double > rotate_cross_correlate(Bimage *pref, View view, double hires, double lores, double search_radius, Bimage *pmask, double &cc, fft_plan planf, fft_plan planb)
Definition: Bimage_correlate.cpp:801
Bimage::data_type_max
double data_type_max()
Get the maximum of a datatype.
Definition: Bimage.cpp:1663
Bimage::data_size
long data_size()
Definition: Bimage.h:270
Bimage::cmyk_to_rgb
void cmyk_to_rgb()
Converts a CMYK color image to RGB.
Definition: Bimage_color.cpp:206
Bimage::meta_data
JSvalue & meta_data()
Definition: Bimage.h:234
Bimage::hanning_taper
int hanning_taper(double fill=0)
Apply Hanning taper window to the image.
Definition: Bimage_edit.cpp:388
Bimage::stats_in_poly
long stats_in_poly(long nn, int nvert, Vector3< double > *poly, double &vavg, double &vstd)
Calculates the statistics for an image within the given polyhedron.
Definition: Bimage_stats.cpp:419
Bimage::truncate_to_avg
int truncate_to_avg(double minim, double maxim)
Sets voxels in image data exceeding a given minimum and maximum to the average.
Definition: Bimage_rescale.cpp:349
Bimage::region_assign
long region_assign(Bimage *pmask, long idx, long region_number, double threshold, int sign)
Finds all the pixels that are part of the same region.
Definition: Bimage_segment.cpp:119
TypePointer::ss
short * ss
Definition: Bimage.h:73
TRGB
@ TRGB
Definition: Bimage.h:63
Bimage::data_pointer
void data_pointer(unsigned char *ptr)
Definition: Bimage.h:286
Bimage::graph_segment
Bimage * graph_segment(int type=1, Bimage *pmask=NULL, int connect_type=0, double complexity=0, long min_size=0, int return_type=0)
Graph-based segmentation of an image.
Definition: Bimage_segment.cpp:1443
Bimage::cylinder
int cylinder(Vector3< double > center, double radius, double height, double width, int fill_type=0, double fill=0)
Fills a cylinder within an image with a uniform value.
Definition: Bimage_edit.cpp:467
Bimage::extract_show
Bimage * extract_show(int aflag)
Converts a slice from an image to a 2D plane for display.
Definition: Bimage_extract.cpp:816
Bimage::transform_lines
int transform_lines()
Definition: Bimage_helix.cpp:1300
CMYK
Definition: Color.h:264
Bimage::smallest
void smallest(Bimage *p)
Selects the smallest of each pixel from two images.
Definition: Bimage.cpp:3733
Bimage::place_with_overlap
int place_with_overlap(Bimage *p, long nn)
Packs a tile into a new composite image with weighted overlap.
Definition: Bimage_combine.cpp:282
Bimage::divide_one
void divide_one(Bimage *p, double scale=1, double shift=0)
Divides the first image by the first sub-image of the second.
Definition: Bimage.cpp:3635
Bimage::divide
void divide(Bimage *p, double scale=1, double shift=0)
Divides the first image by the second.
Definition: Bimage.cpp:3582
Bimage::back_project
int back_project(Bimage *p, double resolution, double axis, fft_plan planf, fft_plan planb)
Definition: Bimage_project.cpp:437
Bimage
General image parameter class.
Definition: Bimage.h:177
Bimage::align_fast
JSvalue align_fast(long ref_num, Bimage *pmask, double hi_res, double lo_res, double shift_limit, double edge_width, double gauss_width)
Aligns and sums a set of sub-images, first progressively and then iteratively.
Definition: Bimage_align.cpp:361
Bimage::compound_type
CompoundType compound_type()
Definition: Bimage.h:364
Bimage::shape
int shape(int type, Vector3< long > rect, Vector3< double > start, double width, int fill_type=0, double fill=0)
Creates a shape in an image and fills it with a constant value.
Definition: Bimage_edit.cpp:105
Bimage::size
void size(vector< long > vec)
Definition: Bimage.h:389
Bimage::set_max
void set_max(double xx, double yy, double zz, long nn, double v)
Sets a value at a given location to neigboring data elements if it is larger.
Definition: Bimage.cpp:1303
Bimage::data_type_string
Bstring data_type_string()
Get the string representation of a datatype.
Definition: Bimage.cpp:1689
Bimage::extract_tiles
Bimage * extract_tiles(long nn, vector< Vector3< long >> &coords, Vector3< long > tile_size)
Extracts a set of tiles at specified positions from an image into a new image.
Definition: Bimage_extract.cpp:331
Bimage::interpolate_wrap
double interpolate_wrap(long cc, double xx, double yy=0, double zz=0, long nn=0) const
Interpolates using a given location with wrapping.
Definition: Bimage.cpp:1524
Bimage::align2D
double align2D(Bimage *pref, double res_polar, int ann_min, int ann_max, Bimage *prs_mask, double shift_limit, double angle_limit, fft_plan planf_1D, fft_plan planb_1D, fft_plan planf_2D, fft_plan planb_2D)
Finds the best in-plane alignment for two 2D images using polar power spectra.
Definition: Bimage_align.cpp:881
Bimage::rotate_height
Bimage * rotate_height(Matrix3 mat, Vector3< double > translate, double threshold=0)
Rotates a 3D map and calculates the height along the z-axis.
Definition: Bimage_topo.cpp:164
Bimage::power
void power(double v)
Calculates the power of an image.
Definition: Bimage.cpp:3291
Bimage::index
long index(long nx, long ny, long nz, long nn) const
Definition: Bimage.h:402
Bimage::mask_region_interfaces
long mask_region_interfaces(int reg_num)
Reports the whole interface matrix or interfaces for one region only.
Definition: Bimage_mask.cpp:2365
Bimage::data_alloc
unsigned char * data_alloc()
Definition: Bimage.h:271
Bimage::fspace_interpolate
Complex< double > fspace_interpolate(long img_num, Vector3< double > m, FSI_Kernel *kernel)
Calculates the complex value at an image location by kernel-based interpolation.
Definition: Bimage_fspace.cpp:85
Bimage::extrude_cross_section
int extrude_cross_section(long length, double helix_rise, double helix_angle, int fill_type, double fill)
Extrudes a 2D cross section into a 3D continuous helix.
Definition: Bimage_helix.cpp:1531
Vector3.h
Class for 3-value vectors.
Bimage::fspace_reconstruction_stats
int fspace_reconstruction_stats(double resolution, double sampling_ratio=1)
Calculates Fourier shell statistics.
Definition: Bimage_reconstruct.cpp:452
Bimage::color_to_simple
void color_to_simple()
A color image is converted to a simple image.
Definition: Bimage_color.cpp:94
Bimage::mask_pack_plane
long mask_pack_plane(Matrix3 mat, double hi_res, double scale)
Packs a 2D mask into a 3D reciprocal space volume.
Definition: Bimage_mask.cpp:1244
UnitCell::a
void a(double d)
Definition: UnitCell.h:36
Bimage::filter_rank_chunk
int filter_rank_chunk(long kernel_size, double rank, float *nudata, long i, long len)
Definition: Bimage_filter.cpp:940
Bimage::check_neighbors
long check_neighbors(long idx)
Check neighbors in region map and assign a value if a neighbor is assigned.
Definition: Bimage_segment.cpp:406
Bimage::mask
long mask(Bimage *pmask, double fill)
Masks an image.
Definition: Bimage_mask.cpp:26
Bimage::resolution_prepare
Bimage * resolution_prepare(Bimage *p)
Definition: Bimage_resolution.cpp:17
JSvalue
Definition: json.h:53
JSvalue::value
string & value()
Definition: json.h:134
Bimage::extract
Bimage * extract(long nn, Vector3< double > loc, Vector3< long > size, Vector3< double > origin)
Definition: Bimage.h:664
Bimage::show_scale
void show_scale(double scale)
Definition: Bimage.h:564
Bimage::kernel_max_neigbor
long kernel_max_neigbor(long idx, long ksize)
Finds the highest value in a kernel excluding the central voxel.
Definition: Bimage.cpp:2931
Bimage::levelmask_asymmetric_units
Bimage * levelmask_asymmetric_units(Bsymmetry *sym, int index)
Calculates a multi-level mask to indicate asymmetric units.
Definition: Bimage_symmetry.cpp:898
Bimage::replace
int replace(Bimage *img)
Replaces the data with that from the given image.
Definition: Bimage.cpp:2830
Bimage::powerspectrum_tilted
Bimage * powerspectrum_tilted(long img_num, Vector3< long > tile_size, double tilt_axis, double tilt_angle, double defocus, double iCL2, int flags=0)
Prepares a tiled powerspectrum from a tilted image for determining CTF parameters.
Definition: Bimage_powerspectrum.cpp:272
Bimage::fix_type
void fix_type()
Determines the replacement data type.
Definition: Bimage.cpp:1740
Bimage::fsc_local
Bimage * fsc_local(Bimage *p, Bimage *pmask, double resolution, double *cutoff, int mask_level, int size, int pad, Vector3< long > vedge, int step=1, int taper=1, double fill=0)
Determine the local resolution at each masked voxel in a map.
Definition: Bimage_resolution.cpp:592
Bimage::index
long index(Vector3< long > vox, long nn) const
Definition: Bimage.h:408
Bimage::place
int place(long nn, Bimage *p, Vector3< double > loc, double radius=0, double scale=1, double shift=0, int operation=0)
Places a small image into a large image.
Definition: Bimage_combine.cpp:176
Bimage::fspace_weigh
int fspace_weigh(long maxrad, double *curve, int flag=0)
Definition: Bimage_fspace.cpp:795
Bimage::find_point_group
double find_point_group(Bsymmetry *sym, double angle_step, int binfac, double hires, double lores, int flags)
Finds the orientation for an image with a specific point group symmetry.
Definition: Bimage_symmetry.cpp:299
Bstring.h
Header file for the string class.
Bimage::bin
int bin(long b)
Definition: Bimage.h:1293
TMulti
@ TMulti
Definition: Bimage.h:66
Bimage::complex
Complex< double > complex(long j)
Returns a complex value at the given index.
Definition: Bimage.cpp:1027
Centered
@ Centered
Definition: Bimage.h:43
Bimage::radial_sections
Bimage * radial_sections(double rad_start, double rad_end, double rad_step, double spherical_fraction, Bsymmetry *sym, int fill_type=FILL_USER, double fill=0)
Calculates an image with slices giving the radial section projections.
Definition: Bimage_polar.cpp:1134
Bimage::levelmask_size_histogram
Bplot * levelmask_size_histogram()
Color a multi-level mask based on the volumes of regions.
Definition: Bimage_mask.cpp:2215
Bimage::sum_images
void sum_images()
Adds all sub-images.
Definition: Bimage.cpp:3306
Bimage::clear
void clear()
Definition: Bimage.h:705
Bimage::quadric_fit
vector< double > quadric_fit()
Fits the whole image to a quadric surface.
Definition: Bimage_rescale.cpp:862
Bimage::assemble_tiles
int assemble_tiles(Bimage *pt, int flag=0)
Assembles overlapping tiles into this image.
Definition: Bimage_combine.cpp:433
Bimage::truncate_to_min_max
int truncate_to_min_max(double minim, double maxim)
Truncates image data to a given minimum and maximum.
Definition: Bimage_rescale.cpp:331
Bimage::center_wrap
int center_wrap()
Centers an image with wrapping.
Definition: Bimage_transform.cpp:708
Bimage::plot
Bplot * plot()
Converts a one-dimensional image into a plot.
Definition: Bimage.cpp:3839
Bimage::change_symmetry
int change_symmetry(Bsymmetry *symold, Bsymmetry *symnu, double radius, double z_slope)
Changes the symmetry order for cyclic and dihedral maps.
Definition: Bimage_symmetry.cpp:583
Bimage::compound_type_size
long compound_type_size()
Definition: Bimage.h:368
Bsub_image::select
void select(long i)
Definition: Bimage.h:168
Bimage::apply_soft_mask
long apply_soft_mask(long nn, Bimage *pmask, int fill_type, double fill)
Applies a soft mask to a sub-image.
Definition: Bimage_mask.cpp:2516
Bimage::complex_power
double complex_power()
Calculates the power in a complex image.
Definition: Bimage_complex.cpp:200
Bimage::data_alloc_and_clear
unsigned char * data_alloc_and_clear()
Definition: Bimage.h:272
Bimage::region_peaks
Bimage * region_peaks(long kernel_size, double threshold, int flood=0, int wrap=0)
Generates a segmented image from peaks above a threshold value.
Definition: Bimage_segment.cpp:457
Bimage::extract_magnify
Bimage * extract_magnify(long nn, Vector3< long > center, Vector3< long > ext_size, double scale)
Extracts a region from an image to magnify.
Definition: Bimage_extract.cpp:872
Bimage::data_alloc_and_clear
unsigned char * data_alloc_and_clear(DataType type, CompoundType ctype, long nx, long ny, long nz, long nn)
Definition: Bimage.h:277
Bimage::show_minimum
void show_minimum(double v)
Definition: Bimage.h:567
Bimage::montage
Bimage * montage(int first, int cols, int rows, int skip=0, int flipy=0)
Rearranges an image into a montage of 2D slices for display.
Definition: Bimage_montage.cpp:49
Bimage::interpolate_wrap
double interpolate_wrap(Vector3< double > vec, long nn=0) const
Definition: Bimage.h:358
Bimage::file_name
void file_name(string s)
Definition: Bimage.h:245
Bimage::histogram_poisson_fit
Bplot * histogram_poisson_fit(long bins, int flag=0)
Fits a poisson function to a histogram of an image.
Definition: Bimage_histogram.cpp:977
CompoundType
CompoundType
Compound data type specifier.
Definition: Bimage.h:58
Bimage::show_image
void show_image(long nn)
Definition: Bimage.h:560
Bimage::density
double density(long nn, Vector3< double > coord, double radius)
Definition: Bimage.h:711
Bimage::convolve_chunk
int convolve_chunk(Bimage *pkernel, float *nudata, long i, long len)
Definition: Bimage_filter.cpp:392
Bimage::subtract
void subtract(Bimage *p)
Subtracts another image from an image.
Definition: Bimage.cpp:3406
Bimage::fspace_bandpass
int fspace_bandpass(double res_hi, double res_lo=0, double width=0)
Applies a bandpass filter to an image.
Definition: Bimage_fspace.cpp:496
Bimage::pps_angular_correlation
vector< double > pps_angular_correlation(Bimage *pref, double res_hi, double res_lo, long nang, fft_plan planf)
Definition: Bimage_align.cpp:720
Bimage::peak_sigma
double peak_sigma(long nn, Vector3< long > coor, long kernel_size)
Calculates a sigma value for a cross-correlation peak.
Definition: Bimage_correlate.cpp:2006
Bimage::fspace_maximum_radius
long fspace_maximum_radius(double resolution, double sampling_ratio=1)
Calculates the maximum radius in frequency space from a given resolution.
Definition: Bimage_fspace.cpp:26
Bimage::data_type
DataType data_type()
Definition: Bimage.h:362
Bimage::kernel_high
Vector3< long > kernel_high(long i, Vector3< long > k)
Definition: Bimage.h:486
Bimage::fspace_weigh_B_factor
int fspace_weigh_B_factor(double B, double resolution=0)
Weighs an image's amplitudes with B-factor (gaussian) curve.
Definition: Bimage_fspace.cpp:1183
Bimage::powerspectrum_tilt_axis
Bimage * powerspectrum_tilt_axis(long img_num, Vector3< long > tile_size, double tilt_axis, double tilt_offset, int flags=0)
Prepares a tiled powerspectrum from a tilted image for determining CTF parameters.
Definition: Bimage_powerspectrum.cpp:154
Bimage::percentiles
Bplot * percentiles()
Calculates the percentiles from the histogram of an image.
Definition: Bimage_histogram.cpp:344
Bimage::color_blue
int color_blue(double cmin, double cmax, int flag=0)
Converts a gray-scale image to blue.
Definition: Bimage_color.cpp:337
Bimage::kernel_gaussian
int kernel_gaussian(double sigma, double max)
Generates a gaussian kernel image.
Definition: Bimage_filter.cpp:34
Bimage::fspace_amp_threshold
int fspace_amp_threshold(double threshold)
Filters the amplitudes of the Fourier transform of an image.
Definition: Bimage_fspace.cpp:368
Bimage::extract_show_chunk
int extract_show_chunk(Bimage *pshow, int aflag, long i, long len)
Definition: Bimage_extract.cpp:700
RGBA
Definition: Color.h:162
Bimage::data_delete
void data_delete()
Deallocates the image data.
Definition: Bimage.cpp:897
Bimage::check_point_group
double check_point_group(Bstring &check_string)
Checks for the requested symmetries.
Definition: Bimage_symmetry.cpp:112
Bsub_image::magnification
double magnification()
Definition: Bimage.h:163
Bimage::check_resolution
void check_resolution(double &resolution)
Checks that the resolution falls within reasonable limits.
Definition: Bimage.cpp:635
Bimage::fspace_normalize_radial
int fspace_normalize_radial(Bimage *pmask, double resolution=0, int flag=0)
Normalizes an image's amplitudes.
Definition: Bimage_fspace.cpp:1662
Bimage::pad_copy
Bimage * pad_copy(long sz, int fill_type=0, double fill=0)
Pads an image to a new size with a given fill value.
Definition: Bimage_resize.cpp:388
Bimage::interpolate
double interpolate(double xx, double yy=0, double zz=0, long nn=0, double fill=0) const
Definition: Bimage.h:332
Bimage::read_data
unsigned char * read_data(ifstream *fimg, int img_select, int sb, int vax, long pad)
Read image data in a generalized style.
Definition: Bimage.cpp:2207
Bimage::interpolate
double interpolate(long cc, double xx, double yy=0, double zz=0, long nn=0, double fill=0) const
Interpolates using a given location.
Definition: Bimage.cpp:1414
Bimage::tile_coordinates
vector< Vector3< long > > tile_coordinates(Vector3< long > &start, Vector3< long > &region, Vector3< long > &tile_size, Vector3< long > &step_size, int exceed)
Generates a set of tile coordinates for an image.
Definition: Bimage_extract.cpp:259
Bimage::complex_normalize
double complex_normalize()
Normalizes the power in a complex image.
Definition: Bimage_complex.cpp:225
TypePointer
Definition: Bimage.h:69
Bimage::symmetry_equivalent
Matrix3 symmetry_equivalent(Bimage *ptemp, Bimage *pmask, Bsymmetry *sym)
Finds the symmetry equivalent orientation of a particle with respect to a template.
Definition: Bimage_symmetry.cpp:654
Bimage::moments
int moments(long max_order)
Prints out moments for all sub-images.
Definition: Bimage.cpp:2607
Bimage::mask_missing_wedge
long mask_missing_wedge(Vector3< double > origin, double tilt_axis, double tilt_neg, double tilt_pos, double resolution)
Generates a mask with a missing wedge.
Definition: Bimage_mask.cpp:893
Bimage::levelmask_collapse
long levelmask_collapse()
Collapse a multi-level mask to a binary mask.
Definition: Bimage_mask.cpp:1500
Bimage::nad
Bimage * nad(double ht, long zw, double lambda, double C, double alpha)
Denoises a 3D density map by non-linear anisotropic diffusion.
Definition: Bimage_nad.cpp:578
Bimage::origin
void origin(Vector3< double > vec)
Definition: Bimage.h:578
isfinite
bool isfinite(complex< T > &value)
Bimage::impose_superpixels
int impose_superpixels(Bimage *pmask, vector< Bsuperpixel > &seg, int impose)
Impose superpixel features onto an image.
Definition: Bimage_segment.cpp:2045
init_point_group_symmetry
Bsymmetry * init_point_group_symmetry(Bstring symmetry_string)
Sets up a symmetry structure from a string identifier.
Definition: symmetry.cpp:39
Bimage::complex_to_amplitudes
void complex_to_amplitudes()
The amplitudes from a complex image is written to a simple image.
Definition: Bimage_complex.cpp:114
Bimage::extract_shell
Bimage * extract_shell(long nn, double minrad, double maxrad)
Extracts a shell from an image into a new image.
Definition: Bimage_extract.cpp:193
Bimage::origin
void origin(double ox, double oy, double oz)
Definition: Bimage.h:570
Bimage::mask_invert
long mask_invert()
Inverts a mask.
Definition: Bimage_mask.cpp:220
TCMYK
@ TCMYK
Definition: Bimage.h:65
Bimage::histogram_gauss_plot
Bplot * histogram_gauss_plot(long bins, long ngauss=1)
Fits a gaussian function to a histogram of an image.
Definition: Bimage_histogram.cpp:702
Bimage::complex_to_phases
void complex_to_phases()
The phases from a complex image is written to a simple image.
Definition: Bimage_complex.cpp:161
Bimage::fspace_reconstruction_add
long fspace_reconstruction_add(Bimage *p)
Adds all components to a reconstruction.
Definition: Bimage_reconstruct.cpp:384
TypePointer::sl
long * sl
Definition: Bimage.h:77
Bimage::fill_value
TypePointer fill_value(double v)
Definition: Bimage.cpp:1089
Bimage::fsc
Bplot * fsc(double hi_res, double sampling_ratio=1)
Definition: Bimage_resolution.cpp:245
Bsub_image::real_coordinates
Vector3< double > real_coordinates(long ix, long iy, long iz)
Definition: Bimage.h:145
Bsub_image::origin
void origin(Vector3< double > vec)
Definition: Bimage.h:137
Bimage::rgb_to_rgba
void rgb_to_rgba()
An alpha channel is added to a RGB color image.
Definition: Bimage_color.cpp:122
Bimage::fspace_pack_2D_into_central_section
long fspace_pack_2D_into_central_section(Bimage *p, long ft_size, double scale, double hi_res, double lo_res, Matrix3 matr, Matrix3 mat)
Packs a 2D Fourier transform into a central section of a 3D reciprocal space volume.
Definition: Bimage_reconstruct.cpp:212
Bimage::levelmask_add
long levelmask_add(Bimage *pmask, int add_level=1)
Adds a bilevel mask to a level mask.
Definition: Bimage_mask.cpp:1538
Bimage::change_type
void change_type(char letter)
Get the data type indicated by a single letter code.
Definition: Bimage.cpp:1765
Bimage::index
long index(long nx, long ny) const
Definition: Bimage.h:396
Bimage::refine_peak_new
int refine_peak_new()
Refines the position of a peak to sub-voxel resolution.
Definition: Bimage_correlate.cpp:1574
Bimage::query
vector< JSvalue * > query(string &path)
Definition: Bimage.h:238
Bimage::rotate_cross_correlate_two_way
double rotate_cross_correlate_two_way(Bimage *pref, double angle, double res_hi, double res_lo, double shift_limit, fft_plan planf, fft_plan planb)
Definition: Bimage_correlate.cpp:859
Bimage::variance_mask
Bimage * variance_mask(long kernel_size, double lowvar=1e-6, int bkg_flag=0)
Calculates a mask based on local variance.
Definition: Bimage_mask.cpp:1364
Bimage::extract_line
Bimage * extract_line(long nn, Vector3< double > start, Vector3< double > end, long width)
Extracts a line from an image into a new image.
Definition: Bimage_extract.cpp:505
Bimage::fspace_amp_one
int fspace_amp_one()
Sets all amplitudes to one.
Definition: Bimage_fspace.cpp:323
Bimage::unit_cell
UnitCell unit_cell()
Definition: Bimage.h:615
Bimage::square
void square()
Calculates the square of an image.
Definition: Bimage_rescale.cpp:678
Bimage::fourier_type
void fourier_type(FourierType tf)
Definition: Bimage.h:381
Bimage::complex_conjugate_product
int complex_conjugate_product(Bimage *p)
Calculates the product of a complex image with the conjugate of a second.
Definition: Bimage_complex.cpp:460
Bimage::meta_data_update
void meta_data_update()
Update metadata from the sub-image information.
Definition: Bimage.cpp:678
Bimage::mask_extract
Bimage * mask_extract(Bimage *pmask)
Zeroes everything outside the mask and return the excised feature.
Definition: Bimage_mask.cpp:293
Bimage::copy_header
Bimage * copy_header()
Definition: Bimage.h:658
Bimage::interpolate
double interpolate(long cc, Vector3< double > vec, long nn=0, double fill=0) const
Definition: Bimage.h:336
Bimage::search_volume_view
double search_volume_view(Bimage *ptemp, View view, double hires, double lores, Bimage *pmask, double threshold, Bimage *pfit)
Searches a 2D/3D density map for a template using a specific view.
Definition: Bimage_search.cpp:151
Bimage::topograph_to_surface
Bimage * topograph_to_surface(Bimage *psd, long nz, double density, double resolution)
Converts a 2D AFM image to a 3D density map.
Definition: Bimage_topo.cpp:39
Bimage::one_color
int one_color(int color, double cmin, double cmax, int flag=0)
Converts a gray-scale image to a single color.
Definition: Bimage_color.cpp:247
Bimage::polar_transform
Bimage * polar_transform(long nangles, long ann_min, long ann_max, long dann, long zmin, long zmax, long zinc)
Calculates an image with cylindrical coordinates by integration.
Definition: Bimage_polar.cpp:699
Bimage::compatible
bool compatible(Bimage *p)
Check if this image has the same number of channels and data type as another.
Definition: Bimage.cpp:653
TypePointer::si
int * si
Definition: Bimage.h:75
Bimage::fspace_pack_2D
int fspace_pack_2D(Bimage *p, Matrix3 mat, double hi_res, double lo_res, Vector3< double > scale, double part_weight=1, int interp_type=0)
Packs a 2D Fourier transform into a 3D reciprocal space volume.
Definition: Bimage_reconstruct.cpp:107
Bimage::stats_in_mask
long stats_in_mask(long nn, Bimage *pmask)
Calculates the statistics for an image for each level in a mask.
Definition: Bimage_stats.cpp:490
Bimage::index
long index(vector< long > vox, long nn) const
Definition: Bimage.h:411
Bimage::cross_correlate_two_way
Bimage * cross_correlate_two_way(Bimage *p, double hires, double lores, fft_plan planf, fft_plan planb)
Calculates a cross-correlation map by Fast Fourier transformation.
Definition: Bimage_correlate.cpp:667
Bimage::origin
void origin(vector< double > vec)
Definition: Bimage.h:574
Matrix.h
Generalized matrix class.
Bimage::filter_average
int filter_average(long kernel_size)
Applies an averaging filter to an image.
Definition: Bimage_filter.cpp:207
Bimage::linear_fit
double linear_fit(Bimage *p, Bimage *pmask, double max_exclude)
Linear least squares fit of two images.
Definition: Bimage_combine.cpp:477
Bimage::kernel_high
Vector3< long > kernel_high(long i, long k=1)
Definition: Bimage.h:476
Bimage::extract
Bimage * extract(long nn)
Extracts one sub-image into new image structure.
Definition: Bimage_extract.cpp:21
Bsub_image::FOM
void FOM(double d)
Definition: Bimage.h:166
fft_plan
fftwf_plan fft_plan
Definition: fft.h:20
View.h
View object.
TypePointer::d
double * d
Definition: Bimage.h:79
Bimage::mask_split
long mask_split(long voxels_per_level)
Converts a mask to a multilevel mask with a given number of voxels per level.
Definition: Bimage_mask.cpp:1450
Bimage::catenate
void catenate(long m, Bimage **p)
Catenates an array of images of the same size into a multi-image structure.
Definition: Bimage_combine.cpp:52
Bimage::check
void check()
Checks an image for reasonable properties.
Definition: Bimage.cpp:419
Bimage::periodic_averaging
Bimage * periodic_averaging(Vector3< double > period)
Calculates an average within a periodic frame.
Definition: Bimage_filter.cpp:1144
Bimage::rescale_to_min_max
int rescale_to_min_max(double numin, double numax)
Rescales the image data to a given minimum and maximum.
Definition: Bimage_rescale.cpp:100
Bimage::simple_to_rgb
void simple_to_rgb()
A simple image is converted to a color image.
Definition: Bimage_color.cpp:21
Bimage::space_group
long space_group()
Definition: Bimage.h:598
Bimage::fspace_sqrt_amp
int fspace_sqrt_amp()
Change the amlitudes to their square roots.
Definition: Bimage_fspace.cpp:424
Bsub_image::sampling
void sampling(double x, double y, double z)
Definition: Bimage.h:127
Bimage::fill
void fill(double v)
Definition: Bimage.h:706
Bsub_image::view_angle
double view_angle()
Definition: Bimage.h:162
Bimage::find_helix_parameters
Bplot * find_helix_parameters(double angle_start, double angle_end, double angle_step, int bin, double hires, double lores, double radius)
Finds the best helix parameters for helical map.
Definition: Bimage_helix.cpp:848
Bimage::page_size
void page_size(Vector3< long > vec)
Definition: Bimage.h:498
kill_symmetry
int kill_symmetry(Bsymmetry *sym)
Deallocates a symmetry structure.
Definition: symmetry.cpp:207
Bimage::powerspectrum_tiled_and_tilted
Bimage * powerspectrum_tiled_and_tilted(Vector3< long > tile_size, double tilt_axis, double tilt_angle, double tilt_offset, double defocus, double iCL2, int flags=0)
Prepares a tiled powerspectrum from a tilted image for determining CTF parameters.
Definition: Bimage_powerspectrum.cpp:356
Bimage::rotate_to_axis
long rotate_to_axis(Bsymmetry *sym, long axis, long axis_flag)
Rotates to a symmetry axis.
Definition: Bimage_symmetry.cpp:558
Bimage::noise_poisson
int noise_poisson(double ravg)
Generates an image with a poisson random distribution of densities.
Definition: Bimage_noise.cpp:115
Bimage::cmyk
CMYK< double > cmyk(long j)
Returns a color value at the given index.
Definition: Bimage.cpp:1083
Bimage::blobs
long blobs(double threshold, double min_size, double max_size, double setvalue, int sign)
Identifies contiguous regions above a given threshold (blobs) and eliminate those less than a minimum...
Definition: Bimage_segment.cpp:537
Bimage::show_minimum
double show_minimum()
Definition: Bimage.h:565
Bimage::subimage_information
int subimage_information()
Prints out header information for all sub-images.
Definition: Bimage.cpp:2571
Bsub_image::maximum
void maximum(double d)
Definition: Bimage.h:122
Bimage::filter_bilateral_chunk
int filter_bilateral_chunk(Bimage *pkernel, double sigma2, int kernel_type, float *nudata, long i, long len, int first)
Definition: Bimage_filter.cpp:670
Bimage::invert
void invert()
Inverts the data in the image.
Definition: Bimage.cpp:3111
Bimage::filter_peak
Bimage * filter_peak(long kernel_size)
Finds the peaks in an image.
Definition: Bimage_filter.cpp:1075
string_util.h
Bimage::data_pointer
unsigned char * data_pointer()
Definition: Bimage.h:284
Bimage::sizeY
long sizeY() const
Definition: Bimage.h:394
Bimage::mask_interface_matrix
Matrix mask_interface_matrix(int img_num)
Calculates the interfaces between regions.
Definition: Bimage_mask.cpp:2298
Bsub_image::average
void average(double d)
Definition: Bimage.h:123
TypePointer::us
unsigned short * us
Definition: Bimage.h:72
Bimage::check_if_same_image_size
bool check_if_same_image_size(Bimage *p)
Check if two images are the same size.
Definition: Bimage.cpp:592
Bimage::sampling
vector< Vector3< double > > sampling()
Definition: Bimage.h:529
Bimage::max_in_kernel
int max_in_kernel(long ksize)
Definition: Bimage_mask.cpp:308
Bimage::data_assign
unsigned char * data_assign(unsigned char *nudata)
Assign image data.
Definition: Bimage.cpp:875
Bimage::~Bimage
~Bimage()
Image destructor.
Definition: Bimage.cpp:222
json.h
fft.h
General FFT for n-dimensional data.
Bimage::average_images
void average_images()
Definition: Bimage.h:724
JSvalue::integer
long & integer()
Definition: json.h:142
Vector3::min
Type min()
Definition: Vector3.h:169
Bimage::square_root
void square_root()
Calculates the square root of an image.
Definition: Bimage_rescale.cpp:698
Bimage::intensities_phase_colored
Bimage * intensities_phase_colored(double scale)
Generates a power spectrum with phases colored according to a color wheel.
Definition: Bimage_complex.cpp:1363
Bimage::rotate_correlate
double rotate_correlate(Vector3< double > axis, double angle)
Rotates a copy of an image and correlates it with the original.
Definition: Bimage_correlate.cpp:195
Bimage::pad
int pad(long sz, int fill_type=0, double fill=0)
Pads an image to a new size with a given fill value.
Definition: Bimage_resize.cpp:347
Bimage::mask_plane
long mask_plane(Vector3< double > origin, Vector3< double > normal)
Generates a mask on one side of a plane.
Definition: Bimage_mask.cpp:513
Bimage::minimum
double minimum()
Definition: Bimage.h:541
Bimage::interpolate_wrap
double interpolate_wrap(long cc, Vector3< double > vec, long nn=0) const
Definition: Bimage.h:354
Bimage::complex_product
int complex_product(Bimage *p)
Calculates the complex product of two complex images.
Definition: Bimage_complex.cpp:430
Bimage::search_views
double search_views(Bimage *ptemp, View *view, double hires, double lores, double search_radius, Bimage *pmask, View &currview, Vector3< double > &currshift)
Searches a 2D/3D density map for a template.
Definition: Bimage_search.cpp:34
Bimage::phase_flip
int phase_flip(Bimage *pd)
Flips the phases of an image based on a phase difference map.
Definition: Bimage_fspace.cpp:2074
Bimage::check_sampling
void check_sampling()
Checks that the sampling is properly specified.
Definition: Bimage.cpp:616
Bimage::align2D_pps
double align2D_pps(Bimage *pref, double res_hi, double res_lo, double shift_limit, double angle_limit, fft_plan planf, fft_plan planb)
Finds the best in-plane alignment for two 2D images using polar power spectra.
Definition: Bimage_align.cpp:794
planb
fft_plan planb
Definition: bico.cpp:24
Bimage::color_combine
int color_combine(Bimage *p)
Combines two colored images.
Definition: Bimage_color.cpp:382
Bimage::sampling
void sampling(long nn, Vector3< double > u)
Definition: Bimage.h:514
Bimage::search_volume
Bimage * search_volume(Bimage *ptemp, View *view, double alpha, double alpha_step, double hires, double lores, Bimage *pmask, double threshold)
Searches a 2D/3D density map for a template.
Definition: Bimage_search.cpp:208
Bimage::limit_levels
int limit_levels(int nlevels)
Converts a full gray scale image to a limited level image.
Definition: Bimage_rescale.cpp:426
UnitCell
Definition: UnitCell.h:22
Bimage::update_from_meta_data
void update_from_meta_data()
Update sub-image information from the metadata.
Definition: Bimage.cpp:725
Bimage::subtract_background
int subtract_background()
Subtracts the background for each sub-image.
Definition: Bimage_background.cpp:337
Bimage::powerspectrum_tiled
Bimage * powerspectrum_tiled(long img_num, Vector3< long > tile_size, int flags=0)
Prepares a tiled power spectrum from an image for determining CTF parameters.
Definition: Bimage_powerspectrum.cpp:97
Bimage::snvariance
double snvariance(double snradius)
Calculates the ratio of variance inside and outside a given radius.
Definition: Bimage_helix.cpp:1467
Bimage::coordinates
void coordinates(long i, long &nc, long &nx, long &ny, long &nz, long &nn)
Definition: Bimage.h:445
Bimage::minimum
void minimum(double d)
Definition: Bimage.h:545
Bimage::fspace_weigh_LoG
int fspace_weigh_LoG(double resolution, double sigma)
Weighs an image's amplitudes with a Laplacian-of-Gaussian function.
Definition: Bimage_fspace.cpp:1261
Bimage::mask_combine
long mask_combine(Bimage *p, int operation)
Combines two masks with different operations.
Definition: Bimage_mask.cpp:255
Bimage::sizeX
long sizeX() const
Definition: Bimage.h:393
Bimage::levelmask_switch
long levelmask_switch(long index1, long index2)
Switches two segments in a multi-level mask.
Definition: Bimage_mask.cpp:1774
Bimage::blend
Bimage * blend(Bimage *p, long number)
Blends the two images, creating a new set of sub-images.
Definition: Bimage_combine.cpp:106
Bimage::fspace_weigh_RPS_curve
int fspace_weigh_RPS_curve(Bplot *plot, double resolution=0)
Weighs an image's amplitudes with a given RPS curve.
Definition: Bimage_fspace.cpp:1308
Bimage::bar
int bar(Vector3< double > start, Vector3< double > end, double width, double edge_width, int fill_type=0, double fill=0)
Generates a bar between start and end points.
Definition: Bimage_edit.cpp:731
Bimage::maximum
void maximum(double d)
Definition: Bimage.h:546
Bimage::index_wrap
long index_wrap(vector< long > coor) const
Definition: Bimage.h:426
DataType
DataType
Base data type specifier.
Definition: utilities.h:150
Bimage::defocus_scale
Bimage * defocus_scale(long nn, double df, double df2, double iCL2, int fill_type)
Definition: Bimage_powerspectrum.cpp:216
Bimage::phase_shift_to_origin
int phase_shift_to_origin()
Phase shifts a set of reflections to the image origin.
Definition: Bimage_complex.cpp:327
Bimage::find_symmetric_view
Bimage * find_symmetric_view(Bimage *ptemp, Bsymmetry *sym, double phi_step, double theta_step, double alpha_step, Vector3< double > shift)
Finds the view that on symmetrizing fits best to a symmetric template.
Definition: Bimage_symmetry.cpp:1042
Bimage::origin
void origin(long nn, Vector3< double > vec)
Definition: Bimage.h:582
Bimage::size
void size(long nx, long ny, long nz)
Definition: Bimage.h:387
Bimage::show_maximum
double show_maximum()
Definition: Bimage.h:566
Bimage::levelmask_colorize
long levelmask_colorize()
Colorizes a multi-level mask with random color assignments.
Definition: Bimage_mask.cpp:2095
Bimage::tile_mask
Bimage * tile_mask(long step)
Converts a mask to a tiled multilevel mask.
Definition: Bimage_mask.cpp:1412
Bimage::pure_color
int pure_color()
Generates a pure color image without intensity.
Definition: Bimage_color.cpp:352
Bimage::channels
void channels(long cc)
Definition: Bimage.h:385
Bimage::simple_to_rgba
void simple_to_rgba()
A simple image is converted to a color image.
Definition: Bimage_color.cpp:58
Bsub_image::origin
void origin(vector< double > vec)
Definition: Bimage.h:138
Bsub_image::sampling
Vector3< double > sampling()
Definition: Bimage.h:135
Bimage::helical_cross_section
Bimage * helical_cross_section(double helix_rise, double helix_angle, double scale, double hires)
Calculates a helical cross section from line transforms of a filament.
Definition: Bimage_helix.cpp:1356
Bimage::within_boundaries
bool within_boundaries(Vector3< double > loc)
Definition: Bimage.h:461
Bimage::fspace_pack_3D
int fspace_pack_3D(Bimage *p, double hi_res=0, double threshold=0)
Packs a 3D Fourier transform into a 3D reciprocal space volume.
Definition: Bimage_reconstruct.cpp:314
Bimage::kernel_low
Vector3< long > kernel_low(long i, long k=1)
Definition: Bimage.h:470
Bimage::complex_apply_mask
int complex_apply_mask(Bimage *pmask)
Applies a mask to a complex image.
Definition: Bimage_complex.cpp:521
Matrix
Definition: Matrix.h:22
Bimage::edge
int edge(int type, Vector3< long > rect, Vector3< double > start, double width, int fill_type=0, double fill=0)
Smooths the image edge with a soft rectangular function.
Definition: Bimage_edit.cpp:321
Bimage::kernel_laplacian_of_gaussian
int kernel_laplacian_of_gaussian(double sigma, double max)
Generates a laplacian-of-gaussian kernel.
Definition: Bimage_filter.cpp:77
Bsub_image::image_coordinates
Vector3< long > image_coordinates(double xx, double yy, double zz)
Definition: Bimage.h:151
Bimage::show_slice
void show_slice(long nz)
Definition: Bimage.h:562
Bimage::identifier
void identifier(Bstring s)
Definition: Bimage.h:231
Bimage::median_bin
int median_bin(int binning)
Bins by an integer size, selecting the kernel median.
Definition: Bimage_bin.cpp:392
Bimage::mask_open
long mask_open(int times=1)
Opens a binary mask.
Definition: Bimage_mask.cpp:461
Bimage::average2D
double average2D(long cc, double xf, double yf, double zf, long nn, double iscale)
Averages in the xy plane when scaling is less than 1.
Definition: Bimage.cpp:1334
Bimage::fspace_scale
int fspace_scale(long maxrad, double *scale, Bimage *pmask=NULL)
Definition: Bimage_fspace.cpp:842
Bsub_image::background
void background(double d)
Definition: Bimage.h:126
Bimage::filter_dog
int filter_dog(double sigma1, double sigma2)
Convolves the image with a difference of gausians kernel.
Definition: Bimage_filter.cpp:641
Bimage::filter_ortho
int filter_ortho(int type)
Convolves the image with an orthogonal kernel with wrapping.
Definition: Bimage_filter.cpp:544
Bimage::filter_rolling_ball
int filter_rolling_ball(long radius, double scale)
Apply a rolling ball filter.
Definition: Bimage_filter.cpp:835
Bimage::get_time
time_t get_time()
Definition: Bimage.h:256
Bimage::convert_to_helix
double convert_to_helix(double helix_rise, double helix_angle, Vector3< double > offset)
Converts a map to a helix.
Definition: Bimage_helix.cpp:721
Bsub_image::magnification
void magnification(double d)
Definition: Bimage.h:164
Bimage::channels
long channels()
Definition: Bimage.h:384
Bimage::filament_width
Bplot * filament_width(long width, long lim_lo, long lim_hi)
Estimates the width of a filament.
Definition: Bimage_helix.cpp:1583
Bimage::rgb
RGB< double > rgb(long j)
Returns a color value at the given index.
Definition: Bimage.cpp:1055
Bimage::mask_rectangle
long mask_rectangle(double length, double width, double rect_angle, int wrap)
Generates a mask along an axis within a 2D image.
Definition: Bimage_mask.cpp:568
Bimage::complex_bandpass
int complex_bandpass(double hires, double lores)
Bandpasses a Fourier transform.
Definition: Bimage_complex.cpp:615
Bimage::largest
void largest(Bimage *p)
Selects the largest of each pixel from two images.
Definition: Bimage.cpp:3709
Bimage::orthogonal_slices
Bimage * orthogonal_slices(long nn, Vector3< long > voxel, Vector3< long > ext_size)
Extracts orthogonal views around a voxel.
Definition: Bimage_extract.cpp:616
Bimage::maximum_included_radius
double maximum_included_radius()
Returns the radius of the enclosed sphere or circle.
Definition: Bimage.cpp:2058
Bsub_image::minimum
double minimum()
Definition: Bimage.h:117
TypePointer::ul
unsigned long * ul
Definition: Bimage.h:76
Bsub_image::view
void view(View vw)
Definition: Bimage.h:158
Bimage::complex_to_signed_amplitudes
void complex_to_signed_amplitudes()
The signed amplitudes from a complex image is written to a simple image.
Definition: Bimage_complex.cpp:136
View::angle
double angle()
Definition: View.h:98
Bimage::unpack_transform
int unpack_transform(unsigned char *data, FourierType tf)
Definition: Bimage.cpp:2356
Bimage::phase_shift_to_center
int phase_shift_to_center()
Phase shifts a set of reflections to the nominal center of the image origin.
Definition: Bimage_complex.cpp:382
Bimage::logarithm
void logarithm()
Calculates the logarithm of the image data.
Definition: Bimage_rescale.cpp:728
Bimage::stats_within_radii
long stats_within_radii(long nn, Vector3< double > loc, double rad_min, double rad_max, double &vavg, double &vstd)
Calculates the statistics for an image within given radii from a location.
Definition: Bimage_stats.cpp:205
Bimage::index_wrap
long index_wrap(long nx, long ny, long nz) const
Definition: Bimage.h:414
Bsub_image::sampling
void sampling(Vector3< double > vec)
Definition: Bimage.h:128
Bimage::mask_close
long mask_close(int times=1)
Closes a binary mask.
Definition: Bimage_mask.cpp:481
Bimage::histogram
vector< long > histogram(long bins, double &scale, double &offset)
Calculates the histogram of an image.
Definition: Bimage_histogram.cpp:32
Bimage::mask_fspace_banded
int mask_fspace_banded(vector< double > &band)
Generate reciprocal space mask based on a specification of bands.
Definition: Bimage_mask.cpp:808
Bimage::average_phase_difference
double average_phase_difference(Bimage *p, double res_hi, double res_lo, int weighting=1)
Calculates the average of the absolute phase difference between two images within given resolution sh...
Definition: Bimage_fspace.cpp:1986
Bimage::friedel_check
double friedel_check()
Checks Friedel symmetry.
Definition: Bimage_fspace.cpp:1744
Bimage::show_scale
double show_scale()
Definition: Bimage.h:563
Bimage::combined_complex_product
int combined_complex_product()
Calculates the complex conjugate product of a complex image resulting from combining and Fourier tran...
Definition: Bimage_complex.cpp:813
Bimage::space_group
void space_group(unsigned int grp)
Definition: Bimage.h:602
Bimage::fit_peak
Vector3< double > fit_peak()
Fits an elliptic parabole to locate the position of the peak to sub-voxel resolution.
Definition: Bimage_correlate.cpp:1431
Bimage::mask_merge_delete
long mask_merge_delete(long min_size, long min_if)
Calculates the interfaces between regions and deletes/merges small ones.
Definition: Bimage_mask.cpp:2416
Bimage::filter_bilateral
int filter_bilateral(double sigma1, double sigma2, int kernel_type, long kernel_radius)
Denoise an image with combined gaussian distance and density difference kernel.
Definition: Bimage_filter.cpp:783
Bsub_image::minimum
void minimum(double d)
Definition: Bimage.h:121
Bimage::symmetrize_cylinder
int symmetrize_cylinder()
Calculates a cylindrically symmetrized map.
Definition: Bimage_helix.cpp:585
NoTransform
@ NoTransform
Definition: Bimage.h:41
Bimage::fspace_resize
int fspace_resize(double scale, double res_hi, double res_lo)
Resizes an image in frequency space to avoid interpolation.
Definition: Bimage_fspace.cpp:202
Bimage::helix_segment_correlation
Bplot * helix_segment_correlation(int thickness, double angle_start, double angle_end, double angle_step, int bin, double hires, double lores, double radius)
Calculates the correlation over rotation angles between helical segments.
Definition: Bimage_helix.cpp:1175
Bimage::view
void view(double vx, double vy, double vz, double va)
Definition: Bimage.h:596
Bimage::superpixels_update
int superpixels_update(Bimage *pmask, vector< long > vstep, double colorweight, vector< Bsuperpixel > &seg)
Definition: Bimage_segment.cpp:1609
kernel
Definition: kernlut.h:14
Bimage::histomatch
int histomatch(Bimage *p, long bins)
Fits two images by matching the histogram of the second to the first.
Definition: Bimage_combine.cpp:615
Bimage::complex_to_real
void complex_to_real()
The real part of a complex image is written to a simple image.
Definition: Bimage_complex.cpp:50
Bimage::transform_voxel
void transform_voxel(long i, Bimage *pt, long nn, Vector3< double > oldorigin, Vector3< double > nuorigin, Matrix3 affmat, double fill)
Definition: Bimage_transform.cpp:104
Bimage::quadric
int quadric(double *param)
Generates a quadric surface over the whole image.
Definition: Bimage_edit.cpp:821
Bimage::identifier
Bstring & identifier()
Definition: Bimage.h:232
Bimage::mask_missing_cone
long mask_missing_cone(Vector3< double > origin, double mis_ang, double resolution)
Generates a mask with a missing cone.
Definition: Bimage_mask.cpp:1064
Bimage::cartesian_to_spherical
Bimage * cartesian_to_spherical(long nannuli, long nphi, long ntheta)
Calculates an image with spherical coordinates.
Definition: Bimage_polar.cpp:501
Bimage::statistics
long statistics()
Calculates the statistics for an image.
Definition: Bimage_stats.cpp:22
Bimage::check_if_same_size
bool check_if_same_size(Bimage *p)
Check if two images are the same size.
Definition: Bimage.cpp:566
Bimage::filter_extremes
int filter_extremes()
Filters the extremes out of a micrograph image.
Definition: Bimage_segment.cpp:620
Bimage::to_mask
long to_mask()
Definition: Bimage.h:1313
Bimage::correlate_annuli
double correlate_annuli(Bimage *polref, int ann_min, int ann_max, double ang_min, double ang_max, fft_plan planf, fft_plan planb, double &cc_max)
Correlate annuli of a polar image.
Definition: Bimage_align.cpp:592
Bimage::align_progressive
Bimage * align_progressive(long nref, Bimage *pmask, double hi_res, double lo_res, double shift_limit, fft_plan planf, fft_plan planb)
Aligns and sums a set of sub-images using a progressive algorithm.
Definition: Bimage_align.cpp:29
Bimage::resize
int resize(Vector3< long > nusize, Vector3< long > translate, int fill_type=0, double fill=0)
Resizes without interpolation or rescaling.
Definition: Bimage_resize.cpp:28
Bimage::index
long index(long nc, long nx, long ny, long nz, long nn) const
Definition: Bimage.h:405
FOM
@ FOM
Definition: mg_processing.h:40
FSI_Kernel
Definition: FSI_Kernel.h:14
Bimage::standard_deviation
void standard_deviation(double d)
Definition: Bimage.h:548
Bimage::sphere
int sphere(Vector3< double > center, double radius, double width=0, int fill_type=0, double fill=0)
Fills a sphere within an image with a uniform value.
Definition: Bimage_edit.cpp:440
Bimage::select_images
long select_images(Bstring list)
Definition: Bimage.cpp:2187
Bimage::noise_spectral
int noise_spectral(double alpha)
Generates a noise map with a defined spectral decay.
Definition: Bimage_noise.cpp:184
Bimage::fsc_shell
Bimage * fsc_shell(Bimage *p, double hi_res, double *cutoff, int thickness, int step, int minrad, int maxrad, int pad=1, int smooth=0, double fill=0)
Determine the resolution for each concentric shell in a map.
Definition: Bimage_resolution.cpp:415
Bimage::stats_in_shape
long stats_in_shape(long nn, int type, Vector3< long > start, Vector3< long > end, double &vavg, double &vstd)
Calculates the statistics for an image within the given box.
Definition: Bimage_stats.cpp:282
Bimage::label
void label(string s)
Definition: Bimage.h:250
Bimage::auto_correlate
int auto_correlate(double hires, double lores)
Calculates an autocorrelation map by Fast Fourier transformation.
Definition: Bimage_correlate.cpp:265
Bimage::gaussian_sphere
int gaussian_sphere(long nn, Vector3< double > center, double sigma, double amp)
Fills a gaussian sphere within an image with a uniform value.
Definition: Bimage_edit.cpp:494
Bimage::show_slice
long show_slice()
Definition: Bimage.h:561
Bimage::color_red
int color_red(double cmin, double cmax, int flag=0)
Converts a gray-scale image to red.
Definition: Bimage_color.cpp:307
Bimage::polar_power_spectrum
Bimage * polar_power_spectrum(double resolution, long num_angle)
Calculates the polar power spectrum of a 2D transform amplitude or intensity image.
Definition: Bimage_polar.cpp:774
Bimage::replace_maxima
long replace_maxima(double threshold)
Replaces maxima above a threshold using local averages.
Definition: Bimage_segment.cpp:678
Bimage::otsu_threshold
double otsu_threshold(long bins)
Calculates the threshold on a histogram according to Otsu.
Definition: Bimage_histogram.cpp:523
Bimage::data_type
void data_type(DataType dt)
Definition: Bimage.h:363
Bimage::rescale_to_avg_std
int rescale_to_avg_std(double nuavg, double nustd)
Rescales the image data to a given average and standard deviation.
Definition: Bimage_rescale.cpp:163
Bimage::dyad_interpolate
double dyad_interpolate(long i, int norm_flag=1)
Definition: Bimage_helix.cpp:56