4396 if ( this_img->get_ndim() != 3 || to->get_ndim() != 3 ) {
4406 vector<string> check;
4407 check.push_back(
"searchx");
4408 check.push_back(
"searchy");
4409 check.push_back(
"searchz");
4410 for(vector<string>::const_iterator cit = check.begin(); cit != check.end(); ++cit) {
4413 int search =
params[
"search"];
4429 initxform =
params[
"initxform"];
4442 Dict altered_cmp_params(cmp_params);
4443 if (cmp_name ==
"ccc.tomo") {
4444 altered_cmp_params.set_default(
"searchx", searchx);
4445 altered_cmp_params.set_default(
"searchy", searchy);
4446 altered_cmp_params.set_default(
"searchz", searchz);
4447 altered_cmp_params.set_default(
"norm",
true);
4451 if (nsoln == 0)
return solns;
4452 for (
unsigned int i = 0; i < nsoln; ++i ) {
4456 d[
"xform.align3d"] = &t;
4461 d[
"inc_mirror"] =
true;
4475 bool tomography = (cmp_name ==
"ccc.tomo") ? 1 : 0;
4478 EMData * this_imgfft = 0;
4479 if(dotrans || tomography){
4480 this_imgfft = this_img->do_fft();
4483#ifdef EMAN2_USING_CUDA
4484 if(EMData::usecuda == 1) {
4485 cout <<
"Using CUDA for 3D alignment" << endl;
4486 if(!to->getcudarodata()) to->copy_to_cudaro();
4487 if(!this_img->getcudarwdata()) this_img->copy_to_cuda();
4488 if(this_imgfft) this_imgfft->copy_to_cuda();
4495 bool use_cpu =
true;
4496 for(vector<Transform>::const_iterator trans_it = transforms.begin(); trans_it != transforms.end(); trans_it++) {
4500 float alt =
params[
"alt"];
4502 cout <<
"Trying angle alt: " << alt <<
" az: " << az << endl;
4505 for(
float phi = lphi; phi < uphi; phi += dphi ) {
4511 transformed = to->process(
"xform",
Dict(
"transform",&t));
4514 float best_score = 0.0f;
4516 if(dotrans || tomography){
4518#ifdef EMAN2_USING_CUDA
4519 if(EMData::usecuda == 1){
4523 trans.
set_trans((
float)-data->
px, (
float)-data->
py, (
float)-data->
pz);
4526 float2 stats =
get_stats_cuda(ccf->getcudarwdata(), ccf->get_xsize(), ccf->get_ysize(), ccf->get_zsize());
4527 best_score = -(data->
peak - stats.x)/
sqrt(stats.y);
4529 best_score = -data->
peak;
4536 if(tomography) ccf->process_inplace(
"normalize");
4537 IntPoint point = ccf->calc_max_location_wrap(searchx,searchy,searchz);
4538 trans.
set_trans((
float)-point[0], (float)-point[1], (
float)-point[2]);
4540 best_score = -ccf->get_value_at_wrap(point[0], point[1], point[2]);
4543 delete transformed; transformed = 0;
4547 if(!transformed) transformed = to->process(
"xform",
Dict(
"transform",&t));
4548 best_score = c->
cmp(this_img,transformed);
4549 delete transformed; transformed = 0;
4554 for ( vector<Dict>::iterator it = solns.begin(); it != solns.end(); ++it, ++j ) {
4555 if ( (
float)(*it)[
"score"] > best_score ) {
4556 vector<Dict>::reverse_iterator rit = solns.rbegin();
4557 copy(rit+1,solns.rend()-j,rit);
4559 d[
"score"] = best_score;
4561 d[
"xform.align3d"] = &t;
4569 if(this_imgfft) {
delete this_imgfft; this_imgfft = 0;}
4570 if(sym!=0)
delete sym;
4571 if (c != 0)
delete c;
Cmp class defines image comparison method.
virtual float cmp(EMData *image, EMData *with) const =0
To compare 'image' with another image passed in through its parameters.
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.
Factory is used to store objects to create new instances.
static T * get(const string &instance_name)
IntPoint defines an integer-coordinate point in a 1D/2D/3D space.
Symmetry3D - A base class for 3D Symmetry objects.
vector< Transform > gen_orientations(const string &generatorname="eman", const Dict &parms=Dict())
Ask the Symmetry3D object to generate a set of orientations in its asymmetric unit using an Orientati...
float2 get_stats_cuda(const float *data, const int nx, const int ny, const int nz)
CudaPeakInfo * calc_max_location_wrap_cuda(const float *in, const int nx, const int ny, const int nz, const int maxdx, const int maxdy, const int maxdz)
EMData * copy() const
This file is a part of "emdata.h", to use functions in this file, you should "#include "emdata....
EMData * sqrt() const
return square root of current image
#define InvalidParameterException(desc)
#define ImageDimensionException(desc)
EMData * calc_ccf(EMData *with=0, fp_flag fpflag=CIRCULANT, bool center=false)
Calculate Cross-Correlation Function (CCF).