EMAN2
Classes | Functions
util_sparx.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  sincBlackman
class  KaiserBessel
 1-D Kaiser-Bessel window function class. More...
class  KaiserBessel::kbsinh_win
 Sinh window function object. More...
class  KaiserBessel::kbi0_win
 I0 window function object. More...
class  FakeKaiserBessel
class  Gaussian
 Gaussian function class. More...
struct  tmpstruct

Functions

static int coveig (int n, float *covmat, float *eigval, float *eigvec)
 $Id$
static Dict coveig_for_py (int ncov, const vector< float > &covmatpy)
 same function than Util::coveig but wrapped to use directly in python code
static void WTF (EMData *PROJ, vector< float > SS, float SNR, int K)
static void WTM (EMData *PROJ, vector< float > SS, int DIAMETER, int NUMP)
static Dict CANG (float PHI, float THETA, float PSI)
static void BPCQ (EMData *B, EMData *CUBE, const int radius)
static vector< float > infomask (EMData *Vol, EMData *mask, bool)
static vector< float > helixshiftali (vector< EMData * > ctx, vector< vector< float > > pcoords, int nsegms, float maxincline, int kang, int search_rng, int nxc)
static vector< float > curhelixshiftali (vector< EMData * > ctx, vector< vector< float > > pcoords, int nsegms, int search_rng, int nx, int ny)
static void colreverse (float *beg, float *end, int nx)
static void slicereverse (float *beg, float *end, int nx, int ny)
static void cyclicshift (EMData *image, Dict params)
 Performs inplace integer cyclic shift as specified by the "dx","dy","dz" parameters on a 3d volume.
static Dict im_diff (EMData *V1, EMData *V2, EMData *mask=0)
static EMData * TwoDTestFunc (int Size, float p, float q, float a, float b, int flag=0, float alphaDeg=0)
 Creates a Two D Test Pattern.
static void spline_mat (float *x, float *y, int n, float *xq, float *yq, int m)
 Given a tabulated function y of x (n unordered points), and Given the values of the m values xq to be interpolated This routine returns the interpolated array yq, PRB This function is called by splint.
static void spline (float *x, float *y, int n, float yp1, float ypn, float *y2)
 Given a tabulated function y of x (unordered), and Given the values of the first derivatives at the end points This routine returns an array y2, that contains the second derivatives of the function at the tabulated points.
