2555 if ( this_img->get_ndim() != 3 || to->get_ndim() != 3 ) {
2565 vector<string> check;
2566 check.push_back(
"searchx");
2567 check.push_back(
"searchy");
2568 check.push_back(
"searchz");
2569 for(vector<string>::const_iterator cit = check.begin(); cit != check.end(); ++cit) {
2572 int search =
params[
"search"];
2588 initxform =
params[
"initxform"];
2605 Dict altered_cmp_params(cmp_params);
2606 if (cmp_name ==
"ccc.tomo") {
2607 altered_cmp_params.set_default(
"searchx", searchx);
2608 altered_cmp_params.set_default(
"searchy", searchy);
2609 altered_cmp_params.set_default(
"searchz", searchz);
2610 altered_cmp_params.set_default(
"norm",
true);
2614 if (nsoln == 0)
return solns;
2615 for (
unsigned int i = 0; i < nsoln; ++i ) {
2619 d[
"xform.align3d"] = &t;
2623 bool tomography = (cmp_name ==
"ccc.tomo") ? 1 : 0;
2625 if(dotrans || tomography){
2626 tofft = to->do_fft();
2629#ifdef EMAN2_USING_CUDA
2630 if(EMData::usecuda == 1) {
2631 if(!this_img->getcudarodata()) this_img->copy_to_cudaro();
2632 if(!to->getcudarwdata()) to->copy_to_cuda();
2633 if(to->getcudarwdata()){
if(tofft) tofft->copy_to_cuda();}
2641 bool use_cpu =
true;
2642 for (
float alt = lalt; alt <= ualt; alt += dalt) {
2645 for (
float az = laz; az < uaz; az += daz ){
2647 cout <<
"Trying angle alt " << alt <<
" az " << az << endl;
2649 for(
float phi = lphi; phi < uphi; phi += dphi ) {
2655 EMData* transformed = this_img->process(
"xform",
Dict(
"transform",&t));
2658 float best_score = 0.0f;
2659 if(dotrans || tomography){
2661#ifdef EMAN2_USING_CUDA
2662 if(EMData::usecuda == 1){
2665 trans.
set_trans((
float)-data->
px, (
float)-data->
py, (
float)-data->
pz);
2668 float2 stats =
get_stats_cuda(ccf->getcudarwdata(), ccf->get_xsize(), ccf->get_ysize(), ccf->get_zsize());
2669 best_score = -(data->
peak - stats.x)/
sqrt(stats.y);
2671 best_score = -data->
peak;
2677 if(tomography) ccf->process_inplace(
"normalize");
2678 IntPoint point = ccf->calc_max_location_wrap(searchx,searchy,searchz);
2679 trans.
set_trans((
float)-point[0], (float)-point[1], (
float)-point[2]);
2681 best_score = -ccf->get_value_at_wrap(point[0], point[1], point[2]);
2684 delete transformed; transformed = 0;
2688 if(!transformed) transformed = this_img->process(
"xform",
Dict(
"transform",&t));
2689 best_score = c->
cmp(to,transformed);
2690 delete transformed; transformed = 0;
2694 for ( vector<Dict>::iterator it = solns.begin(); it != solns.end(); ++it, ++j ) {
2695 if ( (
float)(*it)[
"score"] > best_score ) {
2696 vector<Dict>::reverse_iterator rit = solns.rbegin();
2697 copy(rit+1,solns.rend()-j,rit);
2699 d[
"score"] = best_score;
2700 d[
"xform.align3d"] = &t;
2708 if(tofft) {
delete tofft; tofft = 0;}
2709 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.
IntPoint defines an integer-coordinate point in a 1D/2D/3D space.
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).