Xmipp  v3.23.11-Nereus
Public Member Functions | Public Attributes | List of all members
MultidimArrayBase Class Referenceabstract

#include <multidim_array_base.h>

Inheritance diagram for MultidimArrayBase:
Inheritance graph
[legend]

Public Member Functions

virtual ~MultidimArrayBase ()
 
virtual void clear ()=0
 
virtual void selfReverseX ()=0
 
virtual void selfReverseY ()=0
 
virtual void selfReverseZ ()=0
 
virtual double computeAvg () const =0
 
virtual void computeDoubleMinMaxRange (double &minval, double &maxval, size_t offset, size_t size) const =0
 
virtual void maxIndex (size_t &lmax, int &kmax, int &imax, int &jmax) const =0
 
virtual void coreAllocateReuse ()=0
 
virtual void coreDeallocate ()=0
 
virtual void * getArrayPointer () const =0
 
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
 
Size
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
 
virtual void resize (size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)=0
 
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

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
 

Detailed Description

Template class for Xmipp arrays. This class provides physical and logical access.

Definition at line 615 of file multidim_array_base.h.

Constructor & Destructor Documentation

◆ ~MultidimArrayBase()

virtual MultidimArrayBase::~MultidimArrayBase ( )
inlinevirtual

Definition at line 658 of file multidim_array_base.h.

659  {}

Member Function Documentation

◆ clear()

virtual void MultidimArrayBase::clear ( )
pure virtual

◆ colNumber()

size_t MultidimArrayBase::colNumber ( ) const
inline

Returns X dimension.

Definition at line 832 of file multidim_array_base.h.

833  {
834  return xdim;
835  }

◆ computeAvg()

virtual double MultidimArrayBase::computeAvg ( ) const
pure virtual

◆ computeDoubleMinMaxRange()

virtual void MultidimArrayBase::computeDoubleMinMaxRange ( double &  minval,
double &  maxval,
size_t  offset,
size_t  size 
) const
pure virtual

◆ copyShape()

void MultidimArrayBase::copyShape ( const MultidimArrayBase m)

Copy the shape parameters

Definition at line 186 of file multidim_array_base.cpp.

◆ coreAllocateReuse()

virtual void MultidimArrayBase::coreAllocateReuse ( )
pure virtual

◆ coreDeallocate()

virtual void MultidimArrayBase::coreDeallocate ( )
pure virtual

◆ finishingX()

int MultidimArrayBase::finishingX ( ) const
inline

Returns the last valid logical X index.

Definition at line 939 of file multidim_array_base.h.

940  {
941  return xinit + xdim - 1;
942  }

◆ finishingY()

int MultidimArrayBase::finishingY ( ) const
inline

Returns the last valid logical Y index.

Definition at line 925 of file multidim_array_base.h.

926  {
927  return yinit + ydim - 1;
928  }

◆ finishingZ()

int MultidimArrayBase::finishingZ ( ) const
inline

Returns the last valid logical Z index.

Definition at line 911 of file multidim_array_base.h.

912  {
913  return zinit + zdim - 1;
914  }

◆ getArrayPointer()

virtual void* MultidimArrayBase::getArrayPointer ( ) const
pure virtual

◆ getDim()

int MultidimArrayBase::getDim ( ) const
inline

Returns the multidimArray dimension.

int dim = V.getDim();

Definition at line 1000 of file multidim_array_base.h.

1001  {
1002  if (NZYXSIZE(*this) < 1)
1003  return 0;
1004  if (NSIZE(*this) > 1)
1005  return 4;
1006  if (ZSIZE(*this) > 1)
1007  return 3;
1008  if (YSIZE(*this) > 1)
1009  return 2;
1010  return 1;
1011  }
#define NSIZE(v)
#define YSIZE(v)
#define ZSIZE(v)
#define NZYXSIZE(v)

◆ getDimensions() [1/4]

void MultidimArrayBase::getDimensions ( size_t &  Xdim,
size_t &  Ydim,
size_t &  Zdim,
size_t &  Ndim 
) const

Get the array dimensions.

Returns the multidimArray N,Z, Y and X dimensions.

V.getDimensions(Xdim, Ydim, Zdim, Ndim);