static void splint (float *xa, float *ya, float *y2a, int n, float *xq, float *yq, int m)
 Given the arrays xa(ordered, ya of length n, which tabulate a function and given the array y2a which is the output of spline and an unordered array xq, this routine returns a cubic-spline interpolated array yq.
static void Radialize (int *PermMatTr, float *kValsSorted, float *weightofkvalsSorted, int Size, int *SizeReturned)
 list the sorted lengths of the integer lattice sites of a square sided image of size Size.
static vector< float > even_angles (float delta, float t1=0, float t2=90, float p1=0, float p2=359.999)
 Compute a vector containing quasi-evenly spaced Euler angles.
static float quadri (float x, float y, int nx, int ny, float *image)
 Quadratic interpolation (2D).
static float quadri_background (float x, float y, int nx, int ny, float *image, int xnew, int ynew)
 Quadratic interpolation (2D).
static float get_pixel_conv_new (int nx, int ny, int nz, float delx, float dely, float delz, float *data, Util::KaiserBessel &kb)
static float get_pixel_conv_new_background (int nx, int ny, int nz, float delx, float dely, float delz, float *data, Util::KaiserBessel &kb, int xnew, int ynew)
static std::complex< float > extractpoint2 (int nx, int ny, float nuxnew, float nuynew, EMData *fimage, Util::KaiserBessel &kb)
static float bilinear (float xold, float yold, int nsam, int nrow, float *xim)
static float triquad (float r, float s, float t, float *fdata)
 Quadratic interpolation (3D)
static EMData * Polar2D (EMData *image, vector< int > numr, string mode)
static EMData * Polar2Dm (EMData *image, float cns2, float cnr2, vector< int > numr, string cmode)
static void alrl_ms (float *xim, int nsam, int nrow, float cns2, float cnr2, int *numr, float *circ, int lcirc, int nring, char mode)
static EMData * Polar2Dmi (EMData *image, float cns2, float cnr2, vector< int > numr, string cmode, Util::KaiserBessel &kb)
static void fftr_q (float *xcmplx, int nv)
static void fftr_d (double *xcmplx, int nv)
static void fftc_q (float *br, float *bi, int ln, int ks)
static void fftc_d (double *br, double *bi, int ln, int ks)
static void Frngs (EMData *circ, vector< int > numr)
 This function conducts the Single Precision Fourier Transform for a set of rings.
static void Normalize_ring (EMData *ring, const vector< int > &numr)
static void Frngs_inv (EMData *circ, vector< int > numr)
 This function conducts the Single Precision Inverse Fourier Transform for a set of rings.
static void Applyws (EMData *circ, vector< int > numr, vector< float > wr)
 This is a copy of Applyws routine from alignment.py.
static Dict Crosrng_e (EMData *circ1, EMData *circ2, vector< int > numr, int neg)
static Dict Crosrng_ew (EMData *circ1, EMData *circ2, vector< int > numr, vector< float > w, int neg)
static Dict Crosrng_ms (EMData *circ1, EMData *circ2, vector< int > numr)
static Dict Crosrng_ms_delta (EMData *circ1, EMData *circ2, vector< int > numr, float delta_start, float delta)
static Dict Crosrng_sm_psi (EMData *circ1, EMData *circ2, vector< int > numr, float psi, int flag, float psimax)
 checks either straight or mirrored position depending on flag input - fourier transforms of rings!! circ1 already multiplied by weights!
static Dict Crosrng_psi (EMData *circ1, EMData *circ2, vector< int > numr, float psi, float psimax)
 checks both straight & mirrored position input - fourier transforms of rings!! circ1 already multiplied by weights!
static Dict Crosrng_ns (EMData *circ1, EMData *circ2, vector< int > numr)
 checks both straight & mirrored positions Find only positions within +/-pis_max of 0 and 180 (for helcal use) input - fourier transforms of rings! circ1 already multiplied by weights!
static EMData * Crosrng_msg (EMData *circ1, EMData *circ2, vector< int > numr)
 checks both straight & mirrored positions input - fourier transforms of rings!! circ1 already multiplied by weights! returns EM object with 1D ccf
static void Crosrng_msg_vec (EMData *circ1, EMData *circ2, vector< int > numr, float *q, float *t)
 checks both straight & mirrored positions input - fourier transforms of rings!! circ1 already multiplied by weights! returns EM object with 1D ccf
static EMData * Crosrng_msg_s (EMData *circ1, EMData *circ2, vector< int > numr)
 This program is half of the Crosrng_msg.
static EMData * Crosrng_msg_m (EMData *circ1, EMData *circ2, vector< int > numr)
 This program is half of the Crosrng_msg.
static vector< float > Crosrng_msg_vec_p (EMData *circ1, EMData *circ2, vector< int > numr)
static void prb1d (double *b, int npoint, float *pos)
static void update_fav (EMData *ave, EMData *dat, float tot, int mirror, vector< int > numr)
static void sub_fav (EMData *ave, EMData *dat, float tot, int mirror, vector< int > numr)
static float ener (EMData *ave, vector< int > numr)
static float ener_tot (const vector< EMData * > &data, vector< int > numr, vector< float > tot)
static Dict min_dist_real (EMData *image, const vector< EMData * > &data)
 k-means helper
static Dict min_dist_four (EMData *image, const vector< EMData * > &data)
 helper function for k-means
static int k_means_cont_table_ (int *group1, int *group2, int *stb, long int s1, long int s2, int flag)
 helper to create the contengency table for partition matching (k-means) flag define is the list of stable obj must be store to stb, but the size st must be know before.
static void initial_prune (vector< vector< int * > > &Parts, int *dimClasses, int nParts, int K, int T)
 initial_prune removes all classes C from Parts where there does not exist ANY feasible matching containing class C which has weight gt T.
static bool explore (vector< vector< int * > > &Parts, int *dimClasses, int nParts, int K, int T, int partref, int *curintx, int size_curintx, int *next, int size_next, int depth)
 Each class in Parts has its dummy variable set to 0 or 1.
static int generatesubmax (int *argParts, int *Indices, int *dimClasses, int nParts, int K, int T, int n_guesses, int LARGEST_CLASS)
 make an intelligent "guess" at the largest weight of all possible feasible matches.
static void search2 (int *argParts, int *Indices, int *dimClasses, int nParts, int K, int T, int *matchlist, int *costlist, int J)
 return the weight of the largest weighted feasible match, along with the match in the (preallocated) argument curmax.
static void explore2 (int *argParts, int *Indices, int *dimClasses, int nParts, int K, int T, int *curintx, int size_curintx, int *next, int size_next, int depth, int J, int *matchlist, int *costlist, int *curbranch)
static bool sanitycheck (int *argParts, int *Indices, int *dimClasses, int nParts, int K, int T, int *output)
 First element of output is total cost of the matches in the output Second element of output is the total number of matches in output So output has 2+(*(output+1))nParts elements.
static vector< int > bb_enumerateMPI_ (int *argParts, int *dimClasses, int nParts, int K, int T, int n_guesses, int LARGEST_CLASS, int J, int max_branching, float stmult, int branchfunc, int LIM)
 K is the number of classes in each partition (should be the same for all partitions) the first element of each class is its original index in the partition, and second is dummy var MPI: if nTop <= 0, then initial prune is called, and the pruned partitions are returned in a 1D array.
static int * branchMPI (int *argParts, int *Indices, int *dimClasses, int nParts, int K, int T, int curlevel, int n_guesses, int LARGEST_CLASS, int J, int max_branching, float stmult, int branchfunc, int LIM)
 same as branch except the nFirst (=Levels[0]) possibilites for the first match are already chosen firstmatches stores the matches and corresponding cost, where each match is preceded by its cost....
static int branch_factor_0 (int *costlist, int *matchlist, int J, int T, int nParts, int curlevel, int max_branching, int LIM)
static int branch_factor_2 (int *costlist, int *matchlist, int J, int T, int nParts, int curlevel, int max_branching, int LIM)
static int branch_factor_3 (int *costlist, int *matchlist, int J, int T, int nParts, int curlevel, int max_branching, int K, int LIM)
static int branch_factor_4 (int *costlist, int *matchlist, int J, int T, int nParts, int curlevel, int max_branching, float stmult)
static vector< double > cml_weights (const vector< float > &cml)
static vector< int > cml_line_insino (vector< float > Rot, int i_prj, int n_prj)
 2009-03-25 15:35:53 JB.
static vector< int > cml_line_insino_all (vector< float > Rot, vector< int > seq, int n_prj, int n_lines)
 2009-03-30 15:35:07 JB.
static vector< double > cml_init_rot (vector< float > Ori)
 2009-03-25 15:35:05 JB.
static vector< float > cml_update_rot (vector< float > Rot, int iprj, float nph, float th, float nps)
 2009-03-25 15:35:37 JB.
static vector< double > cml_line_in3d (vector< float > Ori, vector< int > seq, int nprj, int nlines)
 2009-03-26 10:46:14 JB.
static vector< double > cml_spin_psi (const vector< EMData * > &data, vector< int > com, vector< float > weights, int iprj, vector< int > iw, int n_psi, int d_psi, int n_prj)
 2009-03-26 11:37:53 JB.
static vector< double > cml_spin_psi_now (const vector< EMData * > &data, vector< int > com, int iprj, vector< int > iw, int n_psi, int d_psi, int n_prj)
static double cml_disc (const vector< EMData * > &data, vector< int > com, vector< int > seq, vector< float > weights, int n_lines)
 2009-03-30 15:44:05 JB.
static void set_line (EMData *img, int posline, EMData *line, int offset, int length)
 This function drop a line (line) to an 2D image (img).
static void cml_prepare_line (EMData *sino, EMData *line, int ilf, int ihf, int pos_line, int nblines)
 This function prepare the line from sinogram by cutting off some frequencies, and creating the mirror part (complexe conjugate of the first part).
static EMData * decimate (EMData *img, int x_step, int y_step=1, int z_step=1)
static EMData * window (EMData *img, int new_nx, int new_ny=1, int new_nz=1, int x_offset=0, int y_offset=0, int z_offset=0)
static EMData * pad (EMData *img, int new_nx, int new_ny=1, int new_nz=1, int x_offset=0, int y_offset=0, int z_offset=0, const char *params="average")
static vector< float > histogram (EMData *image, EMData *mask, int nbins=128, float hmin=0.0f, float hmax=0.0f)
static Dict histc (EMData *ref, EMData *img, EMData *mask)
static float hist_comp_freq (float PA, float PB, size_t size_img, int hist_len, EMData *img, vector< float > ref_freq_hist, EMData *mask, float ref_h_diff, float ref_h_min)
static float tf (float dzz, float ak, float voltage=300.0f, float cs=2.0f, float wgh=0.1f, float b_factor=0.0f, float sign=-1.0f)
static EMData * compress_image_mask (EMData *image, EMData *mask)
static EMData * reconstitute_image_mask (EMData *image, EMData *mask)
 Recreates a n-d image using its compressed 1-D form and the mask.
static vector< float > merge_peaks (vector< float > peak1, vector< float > peak2, float p_size)
static vector< float > pw_extract (vector< float >pw, int n, int iswi, float ps)
static vector< float > call_cl1 (long int *k, long int *n, float *ps, long int *iswi, float *pw, float *q2, double *q, double *x, double *res, double *cu, double *s, long int *iu)
static vector< float > lsfit (long int *ks, long int *n, long int *klm2d, long int *iswi, float *q1, double *q, double *x, double *res, double *cu, double *s, long int *iu)
static void cl1 (long int *k, long int *l, long int *m, long int *n, long int *klm2d, double *q, double *x, double *res, double *cu, long int *iu, double *s)
static float eval (char *images, EMData *img, vector< int > S, int N, int K, int size)
static vector< double > vrdg (const vector< float > &ph, const vector< float > &th)
static void hsortd (double *theta, double *phi, int *key, int len, int option)
static void voronoidiag (double *theta, double *phi, double *weight, int n)
static void voronoi (double *phi, double *theta, double *weight, int nt)
static void disorder2 (double *x, double *y, int *key, int len)
static void ang_to_xyz (double *x, double *y, double *z, int len)
static void flip23 (double *x, double *y, double *z, int *key, int k, int len)
static bool cmp1 (tmpstruct tmp1, tmpstruct tmp2)
static bool cmp2 (tmpstruct tmp1, tmpstruct tmp2)
static int trmsh3_ (int *n0, double *tol, double *x, double *y, double *z__, int *n, int *list, int *lptr, int *lend, int *lnew, int *indx, int *lcnt, int *near__, int *next, double *dist, int *ier)
static double areav_ (int *k, int *n, double *x, double *y, double *z__, int *list, int *lptr, int *lend, int *ier)
static EMData * madn_scalar (EMData *img, EMData *img1, float scalar)
static EMData * mult_scalar (EMData *img, float scalar)
static EMData * addn_img (EMData *img, EMData *img1)
static EMData * subn_img (EMData *img, EMData *img1)
static EMData * muln_img (EMData *img, EMData *img1)
static EMData * divn_img (EMData *img, EMData *img1)
static EMData * squaren_img (EMData *img)
static EMData * divn_filter (EMData *img, EMData *img1)
static void mad_scalar (EMData *img, EMData *img1, float scalar)
static void mul_scalar (EMData *img, float scalar)
static void add_img (EMData *img, EMData *img1)
static void add_img_abs (EMData *img, EMData *img1)
static void add_img2 (EMData *img, EMData *img1)
static void sub_img (EMData *img, EMData *img1)
static void mul_img (EMData *img, EMData *img1)
static void div_img (EMData *img, EMData *img1)
static void square_img (EMData *img)
static void div_filter (EMData *img, EMData *img1)
static void set_freq (EMData *freqvol, EMData *temp, EMData *mask, float cutoff, float freq)
static EMData * pack_complex_to_real (EMData *img)
static float ang_n (float peakp, string mode, int maxrin)
static vector< float > multiref_polar_ali_2d (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, string mode, vector< int >numr, float cnx, float cny)
 formerly known as apmq Determine shift and rotation between image and many reference images (crefim, weights have to be applied) quadratic interpolation
static vector< float > multiref_polar_ali_2d_peaklist (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, string mode, vector< int >numr, float cnx, float cny)
static vector< float > multiref_polar_ali_2d_peaklist_local (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, float ant, string mode, vector< int >numr, float cnx, float cny)
static vector< int > assign_groups (std::string matrix_address, int nref, int nima)
static void getvec (float phi, float theta, float &x, float &y, float &z, int option=0)
static float ang_diff (float v11, float v12, float v13, float v21, float v22, float v23, int &mirror)
static int nearest_ang (const vector< float > &vecref, float x, float y, float z)
static vector< int > assign_projangles (const vector< float > &projangles, const vector< float > &refangles)
static vector< int > nearestk_to_refdir (const vector< float > &projangles, const vector< float > &refangles, const int howmany)
static vector< int > group_proj_by_phitheta (const vector< float > &projangles, const vector< float > &ref_ang, const int img_per_grp)
static vector< float > multiref_polar_ali_2d_delta (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, string mode, vector< int >numr, float cnx, float cny, float delta_start, float delta)
 formerly known as apmq Determine shift and rotation between image and many reference images (crefim, weights have to be applied) quadratic interpolation
static vector< float > multiref_polar_ali_2d_nom (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, string mode, vector< int >numr, float cnx, float cny)
 formerly known as apnq DO NOT CONSIDER MIRROR Determine shift and rotation between image and many reference images (crefim, weights have to be applied) quadratic interpolation
static vector< float > multiref_polar_ali_2d_local (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, float ant, string mode, vector< int >numr, float cnx, float cny)
 formerly known as apmq Determine shift and rotation between image and many reference images (crefim, weights have to be applied) quadratic interpolation
static vector< float > shc (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, float ant, string mode, vector< int >numr, float cnx, float cny, string sym)
static vector< float > shc_multipeaks (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, float ant, string mode, vector< int >numr, float cnx, float cny, int max_peaks_count)
static vector< float > multiref_polar_ali_helical (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, float psi_max, string mode, vector< int >numr, float cnx, float cny, int ynumber=-1)
 formerly known as apmq Determine shift and rotation between image and many reference images (crefim, weights have to be applied) quadratic interpolation Search for peaks only within +/-psi_max from 0 and 180 (helical)
static vector< float > multiref_polar_ali_helical_local (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, float ant, float psi_max, string mode, vector< int >numr, float cnx, float cny, int ynumber=-1, float yrnglocal=-1.0)
static vector< float > multiref_polar_ali_helical_90 (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, float psi_max, string mode, vector< int >numr, float cnx, float cny, int ynumber=-1)
static vector< float > multiref_polar_ali_helical_90_local (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, float ant, float psi_max, string mode, vector< int >numr, float cnx, float cny, int ynumber=-1, float yrnglocal=-1.0)
static vector< float > multiref_polar_ali_helicon_local (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, float ant, float psi_max, string mode, vector< int >numr, float cnx, float cny, int ynumber=-1, float yrnglocal=-1.0)
 Next two for helicon.
static vector< float > multiref_polar_ali_helicon_90_local (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, float ant, float psi_max, string mode, vector< int >numr, float cnx, float cny, int ynumber=-1, float yrnglocal=-1.0)
static vector< float > multiref_polar_ali_2d_local_psi (EMData *image, const vector< EMData * > &crefim, float xrng, float yrng, float step, float ant, float psi_max, string mode, vector< int >numr, float cnx, float cny)
 formerly known as apmq Determine shift and rotation between image and many reference images (crefim, weights have to be applied) quadratic interpolation
static void multiref_peaks_ali2d (EMData *image, EMData *crefim, float xrng, float yrng, float step, string mode, vector< int >numr, float cnx, float cny, EMData *peaks, EMData *peakm)
 Determine shift and rotation between image and one reference image (crefim, weights have to be applied) using quadratic interpolation, return a list of peaks PAP 07/21/08.
static void multiref_peaks_compress_ali2d (EMData *image, EMData *crefim, float xrng, float yrng, float step, string mode, vector< int >numr, float cnx, float cny, EMData *peaks, EMData *peakm, EMData *peaks_compress, EMData *peakm_compress)
 Determine shift and rotation between image and one reference image (crefim, weights have to be applied) using quadratic interpolation, return a list of peaks PAP 07/21/08.
static vector< float > ali2d_ccf_list (EMData *image, EMData *crefim, float xrng, float yrng, float step, string mode, vector< int >numr, float cnx, float cny, double T)
 Determine shift and rotation between image and one reference image (crefim, weights have to be applied) using quadratic interpolation.
static vector< float > twoD_fine_ali (EMData *image, EMData *refim, EMData *mask, float ang, float sxs, float sys)
static vector< float > twoD_fine_ali_G (EMData *image, EMData *refim, EMData *mask, Util::KaiserBessel &kb, float ang, float sxs, float sys)
static vector< float > twoD_to_3D_ali (EMData *volft, Util::KaiserBessel &kb, EMData *refim, EMData *mask, float phi, float theta, float psi, float sxs, float sxy)
static vector< float > twoD_fine_ali_SD (EMData *image, EMData *refim, EMData *mask, float ang, float sxs, float sys)
static float ccc_images (EMData *, EMData *, EMData *, float, float, float)
static vector< float > twoD_fine_ali_SD_G (EMData *image, EMData *refim, EMData *mask, Util::KaiserBessel &kb, float ang, float sxs, float sys)
static float ccc_images_G (EMData *image, EMData *refim, EMData *mask, Util::KaiserBessel &kb, float ang, float sx, float sy)
static float local_inner_product (EMData *image1, EMData *image2, int lx, int ly, int lz, int w)
static EMData * move_points (EMData *img, float qprob, int ri, int ro)
static EMData * get_biggest_cluster (EMData *mg)
static EMData * ctf_img (int nx, int ny, int nz, float dz, float ps, float voltage, float cs, float wgh, float b_factor, float dza, float azz, float sign)
static EMData * ctf_rimg (int nx, int ny, int nz, float dz, float ps, float voltage, float cs, float wgh, float b_factor, float dza, float azz, float sign)
static EMData * ctf2_rimg (int nx, int ny, int nz, float dz, float ps, float voltage, float cs, float wgh, float b_factor, float dza, float azz, float sign)
static int mono (int k1, int k2)
static int nint180 (float arg)
static double mean (double *x, int n)
static double var (double *x, int n)
static vector< float > multi_align_error (vector< float > args, vector< float > all_ali_params, int d)
static double multi_align_error_func (double *x, vector< float > all_ali_params, int nima, int num_ali, int d)
static vector< double > multi_align_error_func2 (double *x, vector< float > all_ali_params, int nima, int num_ali, int d)
static void multi_align_error_dfunc (double *x, vector< float > all_ali_params, int nima, int num_ali, double *g, int d)
static vector< float > cluster_pairwise (EMData *d, int K, float T, float F)
static vector< float > cluster_equalsize (EMData *d)
static vector< float > vareas (EMData *d)
static EMData * get_slice (EMData *vol, int dim, int index)
 This function returns a 2-D slice from a 3-D EMData object dim denotes the slice is perpendicular to which dimension 1 for x-dimension, 2 for y-dimension and 3 for z-dimension.
static void image_mutation (EMData *img, float mutation_rate)
static void array_mutation (float *list, int len_list, float mutation_rate, float min_val, float max_val, int K, int is_mirror)
 The purpose of this function is to convert a list to grey code and mutate them and convert them back.
static vector< float > list_mutation (vector< float > list, float mutation_rate, float min_val, float max_val, int K, int is_mirror)
static float restrict1 (float x, int nx)
static Dict get_transform_params (EMData *image, string xform, string convention)
 This function returns parameters from Transform object as a Dict object.
static void constrained_helix_exhaustive (vector< EMData * > data, vector< EMData * > fdata, vector< EMData * > refproj, vector< EMData * > rotproj, vector< float > dp_dphi_rise_delta, vector< int > nphi_phiwobble_range_ywobble_Dsym_nwx_nwy_nwxc_nwyc, bool FindPsi, float psi_max, vector< EMData * > crefim, vector< int > numr, int maxrin, string mode, int cnx, int cny)
static std::vector< float > diff_between_matrix_of_3D_parameters_angles (std::vector< float > all_params, std::vector< float > rotations)
static std::vector< int > max_clique (std::vector< int > edges)
 Calculates max_clique in undirected graph, input: edges coded as pair of integers (integers correspond to vertices, must be >=0) Returns: vertices (integers) belonging to max clique.

Function Documentation

static void add_img ( EMData *  img,
EMData *  img1 
) [static]
static void add_img2 ( EMData *  img,
EMData *  img1 
) [static]
static void add_img_abs ( EMData *  img,
EMData *  img1 
) [static]
static EMData* addn_img ( EMData *  img,
EMData *  img1 
) [static]
static vector<float> ali2d_ccf_list ( EMData *  image,
EMData *  crefim,
float  xrng,
float  yrng,
float  step,
string  mode,
vector< int >  numr,
float  cnx,
float  cny,
double  T 
) [static]

Determine shift and rotation between image and one reference image (crefim, weights have to be applied) using quadratic interpolation.

static void alrl_ms ( float *  xim,
int  nsam,
int  nrow,
float  cns2,
float  cnr2,
int *  numr,
float *  circ,
int  lcirc,
int  nring,
char  mode 
) [static]
static float ang_diff ( float  v11,
float  v12,
float  v13,
float  v21,
float  v22,
float  v23,
int &  mirror 
) [inline, static]

Definition at line 891 of file util_sparx.h.

References v.

                                                                                                                    {
                float v = v11*v21+v12*v22+v13*v23;
                if (v > 1) v = 1;
                if (v < -1) v = -1;
                if (v > 0) { mirror = 1; return acos(v)*180.0f/M_PI; }
                else { mirror = -1; return acos(-v)*180.0f/M_PI; }
        }
static float ang_n ( float  peakp,
string  mode,
int  maxrin 
) [static, private]

Referenced by aprq2d().

static void ang_to_xyz ( double *  x,
double *  y,
double *  z,
int  len 
) [static]
static void Applyws ( EMData *  circ,
vector< int >  numr,
vector< float >  wr 
) [static]

This is a copy of Applyws routine from alignment.py.

static double areav_ ( int *  k,
int *  n,
double *  x,
double *  y,
double *  z__,
int *  list,
int *  lptr,
int *  lend,
int *  ier 
) [static]
static void array_mutation ( float *  list,
int  len_list,
float  mutation_rate,
float  min_val,
float  max_val,
int  K,
int  is_mirror 
) [static]

The purpose of this function is to convert a list to grey code and mutate them and convert them back.

static vector<int> assign_groups ( std::string  matrix_address,
int  nref,
int  nima 
) [static]
static vector<int> assign_projangles ( const vector< float > &  projangles,
const vector< float > &  refangles 
) [static]
static vector<int> bb_enumerateMPI_ ( int *  argParts,
int *  dimClasses,
int  nParts,
int  K,
int  T,
int  n_guesses,
int  LARGEST_CLASS,
int  J,
int  max_branching,
float  stmult,
int  branchfunc,
int  LIM 
) [static]

K is the number of classes in each partition (should be the same for all partitions) the first element of each class is its original index in the partition, and second is dummy var MPI: if nTop <= 0, then initial prune is called, and the pruned partitions are returned in a 1D array.

The first element is reserved for max_levels (the size of the smallest partition after pruning). if nTop > 0, then partitions are assumed to have been pruned, where only dummy variables of un-pruned partitions are set to 1, and findTopLargest is called to find the top weighted matches. The matches, where each match is preceded by its cost, is returned in a one dimensional vector.

essentially the same as bb_enumerate but with the option to do mpi version.

static float bilinear ( float  xold,
float  yold,
int  nsam,
int  nrow,
float *  xim 
) [static]
static void BPCQ ( EMData *  B,
EMData *  CUBE,
const int  radius 
) [static]
static int branch_factor_0 ( int *  costlist,
int *  matchlist,
int  J,
int  T,
int  nParts,
int  curlevel,
int  max_branching,
int  LIM 
) [static]
static int branch_factor_2 ( int *  costlist,
int *  matchlist,
int  J,
int  T,
int  nParts,
int  curlevel,
int  max_branching,
int  LIM 
) [static]
static int branch_factor_3 ( int *  costlist,
int *  matchlist,
int  J,
int  T,
int  nParts,
int  curlevel,
int  max_branching,
int  K,
int  LIM 
) [static]
static int branch_factor_4 ( int *  costlist,
int *  matchlist,
int  J,
int  T,
int  nParts,
int  curlevel,
int  max_branching,
float  stmult 
) [static]
static int* branchMPI ( int *  argParts,
int *  Indices,
int *  dimClasses,
int  nParts,
int  K,
int  T,
int  curlevel,
int  n_guesses,
int  LARGEST_CLASS,
int  J,
int  max_branching,
float  stmult,
int  branchfunc,
int  LIM 
) [static]

same as branch except the nFirst (=Levels[0]) possibilites for the first match are already chosen firstmatches stores the matches and corresponding cost, where each match is preceded by its cost....

output is an int array, the first element is the cost of the output solution, the second element is the total number of matches in the solution and the rest is the list of matches. output is in one dimensional form.

static vector<float> call_cl1 ( long int *  k,
long int *  n,
float *  ps,
long int *  iswi,
float *  pw,
float *  q2,
double *  q,
double *  x,
double *  res,
double *  cu,
double *  s,
long int *  iu 
) [static]
static Dict CANG ( float  PHI,
float  THETA,
float  PSI 
) [static]
static float ccc_images ( EMData *  ,
EMData *  ,
EMData *  ,
float  ,
float  ,
float   
) [static]
static float ccc_images_G ( EMData *  image,
EMData *  refim,
EMData *  mask,
Util::KaiserBessel &  kb,
float  ang,
float  sx,
float  sy 
) [static]
static void cl1 ( long int *  k,
long int *  l,
long int *  m,
long int *  n,
long int *  klm2d,
double *  q,
double *  x,
double *  res,
double *  cu,
long int *  iu,
double *  s 
) [static]
static vector<float> cluster_equalsize ( EMData *  d) [static]
static vector<float> cluster_pairwise ( EMData *  d,
int  K,
float  T,
float  F 
) [static]
static double cml_disc ( const vector< EMData * > &  data,
vector< int >  com,
vector< int >  seq,
vector< float >  weights,
int  n_lines 
) [static]

2009-03-30 15:44:05 JB.

Compute the discrepancy belong all common-lines

static vector<double> cml_init_rot ( vector< float >  Ori) [static]

2009-03-25 15:35:05 JB.

This function prepare rotation matrix for common-lines

static vector<double> cml_line_in3d ( vector< float >  Ori,
vector< int >  seq,
int  nprj,
int  nlines 
) [static]

2009-03-26 10:46:14 JB.

This function calculate all common-lines in space for Voronoi

static vector<int> cml_line_insino ( vector< float >  Rot,
int  i_prj,
int  n_prj 
) [static]

2009-03-25 15:35:53 JB.

This function calculates common-lines between sinogram

static vector<int> cml_line_insino_all ( vector< float >  Rot,
vector< int >  seq,
int  n_prj,
int  n_lines 
) [static]

2009-03-30 15:35:07 JB.

This function calculates all common-lines between sinogram

static void cml_prepare_line ( EMData *  sino,
EMData *  line,
int  ilf,
int  ihf,
int  pos_line,
int  nblines 
) [static]

This function prepare the line from sinogram by cutting off some frequencies, and creating the mirror part (complexe conjugate of the first part).

Then both lines (mirror and without) are drop to the sinogram. line is in Fourrier space, ilf low frequency, ihf high frequency, nblines number of lines of the half sinogram (the non miror part), sino the sinogram, pos_line the position of the line in the sino.

static vector<double> cml_spin_psi ( const vector< EMData * > &  data,
vector< int >  com,
vector< float >  weights,
int  iprj,
vector< int >  iw,
int  n_psi,
int  d_psi,
int  n_prj 
) [static]

2009-03-26 11:37:53 JB.

This function spin all angle psi and evaluate the partial discrepancy belong common-lines

static vector<double> cml_spin_psi_now ( const vector< EMData * > &  data,
vector< int >  com,
int  iprj,
vector< int >  iw,
int  n_psi,
int  d_psi,
int  n_prj 
) [static]
static vector<float> cml_update_rot ( vector< float >  Rot,
int  iprj,
float  nph,
float  th,
float  nps 
) [static]

2009-03-25 15:35:37 JB.

this function update only one rotation amtrix according a new orientation

static vector<double> cml_weights ( const vector< float > &  cml) [static]
static bool cmp1 ( tmpstruct  tmp1,
tmpstruct  tmp2 
) [static]
static bool cmp2 ( tmpstruct  tmp1,
tmpstruct  tmp2 
) [static]
static void colreverse ( float *  beg,
float *  end,
int  nx 
) [static]
static EMData* compress_image_mask ( EMData *  image,
EMData *  mask 
) [static]
static void constrained_helix_exhaustive ( vector< EMData * >  data,
vector< EMData * >  fdata,
vector< EMData * >  refproj,
vector< EMData * >  rotproj,
vector< float >  dp_dphi_rise_delta,
vector< int >  nphi_phiwobble_range_ywobble_Dsym_nwx_nwy_nwxc_nwyc,
bool  FindPsi,
float  psi_max,
vector< EMData * >  crefim,
vector< int >  numr,
int  maxrin,
string  mode,
int  cnx,
int  cny 
) [static]
static int coveig ( int  n,
float *  covmat,
float *  eigval,
float *  eigvec 
) [static]

$Id$

This file is a part of util.h, To use this file's functions, you should include "util.h" NEVER directly include this file

Referenced by EMAN::PCAsmall::analyze(), EMAN::PointArray::construct_helix(), and EMAN::PointArray::do_pca().

static Dict coveig_for_py ( int  ncov,
const vector< float > &  covmatpy 
) [static]

same function than Util::coveig but wrapped to use directly in python code

static Dict Crosrng_e ( EMData *  circ1,
EMData *  circ2,
vector< int >  numr,
int  neg 
) [static]
static Dict Crosrng_ew ( EMData *  circ1,
EMData *  circ2,
vector< int >  numr,
vector< float >  w,
int  neg 
) [static]
static Dict Crosrng_ms ( EMData *  circ1,
EMData *  circ2,
vector< int >  numr 
) [static]
static Dict Crosrng_ms_delta ( EMData *  circ1,
EMData *  circ2,
vector< int >  numr,
float  delta_start,
float  delta 
) [static]
static EMData* Crosrng_msg ( EMData *  circ1,
EMData *  circ2,
vector< int >  numr 
) [static]

checks both straight & mirrored positions input - fourier transforms of rings!! circ1 already multiplied by weights! returns EM object with 1D ccf

static EMData* Crosrng_msg_m ( EMData *  circ1,
EMData *  circ2,
vector< int >  numr 
) [static]

This program is half of the Crosrng_msg.

It only checks mirrored position. input - fourier transforms of rings!! circ1 already multiplied by weights! returns EM object with 1D ccf

static EMData* Crosrng_msg_s ( EMData *  circ1,
EMData *  circ2,
vector< int >  numr 
) [static]

This program is half of the Crosrng_msg.

It only checks straight position. input - fourier transforms of rings!! circ1 already multiplied by weights! returns EM object with 1D ccf

static void Crosrng_msg_vec ( EMData *  circ1,
EMData *  circ2,
vector< int >  numr,
float *  q,
float *  t 
) [static]

checks both straight & mirrored positions input - fourier transforms of rings!! circ1 already multiplied by weights! returns EM object with 1D ccf

static vector<float> Crosrng_msg_vec_p ( EMData *  circ1,
EMData *  circ2,
vector< int >  numr 
) [static]
static Dict Crosrng_ns ( EMData *  circ1,
EMData *  circ2,
vector< int >  numr 
) [static]

checks both straight & mirrored positions Find only positions within +/-pis_max of 0 and 180 (for helcal use) input - fourier transforms of rings! circ1 already multiplied by weights!

static Dict Crosrng_psi ( EMData *  circ1,
EMData *  circ2,
vector< int >  numr,
float  psi,
float  psimax 
) [static]

checks both straight & mirrored position input - fourier transforms of rings!! circ1 already multiplied by weights!

static Dict Crosrng_sm_psi ( EMData *  circ1,
EMData *  circ2,
vector< int >  numr,
float  psi,
int  flag,
float  psimax 
) [static]

checks either straight or mirrored position depending on flag input - fourier transforms of rings!! circ1 already multiplied by weights!

static EMData* ctf2_rimg ( int  nx,
int  ny,
int  nz,
float  dz,
float  ps,
float  voltage,
float  cs,
float  wgh,
float  b_factor,
float  dza,
float  azz,
float  sign 
) [static]
static EMData* ctf_img ( int  nx,
int  ny,
int  nz,
float  dz,
float  ps,
float  voltage,
float  cs,
float  wgh,
float  b_factor,
float  dza,
float  azz,
float  sign 
) [static]
static EMData* ctf_rimg ( int  nx,
int  ny,
int  nz,
float  dz,
float  ps,
float  voltage,
float  cs,
float  wgh,
float  b_factor,
float  dza,
float  azz,
float  sign 
) [static]
static vector<float> curhelixshiftali ( vector< EMData * >  ctx,
vector< vector< float > >  pcoords,
int  nsegms,
int  search_rng,
int  nx,
int  ny 
) [static]
static void cyclicshift ( EMData *  image,
Dict  params 
) [static]

Performs inplace integer cyclic shift as specified by the "dx","dy","dz" parameters on a 3d volume.

Implements the inplace swapping using reversals as descibed in also: http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Intro/Eg01/

Author:
Phani Ivatury
Date:
18-2006
See also:
http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Intro/Eg01/

A[0] A[1] A[2] A[3] A[4] A[5] A[6] A[7] A[8] A[9]

10 20 30 40 50 60 70 80 90 100 ------------ m = 3 (shift left three places)

Reverse the items from 0..m-1 and m..N-1:

30 20 10 100 90 80 70 60 50 40

Now reverse the entire sequence:

40 50 60 70 80 90 100 10 20 30

cycl_shift() in libpy/fundementals.py calls this function

Usage: EMData *im1 = new EMData(); im1->set_size(70,80,85); im1->to_one(); Dict params; params["dx"] = 10;params["dy"] = 10000;params["dz"] = -10; Utils::cyclicshift(im1,params); im1.peak_search(1,1)

static EMData* decimate ( EMData *  img,
int  x_step,
int  y_step = 1,
int  z_step = 1 
) [static]
static std::vector<float> diff_between_matrix_of_3D_parameters_angles ( std::vector< float >  all_params,
std::vector< float >  rotations 
) [static]
static void disorder2 ( double *  x,
double *  y,
int *  key,
int  len 
) [static]
static void div_filter ( EMData *  img,
EMData *  img1 
) [static]
static void div_img ( EMData *  img,
EMData *  img1 
) [static]
static EMData* divn_filter ( EMData *  img,
EMData *  img1 
) [static]
static EMData* divn_img ( EMData *  img,
EMData *  img1 
) [static]
static float ener ( EMData *  ave,
vector< int >  numr 
) [static]
static float ener_tot ( const vector< EMData * > &  data,
vector< int >  numr,
vector< float >  tot 
) [static]
static float eval ( char *  images,
EMData *  img,
vector< int >  S,
int  N,
int  K,
int  size 
) [static]
static vector<float> even_angles ( float  delta,
float  t1 = 0,
float  t2 = 90,
float  p1 = 0,
float  p2 = 359.999 
) [static]

Compute a vector containing quasi-evenly spaced Euler angles.

The order of angles in the vector is phi, theta, psi.

Parameters:
[in]deltaDelta theta (spacing in theta).
[in]t1Starting (min) value of theta in degrees, default = 0.
[in]t2Ending (max) value of theta in degrees, default = 90.
[in]p1Starting (min) value of phi in degrees, default = 0.
[in]p2Ending (max) value of phi in degrees, default = 359.9.
Returns:
Vector of angles as a flat list of phi_0, theta_0, psi_0, ..., phi_N, theta_N, psi_N.
static bool explore ( vector< vector< int * > > &  Parts,
int *  dimClasses,
int  nParts,
int  K,
int  T,
int  partref,
int *  curintx,
int  size_curintx,
int *  next,
int  size_next,
int  depth 
) [static]

Each class in Parts has its dummy variable set to 0 or 1.

Only consider those with its dummy variable set to 1 (the 'active' ones) First element of each class is its original index, second is the dummy variable slot.

static void explore2 ( int *  argParts,
int *  Indices,
int *  dimClasses,
int  nParts,
int  K,
int  T,
int *  curintx,
int  size_curintx,
int *  next,
int  size_next,
int  depth,
int  J,
int *  matchlist,
int *  costlist,
int *  curbranch 
) [static]
static std::complex<float> extractpoint2 ( int  nx,
int  ny,
float  nuxnew,
float  nuynew,
EMData *  fimage,
Util::KaiserBessel &  kb 
) [static]
static void fftc_d ( double *  br,
double *  bi,
int  ln,
int  ks 
) [static]

Definition at line 366 of file spidfft.cpp.

Referenced by fftr_d().

{
   double rni,sgn,tr1,tr2,ti1,ti2;
   double cc,c,ss,s,t,x2,x3,x4,x5;
   int    b3,b4,b5,b6,b7,b56;
   int    n, k, l, j, i, ix0, ix1, status=0; 
   double tab1[15];

   tab1(1)=9.58737990959775e-5;
   tab1(2)=1.91747597310703e-4;
   tab1(3)=3.83495187571395e-4;
   tab1(4)=7.66990318742704e-4;
   tab1(5)=1.53398018628476e-3;
   tab1(6)=3.06795676296598e-3;
   tab1(7)=6.13588464915449e-3;
   tab1(8)=1.22715382857199e-2;
   tab1(9)=2.45412285229123e-2;
   tab1(10)=4.90676743274181e-2;
   tab1(11)=9.80171403295604e-2;
   tab1(12)=1.95090322016128e-1;
   tab1(13)=3.82683432365090e-1;
   tab1(14)=7.07106781186546e-1;
   tab1(15)=1.00000000000000;

   n=(int)pow(2,ln);

   k=abs(ks);
   l=16-ln;
   b3=n*k;
   b6=b3;
   b7=k;
   if (ks > 0) {
      sgn=1.0;
   }
   else {
      sgn=-1.0;
      rni=1.0/(float)(n);
      j=1;
      for (i=1;i<=n;i++) {
         br(j)=br(j)*rni;
         bi(j)=bi(j)*rni;
         j=j+k;
      }
   }

L12:
   b6=b6/2;
   b5=b6;
   b4=2*b6;
   b56=b5-b6;

L14:
   tr1=br(b5+1);
   ti1=bi(b5+1);
   tr2=br(b56+1);
   ti2=bi(b56+1);

   br(b5+1)=tr2-tr1;
   bi(b5+1)=ti2-ti1;
   br(b56+1)=tr1+tr2;
   bi(b56+1)=ti1+ti2;

   b5=b5+b4;
   b56=b5-b6;
   if ( b5 <= b3 )  goto  L14;
   if ( b6 == b7 )  goto  L20;

   b4=b7;
   cc=2.0*pow(tab1(l),2);
   c=1.0-cc;
   l++;
   ss=sgn*tab1(l);
   s=ss;

L16:
   b5=b6+b4;
   b4=2*b6;
   b56=b5-b6;

L18:
   tr1=br(b5+1);
   ti1=bi(b5+1);
   tr2=br(b56+1);
   ti2=bi(b56+1);
   br(b5+1)=c*(tr2-tr1)-s*(ti2-ti1);
   bi(b5+1)=s*(tr2-tr1)+c*(ti2-ti1);
   br(b56+1)=tr1+tr2;
   bi(b56+1)=ti1+ti2;

   b5=b5+b4;
   b56=b5-b6;
   if ( b5 <= b3 )  goto  L18;
   b4=b5-b6;
   b5=b4-b3;
   c=-c;
   b4=b6-b5;
   if ( b5 < b4 )  goto  L16;
   b4=b4+b7;
   if ( b4 >= b5 ) goto  L12;

   t=c-cc*c-ss*s;
   s=s+ss*c-cc*s;
   c=t;
   goto  L16;

L20:
   ix0=b3/2;
   b3=b3-b7;
   b4=0;
   b5=0;
   b6=ix0;
   ix1=0;
   if (b6 == b7) goto EXIT;

L22:
   b4=b3-b4;
   b5=b3-b5;
   x2=br(b4+1);
   x3=br(b5+1);
   x4=bi(b4+1);
   x5=bi(b5+1);
   br(b4+1)=x3;
   br(b5+1)=x2;
   bi(b4+1)=x5;
   bi(b5+1)=x4;
   if(b6 < b4)  goto  L22;

L24:
   b4=b4+b7;
   b5=b6+b5;
   x2=br(b4+1);
   x3=br(b5+1);
   x4=bi(b4+1);
   x5=bi(b5+1);
   br(b4+1)=x3;
   br(b5+1)=x2;
   bi(b4+1)=x5;
   bi(b5+1)=x4;
   ix0=b6;

L26:
   ix0=ix0/2;
   ix1=ix1-ix0;
   if( ix1 >= 0)  goto L26;

   ix0=2*ix0;
   b4=b4+b7;
   ix1=ix1+ix0;
   b5=ix1;
   if ( b5 >= b4)  goto  L22;
   if ( b4 < b6)   goto  L24;

EXIT:
   status = 0;
} 
static void fftc_q ( float *  br,
float *  bi,
int  ln,
int  ks 
) [static]

Definition at line 135 of file spidfft.cpp.

Referenced by fftr_q().

{
   //  dimension  br(1),bi(1)

   int b3,b4,b5,b6,b7,b56;
   int n, k, l, j, i, ix0, ix1; 
   float rni, tr1, ti1, tr2, ti2, cc, c, ss, s, t, x2, x3, x4, x5, sgn;
   float tab1[15]; 
   int status=0;

   tab1(1)=9.58737990959775e-5;
   tab1(2)=1.91747597310703e-4;
   tab1(3)=3.83495187571395e-4;
   tab1(4)=7.66990318742704e-4;
   tab1(5)=1.53398018628476e-3;
   tab1(6)=3.06795676296598e-3;
   tab1(7)=6.13588464915449e-3;
   tab1(8)=1.22715382857199e-2;
   tab1(9)=2.45412285229123e-2;
   tab1(10)=4.90676743274181e-2;
   tab1(11)=9.80171403295604e-2;
   tab1(12)=1.95090322016128e-1;
   tab1(13)=3.82683432365090e-1;
   tab1(14)=7.07106781186546e-1;
   tab1(15)=1.00000000000000;

   n=(int)pow(2,ln);

   k=abs(ks);
   l=16-ln;
   b3=n*k;
   b6=b3;
   b7=k;
   if( ks > 0 ) {
      sgn=1.0;
   } 
   else {
      sgn=-1.0;
      rni=1.0/(float)n;
      j=1;
      for (i=1; i<=n;i++) {
         br(j)=br(j)*rni;
         bi(j)=bi(j)*rni;
         j=j+k;
      }
   }
L12:
   b6=b6/2;
   b5=b6;
   b4=2*b6;
   b56=b5-b6;
L14:
   tr1=br(b5+1);
   ti1=bi(b5+1);
   tr2=br(b56+1);
   ti2=bi(b56+1);

   br(b5+1)=tr2-tr1;
   bi(b5+1)=ti2-ti1;
   br(b56+1)=tr1+tr2;
   bi(b56+1)=ti1+ti2;

   b5=b5+b4;
   b56=b5-b6;
   if (b5 <= b3)  goto  L14;
   if (b6 == b7)  goto  L20;

   b4=b7;
   cc=2.0*pow(tab1(l),2);
   c=1.0-cc;
   l=l+1;
   ss=sgn*tab1(l);
   s=ss;
L16: 
   b5=b6+b4;
   b4=2*b6;
   b56=b5-b6;
L18:
   tr1=br(b5+1);
   ti1=bi(b5+1);
   tr2=br(b56+1);
   ti2=bi(b56+1);
   br(b5+1)=c*(tr2-tr1)-s*(ti2-ti1);
   bi(b5+1)=s*(tr2-tr1)+c*(ti2-ti1);
   br(b56+1)=tr1+tr2;
   bi(b56+1)=ti1+ti2;

   b5=b5+b4;
   b56=b5-b6;
   if(b5 <= b3)  goto L18;
   b4=b5-b6;
   b5=b4-b3;
   c=-c;
   b4=b6-b5;
   if(b5 < b4)  goto  L16;
   b4=b4+b7;
   if(b4 >= b5) goto  L12;

   t=c-cc*c-ss*s;
   s=s+ss*c-cc*s;
   c=t;
   goto  L16;
L20:
   ix0=b3/2;
   b3=b3-b7;
   b4=0;
   b5=0;
   b6=ix0;
   ix1=0;
   if ( b6 == b7) goto EXIT;
L22:
   b4=b3-b4;
   b5=b3-b5;
   x2=br(b4+1);
   x3=br(b5+1);
   x4=bi(b4+1);
   x5=bi(b5+1);
   br(b4+1)=x3;
   br(b5+1)=x2;
   bi(b4+1)=x5;
   bi(b5+1)=x4;
   if (b6 < b4) goto  L22;
L24:
   b4=b4+b7;
   b5=b6+b5;
   x2=br(b4+1);
   x3=br(b5+1);
   x4=bi(b4+1);
   x5=bi(b5+1);
   br(b4+1)=x3;
   br(b5+1)=x2;
   bi(b4+1)=x5;
   bi(b5+1)=x4;
   ix0=b6;
L26:
   ix0=ix0/2;
   ix1=ix1-ix0;
   if(ix1 >= 0)  goto  L26;

   ix0=2*ix0;
   b4=b4+b7;
   ix1=ix1+ix0;
   b5=ix1;
   if (b5 >= b4)  goto  L22;
   if (b4 < b6)   goto  L24;
EXIT:
   status = 0; 
}
static void fftr_d ( double *  xcmplx,
int  nv 
) [static]

Definition at line 285 of file spidfft.cpp.

Referenced by crosrng_e(), and crosrng_ms().

{
   // double precision  x(2,1)
   int    i1, i2,  nu, inv, nu1, n, isub, n2, i;
   double tr1,tr2,ti1,ti2,tr,ti;
   double cc,c,ss,s,t;
   double tab1[15];

   tab1(1)=9.58737990959775e-5;
   tab1(2)=1.91747597310703e-4;
   tab1(3)=3.83495187571395e-4;
   tab1(4)=7.66990318742704e-4;
   tab1(5)=1.53398018628476e-3;
   tab1(6)=3.06795676296598e-3;
   tab1(7)=6.13588464915449e-3;
   tab1(8)=1.22715382857199e-2;
   tab1(9)=2.45412285229123e-2;
   tab1(10)=4.90676743274181e-2;
   tab1(11)=9.80171403295604e-2;
   tab1(12)=1.95090322016128e-1;
   tab1(13)=3.82683432365090e-1;
   tab1(14)=7.07106781186546e-1;
   tab1(15)=1.00000000000000;

   nu=abs(nv);
   inv=nv/nu;
   nu1=nu-1;
   n=(int)pow(2,nu1);
   isub=16-nu1;
   ss=-tab1(isub);
   cc=-2.0*pow(tab1(isub-1),2);
   c=1.0;
   s=0.0;
   n2=n/2;

   if ( inv > 0 ) {
      fftc_d(&xcmplx(1,1),&xcmplx(2,1),nu1,2);
      tr=xcmplx(1,1);
      ti=xcmplx(2,1);
      xcmplx(1,1)=tr+ti;
      xcmplx(2,1)=tr-ti;
      for (i=1;i<=n2;i++) {
         i1=i+1;
         i2=n-i+1;
         tr1=xcmplx(1,i1);
         tr2=xcmplx(1,i2);
         ti1=xcmplx(2,i1);
         ti2=xcmplx(2,i2);
         t=(cc*c-ss*s)+c;
         s=(cc*s+ss*c)+s;
         c=t;
         xcmplx(1,i1)=0.5*((tr1+tr2)+(ti1+ti2)*c-(tr1-tr2)*s);
         xcmplx(1,i2)=0.5*((tr1+tr2)-(ti1+ti2)*c+(tr1-tr2)*s);
         xcmplx(2,i1)=0.5*((ti1-ti2)-(ti1+ti2)*s-(tr1-tr2)*c);
         xcmplx(2,i2)=0.5*(-(ti1-ti2)-(ti1+ti2)*s-(tr1-tr2)*c);
      }
   }
   else {
      tr=xcmplx(1,1);
      ti=xcmplx(2,1);
      xcmplx(1,1)=0.5*(tr+ti);
      xcmplx(2,1)=0.5*(tr-ti);
      for (i=1;i<=n2;i++) {
         i1=i+1;
         i2=n-i+1;
         tr1=xcmplx(1,i1);
         tr2=xcmplx(1,i2);
         ti1=xcmplx(2,i1);
         ti2=xcmplx(2,i2);
         t=(cc*c-ss*s)+c;
         s=(cc*s+ss*c)+s;
         c=t;
         xcmplx(1,i1)=0.5*((tr1+tr2)-(tr1-tr2)*s-(ti1+ti2)*c);
         xcmplx(1,i2)=0.5*((tr1+tr2)+(tr1-tr2)*s+(ti1+ti2)*c);
         xcmplx(2,i1)=0.5*((ti1-ti2)+(tr1-tr2)*c-(ti1+ti2)*s);
         xcmplx(2,i2)=0.5*(-(ti1-ti2)+(tr1-tr2)*c-(ti1+ti2)*s);
      } 
      fftc_d(&xcmplx(1,1),&xcmplx(2,1),nu1,-2);
   } 
} 
static void fftr_q ( float *  xcmplx,
int  nv 
) [static]

Definition at line 53 of file spidfft.cpp.

Referenced by frngs().

{
   // dimension xcmplx(2,1); xcmplx(1,i) --- real, xcmplx(2,i) --- imaginary

   float tab1[15];
   int nu, inv, nu1, n, isub, n2, i1, i2, i;
   float ss, cc, c, s, tr, ti, tr1, tr2, ti1, ti2, t;

   tab1(1)=9.58737990959775e-5;
   tab1(2)=1.91747597310703e-4;
   tab1(3)=3.83495187571395e-4;
   tab1(4)=7.66990318742704e-4;
   tab1(5)=1.53398018628476e-3;
   tab1(6)=3.06795676296598e-3;
   tab1(7)=6.13588464915449e-3;
   tab1(8)=1.22715382857199e-2;
   tab1(9)=2.45412285229123e-2;
   tab1(10)=4.90676743274181e-2;
   tab1(11)=9.80171403295604e-2;
   tab1(12)=1.95090322016128e-1;
   tab1(13)=3.82683432365090e-1;
   tab1(14)=7.07106781186546e-1;
   tab1(15)=1.00000000000000;

   nu=abs(nv);
   inv=nv/nu;
   nu1=nu-1;
   n=(int)pow(2,nu1);
   isub=16-nu1;

   ss=-tab1(isub);
   cc=-2.0*pow(tab1(isub-1),2);
   c=1.0;
   s=0.0;
   n2=n/2;
   if ( inv > 0) {
      fftc_q(&xcmplx(1,1),&xcmplx(2,1),nu1,2);
      tr=xcmplx(1,1);
      ti=xcmplx(2,1);
      xcmplx(1,1)=tr+ti;
      xcmplx(2,1)=tr-ti;
      for (i=1;i<=n2;i++) {
         i1=i+1;
         i2=n-i+1;
         tr1=xcmplx(1,i1);
         tr2=xcmplx(1,i2);
         ti1=xcmplx(2,i1);
         ti2=xcmplx(2,i2);
         t=(cc*c-ss*s)+c;
         s=(cc*s+ss*c)+s;
         c=t;
         xcmplx(1,i1)=0.5*((tr1+tr2)+(ti1+ti2)*c-(tr1-tr2)*s);
         xcmplx(1,i2)=0.5*((tr1+tr2)-(ti1+ti2)*c+(tr1-tr2)*s);
         xcmplx(2,i1)=0.5*((ti1-ti2)-(ti1+ti2)*s-(tr1-tr2)*c);
         xcmplx(2,i2)=0.5*(-(ti1-ti2)-(ti1+ti2)*s-(tr1-tr2)*c);
     }
   }
   else {
     tr=xcmplx(1,1);
     ti=xcmplx(2,1);
     xcmplx(1,1)=0.5*(tr+ti);
     xcmplx(2,1)=0.5*(tr-ti);
     for (i=1; i<=n2; i++) {
        i1=i+1;
        i2=n-i+1;
        tr1=xcmplx(1,i1);
        tr2=xcmplx(1,i2);
        ti1=xcmplx(2,i1);
        ti2=xcmplx(2,i2);
        t=(cc*c-ss*s)+c;
        s=(cc*s+ss*c)+s;
        c=t;
        xcmplx(1,i1)=0.5*((tr1+tr2)-(tr1-tr2)*s-(ti1+ti2)*c);
        xcmplx(1,i2)=0.5*((tr1+tr2)+(tr1-tr2)*s+(ti1+ti2)*c);
        xcmplx(2,i1)=0.5*((ti1-ti2)+(tr1-tr2)*c-(ti1+ti2)*s);
        xcmplx(2,i2)=0.5*(-(ti1-ti2)+(tr1-tr2)*c-(ti1+ti2)*s);
     }
     fftc_q(&xcmplx(1,1),&xcmplx(2,1),nu1,-2);
   }
}
static void flip23 ( double *  x,
double *  y,
double *  z,
int *  key,
int  k,
int  len 
) [static]
static void Frngs ( EMData *  circ,
vector< int >  numr 
) [static]

This function conducts the Single Precision Fourier Transform for a set of rings.

static void Frngs_inv ( EMData *  circ,
vector< int >  numr 
) [static]

This function conducts the Single Precision Inverse Fourier Transform for a set of rings.

static int generatesubmax ( int *  argParts,
int *  Indices,
int *  dimClasses,
int  nParts,
int  K,
int  T,
int  n_guesses,
int  LARGEST_CLASS 
) [static]

make an intelligent "guess" at the largest weight of all possible feasible matches.

we make "n_guesses" guesses and return the largest one. the largest weight of all feasible matches is guaranteed to be larger than or equal to the returned guess.

static EMData* get_biggest_cluster ( EMData *  mg) [static]
static float get_pixel_conv_new ( int  nx,
int  ny,
int  nz,
float  delx,
float  dely,
float  delz,
float *  data,
Util::KaiserBessel &  kb 
) [static]
static float get_pixel_conv_new_background ( int  nx,
int  ny,
int  nz,
float  delx,
float  dely,
float  delz,
float *  data,
Util::KaiserBessel &  kb,
int  xnew,
int  ynew 
) [static]
static EMData* get_slice ( EMData *  vol,
int  dim,
int  index 
) [static]

This function returns a 2-D slice from a 3-D EMData object dim denotes the slice is perpendicular to which dimension 1 for x-dimension, 2 for y-dimension and 3 for z-dimension.

static Dict get_transform_params ( EMData *  image,
string  xform,
string  convention 
) [static]

This function returns parameters from Transform object as a Dict object.

It allows to omit problem with passing Transform object through C++/Python layer (It causes memory leak).

static void getvec ( float  phi,
float  theta,
float &  x,
float &  y,
float &  z,
int  option = 0 
) [inline, static]

Definition at line 870 of file util_sparx.h.

References theta.

                                                                                                      {
                float pi180 = M_PI/180.0f;
                
                if (theta > 180.0f) {
                        theta -= 180.0f;
                        phi += 180.0f;
                } else if (theta > 90.0f && option == 0) {
                        theta = 180.0f - theta;
                        phi += 180.0f;
                }

                phi   *= pi180;
                theta *= pi180;

                x = sin(theta)*cos(phi);
                y = sin(theta)*sin(phi);
                z = cos(theta);

                return;
        }
static vector<int> group_proj_by_phitheta ( const vector< float > &  projangles,
const vector< float > &  ref_ang,
const int  img_per_grp 
) [static]
static vector<float> helixshiftali ( vector< EMData * >  ctx,
vector< vector< float > >  pcoords,
int  nsegms,
float  maxincline,
int  kang,
int  search_rng,
int  nxc 
) [static]
static float hist_comp_freq ( float  PA,
float  PB,
size_t  size_img,
int  hist_len,
EMData *  img,
vector< float >  ref_freq_hist,
EMData *  mask,
float  ref_h_diff,
float  ref_h_min 
) [static]
static Dict histc ( EMData *  ref,
EMData *  img,
EMData *  mask 
) [static]
static vector<float> histogram ( EMData *  image,
EMData *  mask,
int  nbins = 128,
float  hmin = 0.0f,
float  hmax = 0.0f 
) [static]
static void hsortd ( double *  theta,
double *  phi,
int *  key,
int  len,
int  option 
) [static]
static Dict im_diff ( EMData *  V1,
EMData *  V2,
EMData *  mask = 0 
) [static]
static void image_mutation ( EMData *  img,
float  mutation_rate 
) [static]
static vector<float> infomask ( EMData *  Vol,
EMData *  mask,
bool   
) [static]
static void initial_prune ( vector< vector< int * > > &  Parts,
int *  dimClasses,
int  nParts,
int  K,
int  T 
) [static]

initial_prune removes all classes C from Parts where there does not exist ANY feasible matching containing class C which has weight gt T.

The first element of each class is its original index, and second is dummy variable

static int k_means_cont_table_ ( int *  group1,
int *  group2,
int *  stb,
long int  s1,
long int  s2,
int  flag 
) [static]

helper to create the contengency table for partition matching (k-means) flag define is the list of stable obj must be store to stb, but the size st must be know before.

The trick is first start wihtout the flag to get number of elements stable, then again with the flag to get the list. This avoid to have two differents functions for the same thing.

static vector<float> list_mutation ( vector< float >  list,
float  mutation_rate,
float  min_val,
float  max_val,
int  K,
int  is_mirror 
) [static]
static float local_inner_product ( EMData *  image1,
EMData *  image2,
int  lx,
int  ly,
int  lz,
int  w 
) [static]
static vector<float> lsfit ( long int *  ks,
long int *  n,
long int *  klm2d,
long int *  iswi,
float *  q1,
double *  q,
double *  x,
double *  res,
double *  cu,
double *  s,
long int *  iu 
) [static]
static void mad_scalar ( EMData *  img,
EMData *  img1,
float  scalar 
) [static]
static EMData* madn_scalar ( EMData *  img,
EMData *  img1,
float  scalar 
) [static]
static std::vector<int> max_clique ( std::vector< int >  edges) [static]

Calculates max_clique in undirected graph, input: edges coded as pair of integers (integers correspond to vertices, must be >=0) Returns: vertices (integers) belonging to max clique.

static double mean ( double *  x,
int  n 
) [inline, static]
static vector<float> merge_peaks ( vector< float >  peak1,
vector< float >  peak2,
float  p_size 
) [static]
static Dict min_dist_four ( EMData *  image,
const vector< EMData * > &  data 
) [static]

helper function for k-means

static Dict min_dist_real ( EMData *  image,
const vector< EMData * > &  data 
) [static]

k-means helper

static int mono ( int  k1,
int  k2 
) [inline, static]

Definition at line 1042 of file util_sparx.h.

References max, and min.

                                               {
#ifdef _WIN32
                int  mk = _cpp_max(k1,k2);
                return  _cpp_min(k1,k2) + mk*(mk-1)/2;
#else
                int  mk = std::max(k1,k2);
                return  std::min(k1,k2) + mk*(mk-1)/2;
#endif  //_WIN32
        }
static EMData* move_points ( EMData *  img,
float  qprob,
int  ri,
int  ro 
) [static]
static void mul_img ( EMData *  img,
EMData *  img1 
) [static]
static void mul_scalar ( EMData *  img,
float  scalar 
) [static]
static EMData* muln_img ( EMData *  img,
EMData *  img1 
) [static]
static EMData* mult_scalar ( EMData *  img,
float  scalar 
) [static]
static vector<float> multi_align_error ( vector< float >  args,
vector< float >  all_ali_params,
int  d 
) [static]
static void multi_align_error_dfunc ( double *  x,
vector< float >  all_ali_params,
int  nima,
int  num_ali,
double *  g,
int  d 
) [static]
static double multi_align_error_func ( double *  x,
vector< float >  all_ali_params,
int  nima,
int  num_ali,
int  d 
) [static]
static vector<double> multi_align_error_func2 ( double *  x,
vector< float >  all_ali_params,
int  nima,
int  num_ali,
int  d 
) [static]
static void multiref_peaks_ali2d ( EMData *  image,
EMData *  crefim,
float  xrng,
float  yrng,
float  step,
string  mode,
vector< int >  numr,
float  cnx,
float  cny,
EMData *  peaks,
EMData *  peakm 
) [static]

Determine shift and rotation between image and one reference image (crefim, weights have to be applied) using quadratic interpolation, return a list of peaks PAP 07/21/08.

ccf1d keeps 1d ccfs stored as (maxrin, -kx-1:kx+1, -ky-1:ky+1) margin is needed for peak search and both arrays are initialized with -1.0e20

static void multiref_peaks_compress_ali2d ( EMData *  image,
EMData *  crefim,
float  xrng,
float  yrng,
float  step,
string  mode,
vector< int >  numr,
float  cnx,
float  cny,
EMData *  peaks,
EMData *  peakm,
EMData *  peaks_compress,
EMData *  peakm_compress 
) [static]

Determine shift and rotation between image and one reference image (crefim, weights have to be applied) using quadratic interpolation, return a list of peaks PAP 07/21/08.

ccf1d keeps 1d ccfs stored as (maxrin, -kx-1:kx+1, -ky-1:ky+1) margin is needed for peak search and both arrays are initialized with -1.0e20

static vector<float> multiref_polar_ali_2d ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
string  mode,
vector< int >  numr,
float  cnx,
float  cny 
) [static]

