EMAN2
|
Util is a collection of utility functions. More...
#include <util.h>
Static Public Member Functions | |
static int | MUTEX_INIT (MUTEX *mutex) |
For those util function developed by Pawel's group. More... | |
static int | MUTEX_LOCK (MUTEX *mutex) |
static int | MUTEX_UNLOCK (MUTEX *mutex) |
static bool | is_nan (const float number) |
tell whether a float value is a NaN More... | |
static void | ap2ri (float *data, size_t n) |
convert complex data array from Amplitude/Phase format into Real/Imaginary format. More... | |
static void | ap2ri (double *data, size_t n) |
static void | flip_complex_phase (float *data, size_t n) |
flip the phase of a complex data array. More... | |
static void | rotate_phase_origin (float *data, size_t nx, size_t ny, size_t nz) |
rotate data vertically by ny/2, to make the mrc phase origin compliance with EMAN1 and TNF reader More... | |
static int | file_lock_wait (FILE *file) |
lock a file. More... | |
static bool | check_file_by_magic (const void *first_block, const char *magic) |
check whether a file starts with certain magic string. More... | |
static bool | is_file_exist (const string &filename) |
check whether a file exists or not More... | |
static void | flip_image (float *data, size_t nx, size_t ny) |
Vertically flip the data of a 2D real image. More... | |
static vector< EMData * > | svdcmp (const vector< EMData * > &data, int nvec) |
Perform singular value decomposition on a set of images. More... | |
static string | str_to_lower (const string &s) |
Return a lower case version of the argument string. More... | |
static void | replace_non_ascii (char *str, int max_size, char repl_char='?') |
Replace any non-ASCII characters in a C string with a given character. More... | |
static bool | sstrncmp (const char *s1, const char *s2) |
Safe string compare. More... | |
static string | int2str (int n) |
Get a string format of an integer, e.g. More... | |
static string | get_line_from_string (char **str) |
Extract a single line from a multi-line string. More... | |
static bool | get_str_float (const char *str, const char *float_var, float *p_val) |
Extract the float value from a variable=value string with format like "XYZ=1.1", where 'str' is "XYZ=1.1"; 'float_var' is "XYZ="; 'p_val' points to float number 1.1. More... | |
static bool | get_str_float (const char *str, const char *float_var, float *p_v1, float *p_v2) |
Extract the float values from a variable=value1,value2 string with format like "XYZ=1.1,1.2", where 'str' is "XYZ=1.1,1.2"; 'float_var' is "XYZ="; 'p_v1' points to 1.1; 'p_v2' points to 1.2. More... | |
static bool | get_str_float (const char *str, const char *float_var, int *p_nvalues, float *p_v1, float *p_v2) |
Extract number of values and the float values, if any, from a string whose format is either "variable=value1,value2 " or "variable". More... | |
static bool | get_str_int (const char *str, const char *int_var, int *p_val) |
Extract the int value from a variable=value string with format like "XYZ=1", where 'str' is "XYZ=1"; 'int_var' is "XYZ="; 'p_val' points to float number 1. More... | |
static bool | get_str_int (const char *str, const char *int_var, int *p_v1, int *p_v2) |
Extract the int value from a variable=value1,value2 string with format like "XYZ=1,2", where 'str' is "XYZ=1,2"; 'int_var' is "XYZ="; 'p_val' points to float number 1. More... | |
static bool | get_str_int (const char *str, const char *int_var, int *p_nvalues, int *p_v1, int *p_v2) |
Extract number of values and the int values, if any, from a string whose format is either "variable=value1,value2 " or "variable". More... | |
static string | change_filename_ext (const string &old_filename, const string &new_ext) |
Change a file's extension and return the new filename. More... | |
static string | remove_filename_ext (const string &filename) |
Remove a filename's extension and return the new filename. More... | |
static string | get_filename_ext (const string &filename) |
Get a filename's extension. More... | |
static string | sbasename (const string &filename) |
Get a filename's basename. More... | |
static void | calc_least_square_fit (size_t nitems, const float *data_x, const float *data_y, float *p_slope, float *p_intercept, bool ignore_zero, float absmax=0) |
calculate the least square fit value. More... | |
static Vec3f | calc_bilinear_least_square (const vector< float > &points) |
calculate bilinear least-square fit, z = a + b x + c y Takes a set of x,y,z vectors and produces an a,b,c vector does not accept error bars on z or return goodness of fit More... | |
static void | save_data (const vector< float > &x_array, const vector< float > &y_array, const string &filename) |
Save (x y) data array into a file. More... | |
static void | save_data (float x0, float dx, const vector< float > &y_array, const string &filename) |
Save x, y data into a file. More... | |
static void | save_data (float x0, float dx, float *y_array, size_t array_size, const string &filename) |
Save x, y data into a file. More... | |
static void | sort_mat (float *left, float *right, int *leftPerm, int *rightPerm) |
does a sort as in Matlab. More... | |
static unsigned long long | get_randnum_seed () |
Get the seed for Randnum class. More... | |
static void | set_randnum_seed (unsigned long long seed) |
Set the seed for Randnum class. More... | |
static int | get_irand (int low, int high) |
Get an integer random number between low and high, [low, high]. More... | |
static float | get_frand (int low, int high) |
Get a float random number between low and high, [low, high) More... | |
static float | get_frand (float low, float high) |
Get a float random number between low and high, [low, high) More... | |
static float | get_frand (double low, double high) |
Get a float random number between low and high, [low, high) More... | |
static float | get_gauss_rand (float mean, float sigma) |
Get a Gaussian random number. More... | |
static int | round (float x) |
Get ceiling round of a float number x. More... | |
static int | round (double x) |
Get ceiling round of a float number x. More... | |
static float | log_2 (float x) |
Get the log base 2 of a float x. More... | |
static double | log_2 (double x) |
Get the log base 2 of a double x. More... | |
static float | log_2 (int i) |
Get the log base 2 of an integer i. More... | |
static float | linear_interpolate (float p1, float p2, float t) |
Calculate linear interpolation. More... | |
static std::complex< float > | linear_interpolate_cmplx (std::complex< float > p1, std::complex< float > p2, float t) |
Calculate linear interpolation. More... | |
static float | bilinear_interpolate (float p1, float p2, float p3, float p4, float t, float u) |
Calculate bilinear interpolation. More... | |
static std::complex< float > | bilinear_interpolate_cmplx (std::complex< float > p1, std::complex< float > p2, std::complex< float > p3, std::complex< float > p4, float t, float u) |
Calculate bilinear interpolation. More... | |
static std::complex< float > | gauss_interpolate_cmplx (std::complex< float > p1, std::complex< float > p2, std::complex< float > p3, std::complex< float > p4, float t, float u) |
Calculate 2x2 Gaussian interpolation. More... | |
static std::complex< float > | gauss3_interpolate_cmplx (std::complex< float > *p, float t, float u) |
Calculate 3x3 Gaussian interpolation. More... | |
static float | trilinear_interpolate (float p1, float p2, float p3, float p4, float p5, float p6, float p7, float p8, float t, float u, float v) |
Calculate trilinear interpolation. More... | |
static std::complex< float > | trilinear_interpolate_complex (std::complex< float > p1, std::complex< float > p2, std::complex< float > p3, std::complex< float > p4, std::complex< float > p5, std::complex< float > p6, std::complex< float > p7, std::complex< float > p8, float t, float u, float v) |
Calculate trilinear interpolation. More... | |
static void | find_max (const float *data, size_t nitems, float *p_max_val, int *p_max_index=0) |
Find the maximum value and (optional) its index in an array. More... | |
static void | find_min_and_max (const float *data, size_t nitems, float *p_max_val, float *p_min_val, int *p_max_index=0, int *p_min_index=0) |
Find the maximum value and (optional) its index, minimum value and (optional) its index in an array. More... | |
static Dict | get_stats (const vector< float > &data) |
Get the mean, standard deviation, skewness and kurtosis of the input data. More... | |
static Dict | get_stats_cstyle (const vector< float > &data) |
Performs the same calculations as in get_stats, but uses a single pass, optimized c approach Should perform better than get_stats. More... | |
static int | calc_best_fft_size (int low) |
Search the best FFT size with good primes. More... | |
static vector< float > | nonconvex (const vector< float > &curve, int first=3) |
Returns a non-convex version of a curve. More... | |
static vector< float > | windowdot (const vector< float > &curveA, const vector< float > &curveB, int window, int normA) |
Computes a windowed dot product between curve A and curve B. More... | |
static EMData * | calc_bessel (const int n, const float &x) |
static double | angle3 (double x1, double y1, double z1, double x2, double y2, double z2) |
Given 2 vectors, it will compute the angle between them in radians. More... | |
static float | angle3 (float x1, float y1, float z1, float x2, float y2, float z2) |
static int | square (int n) |
Calculate a number's square. More... | |
static float | square (float x) |
Calculate a number's square. More... | |
static float | square (double x) |
Calculate a number's square. More... | |
static float | square_sum (float x, float y) |
Calcuate (x*x + y*y). More... | |
static float | hypot2 (float x, float y) |
Euclidean distance function in 2D: f(x,y) = sqrt(x*x + y*y);. More... | |
static int | hypot2sq (int x, int y) |
Euclidean distance function squared in 2D: f(x,y) = (x*x + y*y);. More... | |
static float | hypot2sq (float x, float y) |
Euclidean distance function squared in 2D: f(x,y) = (x*x + y*y);. More... | |
static int | hypot3sq (int x, int y, int z) |
Euclidean distance function squared in 3D: f(x,y,z) = (x*x + y*y + z*z);. More... | |
static float | hypot3sq (float x, float y, float z) |
Euclidean distance function squared in 3D: f(x,y,z) = (x*x + y*y + z*z);. More... | |
static float | hypot3 (int x, int y, int z) |
Euclidean distance function in 3D: f(x,y,z) = sqrt(x*x + y*y + z*z);. More... | |
static float | hypot3 (float x, float y, float z) |
Euclidean distance function in 3D: f(x,y,z) = sqrt(x*x + y*y + z*z);. More... | |
static double | hypot3 (double x, double y, double z) |
Euclidean distance function in 3D: f(x,y,z) = sqrt(x*x + y*y + z*z);. More... | |
static float | hypot_fast (int x, int y) |
Euclidean distance in 2D for integers computed fast using a cached lookup table. More... | |
static short | hypot_fast_int (int x, int y) |
Euclidean distance in 2D for integers computed fast using a cached lookup table. More... | |
static int | fast_floor (float x) |
A fast way to calculate a floor, which is largest integral value not greater than argument. More... | |
static float | fast_exp (const float &f) |
Returns an approximate of exp(x) using a cached table uses actual exp(x) outside the cached range. More... | |
static float | fast_acos (const float &f) |
Returns an approximate of acos(x) using a cached table and linear interpolation tolerates values very slightly outside the -1 - 1 range (returning 0) More... | |
static float | fast_gauss_B2 (const float &f) |
Returns an approximate of exp(-2x^2) using a cached table uses actual function outside the cached range. More... | |
static float | agauss (float a, float dx, float dy, float dz, float d) |
Calculate Gaussian value. More... | |
static int | get_min (int f1, int f2) |
Get the minimum of 2 numbers. More... | |
static int | get_min (int f1, int f2, int f3) |
Get the minimum of 3 numbers. More... | |
static float | get_min (float f1, float f2) |
Get the minimum of 2 numbers. More... | |
static float | get_min (float f1, float f2, float f3) |
Get the minimum of 3 numbers. More... | |
static float | get_min (float f1, float f2, float f3, float f4) |
Get the minimum of 4 numbers. More... | |
static float | get_max (float f1, float f2) |
Get the maximum of 2 numbers. More... | |
static float | get_max (float f1, float f2, float f3) |
Get the maximum of 3 numbers. More... | |
static float | get_max (float f1, float f2, float f3, float f4) |
Get the maximum of 4 numbers. More... | |
static float | angle_norm_2pi (float in) |
Normalize an angle in radians so it is in the 0-2pi range. More... | |
static float | angle_norm_pi (float in) |
Normalize an angle in radians so it is in the -pi to pi range. More... | |
static float | angle_sub_2pi (float x, float y) |
Calculate the difference of 2 angles and makes the equivalent result to be less than Pi. More... | |
static float | angle_sub_pi (float x, float y) |
Calculate the difference of 2 angles and makes the equivalent result to be less than Pi/2. More... | |
static float | angle_err_ri (float r1, float i1, float r2, float i2) |
Calculate the angular phase difference between two r/i vectors. More... | |
static int | goodf (const float *p_f) |
Check whether a number is a good float. More... | |
static int | goodf (const double *p_f) |
static string | recv_broadcast (int port) |
static string | get_time_label () |
Get the current time in a string with format "mm/dd/yyyy hh:mm". More... | |
static void | set_log_level (int argc, char *argv[]) |
Set program logging level through command line option "-v N", where N is the level. More... | |
static float | eman_copysign (float a, float b) |
copy sign of a number. More... | |
static float | eman_erfc (float x) |
complementary error function. More... | |
static void | equation_of_plane (const Vec3f &p1, const Vec3f &p2, const Vec3f &p3, float *plane) |
Determine the equation of a plane that intersects 3 points in 3D space. More... | |
static bool | point_is_in_convex_polygon_2d (const Vec2f &p1, const Vec2f &p2, const Vec2f &p3, const Vec2f &p4, const Vec2f &actual_point) |
Determines if a point is in a 2D convex polygon described by 4 points using the Barycentric method, which is a fast way of performing the query. More... | |
static bool | point_is_in_triangle_2d (const Vec2f &p1, const Vec2f &p2, const Vec2f &p3, const Vec2f &actual_point) |
Determines if a point is in a 2D triangle using the Barycentric method, which is a fast way of performing the query Triangle points can be specified in any order. More... | |
static void | printMatI3D (MIArray3D &mat, const string str=string(""), ostream &out=std::cout) |
Print a 3D integer matrix to a file stream (std out by default). More... | |
template<class T > | |
static T | sgn (T &val) |
Sign function. More... | |
static float * | getBaldwinGridWeights (const int &freq_cutoff, const float &P, const float &r, const float &dfreq=1, const float &alpha=0.5, const float &beta=0.2) |
static bool | IsPower2 (int x) |
Return true if an integer is positive and is power of 2. More... | |
static void | apply_precision (float &value, const float &precision) |
|
inlinestatic |
Calculate Gaussian value.
a * exp(-(dx * dx + dy * dy + dz * dz) / d)
[in] | a | amplitude |
[in] | dx | x center |
[in] | dy | y center |
[in] | dz | z center |
[in] | d | width of gaussian |
Definition at line 912 of file util.h.
Referenced by EMAN::FourierReconstructorSimple2D::insert_slice(), and EMAN::GaussFFTProjector::interp_ft_3d().
|
inlinestatic |
Given 2 vectors, it will compute the angle between them in radians.
Definition at line 724 of file util.h.
References fast_acos(), and hypot3().
|
inlinestatic |
|
inlinestatic |
Calculate the angular phase difference between two r/i vectors.
[in] | r1/i1 | first vector, 2 floats |
[in] | r2/i2 | second vector, 2 floats |
Definition at line 1099 of file util.h.
References fast_acos().
Referenced by EMAN::PhaseCmp::cmp().
|
inlinestatic |
|
inlinestatic |
Normalize an angle in radians so it is in the -pi to pi range.
Definition at line 1051 of file util.h.
Referenced by EMAN::MaskAzProcessor::process_inplace().
|
inlinestatic |
Calculate the difference of 2 angles and makes the equivalent result to be less than Pi.
[in] | x | The first angle. |
[in] | y | The second angle. |
Definition at line 1066 of file util.h.
Referenced by EMAN::EMData::common_lines(), and EMAN::MaskAzProcessor::process_inplace().
|
inlinestatic |
|
static |
Definition at line 112 of file util.cpp.
References Assert, and NullPointerException.
|
static |
convert complex data array from Amplitude/Phase format into Real/Imaginary format.
data | complex data array. |
n | array size. |
Definition at line 97 of file util.cpp.
References Assert, and NullPointerException.
|
inlinestatic |
Definition at line 1309 of file util.h.
References fast_floor().
Referenced by EMAN::Transform::get_determinant(), EMAN::Transform::get_scale(), EMAN::Transform::get_scale_and_mirror(), EMAN::Transform::get_trans(), EMAN::Transform::is_identity(), EMAN::Transform::is_rot_identity(), and EMAN::Transform::set_scale().
|
inlinestatic |
Calculate bilinear interpolation.
[in] | p1 | The first number. corresponding to (x0,y0). |
[in] | p2 | The second number. corresponding to (x1,y0). |
[in] | p3 | The third number. corresponding to (x1,y1). |
[in] | p4 | The fourth number. corresponding to (x0,y1). |
[in] | t | t |
[in] | u | u |
Definition at line 543 of file util.h.
Referenced by EMAN::EMData::common_lines(), EMAN::EMData::cut_slice(), EMAN::MaxValProjector::project3d(), EMAN::StandardProjector::project3d(), sget_value_at_interp(), EMAN::TransformProcessor::transform(), and EMAN::EMData::unwrap().
|
inlinestatic |
Calculate bilinear interpolation.
[in] | p1 | The first number. corresponding to (x0,y0). |
[in] | p2 | The second number. corresponding to (x1,y0). |
[in] | p3 | The third number. corresponding to (x1,y1). |
[in] | p4 | The fourth number. corresponding to (x0,y1). |
[in] | t | t |
[in] | u | u |
Definition at line 558 of file util.h.
Referenced by get_complex_at_interp().
|
static |
|
static |
Search the best FFT size with good primes.
It supports FFT size up to 4096 now.
[in] | low | low size the search starts with. |
Definition at line 1021 of file util.cpp.
References Assert, and good_fft_sizes.
Referenced by EMAN::HarmonicProcessor::process(), EMAN::BispecSliceProcessor::process(), EMAN::EMData::unwrap(), and EMAN::EMData::unwrap_largerR().
|
static |
calculate bilinear least-square fit, z = a + b x + c y Takes a set of x,y,z vectors and produces an a,b,c vector does not accept error bars on z or return goodness of fit
[in] | points | a vector<float> of x,y,z values in (x1,y1,z1,x2,y2,z2...) sequence to fit a plane to |
Definition at line 577 of file util.cpp.
Referenced by EMAN::PointArray::align_2d().
|
static |
calculate the least square fit value.
[in] | nitems | Number of items in array data_x and data_y. |
[in] | data_x | x data array. |
[in] | data_y | y data array. It should have the same number of items to data_x. |
[out] | p_slope | pointer to the result slope. |
[out] | p_intercept | pointer to the result intercept. |
[in] | ignore_zero | If true, ignore data where either x or y is 0. If false, includes all 0. |
[in] | absmax | Ignores values in y more than absmax from zero |
Definition at line 538 of file util.cpp.
References Assert, div(), NullPointerException, x, and y.
Referenced by EMAN::OptVarianceCmp::cmp(), EMAN::LowpassAutoBProcessor::create_radial_func(), and EMAN::GradientRemoverProcessor::process_inplace().
|
static |
Change a file's extension and return the new filename.
If the given new extension is empty, the old filename is not changed. If the old filename has no extension, add the new extension to it.
[in] | old_filename | Old filename. |
[in] | new_ext | The new extension. It shouldn't have ".". e.g., for MRC file, it will be "mrc", not ".mrc". |
Definition at line 485 of file util.cpp.
References Assert, and remove_filename_ext().
Referenced by EMAN::EMUtil::get_image_type(), EMAN::ImagicIO::ImagicIO(), and EMAN::ImagicIO2::ImagicIO2().
|
static |
check whether a file starts with certain magic string.
first_block | The first block of the file. |
magic | The magic string to identify a file format. |
Definition at line 239 of file util.cpp.
References NullPointerException.
Referenced by EMAN::AmiraIO::is_valid(), EMAN::LstFastIO::is_valid(), EMAN::LstIO::is_valid(), EMAN::PgmIO::is_valid(), EMAN::SalIO::is_valid(), and EMAN::VtkIO::is_valid().
|
inlinestatic |
copy sign of a number.
return a value whose absolute value matches that of 'a', but whose sign matches that of 'b'. If 'a' is a NaN, then a NaN with the sign of 'b' is returned.
It is exactly copysign() on non-Windows system.
[in] | a | The first number. |
[in] | b | The second number. |
|
inlinestatic |
complementary error function.
It is exactly erfc() on non-Windows system. On Windows, it tries to simulate erfc().
The erf() function returns the error function of x; defined as erf(x) = 2/sqrt(pi)* integral from 0 to x of exp(-t*t) dt
The erfc() function returns the complementary error function of x, that is 1.0 - erf(x).
[in] | x | A float number. |
Definition at line 1184 of file util.h.
References x.
|
static |
Determine the equation of a plane that intersects 3 points in 3D space.
Required by Symmetry3D::reduce IMPORTANT - does no error checking, if the float pointer is less than 4 in size will get unknown behavior
p1 | point one |
p2 | point two |
p3 | point three |
plane | a float pointer - should have room for 4 elements which will be A,B,C, and D (in that order) for the equation Ax+By+Cz+D=0 |
Definition at line 1293 of file util.cpp.
Referenced by EMAN::Symmetry3D::cache_au_planes().
|
static |
Returns an approximate of acos(x) using a cached table and linear interpolation tolerates values very slightly outside the -1 - 1 range (returning 0)
[in] | x | argument to acos(x) |
Definition at line 804 of file util.cpp.
Referenced by angle3(), and angle_err_ri().
|
static |
Returns an approximate of exp(x) using a cached table uses actual exp(x) outside the cached range.
[in] | f | argument to exp(f) |
Definition at line 788 of file util.cpp.
Referenced by EMAN::FourierInserter3DMode2::insert_pixel(), EMAN::FourierInserter3DMode3::insert_pixel(), EMAN::FourierInserter3DMode5::insert_pixel(), EMAN::FourierInserter3DMode6::insert_pixel(), EMAN::FourierInserter3DMode8::insert_pixel(), EMAN::FourierIterReconstructor::insert_slice(), and EMAN::WienerFourierReconstructor::pixel_at().
|
inlinestatic |
A fast way to calculate a floor, which is largest integral value not greater than argument.
[in] | x | A float point number. |
Definition at line 874 of file util.h.
References x.
Referenced by apply_precision(), EMAN::MaskGaussInvProcessor::calc_locals(), EMAN::CircularMaskProcessor::calc_locals(), EMAN::MaskEdgeMeanProcessor::calc_locals(), EMAN::EMData::cut_slice(), EMAN::EMData::dot_rotate_translate(), EMAN::EMData::extract_box(), get_complex_at_3ginterp(), get_complex_at_ginterp(), get_complex_at_interp(), EMAN::FourierInserter3DMode7::insert_pixel(), EMAN::FourierInserter3DMode11::insert_pixel(), EMAN::RotationalAverageProcessor::process_inplace(), EMAN::AddRandomNoiseProcessor::process_inplace(), EMAN::SymSearchProcessor::process_inplace(), EMAN::DiscritizeProcessor::process_pixel(), EMAN::MaxValProjector::project3d(), EMAN::StandardProjector::project3d(), sget_value_at_interp(), EMAN::TransformProcessor::transform(), and EMAN::EMData::unwrap().
|
static |
Returns an approximate of exp(-2x^2) using a cached table uses actual function outside the cached range.
[in] | f | argument to exp(f) |
Definition at line 830 of file util.cpp.
Referenced by gauss3_interpolate_cmplx(), and gauss_interpolate_cmplx().
|
static |
lock a file.
If the lock fails, wait for 1 second; then try again. Repleat this wait-try for a maxinum of 5 times unless the lock succeeds.
file | The file to be locked. |
Definition at line 182 of file util.cpp.
References LOGERR, and NullPointerException.
|
static |
Find the maximum value and (optional) its index in an array.
[in] | data | data array. |
[in] | nitems | number of items in the data array. |
[out] | p_max_val | pointer to the maximum value. |
[out] | p_max_index | pointer to index of the maximum value. |
Definition at line 851 of file util.cpp.
References Assert, and NullPointerException.
Referenced by EMAN::RotationalAligner::align_180_ambiguous().
|
static |
Find the maximum value and (optional) its index, minimum value and (optional) its index in an array.
[in] | data | data array. |
[in] | nitems | number of items in the data array. |
[out] | p_max_val | pointer to the maximum value. |
[out] | p_min_val | pointer to the minimum value. |
[out] | p_max_index | pointer to index of the maximum value. |
[out] | p_min_index | pointer to index of the minimum value. |
Definition at line 875 of file util.cpp.
References Assert, and NullPointerException.
|
static |
flip the phase of a complex data array.
data | complex data array. |
n | array size. |
Definition at line 127 of file util.cpp.
References Assert, and NullPointerException.
|
static |
Vertically flip the data of a 2D real image.
data | Data array of the 2D real image. |
nx | Image Width. |
ny | Image Height. |
Definition at line 259 of file util.cpp.
References Assert, and NullPointerException.
|
inlinestatic |
Calculate 3x3 Gaussian interpolation.
Note that this sort of interpolation has discontinuities
[in] | p[9] | The 9 pixel values [0,0],[1,0],... |
[in] | t | x distance from p[0] sample |
[in] | u | y distance from p[0] sample |
Definition at line 589 of file util.h.
References fast_gauss_B2(), x, and y.
Referenced by get_complex_at_3ginterp().
|
inlinestatic |
Calculate 2x2 Gaussian interpolation.
Note that this sort of interpolation has discontinuities
[in] | p1 | The first number. corresponding to (x0,y0). |
[in] | p2 | The second number. corresponding to (x1,y0). |
[in] | p3 | The third number. corresponding to (x1,y1). |
[in] | p4 | The fourth number. corresponding to (x0,y1). |
[in] | t | t |
[in] | u | u |
Definition at line 573 of file util.h.
References fast_gauss_B2().
Referenced by get_complex_at_ginterp().
|
static |
Get a filename's extension.
[in] | filename | A given filename. |
Definition at line 526 of file util.cpp.
Referenced by EMAN::EMUtil::fast_get_image_type(), EMAN::EMUtil::get_image_type(), and EMAN::EMUtil::is_valid_filename().
|
static |
Get a float random number between low and high, [low, high)
[in] | low | The lower bound of the random number. |
[in] | high | The upper bound of the random number. |
Definition at line 736 of file util.cpp.
References EMAN::Randnum::get_frand(), and EMAN::Randnum::Instance().
|
static |
Get a float random number between low and high, [low, high)
[in] | low | The lower bound of the random number. |
[in] | high | The upper bound of the random number. |
Definition at line 730 of file util.cpp.
References EMAN::Randnum::get_frand(), and EMAN::Randnum::Instance().
|
static |
Get a float random number between low and high, [low, high)
[in] | low | The lower bound of the random number. |
[in] | high | The upper bound of the random number. |
Definition at line 725 of file util.cpp.
References get_frand().
Referenced by EMAN::OrientationGenerator::add_orientation(), EMAN::RandomOrientationGenerator::gen_orientations(), get_frand(), EMAN::KmeansSegmentProcessor::process(), EMAN::LowpassRandomPhaseProcessor::process_inplace(), EMAN::TestImageFourierNoiseGaussian::process_inplace(), EMAN::TestImageFourierNoiseProfile::process_inplace(), and EMAN::PointArray::set_from_density_map().
|
static |
Get a Gaussian random number.
[in] | mean | The gaussian mean |
[in] | sigma | The gaussian sigma |
Definition at line 845 of file util.cpp.
References EMAN::Randnum::get_gauss_rand(), and EMAN::Randnum::Instance().
Referenced by EMAN::EmanOrientationGenerator::gen_orientations(), and EMAN::MaskNoiseProcessor::process_dist_pixel().
|
static |
Get an integer random number between low and high, [low, high].
[in] | low | The lower bound of the random number. |
[in] | high | The upper bound of the random number. |
Definition at line 719 of file util.cpp.
References EMAN::Randnum::get_irand(), and EMAN::Randnum::Instance().
Referenced by EMAN::KMeansAnalyzer::analyze(), EMAN::PointArray::calc_transform(), EMAN::KMeansAnalyzer::reseed(), and EMAN::PointArray::sim_minstep_seq().
|
static |
Extract a single line from a multi-line string.
The line delimiter is '
'. The multi-line string moves forward one line. If it is the last line, move to the end of the string.
[in,out] | str | A multiple-line string. |
Definition at line 322 of file util.cpp.
References NullPointerException.
Referenced by EMAN::SitusIO::is_valid(), and EMAN::XplorIO::is_valid().
|
inlinestatic |
Get the maximum of 2 numbers.
[in] | f1 | The first number. |
[in] | f2 | The second number. |
Definition at line 998 of file util.h.
Referenced by EMAN::FourierReconstructor::do_insert_slice_work(), EMAN::nnSSNR_Reconstructor::finish(), EMAN::nnSSNR_ctfReconstructor::finish(), EMAN::EMData::max_3D_pixel_error(), EMAN::PawelProjector::project3d(), EMAN::MaxValProjector::project3d(), and EMAN::EMData::update_stat().
|
inlinestatic |
Get the maximum of 3 numbers.
[in] | f1 | The first number. |
[in] | f2 | The second number. |
[in] | f3 | The third number. |
|
inlinestatic |
Get the maximum of 4 numbers.
[in] | f1 | The first number. |
[in] | f2 | The second number. |
[in] | f3 | The third number. |
[in] | f4 | The fourth number. |
|
inlinestatic |
|
inlinestatic |
Get the minimum of 3 numbers.
[in] | f1 | The first number. |
[in] | f2 | The second number. |
[in] | f3 | The third number. |
|
inlinestatic |
Get the minimum of 4 numbers.
[in] | f1 | The first number. |
[in] | f2 | The second number. |
[in] | f3 | The third number. |
[in] | f4 | The fourth number. |
|
inlinestatic |
Get the minimum of 2 numbers.
[in] | f1 | The first number. |
[in] | f2 | The second number. |
Definition at line 922 of file util.h.
Referenced by EMAN::PawelProjector::backproject3d(), EMAN::ChaoProjector::backproject3d(), EMAN::FourierInserter3DMode10::insert_pixel(), EMAN::PlatonicSym::is_in_asym_unit(), EMAN::TetrahedralSym::is_in_asym_unit(), EMAN::ManhattanDistanceProcessor::process_inplace(), EMAN::TestImageCylinder::process_inplace(), EMAN::TestImageDisc::process_inplace(), EMAN::FourierGriddingProjector::project3d(), EMAN::ChaoProjector::project3d(), and EMAN::EMData::update_stat().
|
inlinestatic |
Get the minimum of 3 numbers.
[in] | f1 | The first number. |
[in] | f2 | The second number. |
[in] | f3 | The third number. |
|
static |
Get the seed for Randnum class.
Definition at line 713 of file util.cpp.
References EMAN::Randnum::get_seed(), and EMAN::Randnum::Instance().
|
static |
Get the mean, standard deviation, skewness and kurtosis of the input data.
data | the vector of input data |
EmptyContainerException | when the argument vector is empty |
Definition at line 913 of file util.cpp.
References EmptyContainerException, sqrt(), and square_sum().
|
static |
Performs the same calculations as in get_stats, but uses a single pass, optimized c approach Should perform better than get_stats.
Definition at line 969 of file util.cpp.
References EmptyContainerException, sqrt(), square(), and square_sum().
|
static |
Extract the float values from a variable=value1,value2 string with format like "XYZ=1.1,1.2", where 'str' is "XYZ=1.1,1.2"; 'float_var' is "XYZ="; 'p_v1' points to 1.1; 'p_v2' points to 1.2.
[in] | str | A string like "XYZ=1.1,1.2"; |
[in] | float_var | The variable name "XYZ=". |
[out] | p_v1 | The pointer to the first float. |
[out] | p_v2 | The pointer to the second float. |
Definition at line 399 of file util.cpp.
References NullPointerException.
|
static |
Extract the float value from a variable=value string with format like "XYZ=1.1", where 'str' is "XYZ=1.1"; 'float_var' is "XYZ="; 'p_val' points to float number 1.1.
[in] | str | A string like "XYZ=1.1"; |
[in] | float_var | The variable name "XYZ=". |
[out] | p_val | The pointer to the float number. |
Definition at line 385 of file util.cpp.
References NullPointerException.
|
static |
Extract number of values and the float values, if any, from a string whose format is either "variable=value1,value2 " or "variable".
for example, if the string is "XYZ=1.1,1.2", then 'str' is "XYZ=1.1,1.2"; 'float_var' is "XYZ"; 'p_nvalues' points to 2. 'p_v1' points to 1.1; 'p_v2' points to 1.2. If the string is "XYZ", then 'str' is "XYZ"; 'float_var' is "XYZ". 'p_nvalues' points to 0. 'p_v1' and 'p_v2' unchanged.
[in] | str | A string like "XYZ=1.1,1.2" or "XYZ". |
[in] | float_var | The variable name "XYZ". |
[out] | p_nvalues | Number of values in the string. |
[out] | p_v1 | The pointer to the first float, if any. |
[out] | p_v2 | The pointer to the second float, if any. |
Definition at line 414 of file util.cpp.
References NullPointerException.
|
static |
Extract number of values and the int values, if any, from a string whose format is either "variable=value1,value2 " or "variable".
for example, if the string is "XYZ=1,2", then 'str' is "XYZ=1,2"; 'int_var' is "XYZ"; 'p_nvalues' points to 2. 'p_v1' points to 1; 'p_v2' points to 2. If the string is "XYZ", then 'str' is "XYZ"; 'int_var' is "XYZ". 'p_nvalues' points to 0. 'p_v1' and 'p_v2' unchanged.
[in] | str | A string like "XYZ=1,2" or "XYZ". |
[in] | int_var | The variable name "XYZ". |
[out] | p_nvalues | Number of values in the string. |
[out] | p_v1 | The pointer to the first int, if any. |
[out] | p_v2 | The pointer to the second int, if any. |
Definition at line 464 of file util.cpp.
References NullPointerException.
|
static |
Extract the int value from a variable=value1,value2 string with format like "XYZ=1,2", where 'str' is "XYZ=1,2"; 'int_var' is "XYZ="; 'p_val' points to float number 1.
[in] | str | A string like "XYZ=1"; |
[in] | int_var | The variable name "XYZ=". |
[out] | p_v1 | The pointer to the first int. |
[out] | p_v2 | The pointer to the second int. |
Definition at line 450 of file util.cpp.
References NullPointerException.
|
static |
Extract the int value from a variable=value string with format like "XYZ=1", where 'str' is "XYZ=1"; 'int_var' is "XYZ="; 'p_val' points to float number 1.
[in] | str | A string like "XYZ=1"; |
[in] | int_var | The variable name "XYZ=". |
[out] | p_val | The pointer to the int number. |
Definition at line 436 of file util.cpp.
References NullPointerException.
|
static |
Get the current time in a string with format "mm/dd/yyyy hh:mm".
|
static |
[in] | freq_cutoff | |
[in] | P | |
[in] | r | |
[in] | dfreq | |
[in] | alpha | |
[in] | beta |
Definition at line 1232 of file util.cpp.
References printmatrix(), printvector(), and V.
|
inlinestatic |
|
inlinestatic |
Check whether a number is a good float.
A number is a good float if it is not abnormal zero, and not inf, -inf or NaN
[in] | p_f | Pointer to the given float number. |
Definition at line 1112 of file util.h.
Referenced by EMAN::CccCmp::cmp(), EMAN::SqEuclideanCmp::cmp(), EMAN::FRCCmp::cmp(), EMAN::EMObject::EMObject(), EMAN::ByteOrder::is_float_big_endian(), EMAN::NormalizeProcessor::process_inplace(), and EMAN::FiniteProcessor::process_pixel().
|
inlinestatic |
Euclidean distance function in 2D: f(x,y) = sqrt(x*x + y*y);.
[in] | x | The first number. |
[in] | y | The second number. |
Definition at line 774 of file util.h.
Referenced by EMAN::FourierWeightAverager::add_image(), and EMAN::SetIsoPowProcessor::process_inplace().
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Euclidean distance function in 3D: f(x,y,z) = sqrt(x*x + y*y + z*z);.
[in] | x | The first number. |
[in] | y | The second number. |
[in] | z | The third number. |
Definition at line 827 of file util.h.
Referenced by EMAN::TomoAverager::add_image(), angle3(), EMAN::EMData::calc_radial_dist(), EMAN::PhaseCmp::cmp(), EMAN::Interp::init_gimx(), EMAN::FourierInserter3DMode3::insert_pixel(), EMAN::GaussSegmentProcessor::process(), EMAN::DistanceSegmentProcessor::process(), EMAN::KmeansSegmentProcessor::process(), EMAN::GaussZFourierProcessor::process_inplace(), EMAN::LowpassRandomPhaseProcessor::process_inplace(), EMAN::FFTPeakProcessor::process_inplace(), EMAN::FFTConeProcessor::process_inplace(), EMAN::FFTWedgeProcessor::process_inplace(), EMAN::WedgeFillProcessor::process_inplace(), EMAN::RotationalAverageProcessor::process_inplace(), EMAN::AddRandomNoiseProcessor::process_inplace(), EMAN::SetIsoPowProcessor::process_inplace(), EMAN::TestImageFourierGaussianBand::process_inplace(), EMAN::TestImageSphericalWave::process_inplace(), and EMAN::Transform::set_rotation().
|
inlinestatic |
|
inlinestatic |
Euclidean distance function squared in 3D: f(x,y,z) = (x*x + y*y + z*z);.
[in] | x | The first number. |
[in] | y | The second number. |
[in] | z | The third number. |
Definition at line 805 of file util.h.
Referenced by EMAN::TomoWedgeFscCmp::cmp(), get_attr(), EMAN::FourierInserter3DMode2::insert_pixel(), EMAN::FourierInserter3DMode3::insert_pixel(), EMAN::FourierInserter3DMode5::insert_pixel(), EMAN::FourierInserter3DMode6::insert_pixel(), EMAN::FourierInserter3DMode8::insert_pixel(), EMAN::FourierInserter3DMode9::insert_pixel(), EMAN::FourierInserter3DMode10::insert_pixel(), EMAN::FourierIterReconstructor::insert_slice(), EMAN::GaussFFTProjector::interp_ft_3d(), EMAN::WienerFourierReconstructor::pixel_at(), and EMAN::RangeZeroProcessor::process_inplace().
|
static |
Euclidean distance in 2D for integers computed fast using a cached lookup table.
[in] | x | The first number |
[in] | y | The second number |
Definition at line 742 of file util.cpp.
Referenced by EMAN::EMData::calc_az_dist(), EMAN::EMData::calc_radial_dist(), EMAN::EMAN2Ctf::compute_1d_fromimage(), EMAN::EMAN2Ctf::compute_2d_complex(), EMAN::MatchSFProcessor::create_radial_func(), EMAN::FourierReconstructor::do_compare_slice_work(), EMAN::CtfWtFiltAverager::finish(), EMAN::HarmonicProcessor::process(), EMAN::BispecSliceProcessor::process(), EMAN::SubtractOptProcessor::process(), EMAN::GaussZFourierProcessor::process_inplace(), and EMAN::TestImageFourierGaussianBand::process_inplace().
|
static |
Euclidean distance in 2D for integers computed fast using a cached lookup table.
[in] | x | The first number |
[in] | y | The second number |
Definition at line 764 of file util.cpp.
Referenced by EMAN::PhaseCmp::cmp(), EMAN::FourierReconstructor::do_insert_slice_work(), EMAN::FourierIterReconstructor::insert_slice(), EMAN::CtfSimProcessor::process(), and EMAN::FFTPeakProcessor::process_inplace().
|
static |
Get a string format of an integer, e.g.
123 will be "123".
[in] | n | The input integer. |
Definition at line 315 of file util.cpp.
Referenced by EMAN::Log::loc(), EMAN::SerIO::read_dim_arr(), and EMAN::E2Exception::what().
|
static |
check whether a file exists or not
Definition at line 253 of file util.cpp.
Referenced by EMAN::LstFastIO::calc_ref_image_index(), EMAN::TestUtil::check_image(), and EMAN::SpiderIO::SpiderIO().
|
inlinestatic |
tell whether a float value is a NaN
number | float value |
Definition at line 105 of file util.h.
Referenced by EMAN::TomoWedgeCccCmp::cmp(), and EMAN::EMUtil::getRenderMinMax().
|
inlinestatic |
Return true if an integer is positive and is power of 2.
[in] | x | integer to be checked |
Definition at line 1304 of file util.h.
References x.
Referenced by EMAN::WaveletProcessor::process_inplace().
|
inlinestatic |
Calculate linear interpolation.
[in] | p1 | The first number (at x1). |
[in] | p2 | The second number (at x2). |
[in] | t | (x-x1)/(x2-x1) |
Definition at line 518 of file util.h.
Referenced by EMAN::EMData::cut_slice(), EMAN::WienerFourierReconstructor::do_insert_slice_work(), EMAN::MaxValProjector::project3d(), and EMAN::StandardProjector::project3d().
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
|
static |
|
static |
|
static |
Returns a non-convex version of a curve.
This is used for finding a good approximate background curve when evaluating power spectra.
[in] | curve | The data array (vector<float>) |
[in] | first | First point to consider, default = 3 |
[out] | outcurve | Returned data array |
Definition at line 1037 of file util.cpp.
|
static |
Determines if a point is in a 2D convex polygon described by 4 points using the Barycentric method, which is a fast way of performing the query.
The points must be ordered in the way you would encounter them if you traversed the boundary of the polygon. Direction is irrelevant. Could be generalized for polygons with more points
p1 | point one |
p2 | point two |
p3 | point three |
p4 | point three |
actual_point | the point which might be in the polygon described by p1,p2,p3 and p4 |
Definition at line 1339 of file util.cpp.
References point_is_in_triangle_2d().
|
static |
Determines if a point is in a 2D triangle using the Barycentric method, which is a fast way of performing the query Triangle points can be specified in any order.
p1 | point one |
p2 | point two |
p3 | point three |
actual_point | the point which might be in the triangle described by p1,p2 and p3 |
Definition at line 1304 of file util.cpp.
References EMAN::Vec2< Type >::dot(), and EMAN::Transform::ERR_LIMIT.
Referenced by point_is_in_convex_polygon_2d().
|
static |
|
static |
Definition at line 1111 of file util.cpp.
References BPKT::data, BPKT::hdr, EMAN::ByteOrder::is_host_big_endian(), BPKT::len, BPKT::oseq, and BPKT::pseq.
|
static |
Remove a filename's extension and return the new filename.
[in] | filename | The old filename whose extension is going to be removed. |
Definition at line 495 of file util.cpp.
Referenced by change_filename_ext().
|
static |
Replace any non-ASCII characters in a C string with a given character.
str | updated C string where non-ASCII characters to be replaced |
max_size | replace only in the first max_size characters of str |
repl_char | character to replace any non-ASCII characters in str |
|
static |
rotate data vertically by ny/2, to make the mrc phase origin compliance with EMAN1 and TNF reader
data | complex data array |
nx | x dimension size |
ny | y dimension size |
nz | z dimension size |
|
inlinestatic |
|
inlinestatic |
Get ceiling round of a float number x.
[in] | x | Given float number. |
Definition at line 465 of file util.h.
References x.
Referenced by EMAN::EMData::calc_hist(), EMAN::PointArray::construct_helix(), EMAN::EMData::cut_slice(), EMAN::nnSSNR_Reconstructor::finish(), EMAN::nnSSNR_ctfReconstructor::finish(), hypot_fast_int(), EMAN::FourierReconstructor::pixel_at(), EMAN::BeamstopProcessor::process_inplace(), EMAN::ApplyPolynomialProfileToHelix::process_inplace(), EMAN::EMData::translate(), and EMAN::EMData::uncut_slice().
|
static |
Save (x y) data array into a file.
Each line of the file have the format "x1TABy1", where x1, y1 are elements of x array and y array. The x, y arrays must have the same number of items.
[in] | x_array | The x array. |
[in] | y_array | The y array. |
[in] | filename | The output filename. |
Definition at line 604 of file util.cpp.
References Assert, FileAccessException, and LOGERR.
Referenced by EMAN::LowpassAutoBProcessor::create_radial_func().
|
static |
Save x, y data into a file.
Each line of the file have the format "x1TABy1", where x1 = x0 + dx*i; y1 = y_array[i].
[in] | x0 | The starting point of x. |
[in] | dx | delta x. The increase step of x data. |
[in] | y_array | The y data array. |
[in] | filename | The output filename. |
Definition at line 628 of file util.cpp.
References Assert, and FileAccessException.
|
static |
Save x, y data into a file.
Each line of the file have the format "x1TABy1", where x1 = x0 + dx*i; y1 = y_array[i].
[in] | x0 | The starting point of x. |
[in] | dx | delta x. The increase step of x data. |
[in] | y_array | The y data array. |
[in] | array_size | The y data array size. |
[in] | filename | The output filename. |
Definition at line 647 of file util.cpp.
References Assert, FileAccessException, and NullPointerException.
|
static |
Get a filename's basename.
For example, the basename of "hello.c" is still "hello.c"; The basename of "/tmp/abc/hello.c" is "hello.c".
[in] | filename | The given filename, full path or relative path. |
Definition at line 505 of file util.cpp.
Referenced by EMAN::Log::begin(), EMAN::TestUtil::check_image(), EMAN::TestUtil::dump_emdata(), EMAN::Log::loc(), and EMAN::TestUtil::set_progname().
|
static |
Set program logging level through command line option "-v N", where N is the level.
[in] | argc | Number of arguments. |
[in] | argv | Argument arrays. |
Definition at line 1178 of file util.cpp.
References EMAN::Log::logger(), and EMAN::Log::set_level().
|
static |
Set the seed for Randnum class.
[in] | seed | the seed for current random number generator |
Definition at line 707 of file util.cpp.
References EMAN::Randnum::Instance(), and EMAN::Randnum::set_seed().
|
inlinestatic |
|
static |
does a sort as in Matlab.
Carries along the Permutation matrix
[in] | left | The array [left .. right] is sorted |
[in] | right | The array [left .. right] is sorted |
[in] | leftPerm | The array [leftPerm rightPerm] is shuffled due to the sorting |
[in] | rightPerm | The array [leftPerm rightPerm] is shuffled due to the sorting Both arrays are reshuffled. |
Definition at line 670 of file util.cpp.
References sort_mat().
Referenced by sort_mat().
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Calculate a number's square.
[in] | n | Given number. |
Definition at line 736 of file util.h.
Referenced by EMAN::EMData::calc_dist(), EMAN::EMData::calc_mutual_correlation(), calc_sigma_diff(), EMAN::OptVarianceCmp::cmp(), EMAN::EMData::do_radon(), get_stats_cstyle(), EMAN::FourierInserter3DMode9::insert_pixel(), EMAN::FourierInserter3DMode10::insert_pixel(), EMAN::EMData::little_big_dot(), EMAN::BilateralProcessor::process_inplace(), EMAN::PaintProcessor::process_inplace(), and EMAN::SmartMaskProcessor::process_inplace().
|
inlinestatic |
Calcuate (x*x + y*y).
[in] | x | The first number. |
[in] | y | The second number. |
Definition at line 764 of file util.h.
Referenced by EMAN::TomoWedgeCccCmp::cmp(), EMAN::TomoWedgeFscCmp::cmp(), EMAN::EMData::common_lines(), EMAN::EMAN2Ctf::compute_1d_fromimage(), get_stats(), get_stats_cstyle(), EMAN::WedgeFillProcessor::process_inplace(), and EMAN::TransformProcessor::transform().
|
static |
Safe string compare.
It compares 's2' with the first N characters of 's1', where N is the length of 's2'.
s1 | String 1. Its first strlen(s2) characters will be used to do the comparison. |
s2 | String 2. Its whole string will be used to do the comparison. |
Definition at line 306 of file util.cpp.
References NullPointerException.
Referenced by EMAN::TestUtil::dump_emdata().
|
static |
Return a lower case version of the argument string.
s | the string you want to convert to lower case |
Definition at line 283 of file util.cpp.
Referenced by EMAN::Transform::detect_problem_keys(), EMAN::Symmetry3D::gen_orientations(), EMAN::Dict::get_ci(), EMAN::Transform::get_params(), EMAN::Transform::get_params_inverse(), EMAN::Transform::get_rotation(), EMAN::Transform::get_sym_proj(), EMAN::Symmetry3D::get_symmetries(), EMAN::Dict::has_key_ci(), and EMAN::Transform::set_rotation().
Perform singular value decomposition on a set of images.
data | A List of data objects to be decomposed |
nvec | Number of basis vectors to return, 0 returns full decomposition |
Definition at line 343 of file util.cpp.
References get_value_at(), V, x, and y.
|
inlinestatic |
Calculate trilinear interpolation.
[in] | p1 | The first number. corresponding to (x0,y0,z0). |
[in] | p2 | The second number. corresponding to (x1,y0,z0). |
[in] | p3 | The third number. corresponding to (x0,y1, z0). |
[in] | p4 | The fourth number. corresponding to (x1,y1,z0). |
[in] | p5 | The fifth number. corresponding to (x0,y0,z1). |
[in] | p6 | The sixth number. corresponding to (x1,y0,z1). |
[in] | p7 | The seventh number. corresponding to (x0,y1,z1). |
[in] | p8 | The eighth number. corresponding to (x1,y1,z1). |
[in] | t | t |
[in] | u | u |
[in] | v | v |
Definition at line 619 of file util.h.
Referenced by EMAN::EMData::cut_slice(), EMAN::EMData::extract_box(), EMAN::SymSearchProcessor::process_inplace(), EMAN::MaxValProjector::project3d(), EMAN::StandardProjector::project3d(), sget_value_at_interp(), and EMAN::TransformProcessor::transform().
|
inlinestatic |
Calculate trilinear interpolation.
[in] | p1 | The first number. corresponding to (x0,y0,z0). |
[in] | p2 | The second number. corresponding to (x1,y0,z0). |
[in] | p3 | The third number. corresponding to (x0,y1, z0). |
[in] | p4 | The fourth number. corresponding to (x1,y1,z0). |
[in] | p5 | The fifth number. corresponding to (x0,y0,z1). |
[in] | p6 | The sixth number. corresponding to (x1,y0,z1). |
[in] | p7 | The seventh number. corresponding to (x0,y1,z1). |
[in] | p8 | The eighth number. corresponding to (x1,y1,z1). |
[in] | t | t |
[in] | u | u |
[in] | v | v |
Definition at line 645 of file util.h.
Referenced by EMAN::FourierIterReconstructor::insert_slice(), and EMAN::TransformProcessor::transform().
|
static |
Computes a windowed dot product between curve A and curve B.
Curve B is normalized, curve A can be normalized or not. It thus gives either an absolute or relative indicator of similarity between the two curves.
[in] | curveA | The data curve to be tested |
[in] | curveB | Reference curve being compared to |
[in] | window | 1/2 Width of local window function in samples, ie 4 -> 4+1+4 = 9 component vector |
[in] | normA | A flag indicating whether A should be localized or not |
[out] | outcurve | Returned data array |
Definition at line 1056 of file util.cpp.
References EMAN::dot(), and sqrt().