Xmipp  v3.23.11-Nereus
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Mask Class Reference

#include <mask.h>

Collaboration diagram for Mask:
Collaboration graph
[legend]

Public Member Functions

void readParams (XmippProgram *program)
 
 Mask (int _allowed_data_type=ALL_KINDS)
 
void clear ()
 
void read (int argc, const char **argv)
 
void show () const
 
void usage () const
 
void write_mask (const FileName &fn)
 
int datatype ()
 
void resize (size_t Xdim)
 
void resize (size_t Ydim, size_t Xdim)
 
void resize (size_t Zdim, size_t Ydim, size_t Xdim)
 
template<typename T >
void resize (const MultidimArray< T > &m)
 
void generate_mask (bool apply_geo=false)
 
void generate_mask (size_t Zdim, size_t Ydim, size_t Xdim)
 
void generate_mask (int Ydim, int Xdim, bool apply_geo=false)
 
void generate_mask (int Xdim)
 
template<typename T >
void generate_mask (const MultidimArray< T > &m, bool apply_geo=false)
 
template<typename T >
void apply_mask (const MultidimArray< T > &I, MultidimArray< T > &result, T subs_val=0, bool apply_geo=false)
 
template<typename T >
void produce_vector (const MultidimArray< T > &I, MultidimArray< T > &result)
 
const MultidimArray< int > & get_binary_mask () const
 
MultidimArray< int > & get_binary_mask ()
 
void set_binary_mask (MultidimArray< int > &_imask)
 
const MultidimArray< double > & get_cont_mask () const
 
MultidimArray< double > & get_cont_mask ()
 
void set_cont_mask (MultidimArray< double > &_dmask)
 
void force_to_be_continuous ()
 
void force_to_be_binary ()
 

Static Public Member Functions

static void defineParams (XmippProgram *program, int allowed_data_types=ALL_KINDS, const char *prefix=nullptr, const char *comment=nullptr, bool moreOptions=false)
 

Public Attributes

int type
 
int mode
 
double R1
 
double R2
 
double pix_width
 
int blob_order
 
double blob_radius
 
double blob_alpha
 
double H
 
double sigma
 
double omega
 
int Xrect
 
int Yrect
 
int Zrect
 
double z0
 
double y0
 
double x0
 
int smin
 
int smax
 
std::string quadrant
 
FileName fn_mask
 
Matrix2D< double > mask_geo
 
int allowed_data_types
 
MultidimArray< int > imask
 
MultidimArray< double > dmask
 
std::string mask_type
 

Detailed Description

Parameters for a general Mask.

This class contains all parameters needed to generate masks. The class can read parameters from the command line.

To read a mask from a file within a program do the following

Mask mask;
mask.fn_mask = "...";
mask.generate_2Dmask();
mask.apply(input_Matrix2D, output_Matrix2D);

To generate a geometric mask within a program do the following:

Mask mask;
// Define an spherical mask of radius 32 (the active part is
// within the sphere)
mask.R1 = 32;
// resize the mask after this pattern
mask.resize(input_Matrix2D);
// Really generate the mask. It is stored internally
mask.generate_2Dmask();
// Apply the mask to some image
mask.apply_mask(input_Matrix2D, output_Matrix2D);

To read a mask from the command line:

Mask mask;
mask.read(argc, argv);
mask.resize(Ydim, Xdim);
mask.generate_2Dmask();
Mask.apply_mask(input_Matrix2D, output_Matrix2D);

Definition at line 360 of file mask.h.

Constructor & Destructor Documentation

◆ Mask()

Mask::Mask ( int  _allowed_data_type = ALL_KINDS)

Constructors Allowed data types are ALL_KINDS, INT_MASK and DOUBLE_MASK used with | .

Definition at line 634 of file mask.cpp.

635 {
636  clear();
637  allowed_data_types = _allowed_data_types;
638 }
int allowed_data_types
Definition: mask.h:495
void clear()
Definition: mask.cpp:641

Member Function Documentation

◆ apply_mask()

template<typename T >
void Mask::apply_mask ( const MultidimArray< T > &  I,
MultidimArray< T > &  result,
subs_val = 0,
bool  apply_geo = false 
)
inline

Apply mask to image subs_val is the substitute value in case of binary masks

Definition at line 635 of file mask.h.

637  {
638  switch (datatype())
639  {
640  case INT_MASK:
641  if (apply_geo)
643 
644  apply_binary_mask(imask, I, result, subs_val);
645  break;
646 
647  case DOUBLE_MASK:
648  if (apply_geo)
650 
651  apply_cont_mask(dmask, I, result);
652  break;
653  }
654  }
Matrix2D< double > mask_geo
Definition: mask.h:491
void apply_binary_mask(const MultidimArray< int > &mask, const MultidimArray< T > &m_in, MultidimArray< T > &m_out, T subs_val=(T) 0)
Definition: mask.h:857
void apply_geo_cont_2D_mask(MultidimArray< double > &mask, const Matrix2D< double > &A)
Definition: mask.cpp:1703
MultidimArray< double > dmask
Definition: mask.h:503
#define DOUBLE_MASK
Definition: mask.h:386
void apply_cont_mask(const MultidimArray< double > &mask, const MultidimArray< T > &m_in, MultidimArray< T > &m_out)
Definition: mask.h:881
void apply_geo_binary_2D_mask(MultidimArray< int > &mask, const Matrix2D< double > &A)
Definition: mask.cpp:1682
int datatype()
Definition: mask.h:544
#define INT_MASK
Definition: mask.h:385
MultidimArray< int > imask
Definition: mask.h:499

◆ clear()

void Mask::clear ( )

Clear

Definition at line 641 of file mask.cpp.

642 {
643  type = NO_MASK;
644  mode = INNER_MASK;
645  H = R1 = R2 = sigma = 0;
646  imask.clear();
647  dmask.clear();
648  allowed_data_types = 0;
649  fn_mask = "";
650  x0 = y0 = z0 = 0;
651 }
double z0
Definition: mask.h:462
FileName fn_mask
Definition: mask.h:487
double R2
Definition: mask.h:418
double sigma
Definition: mask.h:442
int allowed_data_types
Definition: mask.h:495
#define NO_MASK
Definition: mask.h:364
double H
Definition: mask.h:437
MultidimArray< double > dmask
Definition: mask.h:503
double y0
Definition: mask.h:466
double R1
Definition: mask.h:413
double x0
Definition: mask.h:470
int type
Definition: mask.h:402
MultidimArray< int > imask
Definition: mask.h:499
int mode
Definition: mask.h:407
constexpr int INNER_MASK
Definition: mask.h:47

◆ datatype()

int Mask::datatype ( )
inline

Return the type of the mask. INT_MASK, DOUBLE_MASK

Definition at line 544 of file mask.h.