formerly known as apmq Determine shift and rotation between image and many reference images (crefim, weights have to be applied) quadratic interpolation

static vector<float> multiref_polar_ali_2d_delta ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
string  mode,
vector< int >  numr,
float  cnx,
float  cny,
float  delta_start,
float  delta 
) [static]

formerly known as apmq Determine shift and rotation between image and many reference images (crefim, weights have to be applied) quadratic interpolation

static vector<float> multiref_polar_ali_2d_local ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
float  ant,
string  mode,
vector< int >  numr,
float  cnx,
float  cny 
) [static]

formerly known as apmq Determine shift and rotation between image and many reference images (crefim, weights have to be applied) quadratic interpolation

static vector<float> multiref_polar_ali_2d_local_psi ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
float  ant,
float  psi_max,
string  mode,
vector< int >  numr,
float  cnx,
float  cny 
) [static]

formerly known as apmq Determine shift and rotation between image and many reference images (crefim, weights have to be applied) quadratic interpolation

static vector<float> multiref_polar_ali_2d_nom ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
string  mode,
vector< int >  numr,
float  cnx,
float  cny 
) [static]

formerly known as apnq DO NOT CONSIDER MIRROR Determine shift and rotation between image and many reference images (crefim, weights have to be applied) quadratic interpolation