Definition at line 114 of file multidim_array_base.cpp.

115 {
116  Xdim = xdim;
117  Ydim = ydim;
118  Zdim = zdim;
119  Ndim = ndim;
120 }

◆ getDimensions() [2/4]

void MultidimArrayBase::getDimensions ( ArrayDim idim) const

Definition at line 122 of file multidim_array_base.cpp.

123 {
124  adim.xdim = xdim;
125  adim.ydim = ydim;
126  adim.zdim = zdim;
127  adim.ndim = ndim;
128  adim.yxdim = yxdim;
129  adim.zyxdim = zyxdim;
130  adim.nzyxdim = nzyxdim;
131 }

◆ getDimensions() [3/4]

ArrayDim MultidimArrayBase::getDimensions ( ) const

Definition at line 133 of file multidim_array_base.cpp.

134 {
135  ArrayDim adim;
136  adim.xdim = xdim;
137  adim.ydim = ydim;
138  adim.zdim = zdim;
139  adim.ndim = ndim;
140  adim.yxdim = yxdim;
141  adim.zyxdim = zyxdim;
142  adim.nzyxdim = nzyxdim;
143 
144  return adim;
145 }
size_t xdim
size_t nzyxdim
size_t zdim
size_t zyxdim
size_t yxdim
size_t ndim
size_t ydim

◆ getDimensions() [4/4]

void MultidimArrayBase::getDimensions ( int *  size) const

Get dimensions.

Returns the size of the object in a 4D vector. If the object is a matrix or a vector, then the higher order dimensions will be set to 1, ie, (Xdim, 1, 1) or (Xdim, Ydim, 1).

This function is not ported to Python.

Definition at line 155 of file multidim_array_base.cpp.

156 {
157  size[0] = xdim;
158  size[1] = ydim;
159  size[2] = zdim;
160  size[3] = ndim;
161 }

◆ getSize()

size_t MultidimArrayBase::getSize ( ) const

Returns the total size of the multidimArray

if (V.getSize() > 1) ...

Definition at line 169 of file multidim_array_base.cpp.

170 {
171  return nzyxdim;
172 }

◆ isCorner()

bool MultidimArrayBase::isCorner ( const Matrix1D< double > &  v) const

IsCorner (in 2D or 3D matrix)

TRUE if the logical index given is a corner of the definition region of this array.

IsCorner (in 2D or 3D matrix)

   TRUE if the logical index given is a corner of the definition region of this
   array.

Definition at line 230 of file multidim_array_base.cpp.

231 {
232 
233  if (v.size() < 2)
234  REPORT_ERROR(ERR_MATRIX_SIZE, "isCorner: index vector has got not enough components");
235 
236  else if (ZSIZE(*this)==1)
237  return ((XX(v) == STARTINGX(*this) && YY(v) == STARTINGY(*this)) ||
238  (XX(v) == STARTINGX(*this) && YY(v) == FINISHINGY(*this)) ||
239  (XX(v) == FINISHINGX(*this) && YY(v) == STARTINGY(*this)) ||
240  (XX(v) == FINISHINGX(*this) && YY(v) == FINISHINGY(*this)));
241  else if (ZSIZE(*this)>1)
242  return ((XX(v) == STARTINGX(*this) && YY(v) == STARTINGY(*this) && ZZ(v) == STARTINGZ(*this)) ||
243  (XX(v) == STARTINGX(*this) && YY(v) == FINISHINGY(*this) && ZZ(v) == STARTINGZ(*this)) ||
244  (XX(v) == FINISHINGX(*this) && YY(v) == STARTINGY(*this) && ZZ(v) == STARTINGZ(*this)) ||
245  (XX(v) == FINISHINGX(*this) && YY(v) == FINISHINGY(*this) && ZZ(v) == STARTINGZ(*this)) ||
246  (XX(v) == STARTINGX(*this) && YY(v) == STARTINGY(*this) && ZZ(v) == FINISHINGZ(*this)) ||
247  (XX(v) == STARTINGX(*this) && YY(v) == FINISHINGY(*this) && ZZ(v) == FINISHINGZ(*this)) ||
248  (XX(v) == FINISHINGX(*this) && YY(v) == STARTINGY(*this) && ZZ(v) == FINISHINGZ(*this)) ||
249  (XX(v) == FINISHINGX(*this) && YY(v) == FINISHINGY(*this) && ZZ(v) == FINISHINGZ(*this)));
250  else
251  REPORT_ERROR(ERR_MATRIX_SIZE, formatString("isCorner: index vector has too many components. dimV= %lu matrix dim = %i", v.size(), XSIZE(*this)));
252 }
#define FINISHINGX(v)
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
size_t size() const
Definition: matrix1d.h:508
Problem with matrix size.
Definition: xmipp_error.h:152
#define FINISHINGZ(v)
#define STARTINGX(v)
#define STARTINGY(v)
#define XX(v)
Definition: matrix1d.h:85
#define XSIZE(v)
#define ZSIZE(v)
#define YY(v)
Definition: matrix1d.h:93
#define FINISHINGY(v)
String formatString(const char *format,...)
#define STARTINGZ(v)
#define ZZ(v)
Definition: matrix1d.h:101