545  {
548  type == BINARY_TUBE ||
549  type == NO_MASK || type == READ_BINARY_MASK ||
551  return INT_MASK;
552 
553  else if (type == GAUSSIAN_MASK || type == RAISED_COSINE_MASK ||
558  return DOUBLE_MASK;
559 
560  return 0;
561  }
#define SINC_BLACKMAN_MASK
Definition: mask.h:373
#define BINARY_TUBE
Definition: mask.h:383
#define BLACKMAN_MASK
Definition: mask.h:371
#define BINARY_CROWN_MASK
Definition: mask.h:366
#define BLOB_CROWN_MASK
Definition: mask.h:382
#define RAISED_COSINE_MASK
Definition: mask.h:370
#define BINARY_CYLINDER_MASK
Definition: mask.h:367
#define BINARY_FRAME_MASK
Definition: mask.h:368
#define SINC_MASK
Definition: mask.h:372
#define NO_MASK
Definition: mask.h:364
#define RAISED_CROWN_MASK
Definition: mask.h:376
#define BINARY_CONE_MASK
Definition: mask.h:379
#define READ_BINARY_MASK
Definition: mask.h:374
#define READ_REAL_MASK
Definition: mask.h:375
#define DOUBLE_MASK
Definition: mask.h:386
int type
Definition: mask.h:402
#define BINARY_DWT_CIRCULAR_MASK
Definition: mask.h:377
#define BLOB_CIRCULAR_MASK
Definition: mask.h:381
#define GAUSSIAN_MASK
Definition: mask.h:369
#define BINARY_CIRCULAR_MASK
Definition: mask.h:365
#define INT_MASK
Definition: mask.h:385
#define BINARY_WEDGE_MASK
Definition: mask.h:380

◆ defineParams()

void Mask::defineParams ( XmippProgram program,
int  allowed_data_types = ALL_KINDS,
const char *  prefix = nullptr,
const char *  comment = nullptr,
bool  moreOptions = false 
)
static

Definition at line 1203 of file mask.cpp.

1205 {
1206  char tempLine[256];
1207  char tempLine2[512];
1208 
1209  char advanced=' ';
1210  if (moreOptions)
1211  advanced='+';
1212  if(prefix == nullptr)
1213  sprintf(tempLine, " [--mask%c <mask_type=circular>] ",advanced);
1214  else
1215  sprintf(tempLine,"%s --mask%c <mask_type=circular> ", prefix,advanced);
1216  if (comment != nullptr)
1217  sprintf(tempLine2, "%s : %s", tempLine, comment);
1218  else
1219  strcpy(tempLine2,tempLine);
1220 
1221  program->addParamsLine(tempLine2);
1222  program->addParamsLine(" where <mask_type> ");
1223  // program->addParamsLine("== INT MASK ==");
1225  {
1226  program->addParamsLine(" circular <R> : circle/sphere mask");
1227  program->addParamsLine(" :if R>0 => outside R");
1228  program->addParamsLine(" :if R<0 => inside R");
1229  program->addParamsLine(" DWT_circular <R> <smin> <smax>: circle/sphere mask");
1230  program->addParamsLine(" : smin and smax define the scales to be kept");
1231  program->addParamsLine(" rectangular <Xrect> <Yrect> <Zrect=-1>: 2D or 3D rectangle");
1232  program->addParamsLine(" :if X,Y,Z > 0 => outside rectangle");
1233  program->addParamsLine(" :if X,Y,Z < 0 => inside rectangle");
1234  program->addParamsLine(" crown <R1> <R2> : 2D or 3D crown");
1235  program->addParamsLine(" :if R1,R2 > 0 => outside crown");
1236  program->addParamsLine(" :if R1,R2 < 0 => inside crown");
1237  program->addParamsLine(" cylinder <R> <H> : 2D circle or 3D cylinder");
1238  program->addParamsLine(" :if R,H > 0 => outside cylinder");
1239  program->addParamsLine(" :if R,H < 0 => inside cylinder");
1240  program->addParamsLine(" tube <R1> <R2> <H> : 3D tube");
1241  program->addParamsLine(" :if R1,R2,H > 0 => outside tube");
1242  program->addParamsLine(" :if R1,R2,H < 0 => inside tube");
1243  program->addParamsLine(" cone <theta> : 3D cone (parallel to Z) ");
1244  program->addParamsLine(" :if theta > 0 => outside cone");
1245  program->addParamsLine(" :if theta < 0 => inside cone");
1246  program->addParamsLine(" wedge <th0> <thF> : 3D missing-wedge mask for data ");
1247  program->addParamsLine(" :collected between tilting angles ");
1248  program->addParamsLine(" :th0 and thF (around the Y-axis) ");
1249  program->addParamsLine(" binary_file <binary_file> : Read from file and cast to binary");
1250  }
1251  //program->addParamsLine("== DOUBLE MASK ==");
1253  {
1254  program->addParamsLine(" real_file <float_file> : Read from file and do not cast");
1255  program->addParamsLine(" gaussian <sigma> : 2D or 3D gaussian");
1256  program->addParamsLine(" :if sigma > 0 => outside gaussian");
1257  program->addParamsLine(" : if sigma < 0 => inside gaussian");
1258  program->addParamsLine(" raised_cosine <R1> <R2>: 2D or 3D raised_cosine");
1259  program->addParamsLine(" : if R1,R2 > 0 => outside sphere");
1260  program->addParamsLine(" : if R1,R2 < 0 => inside sphere");
1261  program->addParamsLine(" raised_crown <R1> <R2> <pixwidth>: 2D or 3D raised_crown");
1262  program->addParamsLine(" : if R1,R2 > 0 => outside sphere");
1263  program->addParamsLine(" : if R1,R2 < 0 => inside sphere");
1264  program->addParamsLine(" blob_circular <R1> <blob_radius>: 2D or 3D blob circular");
1265  program->addParamsLine(" : if blob_radius > 0 => outside sphere");
1266  program->addParamsLine(" : if blob_radius < 0 => inside sphere");
1267  program->addParamsLine(" blob_crown <R1> <R2> <blob_radius>: 2D or 3D blob_crown");
1268  program->addParamsLine(" : if blob_radius > 0 => outside sphere");
1269  program->addParamsLine(" : if blob_radius < 0 => inside sphere");
1270  program->addParamsLine(" blackman : 2D or 3D Blackman mask");
1271  program->addParamsLine(" : always inside blackman");
1272  program->addParamsLine(" sinc <w> : 2D or 3D sincs");
1273  program->addParamsLine(" : if w > 0 => outside sinc");
1274  program->addParamsLine(" : if w < 0 => inside sinc");
1275  sprintf(tempLine, " [ -m%c <blob_order=2>] : Order of blob",advanced);
1276  program->addParamsLine(tempLine);
1277  sprintf(tempLine, " [ -a%c <blob_alpha=10.4>] : Alpha of blob",advanced);
1278  program->addParamsLine(tempLine);
1279  }
1280  sprintf(tempLine, " [--center%c <x0=0> <y0=0> <z0=0>]: mask center",advanced);
1281  program->addParamsLine(tempLine);
1282 }
int allowed_data_types
Definition: mask.h:495
#define DOUBLE_MASK
Definition: mask.h:386
#define INT_MASK
Definition: mask.h:385
void addParamsLine(const String &line)

◆ force_to_be_binary()

void Mask::force_to_be_binary ( )
inline

Force to be binary

This function is used when you need a double mask as a binary matrix.

Definition at line 763 of file mask.h.

764  {
765  if (datatype() == DOUBLE_MASK)
766  {
767  typeCast(dmask, imask);
768  }
769  }
MultidimArray< double > dmask
Definition: mask.h:503
#define DOUBLE_MASK
Definition: mask.h:386
void typeCast(const Matrix1D< T1 > &v1, Matrix1D< T2 > &v2)
Definition: matrix1d.h:1227
int datatype()
Definition: mask.h:544
MultidimArray< int > imask
Definition: mask.h:499

◆ force_to_be_continuous()

void Mask::force_to_be_continuous ( )
inline

Force to be continuous

This function is used when you need a binary mask as a double matrix.

Definition at line 751 of file mask.h.

752  {
753  if (datatype() == INT_MASK)
754  {
755  typeCast(imask, dmask);
756  }
757  }
MultidimArray< double > dmask
Definition: mask.h:503
void typeCast(const Matrix1D< T1 > &v1, Matrix1D< T2 > &v2)
Definition: matrix1d.h:1227
int datatype()
Definition: mask.h:544
#define INT_MASK
Definition: mask.h:385
MultidimArray< int > imask
Definition: mask.h:499

◆ generate_mask() [1/5]

void Mask::generate_mask ( bool  apply_geo = false)

Generate mask for a resized signal It is supposed that the image is already resized and with its logical origin set.

Definition at line 1577 of file mask.cpp.

1578 {
1579  ImageGeneric img;
1580  Matrix2D<double> AA(4, 4);
1581  AA.initIdentity();
1582  blobtype blob;
1584  {
1585  blob.radius = blob_radius;
1586  blob.order = blob_order;
1587  blob.alpha = blob_alpha;
1588  }
1589 
1590  switch (type)
1591  {
1592  case NO_MASK:
1593  imask.initConstant(1);
1594  break;
1595  case BINARY_CIRCULAR_MASK:
1597  break;
1600  break;
1603  break;
1604  case BINARY_CROWN_MASK:
1605  BinaryCrownMask(imask, R1, R2, mode, x0, y0, z0);
1606  break;
1607  case BINARY_CYLINDER_MASK:
1609  break;
1610  case BINARY_TUBE:
1611  BinaryTubeMask(imask, R1, R2, H, mode, x0, y0, z0);
1612  break;
1613  case BINARY_FRAME_MASK:
1615  break;
1616  case BINARY_CONE_MASK:
1618  break;
1619  case BINARY_WEDGE_MASK:
1620  BinaryWedgeMask(imask, R1, R2, AA);
1621  break;
1622  case GAUSSIAN_MASK:
1624  break;
1625  case RAISED_COSINE_MASK:
1627  break;
1628  case RAISED_CROWN_MASK:
1630  break;
1631  case BLOB_CIRCULAR_MASK:
1632  BlobCircularMask(dmask, R1, blob, mode, x0, y0, z0);
1633  break;
1634  case BLOB_CROWN_MASK:
1635  BlobCrownMask(dmask, R1, R2, blob, mode, x0, y0, z0);
1636  break;
1637  case BLACKMAN_MASK:
1638  BlackmanMask(dmask, mode, x0, y0, z0);
1639  break;
1640  case SINC_MASK:
1641  SincMask(dmask, omega, mode, x0, y0, z0);
1642  break;
1643  case READ_BINARY_MASK:
1644  img.readMapped(fn_mask);
1645  img().getImage(imask);
1647  break;
1648  case READ_REAL_MASK://ROB
1649  img.readMapped(fn_mask);
1650  img().getImage(dmask);
1652  break;
1653  default:
1654  REPORT_ERROR(ERR_VALUE_INCORRECT, "MaskProgram::generate_mask: Unknown mask type :"
1655  + integerToString(type));
1656  }
1657 
1658  if (apply_geo)
1659  {
1660  switch (datatype())
1661  {
1662  case INT_MASK:
1663  if (ZSIZE(imask) > 1)
1664  REPORT_ERROR(ERR_NOT_IMPLEMENTED,"Error: apply_geo only implemented for 2D masks");
1666  break;
1667  case DOUBLE_MASK:
1668  if (ZSIZE(dmask) > 1)
1669  REPORT_ERROR(ERR_NOT_IMPLEMENTED,"Error: apply_geo only implemented for 2D masks");
1671  break;
1672  }
1673  }
1674 }
double z0
Definition: mask.h:462
void BinaryConeMask(MultidimArray< int > &mask, double theta, int mode, bool centerOrigin)
Definition: mask.cpp:488
double alpha
Smoothness parameter.
Definition: blobs.h:121
Case or algorithm not implemented yet.
Definition: xmipp_error.h:177
void BlobCircularMask(MultidimArray< double > &mask, double r1, blobtype blob, int mode, double x0, double y0, double z0)
Definition: mask.cpp:219
Matrix2D< double > mask_geo
Definition: mask.h:491
int smin
Definition: mask.h:474
#define BINARY_TUBE
Definition: mask.h:383
#define BLACKMAN_MASK
Definition: mask.h:371
void BinaryCrownMask(MultidimArray< int > &mask, double R1, double R2, int mode, double x0, double y0, double z0)
Definition: mask.cpp:244
int Xrect
Definition: mask.h:451
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
void BinaryDWTSphericalMask3D(MultidimArray< int > &mask, double radius, int smin, int smax, const std::string &quadrant)
Definition: mask.cpp:443
FileName fn_mask
Definition: mask.h:487
double R2
Definition: mask.h:418
int smax
Definition: mask.h:478
void BinaryWedgeMask(MultidimArray< int > &mask, double theta0, double thetaF, const Matrix2D< double > &A, bool centerOrigin)
Definition: mask.cpp:524
#define BINARY_CROWN_MASK
Definition: mask.h:366
void BinaryCircularMask(MultidimArray< int > &mask, double radius, int mode, double x0, double y0, double z0)
Definition: mask.cpp:193
#define BLOB_CROWN_MASK
Definition: mask.h:382
#define RAISED_COSINE_MASK
Definition: mask.h:370
#define BINARY_CYLINDER_MASK
Definition: mask.h:367
void SincMask(MultidimArray< double > &mask, double omega, int mode, double x0, double y0, double z0)
Definition: mask.cpp:127
double sigma
Definition: mask.h:442
#define BINARY_FRAME_MASK
Definition: mask.h:368
void initConstant(T val)
void apply_geo_cont_2D_mask(MultidimArray< double > &mask, const Matrix2D< double > &A)
Definition: mask.cpp:1703
String integerToString(int I, int _width, char fill_with)
#define SINC_MASK
Definition: mask.h:372
#define NO_MASK
Definition: mask.h:364
double H
Definition: mask.h:437
double blob_alpha
Definition: mask.h:432
MultidimArray< double > dmask
Definition: mask.h:503
#define RAISED_CROWN_MASK
Definition: mask.h:376
#define BINARY_CONE_MASK
Definition: mask.h:379
double y0
Definition: mask.h:466
#define READ_BINARY_MASK
Definition: mask.h:374
#define READ_REAL_MASK
Definition: mask.h:375
double R1
Definition: mask.h:413
#define DOUBLE_MASK
Definition: mask.h:386
void BlackmanMask(MultidimArray< double > &mask, int mode, double x0, double y0, double z0)
Definition: mask.cpp:151
double x0
Definition: mask.h:470
#define BINARY_DWT_SPHERICAL_MASK
Definition: mask.h:378
void BlobCrownMask(MultidimArray< double > &mask, double r1, double r2, blobtype blob, int mode, double x0, double y0, double z0)
Definition: mask.cpp:278
int type
Definition: mask.h:402
#define ZSIZE(v)
int Yrect
Definition: mask.h:455
void BinaryDWTCircularMask2D(MultidimArray< int > &mask, double radius, int smin, int smax, const std::string &quadrant)
Definition: mask.cpp:356
std::string quadrant
Definition: mask.h:483
void GaussianMask(MultidimArray< double > &mask, double sigma, int mode, double x0, double y0, double z0)
Definition: mask.cpp:325
double omega
Definition: mask.h:447
#define BINARY_DWT_CIRCULAR_MASK
Definition: mask.h:377
void BinaryCylinderMask(MultidimArray< int > &mask, double R, double H, int mode, double x0, double y0, double z0)
Definition: mask.cpp:471
#define BLOB_CIRCULAR_MASK
Definition: mask.h:381
void RaisedCrownMask(MultidimArray< double > &mask, double r1, double r2, double pix_width, int mode, double x0, double y0, double z0)
Definition: mask.cpp:67
double pix_width
Definition: mask.h:423
void apply_geo_binary_2D_mask(MultidimArray< int > &mask, const Matrix2D< double > &A)
Definition: mask.cpp:1682
void BinaryTubeMask(MultidimArray< int > &mask, double R1, double R2, double H, int mode, double x0, double y0, double z0)
Definition: mask.cpp:261
#define GAUSSIAN_MASK
Definition: mask.h:369
int Zrect
Definition: mask.h:459
#define BINARY_CIRCULAR_MASK
Definition: mask.h:365
int blob_order
Definition: mask.h:428
int datatype()
Definition: mask.h:544
#define INT_MASK
Definition: mask.h:385
double blob_radius
Definition: mask.h:431
int order
Derivation order and Bessel function order.
Definition: blobs.h:118
MultidimArray< int > imask
Definition: mask.h:499
void RaisedCosineMask(MultidimArray< double > &mask, double r1, double r2, int mode, double x0, double y0, double z0)
Definition: mask.cpp:36
#define BINARY_WEDGE_MASK
Definition: mask.h:380
Incorrect value received.
Definition: xmipp_error.h:195
double radius
Spatial radius in Universal System units.
Definition: blobs.h:115
int readMapped(const FileName &name, size_t select_img=ALL_IMAGES, int mode=WRITE_READONLY)
void BinaryFrameMask(MultidimArray< int > &mask, int Xrect, int Yrect, int Zrect, int mode, double x0, double y0, double z0)
Definition: mask.cpp:309
int mode
Definition: mask.h:407

◆ generate_mask() [2/5]

void Mask::generate_mask ( size_t  Zdim,
size_t  Ydim,
size_t  Xdim 
)
inline

Generate mask for an empty signal

Definition at line 600 of file mask.h.

601  {
602  resize(Zdim, Ydim, Xdim);
603  generate_mask();
604  }
void resize(size_t Xdim)
Definition: mask.cpp:654
void generate_mask(bool apply_geo=false)
Definition: mask.cpp:1577

◆ generate_mask() [3/5]

void Mask::generate_mask ( int  Ydim,
int  Xdim,
bool  apply_geo = false 
)
inline

Generate mask for an empty signal

Definition at line 608 of file mask.h.

609  {
610  resize(Ydim, Xdim);
611  generate_mask(apply_geo);
612  }
void resize(size_t Xdim)
Definition: mask.cpp:654
void generate_mask(bool apply_geo=false)
Definition: mask.cpp:1577

◆ generate_mask() [4/5]

void Mask::generate_mask ( int  Xdim)
inline

Generate mask for an empty signal

Definition at line 616 of file mask.h.

617  {
618  resize(Xdim);
619  generate_mask();
620  }
void resize(size_t Xdim)
Definition: mask.cpp:654
void generate_mask(bool apply_geo=false)
Definition: mask.cpp:1577

◆ generate_mask() [5/5]

template<typename T >
void Mask::generate_mask ( const MultidimArray< T > &  m,
bool  apply_geo = false 
)
inline

Generate mask for a signal following a pattern

Definition at line 625 of file mask.h.

626  {
627  resize(m);
628  generate_mask(apply_geo);
629  }
void resize(size_t Xdim)
Definition: mask.cpp:654
void generate_mask(bool apply_geo=false)
Definition: mask.cpp:1577

◆ get_binary_mask() [1/2]

const MultidimArray< int >& Mask::get_binary_mask ( ) const
inline

Get binary mask

Definition at line 707 of file mask.h.

708  {
709  return imask;
710  }
MultidimArray< int > imask
Definition: mask.h:499

◆ get_binary_mask() [2/2]

MultidimArray< int >& Mask::get_binary_mask ( )
inline

Get binary mask

Definition at line 714 of file mask.h.

715  {
716  return imask;
717  }
MultidimArray< int > imask
Definition: mask.h:499

◆ get_cont_mask() [1/2]

const MultidimArray< double >& Mask::get_cont_mask ( ) const
inline

Get continuous mask

Definition at line 728 of file mask.h.

729  {
730  return dmask;
731  }
MultidimArray< double > dmask
Definition: mask.h:503

◆ get_cont_mask() [2/2]

MultidimArray< double >& Mask::get_cont_mask ( )
inline

Get continuous mask

Definition at line 735 of file mask.h.

736  {
737  return dmask;
738  }
MultidimArray< double > dmask
Definition: mask.h:503

◆ produce_vector()

template<typename T >
void Mask::produce_vector ( const MultidimArray< T > &  I,
MultidimArray< T > &  result 
)
inline

Produce vector from MultidimArray

This function returns a 1D vector with all those voxels for which the mask was greater than 0. If the output vector is of size 0, then it is resized to the right size. Otherwise, it is assumed that it has already the right size. The input volume is assumed to be of the same size as the existing mask.

Definition at line 666 of file mask.h.

667  {
668  // Resize the output vector
669  if (XSIZE(result) == 0)
670  {
671  int size = 0;
672  switch (datatype())
673  {
674  case INT_MASK:
676  if (DIRECT_A2D_ELEM(imask, i, j) > 0)
677  size++;
678  break;
679 
680  case DOUBLE_MASK:
682  if (DIRECT_A2D_ELEM(dmask, i, j) > 0)
683  size++;
684  break;
685  }
686  result.initZeros(size);
687  }
688 
689  int p = 0;
690  switch (datatype())
691  {
692  case INT_MASK:
694  if (DIRECT_A2D_ELEM(imask, i, j) > 0)
695  DIRECT_A1D_ELEM(result, p++) = DIRECT_A3D_ELEM(I, k, i, j);
696  break;
697  case DOUBLE_MASK:
699  if (DIRECT_A2D_ELEM(dmask, i, j) > 0)
700  DIRECT_A1D_ELEM(result, p++) = DIRECT_A3D_ELEM(I, k, i, j);
701  break;
702  }
703  }
#define DIRECT_A2D_ELEM(v, i, j)
#define FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY3D(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
MultidimArray< double > dmask
Definition: mask.h:503
#define DIRECT_A1D_ELEM(v, i)
#define DOUBLE_MASK
Definition: mask.h:386
#define XSIZE(v)
#define DIRECT_A3D_ELEM(v, k, i, j)
#define j
int datatype()
Definition: mask.h:544
#define INT_MASK
Definition: mask.h:385
MultidimArray< int > imask
Definition: mask.h:499
void initZeros(const MultidimArray< T1 > &op)

◆ read()

void Mask::read ( int  argc,
const char **  argv 
)

Read from command line An exception is thrown if the read mask is not of an allowed type.

Definition at line 701 of file mask.cpp.

702 {
703  int i = paremeterPosition(argc, argv, "--center");
704  if (i != -1)
705  {
706  if (i + 3 >= argc)
707  REPORT_ERROR(ERR_UNCLASSIFIED, "Mask: Not enough parameters after -center");
708  x0 = textToFloat(argv[i+1]);
709  y0 = textToFloat(argv[i+2]);
710  z0 = textToFloat(argv[i+3]);
711  }
712  else
713  {
714  x0 = y0 = z0 = 0;
715  }
716 
717  i = paremeterPosition(argc, argv, "--mask");
718  if (i == -1)
719  {
720  clear();
721  return;
722  }
723  if (i + 1 >= argc)
724  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: --mask with no mask_type");
725  // Circular mask ........................................................
726  if (strcmp(argv[i+1], "circular") == 0)
727  {
728  if (i + 2 >= argc)
729  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: circular mask with no radius");
730  if (!(allowed_data_types & INT_MASK))
731  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
732  R1 = textToFloat(argv[i+2]);
733  if (R1 < 0)
734  {
735  mode = INNER_MASK;
736  R1 = ABS(R1);
737  }
738  else if (R1 > 0)
739  mode = OUTSIDE_MASK;
740  else
741  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: circular mask with radius 0");
743  // Circular DWT mask ....................................................
744  }
745  else if (strcmp(argv[i+1], "DWT_circular") == 0)
746  {
747  if (i + 5 >= argc)
748  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: DWT circular mask with not enough parameters");
749  if (!(allowed_data_types & INT_MASK))
750  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
751  R1 = ABS(textToFloat(argv[i+2]));
752  smin = textToInteger(argv[i+3]);
753  smax = textToInteger(argv[i+4]);
754  quadrant = argv[i+5];
756  // Rectangular mask .....................................................
757  }
758  else if (strcmp(argv[i+1], "rectangular") == 0)
759  {
760  if (i + 3 >= argc)
761  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: rectangular mask needs at least two dimensions");
762  if (!(allowed_data_types & INT_MASK))
763  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
764  Xrect = textToInteger(argv[i+2]);
765  Yrect = textToInteger(argv[i+3]);
766  if (i + 4 < argc)
767  {
768  Zrect = textToInteger(argv[i+4]);
769  if (argv[i+4][0] != '-')
770  Zrect = ABS(Zrect);
771  }
772  else
773  Zrect = 0;
774  if (Xrect < 0 && Yrect < 0 && Zrect <= 0)
775  {
776  mode = INNER_MASK;
777  Xrect = ABS(Xrect);
778  Yrect = ABS(Yrect);
779  Zrect = ABS(Zrect);
780  }
781  else if (Xrect > 0 && Yrect > 0 && Zrect >= 0)
782  mode = OUTSIDE_MASK;
783  else
784  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for rectangle");
786  // Cone mask ............................................................
787  }
788  else if (strcmp(argv[i+1], "cone") == 0)
789  {
790  if (i + 2 >= argc)
791  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: cone mask needs one angle");
792  if (!(allowed_data_types & INT_MASK))
793  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
794  R1 = textToFloat(argv[i+2]);
795  if (R1 < 0)
796  {
797  mode = INNER_MASK;
798  R1 = ABS(R1);
799  }
800  else
801  mode = OUTSIDE_MASK;
803  // Wedge mask ............................................................
804  }
805  else if (strcmp(argv[i+1], "wedge") == 0)
806  {
807  if (i + 3 >= argc)
808  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: wedge mask needs two angles");
810  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
811  R1 = textToFloat(argv[i+2]);
812  R2 = textToFloat(argv[i+3]);
814  // Crown mask ...........................................................
815  }
816  else if (strcmp(argv[i+1], "crown") == 0)
817  {
818  if (i + 3 >= argc)
819  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: crown mask needs two radii");
820  if (!(allowed_data_types & INT_MASK))
821  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
822  R1 = textToFloat(argv[i+2]);
823  R2 = textToFloat(argv[i+3]);
824  if (R1 < 0 && R2 < 0)
825  {
826  mode = INNER_MASK;
827  R1 = ABS(R1);
828  R2 = ABS(R2);
829  }
830  else if (R1 > 0 && R2 > 0)
831  mode = OUTSIDE_MASK;
832  else
833  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for crown");
835  // Cylinder mask ........................................................
836  }
837  else if (strcmp(argv[i+1], "cylinder") == 0)
838  {
839  if (i + 3 >= argc)
840  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: cylinder mask needs a radius and a height");
841  if (!(allowed_data_types & INT_MASK))
842  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
843  R1 = textToFloat(argv[i+2]);
844  H = textToFloat(argv[i+3]);
845  if (R1 < 0 && H < 0)
846  {
847  mode = INNER_MASK;
848  R1 = ABS(R1);
849  H = ABS(H);
850  }
851  else if (R1 > 0 && H > 0)
852  mode = OUTSIDE_MASK;
853  else
854  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for cylinder");
856  // Gaussian mask ........................................................
857  }
858  else if (strcmp(argv[i+1], "tube") == 0)
859  {
860  if (i + 4 >= argc)
861  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: tube mask needs two radii and a height");
862  if (!(allowed_data_types & INT_MASK))
863  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
864  R1 = textToFloat(argv[i+2]);
865  R2 = textToFloat(argv[i+3]);
866  H = textToFloat(argv[i+4]);
867  if (R1 < 0 && R2 < 0 && H<0)
868  {
869  mode = INNER_MASK;
870  R1 = ABS(R1);
871  R2 = ABS(R2);
872  H=ABS(H);
873  }
874  else if (R1 > 0 && R2 > 0 && H>0)
875  mode = OUTSIDE_MASK;
876  else
877  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for crown");
878  type = BINARY_TUBE;
879  // Cylinder mask ........................................................
880  }
881  else if (strcmp(argv[i+1], "gaussian") == 0)
882  {
883  if (i + 2 >= argc)
884  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: gaussian mask needs a sigma");
886  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: continuous masks are not allowed");
887  sigma = textToFloat(argv[i+2]);
888  if (sigma < 0)
889  {
890  mode = INNER_MASK;
891  sigma = ABS(sigma);
892  }
893  else
894  mode = OUTSIDE_MASK;
896  // Raised cosine mask ...................................................
897  }
898  else if (strcmp(argv[i+1], "raised_cosine") == 0)
899  {
900  if (i + 3 >= argc)
901  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: raised_cosine mask needs two radii");
902  if (!(allowed_data_types & INT_MASK))
903  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: continuous masks are not allowed");
904  R1 = textToFloat(argv[i+2]);
905  R2 = textToFloat(argv[i+3]);
906  if (R1 < 0 && R2 < 0)
907  {
908  mode = INNER_MASK;
909  R1 = ABS(R1);
910  R2 = ABS(R2);
911  }
912  else if (R1 > 0 && R2 > 0)
913  mode = OUTSIDE_MASK;
914  else
915  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for raised_cosine");
917  // Raised crown mask ....................................................
918  }
919  else if (strcmp(argv[i+1], "raised_crown") == 0)
920  {
921  if (i + 4 >= argc)
922  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: raised_crown mask needs two radii & a width");
923  if (!(allowed_data_types & INT_MASK))
924  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: continuous masks are not allowed");
925  R1 = textToFloat(argv[i+2]);
926  R2 = textToFloat(argv[i+3]);
927  pix_width = textToFloat(argv[i+4]);
928  if (R1 < 0 && R2 < 0)
929  {
930  mode = INNER_MASK;
931  R1 = ABS(R1);
932  R2 = ABS(R2);
933  }
934  else if (R1 > 0 && R2 > 0)
935  mode = OUTSIDE_MASK;
936  else
937  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for raised_cosine");
939  // Blob circular mask ....................................................
940  }
941  else if (strcmp(argv[i+1], "blob_circular") == 0)
942  {
943  if (i + 3 >= argc)
944  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: blob_circular mask needs one radius and a width");
945  if (!(allowed_data_types & INT_MASK))
946  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: continuous masks are not allowed");
947  R1 = textToFloat(argv[i+2]);
948  double aux = textToFloat(argv[i+3]);
949  blob_radius= ABS(aux);
950  if (aux < 0)
951  mode = INNER_MASK;
952  else if (aux > 0)
953  mode = OUTSIDE_MASK;
954  else
955  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for blob_circular");
957  blob_order= textToInteger(getParameter(argc, argv, "-m", "2"));
958  blob_alpha= textToFloat(getParameter(argc, argv, "-a", "10.4"));
959 
960  // Raised crown mask ....................................................
961  }
962  else if (strcmp(argv[i+1], "blob_crown") == 0)
963  {
964  if (i + 4 >= argc)
965  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: blob_crown mask needs two radii and a with");
966  if (!(allowed_data_types & INT_MASK))
967  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: continuous masks are not allowed");
968  R1 = textToFloat(argv[i+2]);
969  R2 = textToFloat(argv[i+3]);
970  double aux = textToFloat(argv[i+4]);
971  blob_radius= ABS(aux);
972  if (aux < 0)
973  mode = INNER_MASK;
974  else if (aux > 0)
975  mode = OUTSIDE_MASK;
976  else
977  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for blob_crown");
979  blob_order= textToInteger(getParameter(argc, argv, "-m", "2"));
980  blob_alpha= textToFloat(getParameter(argc, argv, "-a", "10.4"));
981 
982  // Blackman mask ........................................................
983  }
984  else if (strcmp(argv[i+1], "blackman") == 0)
985  {
986  mode = INNER_MASK;
988  // Sinc mask ............................................................
989  }
990  else if (strcmp(argv[i+1], "sinc") == 0)
991  {
992  if (i + 2 >= argc)
993  REPORT_ERROR(ERR_ARG_MISSING, "MaskProgram: sinc mask needs a frequency");
994  if (!(allowed_data_types & INT_MASK))
995  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
996  omega = textToFloat(argv[i+2]);
997  if (omega < 0)
998  {
999  mode = INNER_MASK;
1000  omega = ABS(omega);
1001  }
1002  else
1003  mode = OUTSIDE_MASK;
1004  type = SINC_MASK;
1005  }
1006  else if (strcmp(argv[i+1], "binary_file") == 0)
1007  {
1008  fn_mask = argv[i+2];
1010  }
1011  else if (strcmp(argv[i+1], "real_file") == 0)
1012  {
1013  fn_mask = argv[i+2];
1014  type = READ_REAL_MASK;
1015  }
1016  else
1017  REPORT_ERROR(ERR_ARG_INCORRECT,"Incorrect mask type");
1018 }
Argument missing.
Definition: xmipp_error.h:114
double z0
Definition: mask.h:462
Just to locate unclassified errors.
Definition: xmipp_error.h:192
int smin
Definition: mask.h:474
#define BINARY_TUBE
Definition: mask.h:383
#define BLACKMAN_MASK
Definition: mask.h:371
int Xrect
Definition: mask.h:451
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
FileName fn_mask
Definition: mask.h:487
double R2
Definition: mask.h:418
int smax
Definition: mask.h:478
#define BINARY_CROWN_MASK
Definition: mask.h:366
#define BLOB_CROWN_MASK
Definition: mask.h:382
#define RAISED_COSINE_MASK
Definition: mask.h:370
#define BINARY_CYLINDER_MASK
Definition: mask.h:367
double sigma
Definition: mask.h:442
int allowed_data_types
Definition: mask.h:495
#define BINARY_FRAME_MASK
Definition: mask.h:368
#define SINC_MASK
Definition: mask.h:372
int paremeterPosition(int argc, const char **argv, const char *param)
Definition: args.cpp:111
double H
Definition: mask.h:437
#define i
double blob_alpha
Definition: mask.h:432
#define RAISED_CROWN_MASK
Definition: mask.h:376
#define BINARY_CONE_MASK
Definition: mask.h:379
const char * getParameter(int argc, const char **argv, const char *param, const char *option)
Definition: args.cpp:30
double y0
Definition: mask.h:466
#define READ_BINARY_MASK
Definition: mask.h:374
#define READ_REAL_MASK
Definition: mask.h:375
float textToFloat(const char *str)
Incorrect argument received.
Definition: xmipp_error.h:113
double R1
Definition: mask.h:413
#define DOUBLE_MASK
Definition: mask.h:386
double x0
Definition: mask.h:470
int type
Definition: mask.h:402
#define ABS(x)
Definition: xmipp_macros.h:142
int Yrect
Definition: mask.h:455
std::string quadrant
Definition: mask.h:483
double omega
Definition: mask.h:447
#define BINARY_DWT_CIRCULAR_MASK
Definition: mask.h:377
#define BLOB_CIRCULAR_MASK
Definition: mask.h:381
double pix_width
Definition: mask.h:423
#define GAUSSIAN_MASK
Definition: mask.h:369
int Zrect
Definition: mask.h:459
#define BINARY_CIRCULAR_MASK
Definition: mask.h:365
int blob_order
Definition: mask.h:428
#define INT_MASK
Definition: mask.h:385
double blob_radius
Definition: mask.h:431
int textToInteger(const char *str)
constexpr int OUTSIDE_MASK
Definition: mask.h:48
#define BINARY_WEDGE_MASK
Definition: mask.h:380
void clear()
Definition: mask.cpp:641
int mode
Definition: mask.h:407
constexpr int INNER_MASK
Definition: mask.h:47

◆ readParams()

void Mask::readParams ( XmippProgram program)

Definition at line 1284 of file mask.cpp.

1285 {
1286  x0 = y0 = z0 = 0;
1287  x0 = program->getDoubleParam("--center",0);
1288  y0 = program->getDoubleParam("--center",1);
1289  z0 = program->getDoubleParam("--center",2);
1290  mask_type = program->getParam("--mask");
1291 
1292  /* Circular mask ........................................................*/
1293  if (mask_type == "circular")
1294  {
1295  if (!(allowed_data_types & INT_MASK))
1296  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
1297  R1 = program->getDoubleParam("--mask","circular");
1298  if (R1 < 0)
1299  {
1301  R1 = ABS(R1);
1302  }
1303  else if (R1 > 0)
1305  else
1306  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: circular mask with radius 0");
1308  }
1309  /*// Circular DWT mask ....................................................*/
1310  else if (mask_type == "DWT_circular")
1311  {
1312  if (!(allowed_data_types & INT_MASK))
1313  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
1314  R1 = program->getDoubleParam("--mask","DWT_circular",0);
1315  smin = program->getIntParam("--mask","DWT_circular",1);
1316  smax = program->getIntParam("--mask","DWT_circular",2);
1317  quadrant = program->getParam("--mask","DWT_circular",3);
1319  }
1320  /*// Rectangular mask .....................................................*/
1321  else if (mask_type == "rectangular")
1322  {
1323  if (!(allowed_data_types & INT_MASK))
1324  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
1325  Xrect = program->getIntParam("--mask","rectangular",0);
1326  Yrect = program->getIntParam("--mask","rectangular",1);
1327  Zrect = program->getIntParam("--mask","rectangular",2);
1328  if (Xrect < 0 && Yrect < 0 && Zrect <= 1)
1329  {
1331  Xrect = ABS(Xrect);
1332  Yrect = ABS(Yrect);
1333  Zrect = ABS(Zrect);
1334  }
1335  else if (Xrect > 0 && Yrect > 0 && Zrect >= -1)
1337  else
1338  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for rectangle");
1340  }
1341  /*// Cone mask ............................................................*/
1342  else if (mask_type == "cone")
1343  {
1344  if (!(allowed_data_types & INT_MASK))
1345  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
1346  R1 = program->getDoubleParam("--mask","cone");
1347  if (R1 < 0)
1348  {
1350  R1 = ABS(R1);
1351  }
1352  else
1355  }
1356  /*// Wedge mask ............................................................*/
1357  else if (mask_type == "wedge")
1358  {
1360  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
1361  R1 = program->getDoubleParam("--mask","wedge",0);
1362  R2 = program->getDoubleParam("--mask","wedge",1);
1364  }
1365  /*// Crown mask ...........................................................*/
1366  else if (mask_type == "crown")
1367  {
1368  if (!(allowed_data_types & INT_MASK))
1369  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
1370 
1371  R1 = program->getDoubleParam("--mask","crown",0);
1372  R2 = program->getDoubleParam("--mask","crown",1);
1373 
1374  if (R1 < 0 && R2 < 0)
1375  {
1377  R1 = ABS(R1);
1378  R2 = ABS(R2);
1379  }
1380  else if (R1 > 0 && R2 > 0)
1382  else
1383  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for crown");
1384 
1386  }
1387  /*// Cylinder mask ........................................................*/
1388  else if (mask_type == "cylinder")
1389  {
1390  if (!(allowed_data_types & INT_MASK))
1391  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
1392 
1393  R1 = program->getDoubleParam("--mask","cylinder",0);
1394  H = program->getDoubleParam("--mask","cylinder",1);
1395 
1396  if (R1 < 0 && H < 0)
1397  {
1399  R1 = ABS(R1);
1400  H = ABS(H);
1401  }
1402  else if (R1 > 0 && H > 0)
1404  else
1405  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for cylinder");
1406 
1408  }
1409  /*// Crown mask ...........................................................*/
1410  else if (mask_type == "tube")
1411  {
1412  if (!(allowed_data_types & INT_MASK))
1413  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
1414 
1415  R1 = program->getDoubleParam("--mask","tube",0);
1416  R2 = program->getDoubleParam("--mask","tube",1);
1417  H = program->getDoubleParam("--mask","tube",2);
1418 
1419  if (R1 < 0 && R2 < 0 && H<0)
1420  {
1422  R1 = ABS(R1);
1423  R2 = ABS(R2);
1424  H=ABS(H);
1425  }
1426  else if (R1 > 0 && R2 > 0 && H>0)
1428  else
1429  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for tube");
1430 
1431  type = BINARY_TUBE;
1432  }
1433  /*// Gaussian mask ........................................................*/
1434  else if (mask_type == "gaussian")
1435  {
1436  if (!(allowed_data_types & DOUBLE_MASK))
1437  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: continuous masks are not allowed");
1438 
1439  sigma = program->getDoubleParam("--mask","gaussian");
1440 
1441  if (sigma < 0)
1442  {
1444  sigma = ABS(sigma);
1445  }
1446  else
1448 
1449  type = GAUSSIAN_MASK;
1450  }
1451  /*// Raised cosine mask ...................................................*/
1452  else if (mask_type == "raised_cosine")
1453  {
1454  if (!(allowed_data_types & INT_MASK))
1455  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: continuous masks are not allowed");
1456 
1457  R1 = program->getDoubleParam("--mask","raised_cosine",0);
1458  R2 = program->getDoubleParam("--mask","raised_cosine",1);
1459 
1460  if (R1 < 0 && R2 < 0)
1461  {
1463  R1 = ABS(R1);
1464  R2 = ABS(R2);
1465  }
1466  else if (R1 > 0 && R2 > 0)
1468  else
1469  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for raised_cosine");
1470 
1472  }
1473  /*// Raised crown mask ....................................................*/
1474  else if (mask_type == "raised_crown")
1475  {
1476  if (!(allowed_data_types & INT_MASK))
1477  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: continuous masks are not allowed");
1478 
1479  R1 = program->getDoubleParam("--mask","raised_crown",0);
1480  R2 = program->getDoubleParam("--mask","raised_crown",1);
1481  pix_width = program->getDoubleParam("--mask","raised_crown",2);
1482 
1483  if (R1 < 0 && R2 < 0)
1484  {
1486  R1 = ABS(R1);
1487  R2 = ABS(R2);
1488  }
1489  else if (R1 > 0 && R2 > 0)
1491  else
1492  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for raised_cosine");
1493 
1495  }
1496  /*// Blob circular mask ....................................................*/
1497  else if (mask_type == "blob_circular")
1498  {
1499  if (!(allowed_data_types & INT_MASK))
1500  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: continuous masks are not allowed");
1501 
1502  R1 = program->getDoubleParam("--mask","blob_circular",0);
1503  double aux = program->getDoubleParam("--mask","blob_circular",1);
1504  blob_radius= ABS(aux);
1505 
1506  if (aux < 0)
1508  else if (aux > 0)
1510  else
1511  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for blob_circular");
1512 
1514  blob_order= program->getIntParam("-m");
1515  blob_alpha= program->getIntParam("-a");
1516  }
1517  /*// Raised crown mask ....................................................*/
1518  else if (mask_type == "blob_crown")
1519  {
1520  if (!(allowed_data_types & INT_MASK))
1521  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: continuous masks are not allowed");
1522 
1523  R1 = program->getDoubleParam("--mask","blob_crown",0);
1524  R2 = program->getDoubleParam("--mask","blob_crown",1);
1525  double aux = program->getDoubleParam("--mask","blob_crown",2);
1526  blob_radius= ABS(aux);
1527 
1528  if (aux < 0)
1530  else if (aux > 0)
1532  else
1533  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: cannot determine mode for blob_crown");
1534 
1536  blob_order= program->getIntParam("-m");
1537  blob_alpha= program->getDoubleParam("-a");
1538  }
1539  /*// Blackman mask ........................................................*/
1540  else if (mask_type == "blackman")
1541  {
1543  type = BLACKMAN_MASK;
1544  }
1545  /*// Sinc mask ............................................................*/
1546  else if (mask_type == "sinc")
1547  {
1548  if (!(allowed_data_types & INT_MASK))
1549  REPORT_ERROR(ERR_ARG_INCORRECT, "MaskProgram: binary masks are not allowed");
1550 
1551  omega = program->getDoubleParam("--mask","sinc");
1552 
1553  if (omega < 0)
1554  {
1556  omega = ABS(omega);
1557  }
1558  else
1560 
1561  type = SINC_MASK;
1562  }
1563  else if (mask_type == "binary_file")
1564  {
1565  fn_mask = program->getParam("--mask","binary_file");
1567  }
1568  else if (mask_type == "real_file")
1569  {
1570  fn_mask = program->getParam("--mask","real_file");
1571  type = READ_REAL_MASK;
1572  }
1573  else
1574  REPORT_ERROR(ERR_DEBUG_IMPOSIBLE,"You should never see this meessage, Mask::readParams ");
1575 }
double z0
Definition: mask.h:462
double getDoubleParam(const char *param, int arg=0)
int smin
Definition: mask.h:474
#define BINARY_TUBE
Definition: mask.h:383
#define BLACKMAN_MASK
Definition: mask.h:371
int Xrect
Definition: mask.h:451
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
FileName fn_mask
Definition: mask.h:487
double R2
Definition: mask.h:418
int smax
Definition: mask.h:478
Just for debugging, situation that can&#39;t happens.
Definition: xmipp_error.h:120
#define BINARY_CROWN_MASK
Definition: mask.h:366
#define BLOB_CROWN_MASK
Definition: mask.h:382
#define RAISED_COSINE_MASK
Definition: mask.h:370
#define BINARY_CYLINDER_MASK
Definition: mask.h:367
double sigma
Definition: mask.h:442
int allowed_data_types
Definition: mask.h:495
#define BINARY_FRAME_MASK
Definition: mask.h:368
#define SINC_MASK
Definition: mask.h:372
double H
Definition: mask.h:437
double blob_alpha
Definition: mask.h:432
#define RAISED_CROWN_MASK
Definition: mask.h:376
#define BINARY_CONE_MASK
Definition: mask.h:379
const char * getParam(const char *param, int arg=0)
double y0
Definition: mask.h:466
#define READ_BINARY_MASK
Definition: mask.h:374
#define READ_REAL_MASK
Definition: mask.h:375
Incorrect argument received.
Definition: xmipp_error.h:113
double R1
Definition: mask.h:413
#define DOUBLE_MASK
Definition: mask.h:386
double x0
Definition: mask.h:470
int type
Definition: mask.h:402
#define ABS(x)
Definition: xmipp_macros.h:142
int Yrect
Definition: mask.h:455
std::string quadrant
Definition: mask.h:483
double omega
Definition: mask.h:447
#define BINARY_DWT_CIRCULAR_MASK
Definition: mask.h:377
#define BLOB_CIRCULAR_MASK
Definition: mask.h:381
std::string mask_type
Definition: mask.h:507
double pix_width
Definition: mask.h:423
#define GAUSSIAN_MASK
Definition: mask.h:369
int Zrect
Definition: mask.h:459
#define BINARY_CIRCULAR_MASK
Definition: mask.h:365
int blob_order
Definition: mask.h:428
#define INT_MASK
Definition: mask.h:385
double blob_radius
Definition: mask.h:431
constexpr int OUTSIDE_MASK
Definition: mask.h:48
int getIntParam(const char *param, int arg=0)
#define BINARY_WEDGE_MASK
Definition: mask.h:380
int mode
Definition: mask.h:407
constexpr int INNER_MASK
Definition: mask.h:47

◆ resize() [1/4]

void Mask::resize ( size_t  Xdim)

Resize and set Xmipp origin

Definition at line 654 of file mask.cpp.

655 {
656  switch (datatype())
657  {
658  case INT_MASK:
659  imask.resize(Xdim);
661  break;
662  case DOUBLE_MASK:
663  dmask.resize(Xdim);
665  break;
666  }
667 }
void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)
MultidimArray< double > dmask
Definition: mask.h:503
#define DOUBLE_MASK
Definition: mask.h:386
int datatype()
Definition: mask.h:544
#define INT_MASK
Definition: mask.h:385
MultidimArray< int > imask
Definition: mask.h:499