static vector<float> multiref_polar_ali_2d_peaklist ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
string  mode,
vector< int >  numr,
float  cnx,
float  cny 
) [static]
static vector<float> multiref_polar_ali_2d_peaklist_local ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
float  ant,
string  mode,
vector< int >  numr,
float  cnx,
float  cny 
) [static]
static vector<float> multiref_polar_ali_helical ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
float  psi_max,
string  mode,
vector< int >  numr,
float  cnx,
float  cny,
int  ynumber = -1 
) [static]

formerly known as apmq Determine shift and rotation between image and many reference images (crefim, weights have to be applied) quadratic interpolation Search for peaks only within +/-psi_max from 0 and 180 (helical)

static vector<float> multiref_polar_ali_helical_90 ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
float  psi_max,
string  mode,
vector< int >  numr,
float  cnx,
float  cny,
int  ynumber = -1 
) [static]
static vector<float> multiref_polar_ali_helical_90_local ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
float  ant,
float  psi_max,
string  mode,
vector< int >  numr,
float  cnx,
float  cny,
int  ynumber = -1,
float  yrnglocal = -1.0 
) [static]
static vector<float> multiref_polar_ali_helical_local ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
float  ant,
float  psi_max,
string  mode,
vector< int >  numr,
float  cnx,
float  cny,
int  ynumber = -1,
float  yrnglocal = -1.0 
) [static]
static vector<float> multiref_polar_ali_helicon_90_local ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
float  ant,
float  psi_max,
string  mode,
vector< int >  numr,
float  cnx,
float  cny,
int  ynumber = -1,
float  yrnglocal = -1.0 
) [static]
static vector<float> multiref_polar_ali_helicon_local ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
float  ant,
float  psi_max,
string  mode,
vector< int >  numr,
float  cnx,
float  cny,
int  ynumber = -1,
float  yrnglocal = -1.0 
) [static]