◆ maxIndex() [1/5]

virtual void MultidimArrayBase::maxIndex ( size_t &  lmax,
int &  kmax,
int &  imax,
int &  jmax 
) const
pure virtual

◆ maxIndex() [2/5]

void MultidimArrayBase::maxIndex ( ArrayCoord pos) const
inline

Definition at line 1024 of file multidim_array_base.h.

1025  {
1026  maxIndex(pos.n, pos.z, pos.y, pos.x);
1027  }
virtual void maxIndex(size_t &lmax, int &kmax, int &imax, int &jmax) const =0

◆ maxIndex() [3/5]

void MultidimArrayBase::maxIndex ( int &  kmax,
int &  imax,
int &  jmax 
) const
inline

3D Indices for the maximum element.

This function just calls to the 4D function

Definition at line 1033 of file multidim_array_base.h.

1034  {
1035  size_t dum;
1036  maxIndex(dum, kmax, imax, jmax);
1037  }
virtual void maxIndex(size_t &lmax, int &kmax, int &imax, int &jmax) const =0

◆ maxIndex() [4/5]

void MultidimArrayBase::maxIndex ( int &  imax,
int &  jmax 
) const
inline

2D Indices for the maximum element.

This function just calls to the 4D function

Definition at line 1043 of file multidim_array_base.h.

1044  {
1045  size_t dum;
1046  int idum;
1047  maxIndex(dum, idum, imax, jmax);
1048  }
int idum
virtual void maxIndex(size_t &lmax, int &kmax, int &imax, int &jmax) const =0

◆ maxIndex() [5/5]

void MultidimArrayBase::maxIndex ( int &  jmax) const
inline

1D Indices for the maximum element.

This function just calls to the 4D function

Definition at line 1054 of file multidim_array_base.h.

1055  {
1056  size_t dum;
1057  int idum;
1058  maxIndex(dum, idum, idum, jmax);
1059  }
int idum
virtual void maxIndex(size_t &lmax, int &kmax, int &imax, int &jmax) const =0

◆ moveOriginTo() [1/2]

void MultidimArrayBase::moveOriginTo ( int  k,
int  i,
int  j 
)

Move origin to.

This function adjust logical indexes such that the Xmipp origin of the array moves to the specified position. For instance, an array whose x indexes go from -1 to 1, if we move the origin to 4, then the x indexes go from 3 to 5. This is very useful for convolution operations where you only need to move the logical starting of the array.

Definition at line 212 of file multidim_array_base.cpp.

213 {
217 }
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define j
#define FIRST_XMIPP_INDEX(size)
Definition: xmipp_macros.h:439

◆ moveOriginTo() [2/2]

void MultidimArrayBase::moveOriginTo ( int  i,
int  j 
)

Move origin to.

This function adjust logical indexes such that the Xmipp origin of the array moves to the specified position. For instance, an array whose x indexes go from -1 to 1, if we move the origin to 4, then the x indexes go from 3 to 5. This is very useful for convolution operations where you only need to move the logical starting of the array.

Definition at line 219 of file multidim_array_base.cpp.

220 {
223 }
#define i
#define j
#define FIRST_XMIPP_INDEX(size)
Definition: xmipp_macros.h:439

