Xmipp
v3.23.11-Nereus
|
Constants | |
#define | PI 3.14159265358979323846 |
#define | HALFPI 1.57079632679489661923 |
#define | TWOPI 6.283185307179586 |
#define | XMIPP_EQUAL_ACCURACY 1e-6 |
#define | XMIPP_EQUAL_REAL(x, y) ((fabs((x) - (y))) < XMIPP_EQUAL_ACCURACY) |
#define | XMIPP_EQUAL_ZERO(x) (ABS(x) < XMIPP_EQUAL_ACCURACY) |
#define | XMIPP_RANGE_INSIDE(x, min, max) |
#define | XMIPP_RANGE_OUTSIDE(x, min, max) |
#define | XMIPP_RANGE_OUTSIDE_FAST(x, min, max) ((x) < (min) || (x) >= (max)) |
Numerical functions | |
#define | ABS(x) (((x) >= 0) ? (x) : (-(x))) |
#define | SGN(x) (((x) >= 0) ? 1 : -1) |
#define | SGN0(x) (((x) >= 0) ? (((x) == 0) ? 0:1) : -1) |
#define | XMIPP_MIN(x, y) (((x) >= (y)) ? (y) : (x)) |
#define | XMIPP_MAX(x, y) (((x)>=(y))?(x):(y)) |
#define | ROUND(x) (((x) > 0) ? (int)((x) + 0.5) : (int)((x) - 0.5)) |
#define | CEIL(x) |
#define | FLOOR(x) |
#define | FRACTION(x) ((x) - (int)(x)) |
#define | CLIP(x, x0, xF) (((x) < (x0)) ? (x0) : (((x) > (xF)) ? (xF) : (x))) |
#define | intWRAP(x, x0, xF) |
#define | fastIntWRAP(y, x, x0, xF) |
#define | realWRAP(x, x0, xF) ((x) - floor(((x) - (x0)) / ((xF) - (x0))) * ((xF) - (x0))) |
#define | DEG2RAD(d) ((d) * PI / 180) |
#define | RAD2DEG(r) ((r) * 180 / PI) |
#define | COSD(x) cos(PI * (x) / 180.) |
#define | ACOSD(x) acos((x)) * 180. / PI |
#define | SIND(x) sin(PI * (x) / 180.) |
#define | ASIND(x) asin((x)) * 180. / PI |
#define | SINC(x) |
#define | NEXT_POWER_OF_2(x) pow(2, ceil(log((double) x) / log(2.0)-XMIPP_EQUAL_ACCURACY) ) |
#define | LIN_INTERP(a, l, h) ((l) + ((h) - (l)) * (a)) |
#define | XOR(a, b) (((a) && !(b)) || (!(a) && (b))) |
Miscellaneous | |
#define | SPEED_UP_temps0 double spduptmp0; |
#define | SPEED_UP_temps01 |
#define | SPEED_UP_temps012 |
#define | SPEED_UP_tempsInt |
#define | SPEED_UP_tempsDouble |
#define | SPEED_UP_temps |
#define | SWAP(a, b, tmp) |
#define | FIRST_XMIPP_INDEX(size) -(int)((float) (size) / 2.0) |
#define | LAST_XMIPP_INDEX(size) FIRST_XMIPP_INDEX(size) + (size) - 1 |
#define | SUM_INIT(var, value) if (first_time) var = (value); else var += (value); |
#define | SUM_INIT_COND(var, value, cond) if (cond) var = (value); else var += (value); |
#define | XMIPP_ASSUME_ALIGNED(ptr, alignment) (ptr) |
Absolute value
Valid for any kind of number (int, short, float, etc)
Definition at line 142 of file xmipp_macros.h.
ArcCosine in degrees
Definition at line 338 of file xmipp_macros.h.
ArcSine in degrees
Definition at line 356 of file xmipp_macros.h.
#define CEIL | ( | x | ) |
Round to next larger integer.
Valid for any kind of numbers (int, short, float, etc). The result is of type integer.
Definition at line 225 of file xmipp_macros.h.
Clip in a saturation fashion
CLIP is a macro which acts like a saturation curve, a value x is "clipped" to a range defined by x0 and xF, for example the output values for the following x and CLIP(x,-2,2) would be
Definition at line 260 of file xmipp_macros.h.
Cosine in degrees
Definition at line 329 of file xmipp_macros.h.
Degrees to radians
Definition at line 312 of file xmipp_macros.h.
Fast wrapping for integers
Definition at line 280 of file xmipp_macros.h.
#define FIRST_XMIPP_INDEX | ( | size | ) | -(int)((float) (size) / 2.0) |
Starting point for Xmipp volume/image
Given a size (in some direction), this function returns the first index for a volume/image/array with this size. The formula is -(int) ((float) (size) / 2.0)
Definition at line 439 of file xmipp_macros.h.
#define FLOOR | ( | x | ) |
Round to next smaller integer
Valid for any kind of numbers (int, short, float, etc). The result is of type integer.
Definition at line 240 of file xmipp_macros.h.
Return the fractional part of a value
The fractional part of 3.7 is 0.7 and of -3.7 is -0.7.
Definition at line 247 of file xmipp_macros.h.
#define HALFPI 1.57079632679489661923 |
Pi/2
Definition at line 104 of file xmipp_macros.h.
Wrapping for integers
intWRAP performs a wrapping in the integer set, when the cycle is finsihed it begins again. For example, for intWRAP(x,-2,2) would be
Definition at line 272 of file xmipp_macros.h.
#define LAST_XMIPP_INDEX | ( | size | ) | FIRST_XMIPP_INDEX(size) + (size) - 1 |
Starting point for Xmipp volume/image
Given a size (in some direction), this function returns the first index for a volume/image/array with this size. The formula is FIRST_XMIPP_INDEX(size) + (size) - 1
Definition at line 448 of file xmipp_macros.h.
Linear interpolation
From low (when a=0) to high (when a=1). The following value is returned (equal to (a*h)+((1-a)*l)
Definition at line 381 of file xmipp_macros.h.
#define NEXT_POWER_OF_2 | ( | x | ) | pow(2, ceil(log((double) x) / log(2.0)-XMIPP_EQUAL_ACCURACY) ) |
Returns next positive power of 2
It is supposed that the given number is positive although it's not needed to be an integer
Definition at line 374 of file xmipp_macros.h.
#define PI 3.14159265358979323846 |
Pi
Definition at line 97 of file xmipp_macros.h.
#define RAD2DEG | ( | r | ) | ((r) * 180 / PI) |
Radians to degrees
Definition at line 320 of file xmipp_macros.h.
Wrapping for real numbers
realWRAP is used to keep a floating number between a range with a wrapping fashion. For instance, it is used in trigonometry to say that an angle of 5*PI is the same as PI, ie, to keep an angle in the range 0...2*PI
Definition at line 304 of file xmipp_macros.h.
Sign of
Valid for any kind of number (int, short, float, etc). It returns +1 or -1
Definition at line 155 of file xmipp_macros.h.
Sign of, considering 0 as 0
Valid for any kind of number (int, short, float, etc). It returns +1 if the number is positive, -1 if the number is negative, and 0 if the number is 0.
Definition at line 169 of file xmipp_macros.h.
#define SINC | ( | x | ) |
SINC function
The sinc function is defined as sin(PI*x)/(PI*x).
Definition at line 362 of file xmipp_macros.h.
Sine in degrees
Definition at line 347 of file xmipp_macros.h.
#define SPEED_UP_temps |
Speed up temporary variables
Definition at line 419 of file xmipp_macros.h.
#define SPEED_UP_temps0 double spduptmp0; |
Speed up temporary variables
Definition at line 394 of file xmipp_macros.h.
#define SPEED_UP_temps01 |
Speed up temporary variables
Definition at line 398 of file xmipp_macros.h.
#define SPEED_UP_temps012 |
Speed up temporary variables
Definition at line 403 of file xmipp_macros.h.
#define SPEED_UP_tempsDouble |
Speed up temporary variables
Definition at line 413 of file xmipp_macros.h.
#define SPEED_UP_tempsInt |
Speed up temporary variables
Definition at line 408 of file xmipp_macros.h.
Sum values, initializing with the first one
Inside a loop, the first time the value will be assigned and after that it will be summed. This macro assumes there exists a boolean flag named first_time The second macro is the same but allowing a diffent flag name
Definition at line 458 of file xmipp_macros.h.
Definition at line 459 of file xmipp_macros.h.
Swap two values
It uses a temporal variable which must be of the same type as the two parameters
Definition at line 428 of file xmipp_macros.h.
#define TWOPI 6.283185307179586 |
2 * Pi
Definition at line 111 of file xmipp_macros.h.
#define XMIPP_ASSUME_ALIGNED | ( | ptr, | |
alignment | |||
) | (ptr) |
XMIPP_ASSUME_ALIGNED(ptr, alignment) Tell compiler to assume, that ptr has given alignment, even if the compiler can't prove it. This serves as a performance hint, useful to allow auto-vectorization.
Definition at line 467 of file xmipp_macros.h.
#define XMIPP_EQUAL_ACCURACY 1e-6 |
Equal accuracy
In a comparison if two values are closer than this epsilon they are said to be the same. Actually set to 1e-6
Definition at line 119 of file xmipp_macros.h.
#define XMIPP_EQUAL_REAL | ( | x, | |
y | |||
) | ((fabs((x) - (y))) < XMIPP_EQUAL_ACCURACY) |
Compare if two real values are equals
Definition at line 122 of file xmipp_macros.h.
#define XMIPP_EQUAL_ZERO | ( | x | ) | (ABS(x) < XMIPP_EQUAL_ACCURACY) |
Definition at line 123 of file xmipp_macros.h.
Maximum
Valid for any kind of numbers (int, short, float, etc).
Definition at line 193 of file xmipp_macros.h.
Minimum
Valid for any kind of numbers (int, short, float, etc).
Definition at line 181 of file xmipp_macros.h.
Definition at line 124 of file xmipp_macros.h.
Definition at line 126 of file xmipp_macros.h.
Definition at line 128 of file xmipp_macros.h.