Next two for helicon.

static int nearest_ang ( const vector< float > &  vecref,
float  x,
float  y,
float  z 
) [static]
static vector<int> nearestk_to_refdir ( const vector< float > &  projangles,
const vector< float > &  refangles,
const int  howmany 
) [static]
static int nint180 ( float  arg) [inline, static]

Definition at line 1052 of file util_sparx.h.

                                             {
            int res = int(arg + 180.5) - 180;
            return res;
        }
static void Normalize_ring ( EMData *  ring,
const vector< int > &  numr 
) [static]
static EMData* pack_complex_to_real ( EMData *  img) [static]
static EMData* pad ( EMData *  img,
int  new_nx,
int  new_ny = 1,
int  new_nz = 1,
int  x_offset = 0,
int  y_offset = 0,
int  z_offset = 0,
const char *  params = "average" 
) [static]
static EMData* Polar2D ( EMData *  image,
vector< int >  numr,
string  mode 
) [static]
static EMData* Polar2Dm ( EMData *  image,
float  cns2,
float  cnr2,
vector< int >  numr,
string  cmode 
) [static]
static EMData* Polar2Dmi ( EMData *  image,
float  cns2,
float  cnr2,
vector< int >  numr,
string  cmode,
Util::KaiserBessel &  kb 
) [static]
static void prb1d ( double *  b,
int  npoint,
float *  pos 
) [static]