◆ outside() [1/4]

bool MultidimArrayBase::outside ( int  k,
int  i,
int  j 
) const
inline

Outside for 3D matrices

TRUE if the logical index given is outside the definition region of this array.

Definition at line 956 of file multidim_array_base.h.

957  {
958  return (j < STARTINGX(*this) || j > FINISHINGX(*this) ||
959  i < STARTINGY(*this) || i > FINISHINGY(*this) ||
960  k < STARTINGZ(*this) || k > FINISHINGZ(*this));
961  }
#define FINISHINGX(v)
#define FINISHINGZ(v)
#define STARTINGX(v)
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define STARTINGY(v)
#define j
#define FINISHINGY(v)
#define STARTINGZ(v)

◆ outside() [2/4]

bool MultidimArrayBase::outside ( int  i,
int  j 
) const
inline

Outside for 2D matrices

TRUE if the logical index given is outside the definition region of this array.

Definition at line 968 of file multidim_array_base.h.

969  {
970  return (j < STARTINGX(*this) || j > FINISHINGX(*this) ||
971  i < STARTINGY(*this) || i > FINISHINGY(*this));
972  }
#define FINISHINGX(v)
#define STARTINGX(v)
#define i
#define STARTINGY(v)
#define j
#define FINISHINGY(v)

◆ outside() [3/4]

bool MultidimArrayBase::outside ( int  i) const
inline

Outside for 1D matrices

TRUE if the logical index given is outside the definition region of this array.

Definition at line 979 of file multidim_array_base.h.

980  {
981  return (i < STARTINGX(*this) || i > FINISHINGX(*this));
982  }
#define FINISHINGX(v)
#define STARTINGX(v)
#define i

◆ outside() [4/4]

bool MultidimArrayBase::outside ( const Matrix1D< double > &  r) const

Outside

TRUE if the logical index given is outside the definition region of this array.

Definition at line 259 of file multidim_array_base.cpp.

260 {
261  if (r.size() < 1)
262  {
263  REPORT_ERROR(ERR_MATRIX_SIZE, "Outside: index vector has not got enough components");
264  }
265  else if (r.size()==1)
266  {
267  return (XX(r) < STARTINGX(*this) || XX(r) > FINISHINGX(*this));
268  }
269  else if (r.size()==2)
270  {
271  return (XX(r) < STARTINGX(*this) || XX(r) > FINISHINGX(*this) ||
272  YY(r) < STARTINGY(*this) || YY(r) > FINISHINGY(*this));
273  }
274  else if (r.size()==3)
275  {
276  return (XX(r) < STARTINGX(*this) || XX(r) > FINISHINGX(*this) ||
277  YY(r) < STARTINGY(*this) || YY(r) > FINISHINGY(*this) ||
278  ZZ(r) < STARTINGZ(*this) || ZZ(r) > FINISHINGZ(*this));
279  }
280  else
281  REPORT_ERROR(ERR_MATRIX_SIZE,"Outside: index vector has too many components");
282 }
#define FINISHINGX(v)
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
size_t size() const
Definition: matrix1d.h:508
Problem with matrix size.
Definition: xmipp_error.h:152
#define FINISHINGZ(v)
#define STARTINGX(v)
#define STARTINGY(v)
#define XX(v)
Definition: matrix1d.h:85
#define YY(v)
Definition: matrix1d.h:93
#define FINISHINGY(v)
#define STARTINGZ(v)
#define ZZ(v)
Definition: matrix1d.h:101

◆ printShape()

void MultidimArrayBase::printShape ( std::ostream &  out = std::cout) const

Print shape of multidimensional array.

This function shows the size, starting and finishing indexes of the given array. No end of line is printed neither at the beginning nor the end.

v.printShape();
std::ofstream fh;
...;
v.printShape(fh);

Definition at line 284 of file multidim_array_base.cpp.

