41const string ImageAverager::NAME =
"mean";
42const string SigmaAverager::NAME =
"sigma";
43const string TomoAverager::NAME =
"mean.tomo";
44const string MinMaxAverager::NAME =
"minmax";
45const string MedianAverager::NAME =
"median";
46const string IterAverager::NAME =
"iterative";
47const string CtfCWautoAverager::NAME =
"ctfw.auto";
48const string CtfCAutoAverager::NAME =
"ctf.auto";
49const string CtfWtAverager::NAME =
"ctf.weight";
50const string CtfWtFiltAverager::NAME =
"ctf.weight.autofilt";
51const string FourierWeightAverager::NAME =
"weightedfourier";
52const string LocalWeightAverager::NAME =
"localweight";
56 force_add<ImageAverager>();
57 force_add<SigmaAverager>();
58 force_add<MinMaxAverager>();
59 force_add<MedianAverager>();
60 force_add<LocalWeightAverager>();
61 force_add<IterAverager>();
62 force_add<CtfCWautoAverager>();
63 force_add<CtfCAutoAverager>();
64 force_add<CtfWtAverager>();
65 force_add<CtfWtFiltAverager>();
66 force_add<TomoAverager>();
67 force_add<FourierWeightAverager>();
88 for (
size_t i = 0; i < image_list.size(); i++) {
94 : norm_image(0),nimg(0),overlap(0)
105 if (!image->is_complex()) {
106 image=image->do_fft();
107 image->set_attr(
"free_me",(
int)1);
111 LOGERR(
"%s Averager can only process same-size Images",
116 int nx = image->get_xsize();
117 int ny = image->get_ysize();
118 int nz = image->get_zsize();
123 result = image->copy_head();
134 float *result_data =
result->get_data();
136 float *data = image->get_data();
138 vector<float> threshv;
140 for (
int i=0; i<nx/2; i++) threshv[i]*=threshv[i]*
thresh_sigma;
145 for (
int z=0; z<nz; z++) {
146 for (
int y=0;
y<ny;
y++) {
147 for (
int x=0;
x<nx;
x+=2, j+=2) {
150 if (r>ny/2)
continue;
155 if (inten<threshv[r])
continue;
170 if (image->has_attr(
"free_me"))
delete image;
177 int nx =
result->get_xsize();
178 int ny =
result->get_ysize();
179 int nz =
result->get_zsize();
180 size_t image_size = (size_t)nx * ny * nz;
182 float *result_data =
result->get_data();
187 for (
size_t j = 0; j < image_size; j++) {
188 if (norm_data[j]==0.0) result_data[j]=0.0;
189 else result_data[j]/=norm_data[j];
201 ret->set_attr(
"ptcl_repr",
norm_image->get_attr(
"maximum"));
202 ret->set_attr(
"mean_coverage",(
float)(
overlap/
nimg));
208 normout->set_data(
norm_image->copy()->get_data());
222 : sigma_image(0), ignore0(0), normimage(0), freenorm(0), nimg(0)
234 LOGERR(
"%sAverager can only process same-size Image",
241 int nx = image->get_xsize();
242 int ny = image->get_ysize();
243 int nz = image->get_zsize();
244 size_t image_size = (size_t)nx * ny * nz;
247 result = image->copy_head();
248 result->set_size(nx, ny, nz);
257 float *result_data =
result->get_data();
258 float *sigma_image_data = 0;
264 float * image_data = image->get_data();
267 for (
size_t j = 0; j < image_size; ++j) {
268 float f = image_data[j];
270 if (sigma_image_data) {
271 sigma_image_data[j] += f * f;
276 for (
size_t j = 0; j < image_size; ++j) {
277 float f = image_data[j];
280 if (sigma_image_data) {
281 sigma_image_data[j] += f * f;
292 size_t image_size = (size_t)
result->get_xsize() *
result->get_ysize() *
result->get_zsize();
293 float * result_data =
result->get_data();
296 for (
size_t j = 0; j < image_size; ++j) {
297 result_data[j] /=
nimg;
301 float * sigma_image_data =
sigma_image->get_data();
303 for (
size_t j = 0; j < image_size; ++j) {
304 float f1 = sigma_image_data[j] /
nimg;
305 float f2 = result_data[j];
306 sigma_image_data[j] =
sqrt(f1 - f2 * f2);
313 for (
size_t j = 0; j < image_size; ++j) {
317 float * sigma_image_data =
sigma_image->get_data();
319 for (
size_t j = 0; j < image_size; ++j) {
321 if (
normimage->get_value_at(j)>0) f1=sigma_image_data[j] /
normimage->get_value_at(j);
322 float f2 = result_data[j];
323 sigma_image_data[j] =
sqrt(f1 - f2 * f2);
347 : mean_image(0), ignore0(0), normimage(0), freenorm(0), nimg(0)
359 LOGERR(
"%sAverager can only process same-size Image",
366 int nx = image->get_xsize();
367 int ny = image->get_ysize();
368 int nz = image->get_zsize();
369 size_t image_size = (size_t)nx * ny * nz;
375 result = image->copy_head();
376 result->set_size(nx, ny, nz);
384 float *mean_image_data =
mean_image->get_data();
385 float *result_data =
result->get_data();
386 float * image_data = image->get_data();
389 for (
size_t j = 0; j < image_size; ++j) {
390 float f = image_data[j];
391 mean_image_data[j] += f;
393 result_data[j] += f * f;
398 for (
size_t j = 0; j < image_size; ++j) {
399 float f = image_data[j];
401 mean_image_data[j] += f;
403 result_data[j] += f * f;
415 float * mean_image_data =
mean_image->get_data();
417 for (
size_t j = 0; j < image_size; ++j) {
418 mean_image_data[j] /=
nimg;
421 float * result_data =
result->get_data();
423 for (
size_t j = 0; j < image_size; ++j) {
424 float f1 = result_data[j] /
nimg;
425 float f2 = mean_image_data[j];
426 result_data[j] =
sqrt(f1 - f2 * f2);
432 for (
size_t j = 0; j < image_size; ++j) {
436 float * result_data =
result->get_data();
438 for (
size_t j = 0; j < image_size; ++j) {
441 float f2 = mean_image_data[j];
442 result_data[j] =
sqrt(f1 - f2 * f2);
463 : normimage(0), freenorm(0), nimg(0)
476 EMData *img=image->do_fft();
478 LOGERR(
"%sAverager can only process same-size Image",
485 int nx = img->get_xsize();
486 int ny = img->get_ysize();
494 result->set_complex(
true);
503 for (
int y=-ny/2;
y<ny/2;
y++) {
504 for (
int x=0;
x<nx/2;
x++) {
505 std::complex<float> v=img->get_complex_at(
x,
y);
522 int nx =
result->get_xsize();
523 int ny =
result->get_ysize();
525 for (
int y=-ny/2;
y<ny/2;
y++) {
526 for (
int x=0;
x<nx/2;
x++) {
528 if (norm<=0)
result->set_complex_at(
x,
y,0.0f);
541 ret->set_attr(
"ptcl_repr",
nimg);
550 : normimage(0), freenorm(0), nimg(0),fourier(0)
563 int nx = image->get_xsize();
564 int ny = image->get_ysize();
565 int nz = image->get_zsize();
569 result = image->copy_head();
570 result->set_size(nx, ny, nz);
580 images.push_back(image->copy());
585 if (
nimg==0)
return NULL;
587 int nx =
images.front()->get_xsize();
588 int ny =
images.front()->get_ysize();
589 int nz =
images.front()->get_zsize();
598 for (std::vector<EMData*>::iterator im =
images.begin(); im!=
images.end(); ++im) stg1->add(**im);
599 stg1->process_inplace(
"normalize");
602 for (std::vector<EMData*>::iterator im =
images.begin(); im!=
images.end(); ++im) {
603 EMData *imc=(*im)->copy();
605 imc->process_inplace(
"filter.lowpass.gauss",
Dict(
"cutoff_freq",0.02f));
606 imc->process_inplace(
"threshold.belowtozero",
Dict(
"minval",0.0f));
618 float max=
normimage->get_attr(
"maximum");
619 normimage->process_inplace(
"threshold.clampminmax",
Dict(
"minval",mean*dampnoise,
"maxval",max));
634 for (
int r=0; r<
fourier; r++) {
635 float cen=r/((float)
fourier-1.0)*0.5;
637 std::vector<EMData*> filt;
640 for (std::vector<EMData*>::iterator im =
images.begin(); im!=
images.end(); ++im) {
641 EMData *f=(*im)->process(
"filter.bandpass.gauss",
Dict(
"center",(
float)cen,
"sigma",sig));
646 stg1->process_inplace(
"normalize");
647 stg1->process(
"filter.bandpass.gauss",
Dict(
"center",(
float)cen,
"sigma",sig));
652 for (std::vector<EMData*>::iterator im = filt.begin(); im!=filt.end(); ++im) {
653 EMData *imc=(*im)->copy();
655 imc->process_inplace(
"filter.lowpass.gauss",
Dict(
"cutoff_freq",0.02f));
656 imc->process_inplace(
"threshold.belowtozero",
Dict(
"minval",0.0f));
670 float max=
normimage->get_attr(
"maximum");
671 normimage->process_inplace(
"threshold.clampminmax",
Dict(
"minval",mean*dampnoise,
"maxval",max));
694 images.push_back(image->do_fft());
699 if (
images.size()==0)
return NULL;
701 int nx =
images.front()->get_xsize();
702 int ny =
images.front()->get_ysize();
703 int nz =
images.front()->get_zsize();
714 for (
int it=0; it<4; it++) {
715 for (
int y=-ny/2+1;
y<ny/2-1;
y++) {
716 for (
int x=0;
x<nx-2;
x++) {
717 std::complex<double> nv=0;
719 for (vector<EMData *>::iterator im=
images.begin(); im<
images.end(); im++) {
720 for (
int yy=
y-1; yy<=
y+1; yy++) {
721 for (
int xx=
x-1; xx<=
x+1; xx++) {
722 nv+=(*im)->get_complex_at(xx,yy)+tmp->get_complex_at(
x,
y)-tmp->get_complex_at(xx,yy);
726 result->set_complex_at(
x,
y,std::complex<float>(nv/(9.0*
images.size())));
730 result->write_image(
"dbug.hdf",-1);
738 for (vector<EMData *>::iterator im=
images.begin(); im<
images.end(); im++)
delete (*im);
747EMData *ImageAverager::average(
const vector < EMData * >&image_list)
const
749 if (image_list.size() == 0) {
756 EMData *image0 = image_list[0];
758 int nx = image0->get_xsize();
759 int ny = image0->get_ysize();
760 int nz = image0->get_zsize();
761 size_t image_size = (size_t)nx * ny * nz;
764 result->set_size(nx, ny, nz);
766 float *result_data =
result->get_data();
767 float *sigma_image_data = 0;
776 for (
size_t j = 0; j < image_size; ++j) {
778 for (
size_t i = 0; i < image_list.size(); i++) {
779 float f = image_list[i]->get_value_at(j);
783 if (sigma_image_data) {
784 sigma_image_data[j] += f * f;
794 float *image0_data = image0->get_data();
795 if (sigma_image_data) {
796 memcpy(sigma_image_data, image0_data, image_size *
sizeof(
float));
798 for (
size_t j = 0; j < image_size; ++j) {
799 sigma_image_data[j] *= sigma_image_data[j];
804 memcpy(result_data, image0_data, image_size *
sizeof(
float));
806 for (
size_t i = 1; i < image_list.size(); i++) {
807 EMData *image = image_list[i];
810 float *image_data = image->get_data();
812 for (
size_t j = 0; j < image_size; ++j) {
813 result_data[j] += image_data[j];
816 if (sigma_image_data) {
817 for (
size_t j = 0; j < image_size; ++j) {
818 sigma_image_data[j] += image_data[j] * image_data[j];
827 for (
size_t j = 0; j < image_size; ++j) {
828 result_data[j] /=
static_cast < float >(c);
832 if (sigma_image_data) {
833 for (
size_t j = 0; j < image_size; ++j) {
834 float f1 = sigma_image_data[j] / c;
835 float f2 = result_data[j];
836 sigma_image_data[j] =
sqrt(f1 - f2 * f2);
840 if (sigma_image_data) {
850 : nimg(0),ismax(0),isabs(0)
862 LOGERR(
"%sAverager can only process same-size Image",
868 float thisown = image->get_attr_default(
"ortid",(
float)
nimg);
871 size_t nxyz = image->get_size();
875 if (owner) owner->to_value(thisown);
880 float *data = image->get_data();
882 if (owner) owndata=owner->get_data();
888 for (
size_t i=0; i<nxyz; i++) {
889 float v =
isabs?fabs(data[i]):data[i];
893 if (owndata) owndata[i]=thisown;
921 LOGERR(
"MedianAverager can only process images of the same size");
925 imgs.push_back(image->copy());
930 if (
imgs.size()==0)
return 0;
933 if (
imgs.size()==1) {
940 if (
imgs.size()==2) {
949 int nx=
imgs[0]->get_xsize();
950 int ny=
imgs[0]->get_ysize();
951 int nz=
imgs[0]->get_zsize();
954 if (
imgs.size()==3) {
955 for (
int z=0; z<nz; z++) {
956 for (
int y=0;
y<ny;
y++) {
957 for (
int x=0;
x<nx;
x++) {
958 float v0=
imgs[0]->get_value_at(
x,
y,z);
959 float v1=
imgs[1]->get_value_at(
x,
y,z);
960 float v2=
imgs[2]->get_value_at(
x,
y,z);
963 if (
v0>=v2)
continue;
964 if (v1<=v2)
imgs[0]->set_value_at(
x,
y,z,v1);
965 else imgs[0]->set_value_at(
x,
y,z,v2);
968 if (
v0<=v2)
continue;
969 if (v2<=v1)
imgs[0]->set_value_at(
x,
y,z,v1);
970 else imgs[0]->set_value_at(
x,
y,z,v2);
984 std::vector<float> vals(
imgs.size(),0.0f);
987 for (
int z=0; z<nz; z++) {
988 for (
int y=0;
y<ny;
y++) {
989 for (
int x=0;
x<nx;
x++) {
991 for (std::vector<EMData *>::iterator it =
imgs.begin() ; it !=
imgs.end(); ++it,++i) {
992 vals[i]=(*it)->get_value_at(
x,
y,z);
995 std::sort(vals.begin(),vals.end());
997 if (vals.size()&1) ret->set_value_at(
x,
y,z,vals[vals.size()/2]);
998 else ret->set_value_at(
x,
y,z,(vals[vals.size()/2]+vals[vals.size()/2-1])/2.0f);
1003 if (!
imgs.empty()) {
1004 for (std::vector<EMData *>::iterator it =
imgs.begin() ; it !=
imgs.end(); ++it)
if (*it)
delete *it;
1027 EMData *fft=image->do_fft();
1030 LOGERR(
"%s Averager can only process images of the same size",
get_name().c_str());
1036 result = fft->copy_head();
1040 Ctf *ctf = (
Ctf *)image->get_attr(
"ctf");
1058 float *outd =
result->get_data();
1059 float *ind = fft->get_data();
1060 float *snrd = snr->get_data();
1061 float *ctfd = ctfi->get_data();
1063 size_t sz=snr->get_xsize()*snr->get_ysize();
1064 for (
size_t i = 0; i < sz; i+=2) {
1065 if (snrd[i]<0) snrd[i]=0.001;
1066 ctfd[i]=fabs(ctfd[i]);
1067 if (ctfd[i]<.05) ctfd[i]=0.05f;
1072 outd[i]+=ind[i]*snrd[i]/ctfd[i];
1073 outd[i+1]+=ind[i+1]*snrd[i]/ctfd[i];
1078 float *ssnrd=
snrsum->get_data();
1080 for (
size_t i = 0; i < sz; i+=2) { ssnrd[i]=1.0; ssnrd[i+1]=0.0; }
1083 snr->process_inplace(
"math.absvalue");
1104 int nx=
result->get_xsize();
1105 int ny=
result->get_ysize();
1106 float *snrsd=
snrsum->get_data();
1107 float *outd=
result->get_data();
1109 int rm=(ny-2)*(ny-2)/4;
1110 for (
int j=0; j<ny; j++) {
1111 for (
int i=0; i<nx; i+=2) {
1113 if ((j<ny/2 && i*i/4+j*j>rm) ||(j>=ny/2 && i*i/4+(ny-j)*(ny-j)>rm) || snrsd[ii]==0) { outd[ii]=outd[ii+1]=0;
continue; }
1114 outd[ii]/=snrsd[ii];
1115 outd[ii+1]/=snrsd[ii];
1122 result->set_attr(
"ctf_wiener_filtered",1);
1146 EMData *fft=image->do_fft();
1149 LOGERR(
"%s Averager can only process images of the same size",
get_name().c_str());
1155 result = fft->copy_head();
1159 Ctf *ctf = (
Ctf *)image->get_attr(
"ctf");
1170 float *outd =
result->get_data();
1171 float *ind = fft->get_data();
1172 float *snrd = snr->get_data();
1173 float *ctfd = ctfi->get_data();
1175 size_t sz=snr->get_xsize()*snr->get_ysize();
1176 for (
size_t i = 0; i < sz; i+=2) {
1177 if (snrd[i]<=0) snrd[i]=0.001;
1178 ctfd[i]=fabs(ctfd[i]);
1181 if (ctfd[i]<.05) ctfd[i]=0.05f;
1188 outd[i]+=ind[i]*snrd[i]/ctfd[i];
1189 outd[i+1]+=ind[i+1]*snrd[i]/ctfd[i];
1194 float *ssnrd=
snrsum->get_data();
1196 for (
size_t i = 0; i < sz; i+=2) { ssnrd[i]=0.0; ssnrd[i+1]=0.0; }
1198 snr->process_inplace(
"math.absvalue");
1219 int nx=
result->get_xsize();
1220 int ny=
result->get_ysize();
1221 float *snrsd=
snrsum->get_data();
1222 float *outd=
result->get_data();
1224 int rm=(ny-2)*(ny-2)/4;
1225 for (
int j=0; j<ny; j++) {
1226 for (
int i=0; i<nx; i+=2) {
1228 if ((j<ny/2 && i*i/4+j*j>rm) ||(j>=ny/2 && i*i/4+(ny-j)*(ny-j)>rm) || snrsd[ii]==0) { outd[ii]=outd[ii+1]=0;
continue; }
1230 if (snrsd[ii]<.05) {
1235 outd[ii]/=snrsd[ii];
1236 outd[ii+1]/=snrsd[ii];
1243 result->set_attr(
"ctf_wiener_filtered",0);
1270 EMData *fft=image->do_fft();
1273 LOGERR(
"%s Averager can only process images of the same size",
get_name().c_str());
1279 result = fft->copy_head();
1283 Ctf *ctf = (
Ctf *)image->get_attr(
"ctf");
1291 float *outd =
result->get_data();
1292 float *ind = fft->get_data();
1293 float *ctfd = ctfi->get_data();
1295 size_t sz=ctfi->get_xsize()*ctfi->get_ysize();
1296 for (
size_t i = 0; i < sz; i+=2) {
1299 outd[i]+=ind[i]*ctfd[i];
1300 outd[i+1]+=ind[i+1]*ctfd[i];
1304 ctfsum=ctfi->copy_head();
1316 int nx=
result->get_xsize();
1317 int ny=
result->get_ysize();
1318 float *ctfsd=
ctfsum->get_data();
1319 float *outd=
result->get_data();
1321 for (
int j=0; j<ny; j++) {
1322 for (
int i=0; i<nx; i+=2) {
1324 outd[ii]/=ctfsd[ii];
1325 outd[ii+1]/=ctfsd[ii];
1331 result->set_attr(
"ctf_wiener_filtered",0);
1359 EMData *fft=image->do_fft();
1362 LOGERR(
"%s Averager can only process images of the same size",
get_name().c_str());
1367 results[0] = fft->copy_head();
1369 results[1] = fft->copy_head();
1379 if (image->has_attr(
"ctf")) {
1380 Ctf *ctf = (
Ctf *)image->get_attr(
"ctf");
1393 float *ind = fft->get_data();
1394 float *ctfd = ctfi->get_data();
1396 size_t sz=ctfi->get_xsize()*ctfi->get_ysize();
1397 for (
size_t i = 0; i < sz; i+=2) {
1400 outd[i]+=ind[i]*ctfd[i];
1401 outd[i+1]+=ind[i+1]*ctfd[i];
1417 if (
nimg[0]==0 &&
nimg[1]==0)
return NULL;
1427 int nx=
results[0]->get_xsize();
1428 int ny=
results[0]->get_ysize();
1430 for (
int k=0; k<2; k++) {
1431 float *outd=
results[k]->get_data();
1432 float *ctfsd=
ctfsum[k]->get_data();
1433 for (
int j=0; j<ny; j++) {
1434 for (
int i=0; i<nx; i+=2) {
1436 outd[ii]/=ctfsd[ii];
1437 outd[ii+1]/=ctfsd[ii];
1442 results[0]->set_attr(
"ctf_wiener_filtered",1);
1446 std::vector<float> fsc=
results[0]->calc_fourier_shell_correlation(
results[1]);
1447 int third=fsc.size()/3;
1448 for (
int i=third; i<third*2; i++) {
1449 if (fsc[i]>=.9999) fsc[i]=.9999;
1450 if (fsc[i]<.001) fsc[i]=.001;
1451 float snr=2.0*fsc[i]/(1.0-fsc[i]);
1452 fsc[i]=snr/(snr+1.0);
1459 for (
int j=-ny/2; j<ny/2; j++) {
1460 for (
int i=0; i<nx/2; i++) {
1462 if (r>=third) c=0.0;
1463 else c=fsc[third+r];
1469 ret->set_attr(
"ptcl_repr",
nimg[0]+
nimg[1]);
1484EMData *IterationAverager::average(
const vector < EMData * >&image_list)
const
1486 if (image_list.size() == 0) {
1490 EMData *image0 = image_list[0];
1492 int nx = image0->get_xsize();
1493 int ny = image0->get_ysize();
1494 int nz = image0->get_zsize();
1495 size_t image_size = (size_t)nx * ny * nz;
1498 result->set_size(nx, ny, nz);
1501 sigma_image->set_size(nx, ny, nz);
1503 float *image0_data = image0->get_data();
1504 float *result_data = result->get_data();
1505 float *sigma_image_data = sigma_image->get_data();
1507 memcpy(result_data, image0_data, image_size *
sizeof(
float));
1508 memcpy(sigma_image_data, image0_data, image_size *
sizeof(
float));
1510 for (
size_t j = 0; j < image_size; ++j) {
1511 sigma_image_data[j] *= sigma_image_data[j];
1517 for (
size_t i = 1; i < image_list.size(); i++) {
1518 EMData *image = image_list[i];
1521 float *image_data = image->get_data();
1523 for (
size_t j = 0; j < image_size; j++) {
1524 result_data[j] += image_data[j];
1525 sigma_image_data[j] += image_data[j] * image_data[j];
1533 float c =
static_cast < float >(nc);
1534 for (
size_t j = 0; j < image_size; ++j) {
1535 float f1 = sigma_image_data[j] / c;
1536 float f2 = result_data[j] / c;
1537 sigma_image_data[j] =
sqrt(f1 - f2 * f2) /
sqrt(c);
1541 for (
size_t j = 0; j < image_size; ++j) {
1542 result_data[j] /= c;
1546 sigma_image->update();
1548 result->append_image(
"iter.hed");
1550 float sigma = sigma_image->get_attr(
"sigma");
1551 float *sigma_image_data2 = sigma_image->get_data();
1552 float *result_data2 = result->get_data();
1553 float *d2 =
new float[nx * ny];
1554 size_t sec_size = nx * ny *
sizeof(float);
1556 memcpy(d2, result_data2, sec_size);
1557 memcpy(sigma_image_data2, result_data2, sec_size);
1559 printf(
"Iter sigma=%f\n", sigma);
1561 for (
int k = 0; k < 1000; k++) {
1562 for (
int i = 1; i < nx - 1; i++) {
1563 for (
int j = 1; j < ny - 1; j++) {
1565 float c1 = (d2[l - 1] + d2[l + 1] + d2[l - nx] + d2[l + nx]) / 4.0f - d2[l];
1566 float c2 = fabs(result_data2[l] - sigma_image_data2[l]) / sigma;
1571 memcpy(d2, result_data2, sec_size);
1580 sigma_image->update();
1588 result->append_image(
"iter.hed");
1599 dump_factory < Averager > ();
1604 return dump_factory_list < Averager > ();
virtual void add_image_list(const vector< EMData * > &images)
To add multiple images to the Averager.
virtual void add_image(EMData *image)
To add an image to the Averager.
string get_name() const
Get the Averager's name.
EMData * finish()
Finish up the averaging and return the result.
void add_image(EMData *image)
To add an image to the Averager.
EMData * finish()
Finish up the averaging and return the result.
void add_image(EMData *image)
To add an image to the Averager.
string get_name() const
Get the Averager's name.
string get_name() const
Get the Averager's name.
EMData * finish()
Finish up the averaging and return the result.
void add_image(EMData *image)
To add an image to the Averager.
void add_image(EMData *image)
To add an image to the Averager.
EMData * finish()
Finish up the averaging and return the result.
string get_name() const
Get the Averager's name.
Ctf is the base class for all CTF model.
virtual void compute_2d_complex(EMData *img, CtfType t, XYData *struct_factor=0)=0
Dict is a dictionary to store <string, EMObject> pair.
type set_default(const string &key, type val)
Default setting behavior This can be achieved using a template - d.woolford Jan 2008 (before there wa...
bool has_key(const string &key) const
Ask the Dictionary if it as a particular key.
EMData stores an image's data and defines core image processing routines.
vector< float > calc_radial_dist(int n, float x0, float dx, int inten)
calculates radial distribution.
static bool is_same_size(const EMData *image1, const EMData *image2)
Check whether two EMData images are of the same size.
Factory is used to store objects to create new instances.
EMData * finish()
Finish up the averaging and return the result.
string get_name() const
Get the Averager's name.
void add_image(EMData *image)
To add an image to the Averager.
EMData * finish()
Finish up the averaging and return the result.
void add_image(EMData *image)
To add an image to the Averager.
string get_name() const
Get the Averager's name.
std::vector< EMData * > images
EMData * finish()
Finish up the averaging and return the result.
void add_image(EMData *image)
To add an image to the Averager.
void add_image(EMData *image)
To add an image to the Averager.
EMData * finish()
Finish up the averaging and return the result.
std::vector< EMData * > images
EMData * finish()
Finish up the averaging and return the result.
void add_image(EMData *image)
To add an image to the Averager.
string get_name() const
Get the Averager's name.
void add_image(EMData *image)
To add an image to the Averager.
string get_name() const
Get the Averager's name.
EMData * finish()
Finish up the averaging and return the result.
EMData * finish()
Finish up the averaging and return the result.
string get_name() const
Get the Averager's name.
void add_image(EMData *image)
To add an image to the Averager.
static float eman_erfc(float x)
complementary error function.
static float hypot3(int x, int y, int z)
Euclidean distance function in 3D: f(x,y,z) = sqrt(x*x + y*y + z*z);.
static float hypot_fast(int x, int y)
Euclidean distance in 2D for integers computed fast using a cached lookup table.
static float hypot2(float x, float y)
Euclidean distance function in 2D: f(x,y) = sqrt(x*x + y*y);.
XYData defines a 1D (x,y) data set.
float get_yatx(float x, bool outzero=true)
EMData * copy() const
This file is a part of "emdata.h", to use functions in this file, you should "#include "emdata....
void to_zero()
Set all the pixel value = 0.
EMData * log() const
return natural logarithm image for a image
void mult(int n)
multiply an integer number to each pixel value of the image.
EMData * sqrt() const
return square root of current image
std::complex< float > get_complex_at(const int &x, const int &y) const
Get complex<float> value at x,y.
#define ImageDimensionException(desc)
#define NullPointerException(desc)
map< string, vector< string > > dump_averagers_list()