Definition at line 787 of file spidutil.cpp.

Referenced by crosrng_e(), and crosrng_ms().

{
   double  c2,c3;
   int     nhalf;

   nhalf = npoint/2 + 1;
   *pos  = 0.0;

   if (npoint == 7) {
      c2 = 49.*b(1) + 6.*b(2) - 21.*b(3) - 32.*b(4) - 27.*b(5)
         - 6.*b(6) + 31.*b(7);
      c3 = 5.*b(1) - 3.*b(3) - 4.*b(4) - 3.*b(5) + 5.*b(7);
   } 
   else if (npoint == 5) {
      c2 = (74.*b(1) - 23.*b(2) - 60.*b(3) - 37.*b(4)
         + 46.*b(5) ) / (-70.);
      c3 = (2.*b(1) - b(2) - 2.*b(3) - b(4) + 2.*b(5) ) / 14.0;
   }
   else if (npoint == 3) {
      c2 = (5.*b(1) - 8.*b(2) + 3.*b(3) ) / (-2.0);
      c3 = (b(1) - 2.*b(2) + b(3) ) / 2.0;
   }
   else if (npoint == 9) {
      c2 = (1708.*b(1) + 581.*b(2) - 246.*b(3) - 773.*b(4)
         - 1000.*b(5) - 927.*b(6) - 554.*b(7) + 119.*b(8)
         + 1092.*b(9) ) / (-4620.);
      c3 = (28.*b(1) + 7.*b(2) - 8.*b(3) - 17.*b(4) - 20.*b(5)
         - 17.*b(6) - 8.*b(7) + 7.*b(8) + 28.*b(9) ) / 924.0;
   }
   if (c3 != 0.0)  *pos = c2/(2.0*c3) - nhalf;
}
static vector<float> pw_extract ( vector< float >  pw,
int  n,
int  iswi,
float  ps 
) [static]
static float quadri ( float  x,
float  y,
int  nx,
int  ny,
float *  image 
) [static]