285 {
286  if (NSIZE(*this) > 1)
287  out << " Number of images = "<<NSIZE(*this);
288 
289  if (ZSIZE(*this)>1)
290  out<< " Size(Z,Y,X): " << ZSIZE(*this) << "x" << YSIZE(*this) << "x" << XSIZE(*this)
291  << " k=[" << STARTINGZ(*this) << ".." << FINISHINGZ(*this) << "]"
292  << " i=[" << STARTINGY(*this) << ".." << FINISHINGY(*this) << "]"
293  << " j=[" << STARTINGX(*this) << ".." << FINISHINGX(*this) << "]";
294  else if (YSIZE(*this)>1)
295  out<< " Size(Y,X): " << YSIZE(*this) << "x" << XSIZE(*this)
296  << " i=[" << STARTINGY(*this) << ".." << FINISHINGY(*this) << "]"
297  << " j=[" << STARTINGX(*this) << ".." << FINISHINGX(*this) << "]";
298  else if (XSIZE(*this)>1)
299  out<< " Size(X): " << XSIZE(*this)
300  << " j=[" << STARTINGX(*this) << ".." << FINISHINGX(*this) << "]";
301  else
302  out << " Empty MultidimArray!";
303  out<<"\n";
304 }
#define NSIZE(v)
#define YSIZE(v)
#define FINISHINGX(v)
#define FINISHINGZ(v)
#define STARTINGX(v)
#define STARTINGY(v)
#define XSIZE(v)
#define ZSIZE(v)
#define FINISHINGY(v)
#define STARTINGZ(v)

◆ resetOrigin()

void MultidimArrayBase::resetOrigin ( )

Reset logical origin to zeros.

This function adjust the starting points in the array such that upper left corner begins in zero.

V.resetOrigin();

Definition at line 207 of file multidim_array_base.cpp.

◆ resize() [1/5]

virtual void MultidimArrayBase::resize ( size_t  Ndim,
size_t  Zdim,
size_t  Ydim,
size_t  Xdim,
bool  copy = true 
)
pure 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.

V1.resize(3, 3, 2);

Implemented in MultidimArray< T >, MultidimArray< long >, MultidimArray< double >, MultidimArray< float >, MultidimArray< int >, MultidimArray< unsigned int >, MultidimArray< short int >, MultidimArray< size_t >, MultidimArray< unsigned char >, MultidimArray< std::complex< double > >, MultidimArray< char >, MultidimArray< bool >, and MultidimArray< unsigned short int >.

◆ resize() [2/5]

void MultidimArrayBase::resize ( size_t  Zdim,
size_t  Ydim,
size_t  Xdim 
)
inline

Resize a single 3D image

This function assumes n is 1

V1.resize(3, 3, 2);

Definition at line 761 of file multidim_array_base.h.

762  {
763  resize(1, Zdim, Ydim, Xdim);
764  }
virtual void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)=0

◆ resize() [3/5]

void MultidimArrayBase::resize ( size_t  Ydim,
size_t  Xdim 
)
inline

Resize a single 2D image

This function assumes n and z are 1

V1.resize(3, 2);

Definition at line 773 of file multidim_array_base.h.

774  {
775  resize(1, 1, Ydim, Xdim);
776  }
virtual void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)=0

◆ resize() [4/5]

void MultidimArrayBase::resize ( size_t  Xdim)
inline

Resize a single 1D image

This function assumes n and z and y are 1

V1.resize(2);

Definition at line 785 of file multidim_array_base.h.

786  {
787  resize(1, 1, 1, Xdim);
788  }
virtual void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)=0

◆ resize() [5/5]

void MultidimArrayBase::resize ( ArrayDim adim,
bool  copy = true 
)

Resize an image using the dimensions from an ArrayDim structure.

Resize the multidimarray from an ArrayDim struct

Definition at line 177 of file multidim_array_base.cpp.

178 {
179  setDimensions(adim);
180  resize(adim.ndim, adim.zdim, adim.ydim, adim.xdim, copy);
181 }
size_t xdim
size_t zdim
void setDimensions(int Xdim, int Ydim, int Zdim, size_t Ndim)
virtual void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)=0
size_t ndim
size_t ydim

◆ resizeNoCopy() [1/4]

void MultidimArrayBase::resizeNoCopy ( size_t  Ndim,
size_t  Zdim,
size_t  Ydim,
size_t  Xdim 
)
inline

Resize with no copy a single 3D image

Definition at line 797 of file multidim_array_base.h.

798  {
799  resize(Ndim, Zdim, Ydim, Xdim, false);
800  }
virtual void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)=0