◆ resize() [2/4]

void Mask::resize ( size_t  Ydim,
size_t  Xdim 
)

Resize and set Xmipp origin

Definition at line 669 of file mask.cpp.

670 {
671  switch (datatype())
672  {
673  case INT_MASK:
674  imask.resize(Ydim, Xdim);
676  break;
677  case DOUBLE_MASK:
678  dmask.resize(Ydim, Xdim);
680  break;
681  }
682 }
void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)
MultidimArray< double > dmask
Definition: mask.h:503
#define DOUBLE_MASK
Definition: mask.h:386
int datatype()
Definition: mask.h:544
#define INT_MASK
Definition: mask.h:385
MultidimArray< int > imask
Definition: mask.h:499

◆ resize() [3/4]

void Mask::resize ( size_t  Zdim,
size_t  Ydim,
size_t  Xdim 
)

Resize and set Xmipp origin

Definition at line 684 of file mask.cpp.

685 {
686  switch (datatype())
687  {
688  case INT_MASK:
689  imask.resize(Zdim, Ydim, Xdim);
691  break;
692  case DOUBLE_MASK:
693  dmask.resize(Zdim, Ydim, Xdim);
695  break;
696  }
697 }
void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)
MultidimArray< double > dmask
Definition: mask.h:503
#define DOUBLE_MASK
Definition: mask.h:386
int datatype()
Definition: mask.h:544
#define INT_MASK
Definition: mask.h:385
MultidimArray< int > imask
Definition: mask.h:499

