36 double alpha,
double alpha_step,
double hires,
double lores,
Bimage* pmask,
double threshold)
39 size_t i, n(0), nviews;
41 double alpha_max(
TWOPI - alpha_step/2);
43 double fommin(1), fommax(0), fomavg(0), fomstd(0);
48 alpha_min = alpha - alpha_step;
49 alpha_max = alpha + alpha_step;
50 }
else if ( alpha_step >= 1.999*
M_PI ) mode = 2;
52 if ( !p )
return NULL;
63 if ( origin.sum() == 0 ) {
68 for ( nviews=0, v=view; v; v=v->
next )
69 for ( a=alpha_min; a<=alpha_max; a+=alpha_step ) nviews++;
73 for ( n=0, v=view; v; v=v->
next )
74 for ( a=alpha_min; a<=alpha_max; a+=alpha_step, n++ ) {
76 if ( mode < 2 ) view_arr[n][3] = a;
80 cout <<
"Finding a template in a map:" << endl;
81 cout <<
"Number of views: " << nviews << endl;
82 cout <<
"Alpha step size: " << alpha_step*180.0/
M_PI << endl;
83 cout <<
"Origin: " << origin << endl;
91 cout <<
"View\tCCmax" << endl;
93 for ( n=0; n<nviews; n++ ) {
96 cout << view_arr[n] <<
tab << fommax << endl;
99 size_t datasize = (size_t) pfit->
size().volume();
101 for ( i=0, fommax=-1, fommin=1, fomavg=fomstd=0; i<datasize; i++ ) {
102 if ( fommin > fom[i] ) fommin = fom[i];
103 if ( fommax < fom[i] ) fommax = fom[i];
105 fomstd += fom[i]*fom[i];
112 fomstd = fomstd/datasize - fomavg*fomavg;
113 if ( fomstd > 0 ) fomstd = sqrt(fomstd);
115 cout <<
"FOM minimum and maximum: " << fommin <<
" " << fommax << endl;
116 cout <<
"FOM average: " << fomavg << endl;
117 cout <<
"FOM standard deviation: " << fomstd << endl << endl;
141 double hires,
double lores,
Bimage* pmask,
double threshold,
Bimage* pfit)
150 size_t i, datasize = (size_t) pfit->
size().volume();
152 float* fom = pfit->
FOM();
154 for ( i=0; i<datasize; i++ ) {
155 if ( fom[i] < (*pcc)[i] ) {
159 if ( fommax < (*pcc)[i] ) fommax = (*pcc)[i];
void change_type(char letter)
Get the data type indicated by a single letter code.
Header file for image class.
int calculate_background(size_t nn)
Calculates the background for one sub-image.
Header file for general utilities.
Header file for searching for a template in a map and returning multiple hits in a model...
Vector3< size_t > size() const
Utilities for timing functions.
General image parameter class.
int rescale_to_avg_std(double nuavg=0, double nustd=1)
Rescales the image data to a given average and standard deviation.
float * FOM_initialize()
Allocates and initializes the FOM block.
Bimage * cross_correlate(Bimage *p, Bimage *pmask=NULL)
void origin(double x, double y, double z)
void set(size_t j, double v)
Sets a single value at the given index.
int rotate()
Rotates an image using parameters defined in the image in place.
Bimage * img_multifit(Bimage *p, 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.
double img_multifit_for_view(Bimage *p, 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.
ostream & tab(ostream &out)
void origin(double ox, double oy, double oz)