◆ resizeNoCopy() [2/4]

void MultidimArrayBase::resizeNoCopy ( size_t  Zdim,
size_t  Ydim,
size_t  Xdim 
)
inline

Resize with no copy a single 3D image

Definition at line 804 of file multidim_array_base.h.

805  {
806  resize(1, Zdim, Ydim, Xdim, false);
807  }
virtual void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)=0

◆ resizeNoCopy() [3/4]

void MultidimArrayBase::resizeNoCopy ( size_t  Ydim,
size_t  Xdim 
)
inline

Resize a single 2D image with no copy

Definition at line 811 of file multidim_array_base.h.

812  {
813  resize(1, 1, Ydim, Xdim, false);
814  }
virtual void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)=0

◆ resizeNoCopy() [4/4]

void MultidimArrayBase::resizeNoCopy ( size_t  Xdim)
inline

Resize a single 1D image with no copy

Definition at line 818 of file multidim_array_base.h.

819  {
820  resize(1, 1, 1, Xdim, false);
821  }
virtual void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)=0

◆ rowNumber()

size_t MultidimArrayBase::rowNumber ( ) const
inline

Returns Y dimension.

Definition at line 825 of file multidim_array_base.h.

826  {
827  return ydim;
828  }

◆ sameShape()

bool MultidimArrayBase::sameShape ( const MultidimArrayBase op) const
inline

Same shape.

Returns true if this object has got the same shape (origin and size) than the argument

Definition at line 847 of file multidim_array_base.h.

848  {
849  return (NSIZE(*this) == NSIZE(op) &&
850  XSIZE(*this) == XSIZE(op) &&
851  YSIZE(*this) == YSIZE(op) &&
852  ZSIZE(*this) == ZSIZE(op) &&
853  STARTINGX(*this) == STARTINGX(op) &&
854  STARTINGY(*this) == STARTINGY(op) &&
855  STARTINGZ(*this) == STARTINGZ(op));
856  }
#define NSIZE(v)
#define YSIZE(v)
#define STARTINGX(v)
#define STARTINGY(v)
#define XSIZE(v)
#define ZSIZE(v)
#define STARTINGZ(v)

◆ selfReverseX()

virtual void MultidimArrayBase::selfReverseX ( )
pure virtual

◆ selfReverseY()

virtual void MultidimArrayBase::selfReverseY ( )
pure virtual

◆ selfReverseZ()

virtual void MultidimArrayBase::selfReverseZ ( )
pure virtual

◆ setDimensions() [1/2]

void MultidimArrayBase::setDimensions ( int  Xdim,
int  Ydim,
int  Zdim,
size_t  Ndim 
)

Sets new 4D dimensions. Note that the dataArray is NOT resized. This should be done separately with coreAllocate()

Definition at line 78 of file multidim_array_base.cpp.

79 {
80  if (((size_t)Xdim)*Ydim*Zdim*Ndim < 1)
81  REPORT_ERROR(ERR_MULTIDIM_SIZE, "Dimensions' size cannot be zero nor negative.");
82  ndim=Ndim;
83  zdim=Zdim;
84  ydim=Ydim;
85  xdim=Xdim;
86  yxdim=ydim*xdim;
89 }
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
Incorrect MultidimArray size.
Definition: xmipp_error.h:174

◆ setDimensions() [2/2]

void MultidimArrayBase::setDimensions ( ArrayDim newDim)

Sets new 4D dimensions. Note that the dataArray is NOT resized. This should be done separately with coreAllocate()

Definition at line 94 of file multidim_array_base.cpp.

95 {
96  if (newDim.ndim*newDim.zdim*newDim.ydim*newDim.xdim < 1)
97  REPORT_ERROR(ERR_MULTIDIM_SIZE, "Dimensions' size cannot be zero nor negative.");
98  ndim = newDim.ndim;
99  zdim = newDim.zdim;
100  ydim = newDim.ydim;
101  xdim = newDim.xdim;
102 
103  newDim.yxdim = yxdim = ydim*xdim;
104  newDim.zyxdim = zyxdim = zdim*yxdim;
105  newDim.nzyxdim = nzyxdim = ndim*zyxdim;
106 }
size_t xdim
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
Incorrect MultidimArray size.
Definition: xmipp_error.h:174
size_t nzyxdim
size_t zdim
size_t zyxdim
size_t yxdim
size_t ndim
size_t ydim

