Xmipp  v3.23.11-Nereus
Classes | Macros | Typedefs | Functions
grids.h File Reference
#include <vector>
#include <core/xmipp_image.h>
#include <core/geometry.h>
#include <core/args.h>
#include "core/matrix2d.h"
Include dependency graph for grids.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  GridVolumeT< T >
 
class  SimpleGrid
 
class  Grid
 
class  GridVolumeT< T >
 

Macros

#define GRIDVOLUME_BY_SCALAR(op)
 
#define GRIDVOL_BY_GRIDVOL(op)
 
#define GRIDVOL_BY_GRIDVOLASSIG(op)
 
#define PACK_DOUBLE(v)   {jj=pos%Xdim; ii=pos/Xdim; pos++; VOLVOXEL(V,sli,ii,jj)=(T)(v);}
 
#define PACK_INT(v)
 
#define UNPACK_DOUBLE(v, cast)
 
#define UNPACK_INT(v, cast)
 

Typedefs

typedef GridVolumeT< double > GridVolume
 

Functions

template<class T >
GridVolumeT< T > operator- (T f, const GridVolumeT< T > &GV)
 
template<class T >
GridVolumeT< T > operator/ (T f, const GridVolumeT< T > &GV)
 
template<class T >
std::ostream & operator<< (std::ostream &o, const GridVolumeT< T > &GV)
 

UsefulGrids Some useful grids

These are already-built grids to make your task easier. You can find here Simple Cubic (CC), Face-Centered (FCC) and Body-Centered Cubic (BCC) grids. Most of them are supposed to have its origin in the middle of the two defining corners. The defining corners (corner1 and corner2) are directly related with lowest and highest indexes inside the grid respectively. The difference is that the corners are given ALWAYS in the universal coordinate system while the lowest and highest are vectors in the grid coordinate system

#define CC   0
 CC identifier. More...
 
#define FCC   1
 FCC identifier. More...
 
#define BCC   2
 BCC identifier. More...
 
SimpleGrid Create_CC_grid (double relative_size, const Matrix1D< double > &corner1, const Matrix1D< double > &corner2, const Matrix1D< double > &origin)
 
Grid Create_CC_grid (double relative_size, const Matrix1D< double > &corner1, const Matrix1D< double > &corner2)
 
Grid Create_CC_grid (double relative_size, int Zdim, int Ydim, int Xdim)
 
Grid Create_BCC_grid (double relative_size, const Matrix1D< double > &corner1, const Matrix1D< double > &corner2)
 
Grid Create_FCC_grid (double relative_size, const Matrix1D< double > &corner1, const Matrix1D< double > &corner2)
 
SimpleGrid Create_grid_within_sphere (double relative_size, const Matrix1D< double > &origin, const Matrix1D< double > &X, const Matrix1D< double > &Y, const Matrix1D< double > &Z, double R2)
 
Grid Create_CC_grid (double relative_size, double R)
 
Grid Create_BCC_grid (double relative_size, double R)
 
Grid Create_FCC_grid (double relative_size, double R)
 

Macro Definition Documentation

◆ GRIDVOL_BY_GRIDVOL

#define GRIDVOL_BY_GRIDVOL (   op)
Value:
GridVolumeT<T> result; \
Image<T> * Vol_aux; \
if (VolumesNo()!=GV.VolumesNo()) \
REPORT_ERROR(ERR_GRID_SIZE,(std::string)"GridVolume::"+op+": Different number of subvolumes");\
\
result.G = G;\
result.LV.reserve(VolumesNo());\
for (size_t i=0; i<VolumesNo(); i++) { \
try { \
Vol_aux = new Image<T>; \
arrayByArray((*this)(i)(),GV(i)(),(*Vol_aux)(),op); \
result.LV.push_back(Vol_aux); \
} catch (XmippError XE) {\
std::cout << XE.what(); \
REPORT_ERROR(ERR_GRID_SIZE,(std::string)"GridVolume::"+op+": Different shape of volume " +\
} \
} \
\
return result;
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
String integerToString(int I, int _width, char fill_with)
#define i
if(fabs(c[*nmax+ *nmax *c_dim1])==0.e0)
for(j=1;j<=i__1;++j)
Incorrect number of GRID volumes or shapes.
Definition: xmipp_error.h:126

Definition at line 1064 of file grids.h.

◆ GRIDVOL_BY_GRIDVOLASSIG

#define GRIDVOL_BY_GRIDVOLASSIG (   op)
Value:
if (VolumesNo()!=GV.VolumesNo()) \
REPORT_ERROR(ERR_GRID_SIZE,(std::string)"GridVolume::"+op+"=: Different number of subvolumes");\
for (size_t i=0; i<VolumesNo(); i++) { \
try { \
arrayByArray((*this)(i)(),GV(i)(),(*this)(i)(),op); \
} catch (XmippError XE) {\
std::cout << XE.what(); \
REPORT_ERROR(ERR_GRID_SIZE,(std::string)"GridVolume::"+op+"=: Different shape of volume " +\
} \
}
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
String integerToString(int I, int _width, char fill_with)
#define i
for(j=1;j<=i__1;++j)
Incorrect number of GRID volumes or shapes.
Definition: xmipp_error.h:126

Definition at line 1128 of file grids.h.

◆ GRIDVOLUME_BY_SCALAR

#define GRIDVOLUME_BY_SCALAR (   op)
Value:
GridVolumeT<T> result; \
result.G = G; \
result.LV.reserve(VolumesNo()); \
for (size_t i=0; i<VolumesNo(); i++) \
array_by_scalar((*this)(i)(),f,result(i)(),op); \
return result;
#define i
double * f

Definition at line 1008 of file grids.h.

◆ PACK_DOUBLE

#define PACK_DOUBLE (   v)    {jj=pos%Xdim; ii=pos/Xdim; pos++; VOLVOXEL(V,sli,ii,jj)=(T)(v);}

◆ PACK_INT

#define PACK_INT (   v)
Value:
{jj=pos%Xdim; ii=pos/Xdim; pos++; \
temp_float = (float) (v); \
memcpy( &(VOLVOXEL(V,sli,ii,jj)) , &temp_float, floatsize); \
}
#define VOLVOXEL(V, k, i, j)

◆ UNPACK_DOUBLE

#define UNPACK_DOUBLE (   v,
  cast 
)
Value:
{jj=pos%VOLMATRIX(V).xdim; ii=pos/VOLMATRIX(V).xdim; pos++; \
(v)=(cast)VOLVOXEL(V,sli,ii,jj);}
#define VOLVOXEL(V, k, i, j)
#define VOLMATRIX(V)

◆ UNPACK_INT

#define UNPACK_INT (   v,
  cast 
)
Value:
{jj=pos%VOLMATRIX(V).xdim; ii=pos/VOLMATRIX(V).xdim; pos++; \
memcpy( &temp_float, &(VOLVOXEL(V,sli,ii,jj)),floatsize);\
(v)=(cast)temp_float;}
#define VOLVOXEL(V, k, i, j)
#define VOLMATRIX(V)

Function Documentation

◆ operator-()

template<class T >
GridVolumeT<T> operator- ( f,
const GridVolumeT< T > &  GV 
)

◆ operator/()

template<class T >
GridVolumeT<T> operator/ ( f,
const GridVolumeT< T > &  GV 
)