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