◆ resize() [4/4]

template<typename T >
void Mask::resize ( const MultidimArray< T > &  m)
inline

Resize after a pattern

Definition at line 578 of file mask.h.

579  {
580  switch (datatype())
581  {
582  case INT_MASK:
583  imask.resizeNoCopy(m);
584  break;
585 
586  case DOUBLE_MASK:
587  dmask.resizeNoCopy(m);
588  break;
589  }
590  }
void resizeNoCopy(const MultidimArray< T1 > &v)
MultidimArray< double > dmask
Definition: mask.h:503
#define DOUBLE_MASK
Definition: mask.h:386
int datatype()
Definition: mask.h:544
#define INT_MASK
Definition: mask.h:385
MultidimArray< int > imask
Definition: mask.h:499

◆ set_binary_mask()

void Mask::set_binary_mask ( MultidimArray< int > &  _imask)
inline

Set binary mask

Definition at line 721 of file mask.h.

722  {
723  imask = _imask;
724  }
MultidimArray< int > imask
Definition: mask.h:499

◆ set_cont_mask()

void Mask::set_cont_mask ( MultidimArray< double > &  _dmask)
inline

Set continuous mask

Definition at line 742 of file mask.h.

743  {
744  dmask = _dmask;
745  }
MultidimArray< double > dmask
Definition: mask.h:503

