#include "emfft.h"
#include "cmp.h"
#include "aligner.h"
#include "emdata.h"
#include "processor.h"
#include "util.h"
#include "symmetry.h"
#include <gsl/gsl_multimin.h>
#include "plugins/aligner_template.h"
Include dependency graph for aligner.cpp:
Go to the source code of this file.
Defines | |
#define | EMAN2_ALIGNER_DEBUG 0 |
| |
Functions | |
double | refalifn (const gsl_vector *v, void *params) |
double | refalifnfast (const gsl_vector *v, void *params) |
Transform | refalin3d_perturb (const Transform *const t, const float &delta, const float &arc, const float &phi, const float &x, const float &y, const float &z) |
double | refalifn3d (const gsl_vector *v, void *params) |
|
Definition at line 49 of file aligner.cpp. |
|
Definition at line 950 of file aligner.cpp. References EMAN::Cmp::cmp(), EMAN::EMData::process(), EMAN::Transform::set_mirror(), EMAN::Transform::set_trans(), t, v, x, and y. 00951 { 00952 Dict *dict = (Dict *) params; 00953 00954 double x = gsl_vector_get(v, 0); 00955 double y = gsl_vector_get(v, 1); 00956 double a = gsl_vector_get(v, 2); 00957 00958 EMData *this_img = (*dict)["this"]; 00959 EMData *with = (*dict)["with"]; 00960 bool mirror = (*dict)["mirror"]; 00961 00962 // float mean = (float)this_img->get_attr("mean"); 00963 // if ( Util::goodf(&mean) ) { 00964 // //cout << "tmps mean is nan even before rotation" << endl; 00965 // } 00966 00967 Transform t(Dict("type","2d","alpha",static_cast<float>(a))); 00968 // Transform3D t3d(Transform3D::EMAN, (float)a, 0.0f, 0.0f); 00969 // t3d.set_posttrans( (float) x, (float) y); 00970 // tmp->rotate_translate(t3d); 00971 t.set_trans((float)x,(float)y); 00972 t.set_mirror(mirror); 00973 EMData *tmp = this_img->process("xform",Dict("transform",&t)); 00974 00975 Cmp* c = (Cmp*) ((void*)(*dict)["cmp"]); 00976 double result = c->cmp(tmp,with); 00977 00978 // DELETE AT SOME STAGE, USEFUL FOR PRERELEASE STUFF 00979 // float test_result = (float)result; 00980 // if ( Util::goodf(&test_result) ) { 00981 // cout << "result " << result << " " << x << " " << y << " " << a << endl; 00982 // cout << (float)this_img->get_attr("mean") << " " << (float)tmp->get_attr("mean") << " " << (float)with->get_attr("mean") << endl; 00983 // tmp->write_image("tmp.hdf"); 00984 // with->write_image("with.hdf"); 00985 // this_img->write_image("this_img.hdf"); 00986 // EMData* t = this_img->copy(); 00987 // cout << (float)t->get_attr("mean") << endl; 00988 // t->rotate_translate( t3d ); 00989 // cout << (float)t->get_attr("mean") << endl; 00990 // cout << "exit" << endl; 00992 // cout << (float)t->get_attr("mean") << endl; 00993 // cout << "now exit" << endl; 00994 // delete t; 00995 // } 00996 00997 00998 if ( tmp != 0 ) delete tmp; 00999 01000 return result; 01001 }
|
|
Definition at line 1199 of file aligner.cpp. References EMAN::Cmp::cmp(), phi, EMAN::EMData::process(), refalin3d_perturb(), t, v, x, and y. 01200 { 01201 Dict *dict = (Dict *) params; 01202 double x = gsl_vector_get(v, 0); 01203 double y = gsl_vector_get(v, 1); 01204 double z = gsl_vector_get(v, 2); 01205 double arc = gsl_vector_get(v, 3); 01206 double delta = gsl_vector_get(v, 4); 01207 double phi = gsl_vector_get(v, 5); 01208 EMData *this_img = (*dict)["this"]; 01209 EMData *with = (*dict)["with"]; 01210 // bool mirror = (*dict)["mirror"]; 01211 01212 Transform* t = (*dict)["transform"]; 01213 01214 Transform soln = refalin3d_perturb(t,(float)delta,(float)arc,(float)phi,(float)x,(float)y,(float)z); 01215 01216 EMData *tmp = this_img->process("xform",Dict("transform",&soln)); 01217 Cmp* c = (Cmp*) ((void*)(*dict)["cmp"]); 01218 double result = c->cmp(tmp,with); 01219 if ( tmp != 0 ) delete tmp; 01220 delete t; t = 0; 01221 // cout << result << " " << az << " " << alt << " " << phi << " " << x << " " << y << " " << z << endl; 01222 return result; 01223 }
|
|
Definition at line 1003 of file aligner.cpp. References EMAN::EMData::dot_rotate_translate(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), v, x, and y. 01004 { 01005 Dict *dict = (Dict *) params; 01006 EMData *this_img = (*dict)["this"]; 01007 EMData *img_to = (*dict)["with"]; 01008 bool mirror = (*dict)["mirror"]; 01009 01010 double x = gsl_vector_get(v, 0); 01011 double y = gsl_vector_get(v, 1); 01012 double a = gsl_vector_get(v, 2); 01013 01014 double r = this_img->dot_rotate_translate(img_to, (float)x, (float)y, (float)a, mirror); 01015 int nsec = this_img->get_xsize() * this_img->get_ysize(); 01016 double result = 1.0 - r / nsec; 01017 01018 // cout << result << " x " << x << " y " << y << " az " << a << endl; 01019 return result; 01020 }
|
|
Definition at line 1144 of file aligner.cpp. References EMAN::Transform::get_params(), EMAN::Vec3< Type >::normalize(), phi, q, EMAN::Transform::set_trans(), t, EMAN::Transform::transpose(), EMAN::Vec3f, x, and y. Referenced by EMAN::Refine3DAligner::align(), and refalifn3d(). 01145 { 01146 Dict orig_params = t->get_params("eman"); 01147 float orig_phi = orig_params["phi"]; 01148 float orig_x = orig_params["tx"]; 01149 float orig_y = orig_params["ty"]; 01150 float orig_z = orig_params["tz"]; 01151 orig_params["phi"] = 0; 01152 orig_params["tx"] = 0; 01153 orig_params["ty"] = 0; 01154 orig_params["tz"] = 0; 01155 Transform t_no_phi(orig_params); 01156 01157 Vec3f zz(0,0,1); 01158 01159 Vec3f vv = t_no_phi.transpose()*zz; 01160 Vec3f normal = Vec3f(-vv[2],0,-vv[0]); 01161 01162 normal.normalize(); 01163 01164 Dict d; 01165 d["type"] = "spin"; 01166 d["Omega"] = arc; 01167 d["n1"] = vv[0]; 01168 d["n2"] = vv[1]; 01169 d["n3"] = vv[2]; 01170 01171 Transform q(d); 01172 01173 Vec3f rot_vec = q*normal; 01174 rot_vec.normalize(); 01175 01176 Dict e; 01177 e["type"] = "spin"; 01178 e["Omega"] = delta; 01179 e["n1"] = rot_vec[0]; 01180 e["n2"] = rot_vec[1]; 01181 e["n3"] = rot_vec[2]; 01182 01183 Transform perturb(e); 01184 01185 Dict g; 01186 g["type"] = "eman"; 01187 g["alt"] = 0; 01188 g["az"] = 0; 01189 g["phi"] = 0*phi+orig_phi; 01190 01191 Transform phi_rot(g); 01192 Transform soln = t_no_phi*perturb*phi_rot; 01193 soln.set_trans(x+orig_x,y+orig_y,z+orig_z); 01194 01195 Dict params = soln.get_params("eman"); 01196 return soln; 01197 }
|