Xmipp  v3.23.11-Nereus
List of all members
Vectorial_MultidimArray Class Reference

#include <vectorial.h>

Public Member Functions

Shape
void resize (int Zdim, int Ydim, int Xdim)
 
void resize (const MultidimArray< double > &V)
 
void clear ()
 
void printShape () const
 
void initZeros ()
 
void setXmippOrigin ()
 
Component access
void vector_at (int k, int i, int j, Matrix1D< double > &result) const
 
const MultidimArray< double > & X () const
 
MultidimArray< double > & X ()
 
const MultidimArray< double > & Y () const
 
MultidimArray< double > & Y ()
 
const MultidimArray< double > & Z () const
 
MultidimArray< double > & Z ()
 
double X (int k, int i, int j) const
 
double & X (int k, int i, int j)
 
double Y (int k, int i, int j) const
 
double & Y (int k, int i, int j)
 
double Z (int k, int i, int j) const
 
double & Z (int k, int i, int j)
 
Utilities
void normalize_all_vectors ()
 
void module (MultidimArray< double > &result) const
 
void write (const FileName &fn) const
 
Arithmetic operations
Vectorial_MultidimArray operator+ (const Vectorial_MultidimArray &op1) const
 
Vectorial_MultidimArray operator- (const Vectorial_MultidimArray &op1) const
 
Vectorial_MultidimArray operator* (const Vectorial_MultidimArray &op1) const
 
Vectorial_MultidimArray operator/ (const Vectorial_MultidimArray &op1) const
 
Vectorial_MultidimArray operator^ (const Vectorial_MultidimArray &op1) const
 
void operator+= (const Vectorial_MultidimArray &op1)
 
void operator-= (const Vectorial_MultidimArray &op1)
 
void operator*= (const Vectorial_MultidimArray &op1)
 
void operator/= (const Vectorial_MultidimArray &op1)
 
void operator^= (const Vectorial_MultidimArray &op1)
 
Vectorial_MultidimArray operator+ (double op1) const
 
Vectorial_MultidimArray operator- (double op1) const
 
Vectorial_MultidimArray operator* (double op1) const
 
Vectorial_MultidimArray operator/ (double op1) const
 
Vectorial_MultidimArray operator^ (double op1) const
 
void operator+= (const double &op1)
 
void operator-= (const double &op1)
 
void operator*= (const double &op1)
 
void operator/= (const double &op1)
 
void operator^= (const double &op1)
 

Detailed Description

Vectorial volume.

A vectorial volume is a "normal" MultidimArray whose elements are vectors instead of single elements are doubles, floats, ... You can access independently to any of the three components as a whole volume, ie, a volume with all the X components, another with all Y components, ... or access to the vector at a given position (logical positions as in ), the X component at that position or the X component at a given multidimensional array position.

You can perform arithmetic operations on these vectors, and other common operations such as resize, printShape, ...

Definition at line 65 of file vectorial.h.

Member Function Documentation

◆ clear()

void Vectorial_MultidimArray::clear ( )
inline

Clear.

Definition at line 96 of file vectorial.h.

97  {
98  __X.clear();
99  __Y.clear();
100  __Z.clear();
101  }

◆ initZeros()

void Vectorial_MultidimArray::initZeros ( )
inline

Init zeros.

Definition at line 112 of file vectorial.h.

113  {
114  __X.initZeros();
115  __Y.initZeros();
116  __Z.initZeros();
117  }
void initZeros(const MultidimArray< T1 > &op)

◆ module()

void Vectorial_MultidimArray::module ( MultidimArray< double > &  result) const
inline

Module of all vectors.

A volume with all vector modules at each position is returned.

Definition at line 253 of file vectorial.h.

254  {
255  result.resize(__X);
256 
258  DIRECT_MULTIDIM_ELEM(result, n) = sqrt(
262  }
void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)
void sqrt(Image< double > &op)
#define DIRECT_MULTIDIM_ELEM(v, n)
#define FOR_ALL_ELEMENTS_IN_MULTIDIM_VECTORIAL_MATRIX3D(v)
Definition: vectorial.h:48
int * n

◆ normalize_all_vectors()

void Vectorial_MultidimArray::normalize_all_vectors ( )
inline

Substitute each vector by its unit vector.

Definition at line 235 of file vectorial.h.