◆ show()

void Mask::show ( ) const

Read parametersShow

Definition at line 1021 of file mask.cpp.

1022 {
1023 #define SHOW_MODE \
1024  if (mode==INNER_MASK) std::cout << " mode=INNER MASK\n"; \
1025  else std::cout << " mode=OUTER MASK\n";
1026 #define SHOW_CENTER \
1027  std::cout << " (x0,y0,z0)=(" << x0 << "," << y0 << "," << z0 << ")\n";
1028  switch (type)
1029  {
1030  case NO_MASK:
1031  std::cout << "Mask type: No mask\n";
1032  break;
1033  case BINARY_CIRCULAR_MASK:
1034  std::cout << "Mask type: Binary circular\n"
1035  << " R=" << R1 << std::endl;
1036  SHOW_MODE;
1037  SHOW_CENTER;
1038  break;
1040  std::cout << "Mask type: Binary DWT circular\n"
1041  << " R=" << R1 << std::endl
1042  << " smin=" << smin << std::endl
1043  << " smax=" << smax << std::endl
1044  << " quadrant=" << quadrant << std::endl;
1045  break;
1046  case BINARY_CROWN_MASK:
1047  std::cout << "Mask type: Binary crown\n"
1048  << " R1=" << R1 << std::endl
1049  << " R2=" << R2 << std::endl;
1050  SHOW_MODE;
1051  SHOW_CENTER;
1052  break;
1053  case BINARY_CYLINDER_MASK:
1054  std::cout << "Mask type: Cylinder\n"
1055  << " R1=" << R1 << std::endl
1056  << " H=" << H << std::endl;
1057  SHOW_MODE;
1058  SHOW_CENTER;
1059  break;
1060  case BINARY_TUBE:
1061  std::cout << "Mask type: Tube\n"
1062  << " R1=" << R1 << std::endl
1063  << " R2=" << R2 << std::endl
1064  << " H=" << H << std::endl;
1065  SHOW_MODE;
1066  SHOW_CENTER;
1067  break;
1068  case BINARY_FRAME_MASK:
1069  std::cout << "Mask type: Frame\n"
1070  << " Xrect=" << Xrect << std::endl
1071  << " Yrect=" << Yrect << std::endl;
1072  SHOW_MODE;
1073  SHOW_CENTER;
1074  break;
1075  case GAUSSIAN_MASK:
1076  std::cout << "Mask type: Gaussian\n"
1077  << " sigma=" << sigma << std::endl;
1078  SHOW_MODE;
1079  SHOW_CENTER;
1080  break;
1081  case RAISED_COSINE_MASK:
1082  std::cout << "Mask type: Raised cosine\n"
1083  << " R1=" << R1 << std::endl
1084  << " R2=" << R2 << std::endl;
1085  SHOW_MODE;
1086  SHOW_CENTER;
1087  break;
1088  case RAISED_CROWN_MASK:
1089  std::cout << "Mask type: Raised crown\n"
1090  << " R1=" << R1 << std::endl
1091  << " R2=" << R2 << std::endl
1092  << " pixwidth=" << pix_width << std::endl;
1093  SHOW_MODE;
1094  SHOW_CENTER;
1095  break;
1096  case BLOB_CIRCULAR_MASK:
1097  std::cout << "Mask type: Blob circular\n"
1098  << " R1=" << R1 << std::endl
1099  << " blob radius=" << blob_radius << std::endl
1100  << " blob order=" << blob_order << std::endl
1101  << " blob alpha=" << blob_alpha << std::endl;
1102  SHOW_MODE;
1103  SHOW_CENTER;
1104  break;
1105  case BLOB_CROWN_MASK:
1106  std::cout << "Mask type: Blob crown\n"
1107  << " R1=" << R1 << std::endl
1108  << " R2=" << R2 << std::endl
1109  << " blob radius=" << blob_radius << std::endl
1110  << " blob order=" << blob_order << std::endl
1111  << " blob alpha=" << blob_alpha << std::endl;
1112  SHOW_MODE;
1113  SHOW_CENTER;
1114  break;
1115  case BLACKMAN_MASK:
1116  std::cout << "Mask type: Blackman\n";
1117  SHOW_MODE;
1118  SHOW_CENTER;
1119  break;
1120  case SINC_MASK:
1121  std::cout << "Mask type: Sinc\n"
1122  << " w=" << omega << std::endl;
1123  SHOW_MODE;
1124  SHOW_CENTER;
1125  break;
1126  default:
1127  std::cout << "Mask type: Read from disk\n"
1128  << " File=" << fn_mask << std::endl;
1129  break;
1130  }
1131 }
int smin
Definition: mask.h:474
#define BINARY_TUBE
Definition: mask.h:383
#define BLACKMAN_MASK
Definition: mask.h:371
int Xrect
Definition: mask.h:451
FileName fn_mask
Definition: mask.h:487
double R2
Definition: mask.h:418
int smax
Definition: mask.h:478
#define BINARY_CROWN_MASK
Definition: mask.h:366
#define BLOB_CROWN_MASK
Definition: mask.h:382
#define RAISED_COSINE_MASK
Definition: mask.h:370
#define BINARY_CYLINDER_MASK
Definition: mask.h:367
double sigma
Definition: mask.h:442
#define BINARY_FRAME_MASK
Definition: mask.h:368
#define SINC_MASK
Definition: mask.h:372
#define NO_MASK
Definition: mask.h:364
double H
Definition: mask.h:437
#define SHOW_CENTER
double blob_alpha
Definition: mask.h:432
#define RAISED_CROWN_MASK
Definition: mask.h:376
double R1
Definition: mask.h:413
int type
Definition: mask.h:402
#define SHOW_MODE
int Yrect
Definition: mask.h:455
std::string quadrant
Definition: mask.h:483
double omega
Definition: mask.h:447
#define BINARY_DWT_CIRCULAR_MASK
Definition: mask.h:377
#define BLOB_CIRCULAR_MASK
Definition: mask.h:381
double pix_width
Definition: mask.h:423
#define GAUSSIAN_MASK
Definition: mask.h:369
#define BINARY_CIRCULAR_MASK
Definition: mask.h:365
int blob_order
Definition: mask.h:428
double blob_radius
Definition: mask.h:431