Quadratic interpolation (2D).

Note: This routine starts counting from 1, not 0!

This routine uses six image points for interpolation:

See also:
M. Abramowitz & I.E. Stegun, Handbook of Mathematical Functions (Dover, New York, 1964), Sec. 25.2.67. http://www.math.sfu.ca/~cbm/aands/page_882.htm
http://www.cl.cam.ac.uk/users/nad/pubs/quad.pdf
                f3    fc
                |
                | x
         f2-----f0----f1
                |
                |
                f4
		 *

f0 - f4 are image values near the interpolated point X. f0 is the interior mesh point nearest x.

Coords:

  • f0 = (x0, y0)
  • f1 = (xb, y0)
  • f2 = (xa, y0)
  • f3 = (x0, yb)
  • f4 = (x0, ya)
  • fc = (xc, yc)

Mesh spacings:

  • hxa -- x- mesh spacing to the left of f0
  • hxb -- x- mesh spacing to the right of f0
  • hyb -- y- mesh spacing above f0
  • hya -- y- mesh spacing below f0

Interpolant: f = f0 + c1*(x-x0) + c2*(x-x0)*(x-x1) + c3*(y-y0) + c4*(y-y0)*(y-y1) + c5*(x-x0)*(y-y0)

Parameters:
[in]xx-coord value
[in]yy-coord value
nx
ny
[in]imageImage object (pointer)
Returns:
Interpolated value

Definition at line 186 of file spidutil.cpp.

Referenced by alrq(), alrq_ms(), apring1(), EMAN::Util::quadri(), quadri(), and EMAN::Util::quadri_background().

{
/*
c  purpose: quadratic interpolation 
c 
c  parameters:       xx,yy treated as circularly closed.
c                    fdata - image 1..nxdata, 1..nydata
c
c                    f3    fc       f0, f1, f2, f3 are the values
c                     +             at the grid points.  x is the
c                     + x           point at which the function
c              f2++++f0++++f1       is to be estimated. (it need
c                     +             not be in the first quadrant).
c                     +             fc - the outer corner point
c                    f4             nearest x.
c
c                                   f0 is the value of the fdata at
c                                   fdata(i,j), it is the interior mesh
c                                   point nearest  x.
c                                   the coordinates of f0 are (x0,y0),
c                                   the coordinates of f1 are (xb,y0),
c                                   the coordinates of f2 are (xa,y0),
c                                   the coordinates of f3 are (x0,yb),
c                                   the coordinates of f4 are (x0,ya),
c                                   the coordinates of fc are (xc,yc),
c
c                   o               hxa, hxb are the mesh spacings
c                   +               in the x-direction to the left
c                  hyb              and right of the center point.
c                   +
c            ++hxa++o++hxb++o       hyb, hya are the mesh spacings
c                   +               in the y-direction.
c                  hya
c                   +               hxc equals either  hxb  or  hxa
c                   o               depending on where the corner
c                                   point is located.
c
c                                   construct the interpolant
c                                   f = f0 + c1*(x-x0) +
c                                       c2*(x-x0)*(x-x1) +
c                                       c3*(y-y0) + c4*(y-y0)*(y-y1)
c                                       + c5*(x-x0)*(y-y0)
c
c
*/
    float x, y, dx0, dy0, f0, c1, c2, c3, c4, c5, dxb, dyb;
    float quadri;
    int   i, j, ip1, im1, jp1, jm1, ic, jc, hxc, hyc;

    x = xx;
    y = yy;

    // circular closure
    if (x < 1.0)               x = x+(1 - floor(x) / nxdata) * nxdata;
    if (x > (float)nxdata+0.5) x = fmod(x-1.0,(float)nxdata) + 1.0;
    if (y < 1.0)               y = y+(1 - floor(y) / nydata) * nydata;
    if (y > (float)nydata+0.5) y = fmod(y-1.0,(float)nydata) + 1.0;


    i   = (int) floor(x);
    j   = (int) floor(y);

    dx0 = x - i;
    dy0 = y - j;

    ip1 = i + 1;
    im1 = i - 1;
    jp1 = j + 1;
    jm1 = j - 1;

    if (ip1 > nxdata) ip1 = ip1 - nxdata;
    if (im1 < 1)      im1 = im1 + nxdata;
    if (jp1 > nydata) jp1 = jp1 - nydata;
    if (jm1 < 1)      jm1 = jm1 + nydata;

    f0  = fdata(i,j);
    c1  = fdata(ip1,j) - f0;
    c2  = (c1 - f0 + fdata(im1,j)) * 0.5;
    c3  = fdata(i,jp1) - f0;
    c4  = (c3 - f0 + fdata(i,jm1)) * 0.5;

    dxb = dx0 - 1;
    dyb = dy0 - 1;

    // hxc & hyc are either 1 or -1
    if (dx0 >= 0) {
       hxc = 1;
    }
    else {
       hxc = -1;
    }
    if (dy0 >= 0) {
       hyc = 1;
    }
    else {
       hyc = -1;
    }
 
    ic  = i + hxc;
    jc  = j + hyc;

    if (ic > nxdata) {
       ic = ic - nxdata;
    }
    else if (ic < 1) {
       ic = ic + nxdata;
    }

    if (jc > nydata) {
       jc = jc - nydata;
    }
    else if (jc < 1) {
       jc = jc + nydata;
    }

    c5  =  ( (fdata(ic,jc) - f0 - hxc * c1 - (hxc * (hxc - 1.0)) * c2 
            - hyc * c3 - (hyc * (hyc - 1.0)) * c4) * (hxc * hyc));

    quadri = f0 + dx0 * (c1 + dxb * c2 + dy0 * c5) + dy0 * (c3 + dyb * c4);

    return quadri; 
}
static float quadri_background ( float  x,
float  y,
int  nx,
int  ny,
float *  image,
int  xnew,
int  ynew 
) [static]