236  {
238  {
239  double mod = sqrt(
243  DIRECT_MULTIDIM_ELEM(__X,n) /= mod;
244  DIRECT_MULTIDIM_ELEM(__Y,n) /= mod;
245  DIRECT_MULTIDIM_ELEM(__Z,n) /= mod;
246  }
247  }
void sqrt(Image< double > &op)
#define DIRECT_MULTIDIM_ELEM(v, n)
void mod(const MultidimArray< T > &x, MultidimArray< T > &m, double y)
#define FOR_ALL_ELEMENTS_IN_MULTIDIM_VECTORIAL_MATRIX3D(v)
Definition: vectorial.h:48
int * n

◆ operator*() [1/2]

Vectorial_MultidimArray Vectorial_MultidimArray::operator* ( const Vectorial_MultidimArray op1) const
inline

v3=v1*v2.

Definition at line 310 of file vectorial.h.

311  {
313  OPERATION(arrayByArray, *this, op1, temp, '*');
314  return temp;
315  }
#define OPERATION(func, arg1, arg2, result, op)
Definition: vectorial.h:285

◆ operator*() [2/2]

Vectorial_MultidimArray Vectorial_MultidimArray::operator* ( double  op1) const
inline

v3=v1*k.

Definition at line 395 of file vectorial.h.

396  {
398  OPERATION2(arrayByScalar, *this, op1, temp, '*');
399  return temp;
400  }
#define OPERATION2(func, arg1, arg2, result, op)
Definition: vectorial.h:370

◆ operator*=() [1/2]

void Vectorial_MultidimArray::operator*= ( const Vectorial_MultidimArray op1)
inline

v3*=v2.

Definition at line 351 of file vectorial.h.

352  {
353  OPERATION(arrayByArray, *this, op1, *this, '*');
354  }
#define OPERATION(func, arg1, arg2, result, op)
Definition: vectorial.h:285

◆ operator*=() [2/2]

void Vectorial_MultidimArray::operator*= ( const double &  op1)
inline

v3*=k.

Definition at line 436 of file vectorial.h.

437  {
438  OPERATION2(arrayByScalar, *this, op1, *this, '*');
439  }
#define OPERATION2(func, arg1, arg2, result, op)
Definition: vectorial.h:370

◆ operator+() [1/2]

Vectorial_MultidimArray Vectorial_MultidimArray::operator+ ( const Vectorial_MultidimArray op1) const
inline

v3=v1+v2.

Definition at line 292 of file vectorial.h.

293  {
295  OPERATION(arrayByArray, *this, op1, temp, '+');
296  return temp;
297  }
#define OPERATION(func, arg1, arg2, result, op)
Definition: vectorial.h:285

◆ operator+() [2/2]

Vectorial_MultidimArray Vectorial_MultidimArray::operator+ ( double  op1) const
inline

v3=v1+k.

Definition at line 377 of file vectorial.h.

378  {
380  OPERATION2(arrayByScalar, *this, op1, temp, '+');
381  return temp;
382  }
#define OPERATION2(func, arg1, arg2, result, op)
Definition: vectorial.h:370

◆ operator+=() [1/2]

void Vectorial_MultidimArray::operator+= ( const Vectorial_MultidimArray op1)
inline

v3+=v2.

Definition at line 337 of file vectorial.h.

338  {
339  OPERATION(arrayByArray, *this, op1, *this, '+');
340  }
#define OPERATION(func, arg1, arg2, result, op)
Definition: vectorial.h:285

◆ operator+=() [2/2]

void Vectorial_MultidimArray::operator+= ( const double &  op1)
inline

v3+=k.

Definition at line 422 of file vectorial.h.

423  {
424  OPERATION2(arrayByScalar, *this, op1, *this, '+');
425  }
#define OPERATION2(func, arg1, arg2, result, op)
Definition: vectorial.h:370

◆ operator-() [1/2]

Vectorial_MultidimArray Vectorial_MultidimArray::operator- ( const Vectorial_MultidimArray op1) const
inline

v3=v1-v2.

Definition at line 301 of file vectorial.h.

302  {
304  OPERATION(arrayByArray, *this, op1, temp, '-');
305  return temp;
306  }
#define OPERATION(func, arg1, arg2, result, op)
Definition: vectorial.h:285

◆ operator-() [2/2]

Vectorial_MultidimArray Vectorial_MultidimArray::operator- ( double  op1) const
inline

v3=v1-k.

Definition at line 386 of file vectorial.h.

387  {
389  OPERATION2(arrayByScalar, *this, op1, temp, '-');
390  return temp;
391  }
#define OPERATION2(func, arg1, arg2, result, op)
Definition: vectorial.h:370

◆ operator-=() [1/2]

void Vectorial_MultidimArray::operator-= ( const Vectorial_MultidimArray op1)
inline

v3-=v2.

Definition at line 344 of file vectorial.h.

345  {
346  OPERATION(arrayByArray, *this, op1, *this, '-');
347  }
#define OPERATION(func, arg1, arg2, result, op)
Definition: vectorial.h:285

◆ operator-=() [2/2]

void Vectorial_MultidimArray::operator-= ( const double &  op1)
inline

v3-=k.

Definition at line 429 of file vectorial.h.

430  {
431  OPERATION2(arrayByScalar, *this, op1, *this, '-');
432  }
#define OPERATION2(func, arg1, arg2, result, op)
Definition: vectorial.h:370

◆ operator/() [1/2]

Vectorial_MultidimArray Vectorial_MultidimArray::operator/ ( const Vectorial_MultidimArray op1) const
inline

v3=v1/v2.

Definition at line 319 of file vectorial.h.

320  {
322  OPERATION(arrayByArray, *this, op1, temp, '/');
323  return temp;
324  }
#define OPERATION(func, arg1, arg2, result, op)
Definition: vectorial.h:285

◆ operator/() [2/2]

Vectorial_MultidimArray Vectorial_MultidimArray::operator/ ( double  op1) const
inline

v3=v1/k.

Definition at line 404 of file vectorial.h.

405  {
407  OPERATION2(arrayByScalar, *this, op1, temp, '/');
408  return temp;
409  }
#define OPERATION2(func, arg1, arg2, result, op)
Definition: vectorial.h:370

◆ operator/=() [1/2]

void Vectorial_MultidimArray::operator/= ( const Vectorial_MultidimArray op1)
inline

v3/=v2.

Definition at line 358 of file vectorial.h.

359  {
360  OPERATION(arrayByArray, *this, op1, *this, '/');
361  }
#define OPERATION(func, arg1, arg2, result, op)
Definition: vectorial.h:285

◆ operator/=() [2/2]

void Vectorial_MultidimArray::operator/= ( const double &  op1)
inline

v3/=k.

Definition at line 443 of file vectorial.h.

444  {
445  OPERATION2(arrayByScalar, *this, op1, *this, '/');
446  }
#define OPERATION2(func, arg1, arg2, result, op)
Definition: vectorial.h:370

◆ operator^() [1/2]

Vectorial_MultidimArray Vectorial_MultidimArray::operator^ ( const Vectorial_MultidimArray op1) const
inline

v3=v1^v2.

Definition at line 328 of file vectorial.h.

329  {
331  OPERATION(arrayByArray, *this, op1, temp, '^');
332  return temp;
333  }
#define OPERATION(func, arg1, arg2, result, op)
Definition: vectorial.h:285

◆ operator^() [2/2]

Vectorial_MultidimArray Vectorial_MultidimArray::operator^ ( double  op1) const
inline

v3=v1^k.

Definition at line 413 of file vectorial.h.

414  {
416  OPERATION2(arrayByScalar, *this, op1, temp, '^');
417  return temp;
418  }
#define OPERATION2(func, arg1, arg2, result, op)
Definition: vectorial.h:370

◆ operator^=() [1/2]

void Vectorial_MultidimArray::operator^= ( const Vectorial_MultidimArray op1)
inline

v3^=v2.

Definition at line 365 of file vectorial.h.

366  {
367  OPERATION(arrayByArray, *this, op1, *this, '^');
368  }
#define OPERATION(func, arg1, arg2, result, op)
Definition: vectorial.h:285

◆ operator^=() [2/2]

void Vectorial_MultidimArray::operator^= ( const double &  op1)
inline

v3^=k.

Definition at line 450 of file vectorial.h.

451  {
452  OPERATION2(arrayByScalar, *this, op1, *this, '^');
453  }
#define OPERATION2(func, arg1, arg2, result, op)
Definition: vectorial.h:370

◆ printShape()

void Vectorial_MultidimArray::printShape ( ) const
inline

Print shape.

Definition at line 105 of file vectorial.h.

106  {
107  __X.printShape();
108  }
void printShape(std::ostream &out=std::cout) const

◆ resize() [1/2]

void Vectorial_MultidimArray::resize ( int  Zdim,
int  Ydim,
int  Xdim 
)
inline

Resize.

Definition at line 78 of file vectorial.h.

79  {
80  __X.resize(Zdim, Ydim, Xdim);
81  __Y.resize(Zdim, Ydim, Xdim);
82  __Z.resize(Zdim, Ydim, Xdim);
83  }
void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)