◆ usage()

void Mask::usage ( ) const

Usage

Definition at line 1134 of file mask.cpp.

1135 {
1136  std::cerr << "Mask usage:\n";
1137  std::cerr << " [-center <x0=0> <y0=0> <z0=0>]: Center of the mask\n";
1139  std::cerr << " [-mask circular <R> : circle/sphere mask\n"
1140  << " if R>0 => outside R\n"
1141  << " if R<0 => inside R\n"
1142  << " [-mask DWT_circular <R> <smin> <smax>: circle/sphere mask\n"
1143  << " smin and smax define the scales\n"
1144  << " to be kept\n"
1145  << " |-mask rectangular <Xrect> <Yrect> [<Zrect>]: 2D or 3D rectangle\n"
1146  << " if X,Y,Z > 0 => outside rectangle\n"
1147  << " if X,Y,Z < 0 => inside rectangle\n"
1148  << " |-mask crown <R1> <R2> : 2D or 3D crown\n"
1149  << " if R1,R2 > 0 => outside crown\n"
1150  << " if R1,R2 < 0 => inside crown\n"
1151  << " |-mask cylinder <R> <H> : 2D circle or 3D cylinder\n"
1152  << " if R,H > 0 => outside cylinder\n"
1153  << " if R,H < 0 => inside cylinder\n"
1154  << " |-mask tube <R1> <R2> <H> : 2D or 3D tube\n"
1155  << " if R1,R2,H > 0 => outside tube\n"
1156  << " if R1,R2,H < 0 => inside tube\n"
1157  << " |-mask cone <theta> : 3D cone (parallel to Z) \n"
1158  << " if theta > 0 => outside cone\n"
1159  << " if theta < 0 => inside cone\n"
1160  << " |-mask wedge <th0> <thF> : 3D missing-wedge mask for data \n"
1161  << " collected between tilting angles \n"
1162  << " th0 and thF (around the Y-axis) \n"
1163  << " |-mask <binary file> : Read from file\n"
1164  ;
1166  std::cerr << " |-mask gaussian <sigma> : 2D or 3D gaussian\n"
1167  << " if sigma > 0 => outside gaussian\n"
1168  << " if sigma < 0 => inside gaussian\n"
1169  << " |-mask raised_cosine <R1> <R2>: 2D or 3D raised_cosine\n"
1170  << " if R1,R2 > 0 => outside sphere\n"
1171  << " if R1,R2 < 0 => inside sphere\n"
1172  << " |-mask raised_crown <R1> <R2> <pixwidth>: 2D or 3D raised_crown\n"
1173  << " if R1,R2 > 0 => outside crown\n"
1174  << " if R1,R2 < 0 => inside crown\n"
1175  << " |-mask blob_circular <R1> <blob_radius>: 2D or 3D blob circular\n"
1176  << " if blob_radius > 0 => outside blob\n"
1177  << " if blob_radius < 0 => inside blob\n"
1178  << " |-mask blob_crown <R1> <R2> <blob_radius>: 2D or 3D blob_crown\n"
1179  << " if blob_radius > 0 => outside crown\n"
1180  << " if blob_radius < 0 => inside crown\n"
1181  << " [ -m <blob_order=2> : Order of blob\n"
1182  << " [ -a <blob_alpha=10.4> : Alpha of blob\n"
1183  << " |-mask blackman : 2D or 3D Blackman mask\n"
1184  << " always inside blackman\n"
1185  << " |-mask sinc <w>] : 2D or 3D sincs\n"
1186  << " if w > 0 => outside sinc\n"
1187  << " if w < 0 => inside sinc\n"
1188  ;
1189 }
int allowed_data_types
Definition: mask.h:495
#define DOUBLE_MASK
Definition: mask.h:386
#define INT_MASK
Definition: mask.h:385