Quadratic interpolation (2D).

This is identical to quadri except the wrap around is not done circulantly.

Note: This routine starts counting from 1, not 0!

This routine uses six image points for interpolation:

See also:
M. Abramowitz & I.E. Stegun, Handbook of Mathematical Functions (Dover, New York, 1964), Sec. 25.2.67. http://www.math.sfu.ca/~cbm/aands/page_882.htm
http://www.cl.cam.ac.uk/users/nad/pubs/quad.pdf
                f3    fc
                |
                | x
         f2-----f0----f1
                |
                |
                f4
		 *

f0 - f4 are image values near the interpolated point X. f0 is the interior mesh point nearest x.

Coords:

  • f0 = (x0, y0)
  • f1 = (xb, y0)
  • f2 = (xa, y0)
  • f3 = (x0, yb)
  • f4 = (x0, ya)
  • fc = (xc, yc)

Mesh spacings:

  • hxa -- x- mesh spacing to the left of f0
  • hxb -- x- mesh spacing to the right of f0
  • hyb -- y- mesh spacing above f0
  • hya -- y- mesh spacing below f0

Interpolant: f = f0 + c1*(x-x0) + c2*(x-x0)*(x-x1) + c3*(y-y0) + c4*(y-y0)*(y-y1) + c5*(x-x0)*(y-y0)

Parameters:
[in]xx-coord value
[in]yy-coord value
nx
ny
[in]imageImage object (pointer)
Returns:
Interpolated value
static void Radialize ( int *  PermMatTr,
float *  kValsSorted,
float *  weightofkvalsSorted,
int  Size,
int *  SizeReturned 
) [static]

list the sorted lengths of the integer lattice sites of a square sided image of size Size.

PRB

Parameters:
[out]PermMatTrThe matrix telling the ordering of the lattice sites wrt the array
[out]kValsSorted
[out]weightofkvalsSortedthe number of sites at that distance
[in]SizeThe length of the image
[out]SizeReturned

Referenced by EMAN::EMData::FH2F(), and EMAN::EMData::real2FH().

static EMData* reconstitute_image_mask ( EMData *  image,
EMData *  mask 
) [static]

Recreates a n-d image using its compressed 1-D form and the mask.

Referenced by EMAN::varimax::analyze(), EMAN::PCAlarge::analyze(), EMAN::PCAsmall::analyze(), and EMAN::PCA::dopca_ooc().

static float restrict1 ( float  x,
int  nx 
) [inline, static]

Definition at line 1096 of file util_sparx.h.

References nx, and x.

                                                       {
                while ( x < 0.0f )        x += nx;
                while ( x >= (float)(nx) )  x -= nx;
                return x;
        }
static bool sanitycheck ( int *  argParts,
int *  Indices,
int *  dimClasses,
int  nParts,
int  K,
int  T,
int *  output 
) [static]

First element of output is total cost of the matches in the output Second element of output is the total number of matches in output So output has 2+(*(output+1))nParts elements.

static void search2 ( int *  argParts,
int *  Indices,
int *  dimClasses,
int  nParts,
int  K,
int  T,
int *  matchlist,
int *  costlist,
int  J 
) [static]

return the weight of the largest weighted feasible match, along with the match in the (preallocated) argument curmax.

The returned weight has to be gt newT. If there is no such feasible matching, return 0 as *curmax

static void set_freq ( EMData *  freqvol,
EMData *  temp,
EMData *  mask,
float  cutoff,
float  freq 
) [static]
static void set_line ( EMData *  img,
int  posline,
EMData *  line,
int  offset,
int  length 
) [static]

This function drop a line (line) to an 2D image (img).

The position of the line to the image is defined by (postline). The part of the line paste is defined by (offset), the begin position and (length) the size.

static vector<float> shc ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
float  ant,
string  mode,
vector< int >  numr,
float  cnx,
float  cny,
string  sym 
) [static]
static vector<float> shc_multipeaks ( EMData *  image,
const vector< EMData * > &  crefim,
float  xrng,
float  yrng,
float  step,
float  ant,
string  mode,
vector< int >  numr,
float  cnx,
float  cny,
int  max_peaks_count 
) [static]
static void slicereverse ( float *  beg,
float *  end,
int  nx,
int  ny 
) [static]
static void spline ( float *  x,
float *  y,
int  n,
float  yp1,
float  ypn,
float *  y2 
) [static]

Given a tabulated function y of x (unordered), and Given the values of the first derivatives at the end points This routine returns an array y2, that contains the second derivatives of the function at the tabulated points.

PRB This function is called by splint

Parameters:
x
[in]yof x is the tabulated function of length n
n
[in]yp1: the derivatives of the first point.
[in]ypn: the derivatives of the last point.
[out]y2is the value of the second derivatives

Referenced by EMAN::Util::spline_mat().

static void spline_mat ( float *  x,
float *  y,
int  n,
float *  xq,
float *  yq,
int  m 
) [static]

Given a tabulated function y of x (n unordered points), and Given the values of the m values xq to be interpolated This routine returns the interpolated array yq, PRB This function is called by splint.

Parameters:
x
[in]yof x is the tabulated function of length n
n
[in]xqis the x values to be splined: has m points.
[out]yqare the splined values
m

Referenced by EMAN::EMData::FH2F(), and EMAN::EMData::real2FH().

static void splint ( float *  xa,
float *  ya,
float *  y2a,
int  n,
float *  xq,
float *  yq,
int  m 
) [static]

Given the arrays xa(ordered, ya of length n, which tabulate a function and given the array y2a which is the output of spline and an unordered array xq, this routine returns a cubic-spline interpolated array yq.

Parameters:
xa
[in]yaof x is the tabulated function of length n
[in]y2ais returned from spline: second derivs
n
[in]xqis the x values to be splined: has m points.
[out]yqare the splined values
m

Referenced by EMAN::Util::spline_mat().

static void square_img ( EMData *  img) [static]
static EMData* squaren_img ( EMData *  img) [static]
static void sub_fav ( EMData *  ave,
EMData *  dat,
float  tot,
int  mirror,
vector< int >  numr 
) [static]
static void sub_img ( EMData *  img,
EMData *  img1 
) [static]
static EMData* subn_img ( EMData *  img,
EMData *  img1 
) [static]
static float tf ( float  dzz,
float  ak,
float  voltage = 300.0f,
float  cs = 2.0f,
float  wgh = 0.1f,
float  b_factor = 0.0f,
float  sign = -1.0f 
) [static]
static float triquad ( float  r,
float  s,
float  t,
float *  fdata 
) [static]

Quadratic interpolation (3D)

Parameters:
r
s
t
fdata
Returns:
Interpolated value

Referenced by EMAN::Util::triquad().

static int trmsh3_ ( int *  n0,
double *  tol,
double *  x,
double *  y,
double *  z__,
int *  n,
int *  list,
int *  lptr,
int *  lend,
int *  lnew,
int *  indx,
int *  lcnt,
int *  near__,
int *  next,
double *  dist,
int *  ier 
) [static]
static vector<float> twoD_fine_ali ( EMData *  image,
EMData *  refim,
EMData *  mask,
float  ang,
float  sxs,
float  sys 
) [static]
static vector<float> twoD_fine_ali_G ( EMData *  image,
EMData *  refim,
EMData *  mask,
Util::KaiserBessel &  kb,
float  ang,
float  sxs,
float  sys 
) [static]
static vector<float> twoD_fine_ali_SD ( EMData *  image,
EMData *  refim,
EMData *  mask,
float  ang,
float  sxs,
float  sys 
) [static]
static vector<float> twoD_fine_ali_SD_G ( EMData *  image,
EMData *  refim,
EMData *  mask,
Util::KaiserBessel &  kb,
float  ang,
float  sxs,
float  sys 
) [static]
static vector<float> twoD_to_3D_ali ( EMData *  volft,
Util::KaiserBessel &  kb,
EMData *  refim,
EMData *  mask,
float  phi,
float  theta,
float  psi,
float  sxs,
float  sxy 
) [static]
static EMData* TwoDTestFunc ( int  Size,
float  p,
float  q,
float  a,
float  b,
int  flag = 0,
float  alphaDeg = 0 
) [static]

Creates a Two D Test Pattern.

Parameters:
[in]Sizemust be odd
[in]pthe x frequency
[in]qthe y frequency
[in]athe x falloff
bthe y falloff
flag
[in]alphaDegthe projection angle
Returns:
The 2D test pattern in real space, fourier space, or the projection in real or fourier space or the FH of the pattern

Referenced by EMAN::Util::TwoDTestFunc().

static void update_fav ( EMData *  ave,
EMData *  dat,
float  tot,
int  mirror,
vector< int >  numr 
) [static]
static double var ( double *  x,
int  n 
) [inline, static]

Definition at line 1063 of file util_sparx.h.

References mean().

Referenced by EMAN::LoGFourierProcessor::create_radial_func().

                                                   {
                double s = 0.0;
                double m = mean(x, n);
                for (int i=0; i<n; i++) s += (x[i]-m)*(x[i]-m);
                return s/static_cast<double>(n);
        }
static vector<float> vareas ( EMData *  d) [static]
static void voronoi ( double *  phi,
double *  theta,
double *  weight,
int  nt 
) [static]
static void voronoidiag ( double *  theta,
double *  phi,
double *  weight,
int  n 
) [static]
static vector<double> vrdg ( const vector< float > &  ph,
const vector< float > &  th 
) [static]
static EMData* window ( EMData *  img,
int  new_nx,
int  new_ny = 1,
int  new_nz = 1,
int  x_offset = 0,
int  y_offset = 0,
int  z_offset = 0 
) [static]
static void WTF ( EMData *  PROJ,
vector< float >  SS,
float  SNR,
int  K 
) [static]
static void WTM ( EMData *  PROJ,
vector< float >  SS,
int  DIAMETER,
int  NUMP 
) [static]