Xmipp
v3.23.11-Nereus
|
#include <common_lines.h>
Public Member Functions | |
Constructors | |
MultidimArray () | |
MultidimArray (size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, T *data) | |
MultidimArray (size_t Ndim, int Zdim, int Ydim, int Xdim) | |
MultidimArray (int Zdim, int Ydim, int Xdim) | |
MultidimArray (int Ydim, int Xdim) | |
MultidimArray (int Xdim) | |
MultidimArray (const MultidimArray< T > &V) | |
MultidimArray (MultidimArray< T > &&V) noexcept | |
MultidimArray (const Matrix1D< T > &V) | |
MultidimArray (const std::vector< T > &vector) | |
virtual | ~MultidimArray () |
void | clear () |
Core memory operations | |
void | coreInit () noexcept |
void | swap (MultidimArray< T > &other) noexcept |
void | coreAllocate (size_t _ndim, int _zdim, int _ydim, int _xdim) |
void | coreAllocate () |
void | coreAllocateReuse () |
FILE * | mmapFile (T *&_data, size_t nzyxDim) const |
void | coreDeallocate () noexcept |
void | alias (const MultidimArray< T > &m) |
void | aliasRow (const MultidimArray< T > &m, size_t select_row) |
void | aliasSlice (const MultidimArray< T > &m, size_t select_slice) |
void | aliasImageInStack (const MultidimArray< T > &m, size_t select_image) |
Size | |
void | resize (size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true) |
template<typename T1 > | |
void | resize (const MultidimArray< T1 > &v, bool copy=true) |
template<typename T1 > | |
void | resizeNoCopy (const MultidimArray< T1 > &v) |
void | checkDimensionWithDebug (int dim, const char *file, int line) const |
void | selfWindow (int n0, int z0, int y0, int x0, int nF, int zF, int yF, int xF, T init_value=0) |
template<class T1 > | |
void | window (MultidimArray< T1 > &result, int n0, int z0, int y0, int x0, int nF, int zF, int yF, int xF, T1 init_value=0) const |
template<class T1 > | |
void | window (MultidimArray< T1 > &result, int z0, int y0, int x0, int zF, int yF, int xF, T1 init_value=0) const |
void | selfWindow (int z0, int y0, int x0, int zF, int yF, int xF, T init_value=0) |
template<class T1 > | |
void | window (MultidimArray< T1 > &result, int y0, int x0, int yF, int xF, T1 init_value=0) const |
void | selfWindow (int y0, int x0, int yF, int xF, T init_value=0) |
template<class T1 > | |
void | window (MultidimArray< T1 > &result, int x0, int xF, T1 init_value=0) const |
void | selfWindow (int x0, int xF, T init_value=0) |
void | patch (MultidimArray< T > patchArray, int x, int y) |
Access to the pixel values | |
T & | operator() (const Matrix1D< double > &v) const |
T & | operator() (const Matrix1D< int > &v) const |
T & | operator() (size_t n, int k, int i, int j) const |
T & | operator() (int k, int i, int j) const |
T & | operator() (int i, int j) const |
T & | operator() (int i) const |
T & | operator[] (size_t i) const |
void * | getArrayPointer () const |
void | getImage (size_t n, MultidimArray< T > &M, size_t n2=0) const |
template<typename T1 > | |
void | getSlice (int k, MultidimArray< T1 > &M, char axis='Z', bool reverse=false, size_t n=0) const |
void | getSliceAsMatrix (size_t k, Matrix2D< T > &m) const |
void | getAliasAsRowVector (Matrix1D< T > &m) const |
template<typename T1 > | |
void | setSlice (int k, const MultidimArray< T1 > &v, size_t n=0) |
template<typename T1 > | |
void | reslice (MultidimArray< T1 > &out, AxisView face, bool flip=false, size_t n=0) const |
void | reslice (AxisView face, bool flip=false, size_t n=0) |
void | getCol (size_t j, MultidimArray< T > &v) const |
void | setCol (size_t j, const MultidimArray< T > &v) |
void | getRow (size_t i, MultidimArray< T > &v) const |
void | setRow (int i, const MultidimArray< T > &v) |
void | getReal (MultidimArray< double > &realImg) const |
void | getImag (MultidimArray< double > &imagImg) const |
void | toPhysical (int k_log, int i_log, int j_log, int &k_phys, int &i_phys, int &j_phys) const |
void | toLogical (int k_phys, int i_phys, int j_phys, int &k_log, int &i_log, int &j_log) const |
void | toPhysical (int i_log, int j_log, int &i_phys, int &j_phys) const |
void | toLogical (int i_phys, int j_phys, int &i_log, int &j_log) const |
void | toPhysical (int i_log, int &i_phys) const |
void | toLogical (int i_phys, int &i_log) const |
T | interpolatedElement3D (double x, double y, double z, T outside_value=(T) 0) const |
T | interpolatedElement2D (double x, double y, T outside_value=(T) 0) const |
T | interpolatedElement2DOutsideZero (double x, double y) const |
T | interpolatedElement1D (double x, T outside_value=(T) 0) const |
T | interpolatedElementBSpline3D (double x, double y, double z, int SplineDegree=3) const |
T | interpolatedElementBSpline2D (double x, double y, int SplineDegree=3) const |
T | interpolatedElementBSpline2D_Degree3 (double x, double y) const |
T | interpolatedElementBSpline1D (double x, int SplineDegree=3) const |
Statistics functions | |
void | printStats (std::ostream &out=std::cout) const |
T | computeMax () const |
void | maxIndex (int &jmax) const |
T | computeMin () const |
void | minIndex (int &lmin, int &kmin, int &imin, int &jmin) const |
void | minIndex (int &kmin, int &imin, int &jmin) const |
void | minIndex (int &imin, int &jmin) const |
void | minIndex (int &jmin) const |
void | maxIndex (size_t &lmax, int &kmax, int &imax, int &jmax) const |
void | computeDoubleMinMax (double &minval, double &maxval) const |
void | computeDoubleMinMaxRange (double &minval, double &maxval, size_t offset, size_t size) const |
double | computeAvg () const |
double | computeStddev () const |
void | computeStats (double &avg, double &stddev, T &minval, T &maxval) const |
template<typename U > | |
void | computeAvgStdev (U &avg, U &stddev) const |
void | computeAvgStdev_within_binary_mask (const MultidimArray< int > &mask, double &avg, double &stddev) const |
void | computeMedian_within_binary_mask (const MultidimArray< int > &mask, double &median) const |
void | computeStats (double &avg, double &stddev, T &min_val, T &max_val, Matrix1D< int > &corner1, Matrix1D< int > &corner2, size_t n=0) |
double | computeMedian () const |
void | rangeAdjust (T minF, T maxF) |
void | rangeAdjust (T minF, T maxF, MultidimArray< int > &mask) |
void | rangeAdjust (const MultidimArray< T > &example, const MultidimArray< int > *mask=NULL) |
template<typename U > | |
void | statisticsAdjust (U avgF, U stddevF) |
Initialization | |
void | initConstant (T val) |
template<typename T1 > | |
void | initZeros (const MultidimArray< T1 > &op) |
void | initZeros () |
void | initZeros (size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim) |
void | initZeros (int Xdim) |
void | initZeros (int Ydim, int Xdim) |
void | initZeros (int Zdim, int Ydim, int Xdim) |
void | initLinear (T minF, T maxF, int n=1, const String &mode="incr") |
void | initRandom (double op1, double op2, RandomMode mode=RND_UNIFORM) |
void | addNoise (double op1, double op2, const String &mode="uniform", double df=3.) const |
Public Member Functions inherited from MultidimArrayBase | |
virtual | ~MultidimArrayBase () |
int | getDim () const |
void | setMmap (bool mmap) |
void | maxIndex (ArrayCoord &pos) const |
void | maxIndex (int &kmax, int &imax, int &jmax) const |
void | maxIndex (int &imax, int &jmax) const |
void | maxIndex (int &jmax) const |
void | printShape (std::ostream &out=std::cout) const |
void | setNdim (int Ndim) |
void | setZdim (int Zdim) |
void | setYdim (int Ydim) |
void | setXdim (int Xdim) |
void | setDimensions (int Xdim, int Ydim, int Zdim, size_t Ndim) |
void | setDimensions (ArrayDim &newDim) |
void | getDimensions (size_t &Xdim, size_t &Ydim, size_t &Zdim, size_t &Ndim) const |
void | getDimensions (ArrayDim &idim) const |
ArrayDim | getDimensions () const |
void | getDimensions (int *size) const |
size_t | getSize () const |
void | resize (size_t Zdim, size_t Ydim, size_t Xdim) |
void | resize (size_t Ydim, size_t Xdim) |
void | resize (size_t Xdim) |
void | resize (ArrayDim &adim, bool copy=true) |
void | resizeNoCopy (size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim) |
void | resizeNoCopy (size_t Zdim, size_t Ydim, size_t Xdim) |
void | resizeNoCopy (size_t Ydim, size_t Xdim) |
void | resizeNoCopy (size_t Xdim) |
size_t | rowNumber () const |
size_t | colNumber () const |
void | copyShape (const MultidimArrayBase &m) |
bool | sameShape (const MultidimArrayBase &op) const |
void | setXmippOrigin () |
void | resetOrigin () |
void | moveOriginTo (int k, int i, int j) |
void | moveOriginTo (int i, int j) |
int | startingZ () const |
int | finishingZ () const |
int | startingY () const |
int | finishingY () const |
int | startingX () const |
int | finishingX () const |
bool | isCorner (const Matrix1D< double > &v) const |
bool | outside (int k, int i, int j) const |
bool | outside (int i, int j) const |
bool | outside (int i) const |
bool | outside (const Matrix1D< double > &r) const |
Public Attributes | |
T * | data |
Public Attributes inherited from MultidimArrayBase | |
bool | destroyData |
size_t | ndim |
size_t | zdim |
size_t | ydim |
size_t | xdim |
size_t | yxdim |
size_t | zyxdim |
size_t | nzyxdim |
int | zinit |
int | yinit |
int | xinit |
bool | mmapOn |
FILE * | mFd |
size_t | nzyxdimAlloc |
Friends | |
Scalar "by" array operations | |
These operations are between a scalar (of the same type as the array) and an array. The result must have been defined to be of the same type as the operand. The former content of the result array is lost after the operation. In this kind of operations the constant is operated with each element of array 2. The result has also got the same shape as the input array and its former content is lost | |
void | coreScalarByArray (const T &op1, const MultidimArray< T > &op2, MultidimArray< T > &result, char operation) |
void | scalarByArray (T op1, const MultidimArray< T > &op2, MultidimArray< T > &result, char operation) |
MultidimArray< T > | operator+ (T op1, const MultidimArray< T > &op2) |
MultidimArray< T > | operator- (T op1, const MultidimArray< T > &op2) |
MultidimArray< T > | operator* (T op1, const MultidimArray< T > &op2) |
MultidimArray< T > | operator/ (T op1, const MultidimArray< T > &op2) |
Array "by" array operations. | |
These are operations that are performed between 2 arrays of the SAME type (two integer vectors, two double matrices, ...). If they are not of the same type you can convert one of the arrays to the desired type using the function typeCast. The result must have been defined to be of the same type as the operands. In this kind of operations each element of array 1 is operated with its homologous in array 2, it is very important that both have got the same size and starting origins. The result has also got the same shape as the two operated arrays and its former content is lost. | |
MultidimArray< T > | operator+ (const MultidimArray< T > &op1) const |
MultidimArray< T > | operator- (const MultidimArray< T > &op1) const |
MultidimArray< T > | operator* (const MultidimArray< T > &op1) const |
MultidimArray< T > | operator/ (const MultidimArray< T > &op1) const |
void | operator+= (const MultidimArray< T > &op1) |
void | operator-= (const MultidimArray< T > &op1) |
void | operator*= (const MultidimArray< T > &op1) |
void | operator/= (const MultidimArray< T > &op1) |
double | dotProduct (const MultidimArray< T > &op1) |
void | coreArrayByArray (const MultidimArray< T > &op1, const MultidimArray< T > &op2, MultidimArray< T > &result, char operation) |
void | selfCoreArrayByArrayMask (const MultidimArray< T > &op1, const MultidimArray< T > &op2, MultidimArray< T > &result, char operation, const MultidimArray< T > *mask) |
void | arrayByArray (const MultidimArray< T > &op1, const MultidimArray< T > &op2, MultidimArray< T > &result, char operation) |
void | selfArrayByArrayMask (const MultidimArray< T > &op1, const MultidimArray< T > &op2, MultidimArray< T > &result, char operation, const MultidimArray< T > *mask=NULL) |
Array "by" scalar operations | |
These operations are between an array and a scalar (of the same type as the array). The result must have been defined to be of the same type as the operands. In this kind of operations each element of array 1 is operated with the given constant. The result has also got the same shape as the input array and its former content is lost | |
MultidimArray< T > | operator+ (T op1) const |
MultidimArray< T > | operator- (T op1) const |
MultidimArray< T > | operator* (T op1) const |
MultidimArray< T > | operator/ (T op1) const |
void | equal (T op1, MultidimArray< char > &result) const |
void | operator+= (const T &op1) |
void | operator-= (const T &op1) |
void | operator*= (const T &op1) |
void | operator/= (const T &op1) |
void | coreArrayByScalar (const MultidimArray< T > &op1, const T &op2, MultidimArray< T > &result, char operation) |
void | arrayByScalar (const MultidimArray< T > &op1, T op2, MultidimArray< T > &result, char operation) |
Utilities | |
Here you have several easy functions to manage the values of the array. | |
T *** | adaptForNumericalRecipes3D (size_t n=0) const |
void | killAdaptationForNumericalRecipes3D (T ***m) const |
T ** | adaptForNumericalRecipes2D (size_t n=0) const |
T * | adaptForNumericalRecipes22D () const |
void | loadFromNumericalRecipes2D (T **m, int Ydim, int Xdim) |
void | killAdaptationForNumericalRecipes2D (T **m) const |
void | killAdaptationForNumericalRecipes22D (T **m) const |
T * | adaptForNumericalRecipes1D () const |
void | killAdaptationForNumericalRecipes1D (T *m) const |
void | centerOfMass (Matrix1D< double > ¢er, void *mask=NULL, size_t n=0) |
void | sort (MultidimArray< T > &result) const |
void | indexSort (MultidimArray< int > &indx) const |
void | cumlativeDensityFunction (MultidimArray< double > &cdf) |
void | threshold (const String &type, T a, T b=0, MultidimArray< int > *mask=NULL) |
size_t | countThreshold (const String &type, T a, T b, MultidimArray< int > *mask=NULL) |
void | substitute (T oldv, T newv, double accuracy=XMIPP_EQUAL_ACCURACY, MultidimArray< int > *mask=NULL) |
void | randomSubstitute (T oldv, T avgv, T sigv, double accuracy=XMIPP_EQUAL_ACCURACY, MultidimArray< int > *mask=NULL) |
void | binarize (double val=0, double accuracy=XMIPP_EQUAL_ACCURACY, MultidimArray< int > *mask=NULL) |
void | binarizeRange (double valMin=0, double valMax=255, MultidimArray< int > *mask=NULL) |
void | selfROUND () |
void | selfCEIL () |
void | selfFLOOR () |
void | selfABS () |
void | selfNormalizeInterval (double minPerc=0.25, double maxPerc=0.75, int Npix=1000) |
void | selfSQRT () |
double | sum () const |
double | sum2 () const |
void | selfLog10 () |
void | selfLog () |
void | selfReverseX () |
void | selfReverseY () |
void | selfReverseZ () |
void | profile (int x0, int y0, int xF, int yF, int N, MultidimArray< double > &profile) const |
void | showWithGnuPlot (const String &xlabel, const String &title) |
void | edit () |
void | write (const FileName &fn) const |
void | MultidimArrayMax (const MultidimArray< T > &v1, const MultidimArray< T > &v2, MultidimArray< T > &result) |
void | MultidimArrayMIN (const MultidimArray< T > &v1, const MultidimArray< T > &v2, MultidimArray< T > &result) |
Operators | |
MultidimArray< T > & | operator= (const MultidimArray< T > &op1) |
MultidimArray< T > & | operator= (MultidimArray< T > &&other) noexcept |
MultidimArray< T > & | operator= (const Matrix2D< T > &op1) |
MultidimArray< T > | operator- () const |
void | copy (Matrix2D< T > &op1) const |
bool | equal (const MultidimArray< T > &op, double accuracy=XMIPP_EQUAL_ACCURACY) const |
std::istream & | operator>> (std::istream &in, MultidimArray< T > &v) |
Definition at line 35 of file common_lines.h.
|
inline |
Empty constructor. The empty constructor creates an array with no memory associated, size=0.
Definition at line 94 of file multidim_array.h.
|
inline |
Size constructor with 4D size and already allocated data.
Definition at line 102 of file multidim_array.h.
|
inline |
Size constructor with 4D size. The Size constructor creates an array with memory associated, and fills it with zeros.
Definition at line 115 of file multidim_array.h.
|
inline |
Size constructor with 3D size. The Size constructor creates an array with memory associated, and fills it with zeros.
Definition at line 125 of file multidim_array.h.
|
inline |
Size constructor with 2D size. The Size constructor creates an array with memory associated, and fills it with zeros.
Definition at line 135 of file multidim_array.h.
|
inline |
Size constructor with 1D size. The Size constructor creates an array with memory associated, and fills it with zeros.
Definition at line 145 of file multidim_array.h.
|
inline |
Copy constructor
The created volume is a perfect copy of the input array but with a different memory assignment.
Definition at line 160 of file multidim_array.h.
|
inlinenoexcept |
Move constructor
The created volume is a perfect copy of the input array but with a different memory assignment.
Definition at line 175 of file multidim_array.h.
|
inline |
Copy constructor from a Matrix1D. The Size constructor creates an array with memory associated, and fills it with zeros.
Definition at line 185 of file multidim_array.h.
|
inline |
Constructor from vector 1D This will create a MultidimArray 1D the size and elements will be copied from the std::vector
Definition at line 198 of file multidim_array.h.
|
inlinevirtual |
|
inline |
Produce a 1D array suitable for working with Numerical Recipes
This function must be used only as a preparation for routines which need that the first physical index is 1 and not 0 as it usually is in C. In fact the vector provided for Numerical recipes is exactly this same one but with the indexes changed.
This function is not ported to Python.
Definition at line 2976 of file multidim_array.h.
|
inline |
Produce a 1D pointer suitable for working with Numerical Recipes (2)
This function meets the same goal as the one before, however this one work with 2D arrays as a single pointer. The first element of the array is pointed by result[1*Xdim+1], and in general result[i*Xdim+j]
Definition at line 2935 of file multidim_array.h.
|
inline |
Produce a 2D array suitable for working with Numerical Recipes
This function must be used only as a preparation for routines which need that the first physical index is 1 and not 0 as it usually is in C. New memory is needed to hold the new double pointer array.
Definition at line 2918 of file multidim_array.h.
|
inline |
Produce a 3D array suitable for working with Numerical Recipes.
This function must be used only as a preparation for routines which need that the first physical index is 1 and not 0 as it usually is in C. New memory is needed to hold the new double pointer array.
Definition at line 2894 of file multidim_array.h.
void MultidimArray< T >::addNoise | ( | double | op1, |
double | op2, | ||
const String & | mode = "uniform" , |
||
double | df = 3. |
||
) | const |
Add noise to actual values.
This function add some noise to the actual values of the array according to a certain random distribution. You must choose two parameters for each, for the uniform distribution they mean the range where to generate the random numbers, while in the gaussian case they are the mean and the standard deviation. By default the uniform distribution is selected. The size and origin of the array are not modified. The array itself is modified.
Definition at line 837 of file multidim_array.cpp.
|
inline |
Alias a multidimarray.
Treat the multidimarray as if it were a volume. The data is not copied into new memory, but a pointer to the multidimarray is copied. You should not make any operation on this volume such that the memory locations are changed
Definition at line 379 of file multidim_array.h.
|
inline |
Alias an image in a stack.
Treat the multidimarray as if it were a single slice. The data is not copied into new memory, but a pointer to the selected image in the multidimarray is copied. You should not make any operation on this volume such that the memory locations are changed. Select_slice starts at 0 towards Nsize.
Definition at line 436 of file multidim_array.h.
|
inline |
Alias a row in an image.
Treat the multidimarray as if it were a single slice. The data is not copied into new memory, but a pointer to the selected slice in the multidimarray is copied. You should not make any operation on this volume such that the memory locations are changed. Select_slice starts at 0 towards Zsize.
Definition at line 396 of file multidim_array.h.
|
inline |
Alias a slice in a multidimarray.
Treat the multidimarray as if it were a single slice. The data is not copied into new memory, but a pointer to the selected slice in the multidimarray is copied. You should not make any operation on this volume such that the memory locations are changed. Select_slice starts at 0 towards Zsize.
Definition at line 416 of file multidim_array.h.
|
inline |
Binarize.
This functions substitutes all values in a volume which are greater than val+accuracy by 1 and the rest are set to 0. Use threshold to get a very powerful binarization.
Definition at line 3252 of file multidim_array.h.
|
inline |
Binarize using a range
This functions substitutes all values in a volume which are in the range between valMin and valMax by 1 and the rest are set to 0.
Definition at line 3273 of file multidim_array.h.
|
inline |
Computes the center of mass of the nth array
Definition at line 2992 of file multidim_array.h.
|
inline |
Definition at line 521 of file multidim_array.h.
|
inlinevirtual |
|
inlinevirtual |
Average of the values in the array.
The returned value is always double, independently of the type of the array.
Implements MultidimArrayBase.
Definition at line 1739 of file multidim_array.h.
|
inline |
Compute statistics.
The average, standard deviation, minimum and maximum value are returned.
Definition at line 1836 of file multidim_array.h.
|
inline |
Compute statistics in the active area
Only the statistics for values in the overlapping between the mask and the volume for those the mask is not 0 are computed.
Definition at line 1873 of file multidim_array.h.
|
inline |
Minimum and maximum of the values in the array.
As doubles.
Definition at line 1688 of file multidim_array.h.
|
inlinevirtual |
Minimum and maximum of the values in the array.
As doubles.
Implements MultidimArrayBase.
Definition at line 1713 of file multidim_array.h.
|
inline |
Maximum of the values in the array.
The returned value is of the same type as the type of the array.
Definition at line 1537 of file multidim_array.h.
|
inline |
Median
Calculate the median element.
Definition at line 1951 of file multidim_array.h.
void MultidimArray< T >::computeMedian_within_binary_mask | ( | const MultidimArray< int > & | mask, |
double & | median | ||
) | const |
Definition at line 1099 of file multidim_array.cpp.
|
inline |
Minimum of the values in the array.
The returned value is of the same type as the type of the array.
Definition at line 1568 of file multidim_array.h.
|
inline |
Compute statistics.
The average, standard deviation, minimum and maximum value are returned.
Definition at line 1791 of file multidim_array.h.
|
inline |
Compute statistics within 2D region of 2D image.
The 2D region is specified by two corners. Note that this function only works for the 0th image in a multi-image array...
Definition at line 1906 of file multidim_array.h.
|
inline |
Standard deviation of the values in the array.
Be careful that the standard deviation and NOT the variance is returned. The returned value is always double, independently of the type of the array.
Definition at line 1760 of file multidim_array.h.
void MultidimArray< T >::copy | ( | Matrix2D< T > & | op1 | ) | const |
Definition at line 56 of file multidim_array.cpp.
|
inline |
Core allocate with dimensions.
Definition at line 262 of file multidim_array.h.
|
inline |
Core allocate without dimensions.
It is supposed the dimensions are set previously with setXdim(x), setYdim(y) setZdim(z), setNdim(n) or with setDimensions(Xdim, Ydim, Zdim, Ndim);
Definition at line 289 of file multidim_array.h.
|
inlinevirtual |
Core allocate without dimensions.
It is supposed the dimensions are set previously with setXdim(x), setYdim(y) setZdim(z), setNdim(n) or with setDimensions(Xdim, Ydim, Zdim, Ndim);
Implements MultidimArrayBase.
Definition at line 323 of file multidim_array.h.
|
inlinevirtualnoexcept |
Core deallocate. Free all data.
Implements MultidimArrayBase.
Definition at line 349 of file multidim_array.h.
|
inlinenoexcept |
|
inline |
Count with threshold.
This function returns the number of elements meeting the threshold condition.
Definition at line 3160 of file multidim_array.h.
|
inline |
Cumulative Density Function. For each entry in the array, give what is the probability of having a value smaller or equal than this entry.
Definition at line 3042 of file multidim_array.h.
|
inline |
Dot product
Definition at line 2405 of file multidim_array.h.
void MultidimArray< T >::edit | ( | ) |
Edit with xmipp_editor.
This function generates a random filename starting with PPP and edits it with xmipp_editor. After closing the editor the file is removed.
Definition at line 956 of file multidim_array.cpp.
|
inline |
v3 = (v1 == k).
Definition at line 2545 of file multidim_array.h.
|
inline |
Equality.
Returns true if this object has got the same shape (origin and size) than the argument and the same values (within accuracy).
Definition at line 3721 of file multidim_array.h.
|
inline |
Return the data aliased as a row vector in a Matrix1D
Definition at line 1014 of file multidim_array.h.
|
inlinevirtual |
Return the void pointer to the internal data array
Implements MultidimArrayBase.
Definition at line 864 of file multidim_array.h.
|
inline |
Get Column
This function returns a column vector corresponding to the chosen column.
Definition at line 1126 of file multidim_array.h.
|
inline |
Definition at line 1221 of file multidim_array.h.
|
inline |
Copy an image from a stack to another
Copy image image n from this MDA to image n2 in MDA M.
Definition at line 877 of file multidim_array.h.
|
inline |
Definition at line 1216 of file multidim_array.h.
|
inline |
Get row
This function returns a row vector corresponding to the chosen row inside the nth 2D matrix, the numbering of the rows is also logical not physical.
Definition at line 1178 of file multidim_array.h.
|
inline |
2D Slice access for reading.
This function returns a slice (a 2D matrix) corresponding to the chosen slice inside the nth 3D matrix, the numbering of the slices is also logical not physical. This function differs from the previous one in that this one cuts and assign in a single step instead of in two steps, as in the previous example.
Definition at line 921 of file multidim_array.h.
void MultidimArray< T >::getSliceAsMatrix | ( | size_t | k, |
Matrix2D< T > & | m | ||
) | const |
void MultidimArray< T >::indexSort | ( | MultidimArray< int > & | indx | ) | const |
Gives a vector with the indexes for a sorted vector
This function returns the indexes of a sorted vector. The input vector is not modified at all. For instance, if the input vector is [3 2 -1 0] the result of this function would be [3 4 2 1] meaning that the lowest value is at index 3, then comes the element at index 4, ... Note that indexes start at 1.
Definition at line 882 of file multidim_array.cpp.
|
inline |
Same value in all components.
The constant must be of a type compatible with the array type, ie, you cannot assign a double to an integer array without a casting. It is not an error if the array is empty, then nothing is done.
Definition at line 2705 of file multidim_array.h.
|
inline |
Linear initialization (only for 1D)
The 1D vector is filled with values increasing/decreasing linearly within a range or at given steps.
Increment functionality: The default increment is 1, the initial point is incremented by this value until the upper limit is reached. This is the default working mode for the function.
Step functionality: The given range is divided in as many points as indicated (in the example 6 points).
Definition at line 2797 of file multidim_array.h.
template void MultidimArray< T >::initRandom | ( | double | op1, |
double | op2, | ||
RandomMode | mode = RND_UNIFORM |
||
) |
Initialize with random values.
This function allows you to initialize the array with a set of random values picked from a uniform random distribution or a gaussian one. You must choose two parameters for each, for the uniform distribution they mean the range where to generate the random numbers, while in the gaussian case they are the mean and the standard deviation. By default the uniform distribution is selected. The size and origin of the array are not modified.
Definition at line 821 of file multidim_array.cpp.
|
inline |
Initialize to zeros following a pattern.
All values are set to 0, and the origin and size of the pattern are adopted.
Definition at line 2723 of file multidim_array.h.
|
inline |
Initialize to zeros with current size.
All values are set to 0. The current size and origin are kept. It is not an error if the array is empty, then nothing is done.
Definition at line 2739 of file multidim_array.h.
|
inline |
Initialize to zeros with a given size.
Definition at line 2746 of file multidim_array.h.
|
inline |
|
inline |
|
inline |
|
inline |
Interpolates the value of the nth 1D matrix M at the point (x)
Bilinear interpolation. (x) is in logical coordinates.
Definition at line 1425 of file multidim_array.h.
|
inline |
Interpolates the value of the nth 2D matrix M at the point (x,y)
Bilinear interpolation. (x,y) are in logical coordinates.
Definition at line 1355 of file multidim_array.h.
|
inline |
Non-divergent version of interpolatedElement2D
works only for outside_value = 0 does not break vectorization
Definition at line 1391 of file multidim_array.h.
|
inline |
Interpolates the value of the nth 3D matrix M at the point (x,y,z).
(x,y,z) are in logical coordinates.
Definition at line 1317 of file multidim_array.h.
T MultidimArray< T >::interpolatedElementBSpline1D | ( | double | x, |
int | SplineDegree = 3 |
||
) | const |
Interpolates the value of the nth 1D vector M at the point (x) knowing that this vector is a set of B-spline coefficients
(x) is in logical coordinates
To interpolate using splines you must first produce the Bspline coefficients. An example to interpolate a vector at (0.5) using splines would be:
Definition at line 760 of file multidim_array.cpp.
T MultidimArray< T >::interpolatedElementBSpline2D | ( | double | x, |
double | y, | ||
int | SplineDegree = 3 |
||
) | const |
Interpolates the value of the nth 2D matrix M at the point (x,y) knowing that this image is a set of B-spline coefficients
(x,y) are in logical coordinates
To interpolate using splines you must first produce the Bspline coefficients. An example to interpolate an image at (0.5,0.5) using splines would be:
Definition at line 570 of file multidim_array.cpp.
T MultidimArray< T >::interpolatedElementBSpline2D_Degree3 | ( | double | x, |
double | y | ||
) | const |
Definition at line 682 of file multidim_array.cpp.
T MultidimArray< T >::interpolatedElementBSpline3D | ( | double | x, |
double | y, | ||
double | z, | ||
int | SplineDegree = 3 |
||
) | const |
Interpolates the value of the nth 3D matrix M at the point (x,y,z) knowing that this image is a set of B-spline coefficients.
(x,y,z) are in logical coordinates.
Definition at line 424 of file multidim_array.cpp.
|
inline |
Kill a 1D array produced for Numerical Recipes.
Nothing needs to be done in fact.
This function is not ported to Python.
Definition at line 2987 of file multidim_array.h.
|
inline |
Kill a 2D array produced for numerical recipes, 2.
Nothing needs to be done.
Definition at line 2964 of file multidim_array.h.
|
inline |
Kill a 2D array produced for numerical recipes
The allocated memory is freed.
Definition at line 2955 of file multidim_array.h.
|
inline |
Kill a 3D array produced for numerical recipes.
Definition at line 2907 of file multidim_array.h.
|
inline |
Load 2D array from numerical recipes result.
Definition at line 2942 of file multidim_array.h.
|
inline |
1D Indices for the maximum element.
This function just calls to the 4D function
Definition at line 1557 of file multidim_array.h.
|
inlinevirtual |
4D Indices for the maximum element.
This function returns the index of the maximum element of an array. array(l,k,i,j). Returns -1 if the array is empty
Implements MultidimArrayBase.
Definition at line 1654 of file multidim_array.h.
|
inline |
4D Indices for the minimum element.
This function returns the index of the minimum element of an array. array(l,k,i,j). Returns -1 if the array is empty
Definition at line 1589 of file multidim_array.h.
|
inline |
3D Indices for the minimum element.
This function just calls to the 4D function
Definition at line 1623 of file multidim_array.h.
|
inline |
2D Indices for the minimum element.
This function just calls to the 4D function
Definition at line 1633 of file multidim_array.h.
|
inline |
1D Indices for the minimum element.
This function just calls to the 4D function
Definition at line 1643 of file multidim_array.h.
template FILE * MultidimArray< T >::mmapFile | ( | T *& | _data, |
size_t | nzyxDim | ||
) | const |
Definition at line 859 of file multidim_array.cpp.
|
inline |
Volume element access via double vector.
Returns the value of a matrix logical position, but this time the element position is determined by a R3 vector. The elements can be used either by value or by reference. An exception is thrown if the index is outside the logical range. Pay attention in the following example that we are accessing the same element as in the previous function but, now we have to give first the X position because we are building first a vector of the form (x,y,z).
Definition at line 755 of file multidim_array.h.
|
inline |
|
inline |
4D element access via index.
Returns the value of a matrix logical position. In our example we could access from v(0, 0,-2,-1) to v(0, 1,2,1). The elements can be used either by value or by reference. An exception is thrown if the index is outside the logical range. Be careful that the argument order is (Z,Y,X).
Definition at line 799 of file multidim_array.h.
|
inline |
3D element access via index.
Returns the value of a matrix logical position. In our example we could access from v(0,-2,-1) to v(1,2,1). The elements can be used either by value or by reference. An exception is thrown if the index is outside the logical range. Be careful that the argument order is (Z,Y,X).
Definition at line 816 of file multidim_array.h.
|
inline |
Matrix element access via index
Returns the value of a matrix logical position. In our example we could access from v(-2,-1) to v(2,1). The elements can be used either by value or by reference. An exception is thrown if the index is outside the logical range. The first argument is the Y position and the second the X position.
Definition at line 834 of file multidim_array.h.
|
inline |
Vector element access
Returns the value of a vector logical position. In our example we could access from v(-2) to v(2). The elements can be used either by value or by reference. An exception is thrown if the index is outside the logical range.
Definition at line 851 of file multidim_array.h.
|
inline |
v3 = v1 * v2.
Definition at line 2360 of file multidim_array.h.
|
inline |
v3 = v1 * k.
Definition at line 2526 of file multidim_array.h.
|
inline |
v3 *= v2.
Definition at line 2392 of file multidim_array.h.
|
inline |
v3 *= k.
This function is not ported to Python.
Definition at line 2574 of file multidim_array.h.
|
inline |
v3 = v1 + v2.
Definition at line 2342 of file multidim_array.h.
|
inline |
v3 = v1 + k.
Definition at line 2508 of file multidim_array.h.
|
inline |
v3 += v2.
Definition at line 2378 of file multidim_array.h.
|
inline |
v3 += k.
This function is not ported to Python.
Definition at line 2556 of file multidim_array.h.
|
inline |
v3 = v1 - v2.
Definition at line 2351 of file multidim_array.h.
|
inline |
v3 = v1 - k.
Definition at line 2517 of file multidim_array.h.
|
inline |
Unary minus.
It is used to build arithmetic expressions. You can make a minus of anything as long as it is correct semantically.
Definition at line 3684 of file multidim_array.h.
|
inline |
v3 -= v2.
Definition at line 2385 of file multidim_array.h.
|
inline |
v3 -= k.
This function is not ported to Python.
Definition at line 2565 of file multidim_array.h.
|
inline |
v3 = v1 / v2.
Definition at line 2369 of file multidim_array.h.
|
inline |
v3 = v1 / k.
Definition at line 2535 of file multidim_array.h.
|
inline |
v3 /= v2.
Definition at line 2399 of file multidim_array.h.
|
inline |
v3 /= k.
This function is not ported to Python.
Definition at line 2583 of file multidim_array.h.
|
inline |
Assignment.
You can build as complex assignment expressions as you like. Multiple assignment is allowed.
This function is ported to Python as assign.
Definition at line 3628 of file multidim_array.h.
|
inlinenoexcept |
Move assignment.
You can build as complex assignment expressions as you like. Multiple assignment is allowed.
Definition at line 3649 of file multidim_array.h.
MultidimArray< T > & MultidimArray< T >::operator= | ( | const Matrix2D< T > & | op1 | ) |
Assignment.
You can build as complex assignment expressions as you like. Multiple assignment is allowed.
This function is ported to Python as assign.
Definition at line 47 of file multidim_array.cpp.
|
inline |
Definition at line 856 of file multidim_array.h.
|
inline |
Make a patch with the input array in the given positions
Definition at line 727 of file multidim_array.h.
|
inline |
Print statistics in current line.
No end of line character is written after this print out.
Definition at line 1507 of file multidim_array.h.
|
inline |
Extracts the 1D profile between two points in a 2D array
Given two logical indexes, this function returns samples of the line that joins them. This is done by bilinear interpolation. The number of samples in the line is N.
Definition at line 3576 of file multidim_array.h.
void MultidimArray< T >::randomSubstitute | ( | T | oldv, |
T | avgv, | ||
T | sigv, | ||
double | accuracy = XMIPP_EQUAL_ACCURACY , |
||
MultidimArray< int > * | mask = NULL |
||
) |
Substitute a given value by a sample from a Gaussian distribution.
Substitute a given value by a sample from a Gaussian distribution. The accuracy is used to say if the value in the array is equal to the old value. Set it to 0 for perfect accuracy.
Definition at line 1120 of file multidim_array.cpp.
|
inline |
Adjust the range of the array to a given one.
A linear operation is performed on the values of the array such that after it, the values of the array are comprissed between the two values set. The actual array is modified itself
Definition at line 1982 of file multidim_array.h.
|
inline |
Adjust the range of the array to a given one within a mask.
A linear operation is performed on the values of the array such that after it, the values of the array are comprissed between the two values set. The actual array is modified itself. The linear transformation is computed within the mask, but it is applied everywhere.
Definition at line 2019 of file multidim_array.h.
|
inline |
Adjust the range of the array to the range of another array in a least squares sense.
A linear operation is performed on the values of the array such that after it, the values of the self array are as similar as possible (L2 sense) to the values of the array shown as sample
Definition at line 2073 of file multidim_array.h.
|
virtual |
Resize to a given size
This function resize the actual array to the given size. The origin is not modified. If the actual array is larger than the pattern then the values outside the new size are lost, if it is smaller then 0's are added. An exception is thrown if there is no memory.
Implements MultidimArrayBase.
Definition at line 983 of file multidim_array.cpp.
|
inline |
Resize according to a pattern.
This function resize the actual array to the same size and origin as the input pattern. If the actual array is larger than the pattern then the trailing values are lost, if it is smaller then 0's are added at the end
Definition at line 490 of file multidim_array.h.
|
inline |
Resize according to a pattern with no copy.
Definition at line 504 of file multidim_array.h.
|
inline |
Reslice the volume aliging any X or Y direction with Z axis
face | Select the face to become the new Z direction |
out | The resliced volume is returned |
flip | Invert the positions of Z planes, keeping the X-Y orientation |
n | Select the number of image in case of stacks |
Definition at line 1062 of file multidim_array.h.
|
inline |
Reslice the current volume
face | Select the face to become the new Z direction |
flip | Invert the positions of Z planes, keeping the X-Y orientation |
n | Select the number of image in case of stacks |
Definition at line 1109 of file multidim_array.h.
|
inline |
ABS
Applies an ABS (absolute value) to each array element.
Definition at line 3330 of file multidim_array.h.
|
inline |
CEILING
Applies a CEILING (look for the nearest larger integer) to each array element.
Definition at line 3305 of file multidim_array.h.
|
inline |
FLOOR
Applies a FLOOR (look for the nearest larger integer) to each array element.
Definition at line 3318 of file multidim_array.h.
|
inline |
Log.
Each component of the result is the log of the original components.
Definition at line 3464 of file multidim_array.h.
|
inline |
Log10.
Each component of the result is the log10 of the original components.
Definition at line 3452 of file multidim_array.h.
void MultidimArray< T >::selfNormalizeInterval | ( | double | minPerc = 0.25 , |
double | maxPerc = 0.75 , |
||
int | Npix = 1000 |
||
) |
Normalize the percentil interval values between -1 to 1 the normalization is done over a Npix number of pixels chosen at random
v_sorted(minPerc) = -1 v_sorted(maxPerc) = 1
Definition at line 910 of file multidim_array.cpp.
|
inlinevirtual |
Reverse matrix values over X axis, keep in this object.
Maybe better with an example:
Odd case
Even case
Implements MultidimArrayBase.
Definition at line 3501 of file multidim_array.h.
|
inlinevirtual |
Reverse matrix values over Y axis, keep in this object.
Maybe better with an example:
Implements MultidimArrayBase.
Definition at line 3531 of file multidim_array.h.
|
inlinevirtual |
Reverse matrix values over Z axis, keep result in this object.
Implements MultidimArrayBase.
Definition at line 3553 of file multidim_array.h.
|
inline |
ROUND
Applies a ROUND (look for the nearest integer) to each array element.
Definition at line 3292 of file multidim_array.h.
|
inline |
Sqrt.
Each component of the result is the square root of the original component.
Definition at line 3389 of file multidim_array.h.
|
inline |
Generic selfWindow routine (dim independent)
This function will call to 3D,2D or 1D specific selfWindow routines
Definition at line 538 of file multidim_array.h.
|
inline |
3D Self window
Definition at line 633 of file multidim_array.h.
|
inline |
2D Self window
Definition at line 682 of file multidim_array.h.
|
inline |
1D Self window
Definition at line 718 of file multidim_array.h.
|
inline |
Set Column
This function sets a column vector corresponding to the chosen column inside matrix.
Definition at line 1151 of file multidim_array.h.
|
inline |
Set Row
This function sets a row vector corresponding to the chosen row in the 2D Matrix
Definition at line 1201 of file multidim_array.h.
|
inline |
Slice access for writing.
This function sets a 2D matrix corresponding to the chosen slice inside the nth volume, the numbering of the slices is also logical not physical.
Definition at line 1033 of file multidim_array.h.
void MultidimArray< T >::showWithGnuPlot | ( | const String & | xlabel, |
const String & | title | ||
) |
Show using gnuplot
This function uses gnuplot to plot this vector. You must supply the xlabel, ylabel, and title.
Definition at line 931 of file multidim_array.cpp.
void MultidimArray< T >::sort | ( | MultidimArray< T > & | result | ) | const |
Sort vector elements
Sort in ascending order the vector elements. You can use the "reverse" function to sort in descending order.
Definition at line 1092 of file multidim_array.cpp.
|
inline |
Adjust the average and stddev of the array to given values.
A linear operation is performed on the values of the array such that after it, the average and standard deviation of the array are the two values set. The actual array is modified itself
Definition at line 2114 of file multidim_array.h.
|
inline |
Substitute a value by another.
Substitute an old value by a new one. The accuracy is used to say if the value in the array is equal to the old value. Set it to 0 for perfect accuracy.
Definition at line 3221 of file multidim_array.h.
|
inline |
Sum of matrix values.
This function returns the sum of all internal values.
Definition at line 3405 of file multidim_array.h.
|
inline |
Sum of squared vector values.
This function returns the sum of all internal values to the second power.
Definition at line 3424 of file multidim_array.h.
|
inlinenoexcept |
Definition at line 241 of file multidim_array.h.
|
inline |
Several thresholding.
Apply a threshold to the array, the object is modified itself. There are several kinds of thresholding and you must specify it, the values given in the fuction have different meanings according to the threshold applied.
abs_above: if |x|>a => x=b abs_below: if |x|<a => x=b above: if x >a => x=b below: if x <a => x=b range: if x <a => x=a and if x>b => x=b soft: if abs(x)<a => x=0 else x=sgn(x)*(abs(x)-a)
Definition at line 3089 of file multidim_array.h.
|
inline |
3D Physical to logical index translation.
This function returns the logical position of a physical one.
Definition at line 1251 of file multidim_array.h.
|
inline |
2D Physical to logical index translation
This function returns the logical position of a physical one.
Definition at line 1281 of file multidim_array.h.
|
inline |
1D Physical to logical index translation.
This function returns the logical position of a physical one.
Definition at line 1308 of file multidim_array.h.
|
inline |
3D Logical to physical index translation.
This function returns the physical position of a logical one.
Definition at line 1235 of file multidim_array.h.
|
inline |
2D Logical to physical index translation
This function returns the physical position of a logical one.
Definition at line 1267 of file multidim_array.h.
|
inline |
1D Logical to physical index translation
This function returns the physical position of a logical one.
Definition at line 1295 of file multidim_array.h.
|
inline |
Definition at line 564 of file multidim_array.h.
|
inline |
Put a 3D selfWindow to the nth volume
The volume is windowed within the two positions given to this function. Indexes always refer to logical indexes. If a position is outside the actual matrix range then the matrix is padded init_value until the new position is reached. In the following example suppose that m1 is the following and that the origin is (-1,-1,-1).
Definition at line 615 of file multidim_array.h.
|
inline |
Put a 2D selfWindow to the nth matrix
The matrix is windowed within the two positions given to this function. Indexes always refer to logical indexes. If a position is outside the actual matrix range then the matrix is padded with init_value until the new position is reached. In the following examples suppose that m1 is the following and that the origin is (-1,-1).
Definition at line 666 of file multidim_array.h.
|
inline |
Put a 1D selfWindow to the nth vector
The vector is windowed within the two indexes given to this function. Indexes always refer to logical indexes. If an index is outside the actual vector range then the vector is padded winit_value. In the following examples suppose that v1=[-2 -1 0 1 2] and that the origin is -2.
Definition at line 705 of file multidim_array.h.
void MultidimArray< T >::write | ( | const FileName & | fn | ) | const |
|
friend |
Array by array
This function must take two vectors of the same size, and operate element by element according to the operation required. This is the function which really implements the operations. Simple calls to it perform much faster than calls to the corresponding operators. Although it is supposed to be a hidden function not useable by normal programmers.
Definition at line 2310 of file multidim_array.h.
|
friend |
Array by scalar.
This function must take one vector and a constant, and operate element by element according to the operation required. This is the function which really implements the operations. Simple calls to it perform much faster than calls to the corresponding operators. Although it is supposed to be a hidden function not useable by normal programmers.
This function is not ported to Python.
Definition at line 2496 of file multidim_array.h.
|
friend |
Core array by array operation.
It assumes that the result is already resized.
Definition at line 2163 of file multidim_array.h.
|
friend |
Core array by scalar operation.
It assumes that the result is already resized.
This function is not ported to Python.
Definition at line 2448 of file multidim_array.h.
|
friend |
Core array by scalar operation.
It assumes that the result is already resized.
This function is not ported to Python.
Definition at line 2608 of file multidim_array.h.
|
friend |
MAX
Each component of the result is the maximum of the correspoing components of the two input arrays. They must have the same shape, if not an exception is thrown
Definition at line 3352 of file multidim_array.h.
|
friend |
MIN
Each component of the result is the minimum of the correspoing components of the two input arrays. They must have the same shape, if not an exception is thrown
Definition at line 3371 of file multidim_array.h.
|
friend |
v3 = k * v2.
Definition at line 2675 of file multidim_array.h.
|
friend |
v3 = k + v2.
Definition at line 2657 of file multidim_array.h.
|
friend |
v3 = k - v2.
Definition at line 2666 of file multidim_array.h.
|
friend |
v3 = k / v2
Definition at line 2684 of file multidim_array.h.
|
friend |
Input from input stream.
Actual size of the array is used to know how many values must be read.
This function is not ported to Python.
Definition at line 3705 of file multidim_array.h.
|
friend |
Scalar by array.
This function must take one scalar and a vector, and operate element by element according to the operation required. This is the function which really implements the operations. Simple calls to it perform much faster than calls to the corresponding operators. Although it is supposed to be a hidden function not useable by normal programmers.
This function is not ported to Python.
Definition at line 2645 of file multidim_array.h.
|
friend |
Self Array by array
Similar to array by array. requires 4 vectors the pixel result(i) is calculated as result(i) += op1(i), if the mask is different from zero result(i) += op2(i) * mask(i)
Definition at line 2329 of file multidim_array.h.
|
friend |
Core array by array operation.
It assumes that the result is already resized.
Definition at line 2235 of file multidim_array.h.
T* MultidimArray< T >::data |
Definition at line 84 of file multidim_array.h.