◆ resize() [2/2]

void Vectorial_MultidimArray::resize ( const MultidimArray< double > &  V)
inline

Resize with pattern.

Definition at line 87 of file vectorial.h.

88  {
89  __X.resize(V);
90  __Y.resize(V);
91  __Z.resize(V);
92  }
void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)

◆ setXmippOrigin()

void Vectorial_MultidimArray::setXmippOrigin ( )
inline

Set Xmipp origin.

Definition at line 121 of file vectorial.h.

122  {
123  __X.setXmippOrigin();
124  __Y.setXmippOrigin();
125  __Z.setXmippOrigin();
126  }

◆ vector_at()

void Vectorial_MultidimArray::vector_at ( int  k,
int  i,
int  j,
Matrix1D< double > &  result 
) const
inline

Vector at a position, result as argument.

Definition at line 134 of file vectorial.h.

135  {
136  if (VEC_XSIZE(result)!=3)
137  result.resize(3);
138  XX(result) = __X(k, i, j);
139  YY(result) = __Y(k, i, j);
140  ZZ(result) = __Z(k, i, j);
141  }
#define VEC_XSIZE(m)
Definition: matrix1d.h:77
#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 XX(v)
Definition: matrix1d.h:85
void resize(size_t Xdim, bool copy=true)
Definition: matrix1d.h:410
#define j
#define YY(v)
Definition: matrix1d.h:93
#define ZZ(v)
Definition: matrix1d.h:101