◆ write_mask()

void Mask::write_mask ( const FileName fn)

Save mask as an image

Definition at line 1192 of file mask.cpp.

1193 {
1194  Image<double> img;
1195  if (datatype() == INT_MASK)
1196  typeCast(imask, img());
1197  else if (datatype() == DOUBLE_MASK)
1198  img()=dmask;
1199  img.write(fn);
1200 }
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)
MultidimArray< double > dmask
Definition: mask.h:503
#define DOUBLE_MASK
Definition: mask.h:386
void typeCast(const Matrix1D< T1 > &v1, Matrix1D< T2 > &v2)
Definition: matrix1d.h:1227
int datatype()
Definition: mask.h:544
#define INT_MASK
Definition: mask.h:385
MultidimArray< int > imask
Definition: mask.h:499

Member Data Documentation

◆ allowed_data_types

int Mask::allowed_data_types

Allowed data types.

Definition at line 495 of file mask.h.

◆ blob_alpha

double Mask::blob_alpha

Definition at line 432 of file mask.h.

◆ blob_order

int Mask::blob_order

Blob parameters For blob_circular and blob_crown masks.

Definition at line 428 of file mask.h.

◆ blob_radius

double Mask::blob_radius

Blob parameters

Definition at line 431 of file mask.h.

◆ dmask

