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

#include <phantom.h>

Inheritance diagram for Blob:
Inheritance graph
[legend]
Collaboration diagram for Blob:
Collaboration graph
[legend]

Public Member Functions

void prepare ()
 
void assign (const Blob &F)
 
int point_inside (const Matrix1D< double > &r, Matrix1D< double > &aux) const
 
double density_inside (const Matrix1D< double > &r, Matrix1D< double > &aux) const
 
Featurescale (double factor) const
 
 __attribute__ ((deprecated)) void scale(double factor
 
double intersection (const Matrix1D< double > &direction, const Matrix1D< double > &passing_point, Matrix1D< double > &r, Matrix1D< double > &u) const
 
double volume () const
 
void read_specific (char *line)
 
void read_specific (const std::vector< double > &vect)
 
void feat_printf (FILE *fh) const
 
void feat_printm (MetaData &MD, size_t id)
 
void init_rnd (double minradius, double maxradius, double minalpha, double maxalpha, double minorder, double maxorder, double minden=1.0, double maxden=1.0, double minx0=0, double maxx0=0, double miny0=0, double maxy0=0, double minz0=0, double maxz0=0)
 
- Public Member Functions inherited from Feature
void assign (const Feature &F)
 
virtual void rotate (const Matrix2D< double > &E)
 
virtual void rotate_center (const Matrix2D< double > &E)
 
int point_inside (const Matrix1D< double > &r) const
 
int voxel_inside (const Matrix1D< double > &r, Matrix1D< double > &aux1, Matrix1D< double > &aux2) const
 
int voxel_inside (const Matrix1D< double > &r) const
 
double voxel_inside_by_normalized_density (const Matrix1D< double > &r, Matrix1D< double > &aux1, Matrix1D< double > &aux2) const
 
int intersects_sphere (const Matrix1D< double > &r, double radius, Matrix1D< double > &aux1, Matrix1D< double > &aux2, Matrix1D< double > &aux3) const
 
int intersects_sphere (const Matrix1D< double > &r, double radius) const
 
Featureencircle (double radius=0) const
 
Featurebackground (int back_mode, double back_param) const
 
double intersection (const Matrix1D< double > &direction, const Matrix1D< double > &passing_point) const
 
void mean_variance_in_plane (Image< double > *V, double z, double &mean, double &var)
 
void project_to (Projection &P, const Matrix2D< double > &VP, const Matrix2D< double > &PV) const
 
void corners (const MultidimArray< double > &V, Matrix1D< double > &corner1, Matrix1D< double > &corner2)
 
void draw_in (MultidimArray< double > &V, int color_mode=INTERNAL, double colour=-1)
 
void sketch_in (MultidimArray< double > &V, double colour=2)
 
void shift (double shiftX, double shiftY, double shiftZ)
 
void selfApplyGeometry (const Matrix2D< double > &A)
 
void readCommon (char *line)
 
void readCommon (MDRow &row)
 
void read (MDRow &row)
 

Public Attributes

double radius
 Blob radius. More...
 
double alpha
 Blob alpha. More...
 
int m
 
Feature **_f const
 
- Public Attributes inherited from Feature
std::string type
 
char add_assign
 
double density
 
Matrix1D< double > center
 
double max_distance
 

Friends

std::ostream & operator<< (std::ostream &o, const Blob &f)
 

Detailed Description

Blobs. The blobs are defined by its center, radius, alpha and m (bessel function order). The label is "blo".

A point (r) in the universal coordinate system, where blobs are defined in general, can be expressed (rp) with respect to a system where the blob is centered at the origin and its radius is unity by

V3_MINUS_V3(rp,r,sph.Center);
V3_BY_CT(rp, rp, 1/radius);

Directions (free vectors) are transformed in the same fashion except that for the first vector subtraction (referring to the origin).

Definition at line 563 of file phantom.h.

Member Function Documentation

◆ __attribute__()

Blob::__attribute__ ( (deprecated)  )

Another function for return a scaled Blob.

◆ assign()

void Blob::assign ( const Blob F)

Another function for assignment.

Definition at line 113 of file phantom.cpp.

114 {
115  *this = F;
116 }

◆ density_inside()

double Blob::density_inside ( const Matrix1D< double > &  r,
Matrix1D< double > &  aux 
) const
virtual

Density inside a blob. This function tells you the density of the blob at point r

Implements Feature.

Definition at line 708 of file phantom.cpp.

709 {
710  /*Express r in the feature coord. system*/
711  V3_MINUS_V3(aux, r, center);
712  /*Calculate density*/
713  return (kaiser_value(aux.module(), radius, alpha, m));
714 }
double kaiser_value(double r, double a, double alpha, int m)
Definition: blobs.cpp:37
double module() const
Definition: matrix1d.h:983
#define V3_MINUS_V3(a, b, c)
Definition: matrix1d.h:202
Matrix1D< double > center
Definition: phantom.h:119
int m
Definition: phantom.h:574
double radius
Blob radius.
Definition: phantom.h:570
double alpha
Blob alpha.
Definition: phantom.h:572

◆ feat_printf()

void Blob::feat_printf ( FILE *  fh) const
virtual

Print blob in the standard feature format. \ See {Feature::feat_printf}, Phantoms

Implements Feature.

Definition at line 421 of file phantom.cpp.

422 {
423  fprintf(fh, "blo %c %1.4f % 7.2f % 7.2f % 7.2f % 7.2f"
424  " % 7.2f %1d\n",
426  radius, alpha, m);
427 }
Matrix1D< double > center
Definition: phantom.h:119
double density
Definition: phantom.h:114
char add_assign
Definition: phantom.h:108
int m
Definition: phantom.h:574
double radius
Blob radius.
Definition: phantom.h:570
#define XX(v)
Definition: matrix1d.h:85
#define YY(v)
Definition: matrix1d.h:93
double alpha
Blob alpha.
Definition: phantom.h:572
fprintf(glob_prnt.io, "\)
#define ZZ(v)
Definition: matrix1d.h:101

◆ feat_printm()

void Blob::feat_printm ( MetaData MD,
size_t  id 
)
virtual

Implements Feature.

Definition at line 430 of file phantom.cpp.

431 {
432  std::vector<double> FSVect;
433  FSVect.push_back(radius);
434  FSVect.push_back(alpha);
435  FSVect.push_back(m);
437 }
int m
Definition: phantom.h:574
double radius
Blob radius.
Definition: phantom.h:570
Specific parameters for a feature (vector double)
bool setValue(const MDLabel label, const T &valueIn, size_t id)
double alpha
Blob alpha.
Definition: phantom.h:572

◆ init_rnd()

void Blob::init_rnd ( double  minradius,
double  maxradius,
double  minalpha,
double  maxalpha,
double  minorder,
double  maxorder,
double  minden = 1.0,
double  maxden = 1.0,
double  minx0 = 0,
double  maxx0 = 0,
double  miny0 = 0,
double  maxy0 = 0,
double  minz0 = 0,
double  maxz0 = 0 
)

Generate a random blob. A sphere is generated randomly within the range of the parameters given. Notice that most of them are set by default. The exact parameters are picked uniformly from the range. The maximum distance is adjusted properly according to the randomly generated feature. 'den' stands for density and (x0,y0,z0) is the center of the feature. The behaviour of the new sphere is always Add

Definition at line 1702 of file phantom.cpp.

1710 {
1712  center.resize(3);
1713  type = "blo";
1714  add_assign = '+';
1715  density = rnd_unif(minden, maxden);
1716  XX(center) = rnd_unif(minx0, maxx0);
1717  YY(center) = rnd_unif(miny0, maxy0);
1718  ZZ(center) = rnd_unif(minz0, maxz0);
1719 
1720  radius = rnd_unif(minradius, maxradius);
1721  alpha = rnd_unif(minalpha, maxalpha);
1722  m = (int)(rnd_unif(minorder, maxorder) + 0.5);
1723  max_distance = radius;
1724 }
Matrix1D< double > center
Definition: phantom.h:119
double density
Definition: phantom.h:114
char add_assign
Definition: phantom.h:108
int m
Definition: phantom.h:574
double rnd_unif()
double radius
Blob radius.
Definition: phantom.h:570
#define XX(v)
Definition: matrix1d.h:85
void resize(size_t Xdim, bool copy=true)
Definition: matrix1d.h:410
double max_distance
Definition: phantom.h:126
#define YY(v)
Definition: matrix1d.h:93
double alpha
Blob alpha.
Definition: phantom.h:572
std::string type
Definition: phantom.h:101
unsigned int randomize_random_generator()
#define ZZ(v)
Definition: matrix1d.h:101

◆ intersection()

double Blob::intersection ( const Matrix1D< double > &  direction,
const Matrix1D< double > &  passing_point,
Matrix1D< double > &  r,
Matrix1D< double > &  u 
) const
virtual

Intersection of a ray with a blob. See Feature::intersection to know more about the parameters meaning.

Implements Feature.

Definition at line 1121 of file phantom.cpp.

1126 {
1127  return(kaiser_proj(point_line_distance_3D(center, passing_point, direction),
1128  radius, alpha, m));
1129 }
double point_line_distance_3D(const Matrix1D< double > &p, const Matrix1D< double > &a, const Matrix1D< double > &v)
Definition: geometry.cpp:85
Matrix1D< double > center
Definition: phantom.h:119
int m
Definition: phantom.h:574
double radius
Blob radius.
Definition: phantom.h:570
double alpha
Blob alpha.
Definition: phantom.h:572
double kaiser_proj(double s, double a, double alpha, int m)
Definition: blobs.cpp:94

◆ point_inside()

int Blob::point_inside ( const Matrix1D< double > &  r,
Matrix1D< double > &  aux 
) const
virtual

Speeded up point inside a blob. This function tells you if a point is inside the blob or not. See Feature::point_inside

Implements Feature.

Definition at line 701 of file phantom.cpp.

702 {
704 }
#define DEF_Sph_Blob_point_inside
Definition: phantom.cpp:686

◆ prepare()

void Blob::prepare ( )
virtual

Prepare blob for work. Computes the maximum distance, in this case, equal to "radius"

Implements Feature.

Definition at line 49 of file phantom.cpp.

50 {
52 }
double radius
Blob radius.
Definition: phantom.h:570
double max_distance
Definition: phantom.h:126

◆ read_specific() [1/2]

void Blob::read_specific ( char *  line)

Read specific description for a blob. An exception is thrown if the line doesn't conform the standard specification. See Feature::read_specific

Definition at line 239 of file phantom.cpp.

240 {
241  int stat;
242  stat = sscanf(line, "%*s %*c %*f %*f %*f %*f %lf %lf %d", &radius, &alpha, &m);
243  if (stat != 3)
244  REPORT_ERROR(ERR_IO_NOREAD, (std::string)"Error when reading a blob:" + line);
245  prepare();
246 }
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
int m
Definition: phantom.h:574
double radius
Blob radius.
Definition: phantom.h:570
Couldn&#39;t read from file.
Definition: xmipp_error.h:139
void prepare()
Definition: phantom.cpp:49
double alpha
Blob alpha.
Definition: phantom.h:572

◆ read_specific() [2/2]

void Blob::read_specific ( const std::vector< double > &  vector)
virtual

Read a feature from a file, VIRTUAL!!!. The format must be the one given in Phantoms, and each subclass must implement its own I/O routines. These routines must fill only the non common part of the feature description, but they receive the whole line with the description.

Implements Feature.

Definition at line 248 of file phantom.cpp.

249 {
250  if (vect.size() != 3)
252  radius = vect[0];
253  alpha = vect[1];
254  m = (int)vect[2];
255  prepare();
256 }
Argument missing.
Definition: xmipp_error.h:114
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
int m
Definition: phantom.h:574
double radius
Blob radius.
Definition: phantom.h:570
void prepare()
Definition: phantom.cpp:49
Specific parameters for a feature (vector double)
double alpha
Blob alpha.
Definition: phantom.h:572
static String label2Str(const MDLabel &label)

◆ scale()

void Blob::scale ( double  factor) const
virtual

Return a scaled Blob. The center, density, and behaviour of the new blob is exactly the same as the actual one. The radius is multiplied by the scale factor and the maximum distance is recalculated for the new sphere. Alpha is kept constant

Implements Feature.

Definition at line 1502 of file phantom.cpp.

1503 {
1504  Blob *f;
1505  f = new Blob;
1507 
1508  f->radius = factor * radius;
1509  f->alpha = alpha;
1510  f->m = m;
1511  f->prepare();
1512  return (Feature *)f;
1513 }
Definition: phantom.h:563
int m
Definition: phantom.h:574
#define COPY_COMMON_PART
Definition: phantom.cpp:1473
double radius
Blob radius.
Definition: phantom.h:570
double * f
void prepare()
Definition: phantom.cpp:49
double alpha
Blob alpha.
Definition: phantom.h:572

◆ volume()

double Blob::volume ( ) const
virtual

Mass of a Blob. This function returns mass inside a blob. 3 is the dimension See Feature::volume

Implements Feature.

Definition at line 258 of file phantom.cpp.

259 {
260  return basvolume(radius, alpha, m, 3);
261 }
int m
Definition: phantom.h:574
double radius
Blob radius.
Definition: phantom.h:570
double alpha
Blob alpha.
Definition: phantom.h:572
double basvolume(double a, double alpha, int m, int n)
Definition: blobs.cpp:215

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  o,
const Blob f 
)
friend

Show feature not in the standard format but more informatively. This function only shows the non common part of the feature. Use the << operator of Feature to show the whole feature.

Definition at line 606 of file phantom.cpp.

607 {
608  o << " Radius: " << f.radius << std::endl;
609  o << " Alpha: " << f.alpha << std::endl;
610  o << " m: " << f.m << std::endl;
611  return o;
612 }
int m
Definition: phantom.h:574
double radius
Blob radius.
Definition: phantom.h:570
double alpha
Blob alpha.
Definition: phantom.h:572

Member Data Documentation

◆ alpha

double Blob::alpha

Blob alpha.

Definition at line 572 of file phantom.h.

◆ const

Feature** _f Blob::const

Definition at line 600 of file phantom.h.

◆ m

int Blob::m

Definition at line 574 of file phantom.h.

◆ radius

double Blob::radius

Blob radius.

Definition at line 570 of file phantom.h.


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