◆ write()

void Vectorial_MultidimArray::write ( const FileName fn) const
inline

Write.

Given a FileName, this function saves 3 volumes named "_X", "_Y" and "_Z".

Definition at line 269 of file vectorial.h.

270  {
271  Image<double> V;
272 
273  V() = __X;
274  V.write(fn.insertBeforeExtension("_X"));
275  V() = __Y;
276  V.write(fn.insertBeforeExtension("_Y"));
277  V() = __Z;
278  V.write(fn.insertBeforeExtension("_Z"));
279  }
FileName insertBeforeExtension(const String &str) const
void write(const FileName &name="", size_t select_img=ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE, CastWriteMode castMode=CW_CAST, int _swapWrite=0)

◆ X() [1/4]

const MultidimArray< double >& Vectorial_MultidimArray::X ( ) const
inline

Constant access to X component.

X components are a MultidimArray.

Definition at line 147 of file vectorial.h.

148  {
149  return __X;
150  }

◆ X() [2/4]

MultidimArray< double >& Vectorial_MultidimArray::X ( )
inline

Access to X components.

Definition at line 154 of file vectorial.h.

155  {
156  return __X;
157  }

◆ X() [3/4]

double Vectorial_MultidimArray::X ( int  k,
int  i,
int  j 
) const
inline

Constant access to a particular X component.

Definition at line 189 of file vectorial.h.

190  {
191  return A3D_ELEM(__X, k, i, j);
192  }
#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 A3D_ELEM(V, k, i, j)
#define j

◆ X() [4/4]

double& Vectorial_MultidimArray::X ( int  k,
int  i,
int  j 
)
inline

Access to a particular X component.

Definition at line 196 of file vectorial.h.

197  {
198  return A3D_ELEM(__X, k, i, j);
199  }
#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 A3D_ELEM(V, k, i, j)
#define j

◆ Y() [1/4]

const MultidimArray< double >& Vectorial_MultidimArray::Y ( ) const
inline

Constant access to Y component.

Definition at line 161 of file vectorial.h.

162  {
163  return __Y;
164  }

◆ Y() [2/4]

MultidimArray< double >& Vectorial_MultidimArray::Y ( )
inline

Access to Y components.

Definition at line 168 of file vectorial.h.

169  {
170  return __Y;
171  }

◆ Y() [3/4]

double Vectorial_MultidimArray::Y ( int  k,
int  i,
int  j 
) const
inline

Constant access to a particular Y component.

Definition at line 203 of file vectorial.h.

204  {
205  return A3D_ELEM(__Y, k, i, j);
206  }
#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 A3D_ELEM(V, k, i, j)
#define j

◆ Y() [4/4]

double& Vectorial_MultidimArray::Y ( int  k,
int  i,
int  j 
)
inline

Access to a particular Y component.

Definition at line 210 of file vectorial.h.

211  {
212  return A3D_ELEM(__Y, k, i, j);
213  }
#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 A3D_ELEM(V, k, i, j)
#define j

◆ Z() [1/4]

const MultidimArray< double >& Vectorial_MultidimArray::Z ( ) const
inline

Constant access to Z component.

Definition at line 175 of file vectorial.h.

176  {
177  return __Z;
178  }

◆ Z() [2/4]

MultidimArray< double >& Vectorial_MultidimArray::Z ( )
inline

Access to Z components.

Definition at line 182 of file vectorial.h.

183  {
184  return __Z;
185  }

◆ Z() [3/4]

double Vectorial_MultidimArray::Z ( int  k,
int  i,
int  j 
) const
inline

Constant access to a particular Z component.

Definition at line 217 of file vectorial.h.

218  {
219  return A3D_ELEM(__Z, k, i, j);
220  }
#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 A3D_ELEM(V, k, i, j)
#define j

◆ Z() [4/4]

double& Vectorial_MultidimArray::Z ( int  k,
int  i,
int  j 
)
inline

Access to a particular Z component.

Definition at line 224 of file vectorial.h.

225  {
226  return A3D_ELEM(__Z, k, i, j);
227  }
#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 A3D_ELEM(V, k, i, j)
#define j

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