MultidimArray< double > Mask::dmask

double mask

Definition at line 503 of file mask.h.

◆ fn_mask

FileName Mask::fn_mask

Filename from which the mask is read, if it is the case

Definition at line 487 of file mask.h.

◆ H

double Mask::H

Height Height for cylinders.

Definition at line 437 of file mask.h.

◆ imask

MultidimArray< int > Mask::imask

integer mask

Definition at line 499 of file mask.h.

◆ mask_geo

Matrix2D< double > Mask::mask_geo

Geometrix transformation matrix for the mask

Definition at line 491 of file mask.h.

◆ mask_type

std::string Mask::mask_type

Mask type

Definition at line 507 of file mask.h.

◆ mode

int Mask::mode

Mode The valid modes are INNER_MASK and OUTSIDE_MASK.

Definition at line 407 of file mask.h.

◆ omega

double Mask::omega

Omega Frequency for sincs

Definition at line 447 of file mask.h.

◆ pix_width

double Mask::pix_width

Pixel width For raised crowns.

Definition at line 423 of file mask.h.

◆ quadrant

std::string Mask::quadrant

Quadrant If it is empty then all, except 000, are generated.

Definition at line 483 of file mask.h.

◆ R1

double Mask::R1

Radius 1 Radius for Circular and Cylinder masks and R1 for crowns and raised cosine.

Definition at line 413 of file mask.h.

◆ R2

double Mask::R2

Radius 2 R2 for crowns and raised cosine.

Definition at line 418 of file mask.h.

◆ sigma

double Mask::sigma

Sigma Sigma for gaussians.

Definition at line 442 of file mask.h.

◆ smax

int Mask::smax

Maximum scale for DWT masks

Definition at line 478 of file mask.h.

◆ smin

int Mask::smin

Minimum scale for DWT masks

Definition at line 474 of file mask.h.

◆ type

int Mask::type

Mask Type

The only valid types are BINARY_CIRCULAR_MASK, BINARY_CROWN_MASK, BINARY_CYLINDER_MASK, BINARY_FRAME_MASK, GAUSSIAN_MASK, RAISED_COSINE_MASK, BLACKMAN_MASK, SINC_MASK, SINC_BLACKMAN_MASK, READ_MASK, RAISED_CROWN_MASK, BINARY_CONE_MASK, BINARY_WEDGE_MASK, BLOB_CIRCULAR_MASK, BLOB_CROWN_MASK, BINARY_TUBE

Definition at line 402 of file mask.h.

◆ x0

double Mask::x0

X origin

Definition at line 470 of file mask.h.

◆ Xrect

int Mask::Xrect

Rectangular X dimension

Definition at line 451 of file mask.h.

◆ y0

double Mask::y0

Y origin

Definition at line 466 of file mask.h.

◆ Yrect

int Mask::Yrect

Rectangular Y dimension

Definition at line 455 of file mask.h.

◆ z0

double Mask::z0

Z origin

Definition at line 462 of file mask.h.

◆ Zrect

int Mask::Zrect

Rectangular Z dimension

Definition at line 459 of file mask.h.


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