Xmipp
v3.23.11-Nereus
|
Go to the source code of this file.
Classes | |
class | Matrix1D< T > |
class | MultidimArrayBase |
Macros | |
#define | LOOKUP_TABLE_LEN 6 |
MultidimArraysSpeedUp Speed up macros | |
This macros are defined to allow high speed in critical parts of your program. They shouldn't be used systematically as usually there is no checking on the correctness of the operation you are performing. Speed comes from three facts: first, they are macros and no function call is performed (although most of the critical functions are inline functions), there is no checking on the correctness of the operation (it could be wrong and you are not warned of it), and destination vectors are not returned saving time in the copy constructor and in the creation/destruction of temporary vectors. | |
#define | STARTINGX(v) ((v).xinit) |
#define | FINISHINGX(v) ((v).xinit + (int)(v).xdim - 1) |
#define | STARTINGY(v) ((v).yinit) |
#define | FINISHINGY(v) ((v).yinit + (int)(v).ydim - 1) |
#define | STARTINGZ(v) ((v).zinit) |
#define | FINISHINGZ(v) ((v).zinit + (int)(v).zdim - 1) |
#define | INSIDEX(v, x) ((x) >= STARTINGX(v) && (x) <= FINISHINGX(v)) |
#define | INSIDEY(v, y) ((y) >= STARTINGY(v) && (y) <= FINISHINGY(v)) |
#define | INSIDEZ(v, z) ((z) >= STARTINGZ(v) && (z) <= FINISHINGZ(v)) |
#define | INSIDEXY(v, x, y) (INSIDEX(v, x) && INSIDEY(v, y)) |
#define | INSIDEXYZ(v, x, y, z) (INSIDEX(v, x) && INSIDEY(v, y) && INSIDEZ(v,z)) |
#define | XSIZE(v) ((v).xdim) |
#define | YSIZE(v) ((v).ydim) |
#define | ZSIZE(v) ((v).zdim) |
#define | NSIZE(v) ((v).ndim) |
#define | YXSIZE(v) ((v).yxdim) |
#define | ZYXSIZE(v) ((v).zyxdim) |
#define | MULTIDIM_SIZE(v) ((v).nzyxdim) |
#define | NZYXSIZE(v) ((v).nzyxdim) |
#define | MULTIDIM_ARRAY(v) ((v).data) |
#define | DIRECT_NZYX_ELEM(v, l, k, i, j) ((v).data[(l)*ZYXSIZE(v)+(k)*YXSIZE(v)+((i)*XSIZE(v))+(j)]) |
#define | DIRECT_ZYX_ELEM(v, k, i, j) ((v).data[(k)*YXSIZE(v)+((i)*XSIZE(v))+(j)]) |
#define | DIRECT_N_YX_ELEM(v, l, i, j) ((v).data[(l)*ZYXSIZE(v) +((i)*XSIZE(v))+(j)]) |
#define | DIRECT_N__X_ELEM(v, l, j) ((v).data[(l)*ZYXSIZE(v)+(j)]) |
#define | NZYX_ELEM(v, l, k, i, j) DIRECT_NZYX_ELEM((v), (l), (k) - STARTINGZ(v), (i) - STARTINGY(v), (j) - STARTINGX(v)) |
#define | DIRECT_MULTIDIM_ELEM(v, n) ((v).data[(n)]) |
#define | FOR_ALL_DIRECT_ELEMENTS_IN_MULTIDIMARRAY(v) for (size_t n=0; n<NZYXSIZE(v); ++n) |
#define | FOR_ALL_DIRECT_NZYX_ELEMENTS_IN_MULTIDIMARRAY(V) |
#define | FOR_ALL_NZYX_ELEMENTS_IN_MULTIDIMARRAY(V) |
#define | FOR_ALL_DIRECT_ELEMENTS_IN_MULTIDIMARRAY_ptr(v, n, ptr) for ((n)=0, (ptr)=(v).data; (n)<NZYXSIZE(v); ++(n), ++(ptr)) |
#define | DIRECT_A3D_ELEM(v, k, i, j) ((v).data[YXSIZE(v)*(k)+((i)*XSIZE(v))+(j)]) |
#define | dAkij(V, k, i, j) DIRECT_A3D_ELEM(V, k, i, j) |
#define | A3D_ELEM(V, k, i, j) DIRECT_A3D_ELEM((V),(k) - STARTINGZ(V), (i) - STARTINGY(V), (j) - STARTINGX(V)) |
#define | FOR_ALL_ELEMENTS_IN_ARRAY3D(V) |
#define | FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY3D(V1, V2) |
#define | FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY3D(V) |
#define | DIRECT_A2D_ELEM(v, i, j) ((v).data[(i)*(v).xdim+(j)]) |
#define | dAij(M, i, j) DIRECT_A2D_ELEM(M, i, j) |
#define | A2D_ELEM(v, i, j) DIRECT_A2D_ELEM(v, (i) - STARTINGY(v), (j) - STARTINGX(v)) |
#define | SAME_SHAPE2D(v1, v2) |
#define | SAME_SHAPE3D(v1, v2) |
#define | FOR_ALL_ELEMENTS_IN_ARRAY2D(m) |
#define | FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY2D(m1, m2) |
#define | FOR_ALL_ELEMENTS_IN_ARRAY3D_BETWEEN(corner1, corner2) |
#define | FOR_ALL_ELEMENTS_IN_ARRAY2D_BETWEEN(corner1, corner2) |
#define | FOR_ALL_ELEMENTS_IN_ARRAY1D_BETWEEN(corner1, corner2) for (XX(r)=(int) XX((corner1)); XX(r)<=(int) XX((corner2)); ++XX(r)) |
#define | FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY2D(m) |
#define | DIRECT_A1D_ELEM(v, i) ((v).data[(i)]) |
#define | dAi(v, i) DIRECT_A1D_ELEM(v, i) |
#define | A1D_ELEM(v, i) DIRECT_A1D_ELEM(v, (i) - ((v).xinit)) |
#define | FOR_ALL_ELEMENTS_IN_ARRAY1D(v) for (int i=STARTINGX(v); i<=FINISHINGX(v); ++i) |
#define | FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY1D(v1, v2) |
#define | FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY1D(v) for (size_t i=0; i<v.xdim; ++i) |
#define | OUTSIDE(i, j) |
#define | OUTSIDE3D(k, i, j) |
#define A1D_ELEM | ( | v, | |
i | |||
) | DIRECT_A1D_ELEM(v, (i) - ((v).xinit)) |
Vector element: Logical access
Definition at line 539 of file multidim_array_base.h.
#define A3D_ELEM | ( | V, | |
k, | |||
i, | |||
j | |||
) | DIRECT_A3D_ELEM((V),(k) - STARTINGZ(V), (i) - STARTINGY(V), (j) - STARTINGX(V)) |
Volume element: Logical access.
Definition at line 253 of file multidim_array_base.h.
#define dAi | ( | v, | |
i | |||
) | DIRECT_A1D_ELEM(v, i) |
A short alias to previous function
Definition at line 530 of file multidim_array_base.h.
#define dAij | ( | M, | |
i, | |||
j | |||
) | DIRECT_A2D_ELEM(M, i, j) |
Short alias for DIRECT_A2D_ELEM
Definition at line 345 of file multidim_array_base.h.
A short alias for the previous function.
Definition at line 244 of file multidim_array_base.h.
Vector element: Physical access
Be careful because this is physical access, usually vectors follow the C convention of starting index==0. This function should not be used as it goes against the vector library philosophy unless you explicitly want to access directly to any value in the vector without taking into account its logical position.
Definition at line 526 of file multidim_array_base.h.
Access to a direct element of a matrix. v is the array, i and j define the element v_ij.
Be careful because this is physical access, usually matrices follow the C convention of starting index==0 (X and Y). This function should not be used as it goes against the vector library philosophy unless you explicitly want to access directly to any value in the matrix without taking into account its logical position
Definition at line 341 of file multidim_array_base.h.
Access to a direct element. v is the array, k is the slice (Z), i is the Y index and j is the X index.
Definition at line 239 of file multidim_array_base.h.
Access to a direct element. v is the array, k is the slice and n is the number of the pixel (combined i and j) within the slice.
Definition at line 161 of file multidim_array_base.h.
Access to a direct element. v is the array, l is the image, k =0, i = 0 and j is the X index. i and j) within the slice.
Definition at line 150 of file multidim_array_base.h.
Access to a direct element. v is the array, l is the image, k =0, i is the Y index and j is the X index. i and j) within the slice.
Definition at line 145 of file multidim_array_base.h.
#define DIRECT_NZYX_ELEM | ( | v, | |
l, | |||
k, | |||
i, | |||
j | |||
) | ((v).data[(l)*ZYXSIZE(v)+(k)*YXSIZE(v)+((i)*XSIZE(v))+(j)]) |
Access to a direct element. v is the array, l is the image, k is the slice, i is the Y index and j is the X index. i and j) within the slice.
Definition at line 133 of file multidim_array_base.h.
Access to a direct element. v is the array, l is the image, k is the slice, i is the Y index and j is the X index. i and j) within the slice.
Definition at line 139 of file multidim_array_base.h.
#define FINISHINGX | ( | v | ) | ((v).xinit + (int)(v).xdim - 1) |
Returns the last X valid logical index
Definition at line 55 of file multidim_array_base.h.
#define FINISHINGY | ( | v | ) | ((v).yinit + (int)(v).ydim - 1) |
Returns the last Y valid logical index
Definition at line 63 of file multidim_array_base.h.
#define FINISHINGZ | ( | v | ) | ((v).zinit + (int)(v).zdim - 1) |
Returns the last Z valid logical index
Definition at line 71 of file multidim_array_base.h.
For all elements in the array, accessed physically
This macro is used to generate loops for the vector in an easy way using physical indexes. It defines internal the index 'i' which ranges the vector using its physical definition.
Definition at line 593 of file multidim_array_base.h.
#define FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY2D | ( | m | ) |
For all elements in the array, accessed physically
This macro is used to generate loops for the matrix in an easy way using physical indexes. It defines internal indexes 'i' and 'j' which ranges the matrix using its physical definition.
Definition at line 509 of file multidim_array_base.h.
#define FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY3D | ( | V | ) |
For all direct elements in the array.
This macro is used to generate loops for the volume in an easy way. It defines internal indexes 'k','i' and 'j' which ranges the volume using its physical definition.
Definition at line 322 of file multidim_array_base.h.
For all direct elements in the array
This macro is used to generate loops for the array in an easy manner. It defines an internal index 'n' which goes over the slices and 'n' that goes over the pixels in each slice.
Definition at line 176 of file multidim_array_base.h.
#define FOR_ALL_DIRECT_ELEMENTS_IN_MULTIDIMARRAY_ptr | ( | v, | |
n, | |||
ptr | |||
) | for ((n)=0, (ptr)=(v).data; (n)<NZYXSIZE(v); ++(n), ++(ptr)) |
For all direct elements in the array, pointer version
This macro is used to generate loops for the array in an easy manner. It defines an internal index 'k' which goes over the slices and 'n' that goes over the pixels in each slice. Each element can be accessed through an external pointer called ptr.
Definition at line 233 of file multidim_array_base.h.
#define FOR_ALL_DIRECT_NZYX_ELEMENTS_IN_MULTIDIMARRAY | ( | V | ) |
For all direct elements in the array
This macro is used to generate loops for the array in an easy manner. It defines internal indexes 'l', 'k','i' and 'j' which ranges over the n volume using its physical definition.
Definition at line 192 of file multidim_array_base.h.
For all elements in the array
This macro is used to generate loops for the vector in an easy manner. It defines an internal index 'i' which ranges the vector using its mathematical definition (ie, logical access).
Definition at line 554 of file multidim_array_base.h.
#define FOR_ALL_ELEMENTS_IN_ARRAY1D_BETWEEN | ( | corner1, | |
corner2 | |||
) | for (XX(r)=(int) XX((corner1)); XX(r)<=(int) XX((corner2)); ++XX(r)) |
For all elements in the array between corners
This macro is used to generate loops for a vector in an easy manner. It needs an externally defined MultidimArray< double > r(1). Then XX(r) ranges from (int) XX(corner1) to (int) XX(corner2) (included limits) (notice that corner1 and corner2 need only to be MultidimArray).
Definition at line 493 of file multidim_array_base.h.
#define FOR_ALL_ELEMENTS_IN_ARRAY2D | ( | m | ) |
For all elements in the array
This macro is used to generate loops for the matrix in an easy way. It defines internal indexes 'i' and 'j' which ranges the matrix using its mathematical definition (ie, logical access).
Definition at line 390 of file multidim_array_base.h.
#define FOR_ALL_ELEMENTS_IN_ARRAY2D_BETWEEN | ( | corner1, | |
corner2 | |||
) |
For all elements in the array between corners
This macro is used to generate loops for a matrix in an easy manner. It needs an externally defined MultidimArray< double > r(2). Then YY(r) and XX(r) range from (int) YY(corner1) to (int)YY(corner2), (int) XX(corner1) to (int) XX(corner2) (included limits) respectively. Notice that corner1 and corner2 need only be MultidimArray.
Definition at line 472 of file multidim_array_base.h.
#define FOR_ALL_ELEMENTS_IN_ARRAY3D | ( | V | ) |
For all elements in the array.
This macro is used to generate loops for the volume in an easy way. It defines internal indexes 'k','i' and 'j' which ranges the volume using its mathematical definition (ie, logical access).
Definition at line 269 of file multidim_array_base.h.
#define FOR_ALL_ELEMENTS_IN_ARRAY3D_BETWEEN | ( | corner1, | |
corner2 | |||
) |
For all elements in the array between corners.
This macro is used to generate loops for a volume in an easy manner. Then ZZ(r), YY(r) and XX(r) range from
(int) ZZ(corner1) to (int)ZZ(corner2), (int) YY(corner1) to (int)YY(corner2), (int) XX(corner1) to (int) XX(corner2) (included limits) respectively.
Notice that corner1 and corner2 need only be MultidimArray.
Definition at line 445 of file multidim_array_base.h.
#define FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY1D | ( | v1, | |
v2 | |||
) |
For all elements in common
This macro is used to generate loops for all the elements logically in common between two vectors in an easy manner. Then i (locally defined) ranges from MAX(STARTINGX(V1), STARTINGX(V2)) to MIN(FINISHINGX(V1), FINISHINGX(V2)) (included limits) respectively. You need to define SPEED_UP_temps.
Definition at line 575 of file multidim_array_base.h.
#define FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY2D | ( | m1, | |
m2 | |||
) |
For all elements in common
This macro is used to generate loops for all the elements logically in common between two images in an easy manner. Then i and j (locally defined) range from MAX(STARTINGY(V1), STARTINGY(V2)) to MIN(FINISHINGY(V1), FINISHINGY(V2)), MAX(STARTINGX(V1), STARTINGX(V2)) to MIN(FINISHINGX(V1), FINISHINGX(V2)) (included limits) respectively. You need to define SPEED_UP_temps.
Definition at line 414 of file multidim_array_base.h.
#define FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY3D | ( | V1, | |
V2 | |||
) |
For all elements in common.
This macro is used to generate loops for all the elements logically in common between two volumes in an easy manner. Then k, i and j (locally defined) range from
MAX(STARTINGZ(V1),STARTINGZ(V2)) to MIN(FINISHINGZ(V1),FINISHINGZ(V2)), MAX(STARTINGY(V1),STARTINGY(V2)) to MIN(FINISHINGY(V1),FINISHINGY(V2)), MAX(STARTINGX(V1),STARTINGX(V2)) to MIN(FINISHINGX(V1),FINISHINGX(V2))
(included limits) respectively. You need to define SPEED_UP_temps.
Definition at line 298 of file multidim_array_base.h.
#define FOR_ALL_NZYX_ELEMENTS_IN_MULTIDIMARRAY | ( | V | ) |
For all direct elements in the array
This macro is used to generate loops for the array in an easy manner. It defines internal indexes 'l', 'k','i' and 'j' which ranges over the n volume using its logical definition.
Definition at line 211 of file multidim_array_base.h.
#define INSIDEX | ( | v, | |
x | |||
) | ((x) >= STARTINGX(v) && (x) <= FINISHINGX(v)) |
Check if x is inside logical bounds
Definition at line 75 of file multidim_array_base.h.
Check if a position x, y is inside the logical index bounds
Definition at line 84 of file multidim_array_base.h.
Check if a position x, y is inside the logical index bounds
Definition at line 87 of file multidim_array_base.h.
#define INSIDEY | ( | v, | |
y | |||
) | ((y) >= STARTINGY(v) && (y) <= FINISHINGY(v)) |
Check if y is inside logical bounds
Definition at line 78 of file multidim_array_base.h.
#define INSIDEZ | ( | v, | |
z | |||
) | ((z) >= STARTINGZ(v) && (z) <= FINISHINGZ(v)) |
Check if z is inside logical bounds
Definition at line 81 of file multidim_array_base.h.
#define LOOKUP_TABLE_LEN 6 |
Definition at line 609 of file multidim_array_base.h.
#define MULTIDIM_ARRAY | ( | v | ) | ((v).data) |
Array access.
This macro gives you access to the array (T **)
Definition at line 126 of file multidim_array_base.h.
#define MULTIDIM_SIZE | ( | v | ) | ((v).nzyxdim) |
Access to XYZN dimension (Nsize*Zsize*Ysize*Xsize)
Definition at line 115 of file multidim_array_base.h.
#define NSIZE | ( | v | ) | ((v).ndim) |
Access to N dimension (size)
Definition at line 103 of file multidim_array_base.h.
#define NZYX_ELEM | ( | v, | |
l, | |||
k, | |||
i, | |||
j | |||
) | DIRECT_NZYX_ELEM((v), (l), (k) - STARTINGZ(v), (i) - STARTINGY(v), (j) - STARTINGX(v)) |
Multidim element: Logical access.
Definition at line 154 of file multidim_array_base.h.
#define NZYXSIZE | ( | v | ) | ((v).nzyxdim) |
Access to XYZN dimension (Nsize*Zsize*Ysize*Xsize)
Definition at line 119 of file multidim_array_base.h.
Macro to check whether a point is inside or outside a given matrix.
Definition at line 597 of file multidim_array_base.h.
Macro to check whether a point is inside or outside a given matrix.
Definition at line 602 of file multidim_array_base.h.
#define SAME_SHAPE2D | ( | v1, | |
v2 | |||
) |
TRUE if both arrays have the same shape
Two arrays have the same shape if they have the same size and the same starting point. Be aware that this is a macro which simplifies to a boolean.
Definition at line 362 of file multidim_array_base.h.
#define SAME_SHAPE3D | ( | v1, | |
v2 | |||
) |
Definition at line 368 of file multidim_array_base.h.
#define STARTINGX | ( | v | ) | ((v).xinit) |
Returns the first X valid logical index
Definition at line 51 of file multidim_array_base.h.
#define STARTINGY | ( | v | ) | ((v).yinit) |
Returns the first Y valid logical index
Definition at line 59 of file multidim_array_base.h.
#define STARTINGZ | ( | v | ) | ((v).zinit) |
Returns the first Z valid logical index
Definition at line 67 of file multidim_array_base.h.
#define XSIZE | ( | v | ) | ((v).xdim) |
Access to X dimension (size)
Definition at line 91 of file multidim_array_base.h.
#define YSIZE | ( | v | ) | ((v).ydim) |
Access to Y dimension (size)
Definition at line 95 of file multidim_array_base.h.
#define YXSIZE | ( | v | ) | ((v).yxdim) |
Access to XY dimension (Ysize*Xsize)
Definition at line 107 of file multidim_array_base.h.
#define ZSIZE | ( | v | ) | ((v).zdim) |
Access to Z dimension (size)
Definition at line 99 of file multidim_array_base.h.
#define ZYXSIZE | ( | v | ) | ((v).zyxdim) |
Access to XYZ dimension (Zsize*Ysize*Xsize)
Definition at line 111 of file multidim_array_base.h.