◆ setMmap()

void MultidimArrayBase::setMmap ( bool  mmap)
inline

Sets mmap.

Sets on/off mmap flag to allocate memory in a file.

Definition at line 1018 of file multidim_array_base.h.

1019  {
1020  coreDeallocate();
1021  mmapOn = mmap;
1022  }
virtual void coreDeallocate()=0

◆ setNdim()

void MultidimArrayBase::setNdim ( int  Ndim)

Sets new N dimension.

Note that the dataArray is NOT resized. This should be done separately with coreAllocate()

Definition at line 31 of file multidim_array_base.cpp.

◆ setXdim()

void MultidimArrayBase::setXdim ( int  Xdim)

Sets new X dimension.

Note that the dataArray is NOT resized. This should be done separately with coreAllocate()

Definition at line 67 of file multidim_array_base.cpp.

◆ setXmippOrigin()

void MultidimArrayBase::setXmippOrigin ( )

Set logical origin in Xmipp fashion.

This function adjust the starting points in the array such that the center of the array is defined in the Xmipp fashion.

V.setXmippOrigin();

Definition at line 200 of file multidim_array_base.cpp.

◆ setYdim()

void MultidimArrayBase::setYdim ( int  Ydim)

Sets new Y dimension.

Note that the dataArray is NOT resized. This should be done separately with coreAllocate()

Definition at line 54 of file multidim_array_base.cpp.

◆ setZdim()

void MultidimArrayBase::setZdim ( int  Zdim)

Sets new Z dimension.

Note that the dataArray is NOT resized. This should be done separately with coreAllocate()

Definition at line 42 of file multidim_array_base.cpp.

◆ startingX()

int MultidimArrayBase::startingX ( ) const
inline

Returns the first valid logical X index.

Definition at line 932 of file multidim_array_base.h.

933  {
934  return xinit;
935  }

◆ startingY()

int MultidimArrayBase::startingY ( ) const
inline

Returns the first valid logical Y index.

Definition at line 918 of file multidim_array_base.h.

919  {
920  return yinit;
921  }

◆ startingZ()

int MultidimArrayBase::startingZ ( ) const
inline

Returns the first valid logical Z index.

Definition at line 904 of file multidim_array_base.h.

905  {
906  return zinit;
907  }

Member Data Documentation

◆ destroyData

bool MultidimArrayBase::destroyData

Definition at line 619 of file multidim_array_base.h.

◆ mFd

FILE* MultidimArrayBase::mFd

Definition at line 654 of file multidim_array_base.h.

◆ mmapOn

bool MultidimArrayBase::mmapOn

Definition at line 652 of file multidim_array_base.h.

◆ ndim

size_t MultidimArrayBase::ndim

Definition at line 622 of file multidim_array_base.h.

◆ nzyxdim

size_t MultidimArrayBase::nzyxdim

Definition at line 640 of file multidim_array_base.h.

◆ nzyxdimAlloc

size_t MultidimArrayBase::nzyxdimAlloc

Definition at line 656 of file multidim_array_base.h.

◆ xdim

size_t MultidimArrayBase::xdim

Definition at line 631 of file multidim_array_base.h.

◆ xinit

int MultidimArrayBase::xinit

Definition at line 649 of file multidim_array_base.h.

◆ ydim

size_t MultidimArrayBase::ydim

Definition at line 628 of file multidim_array_base.h.

◆ yinit

int MultidimArrayBase::yinit

Definition at line 646 of file multidim_array_base.h.

◆ yxdim

size_t MultidimArrayBase::yxdim

Definition at line 634 of file multidim_array_base.h.

◆ zdim

size_t MultidimArrayBase::zdim

Definition at line 625 of file multidim_array_base.h.

◆ zinit

int MultidimArrayBase::zinit

Definition at line 643 of file multidim_array_base.h.

◆ zyxdim

size_t MultidimArrayBase::zyxdim

Definition at line 637 of file multidim_array_base.h.


The documentation for this class was generated from the following files: