Xmipp  v3.23.11-Nereus
Macros | Functions
phantom.cpp File Reference
#include "phantom.h"
#include "core/geometry.h"
#include "core/metadata_label.h"
#include "core/metadata_vec.h"
#include "core/xmipp_error.h"
#include "data/blobs.h"
#include "data/fourier_projection.h"
Include dependency graph for phantom.cpp:

Go to the source code of this file.

Macros

#define DEF_Sph_Blob_point_inside
 
#define DEBUG_SHOW
 
#define Vr   A3D_ELEM(V,(int)ZZ(r),(int)YY(r),(int)XX(r))
 
#define COPY_COMMON_PART
 
#define COPY_ANGLES
 

Functions

std::ostream & operator<< (std::ostream &o, const Feature *F)
 
std::ostream & operator<< (std::ostream &o, const Sphere &f)
 
std::ostream & operator<< (std::ostream &o, const Blob &f)
 
std::ostream & operator<< (std::ostream &o, const Gaussian &f)
 
std::ostream & operator<< (std::ostream &o, const Cylinder &f)
 
std::ostream & operator<< (std::ostream &o, const DCylinder &f)
 
std::ostream & operator<< (std::ostream &o, const Cube &f)
 
std::ostream & operator<< (std::ostream &o, const Ellipsoid &f)
 
std::ostream & operator<< (std::ostream &o, const Cone &f)
 
std::ostream & operator<< (std::ostream &o, const Phantom &P)
 

Macro Definition Documentation

◆ COPY_ANGLES

#define COPY_ANGLES
Value:
f->rot = rot; \
f->tilt = tilt; \
f->psi = psi;
double * f
double psi(const double x)

Definition at line 1479 of file phantom.cpp.

◆ COPY_COMMON_PART

#define COPY_COMMON_PART
Value:
f->type = type; \
f->add_assign = add_assign; \
f->density = density; \
f->center = center;
viol type
double * f

Definition at line 1473 of file phantom.cpp.

◆ DEBUG_SHOW

#define DEBUG_SHOW

Definition at line 843 of file phantom.cpp.

◆ DEF_Sph_Blob_point_inside

#define DEF_Sph_Blob_point_inside
Value:
{\
/*Express r in the feature coord. system*/\
V3_MINUS_V3(aux,r,center);\
/*Check if it is inside*/\
if (XX(aux)*XX(aux) + YY(aux)*YY(aux) +ZZ(aux)*ZZ(aux) <= radius*radius)\
return 1;\
return 0;}
#define XX(v)
Definition: matrix1d.h:85
#define YY(v)
Definition: matrix1d.h:93
double radius
Spatial radius in Universal System units.
Definition: blobs.h:115
#define ZZ(v)
Definition: matrix1d.h:101

Definition at line 686 of file phantom.cpp.

◆ Vr

#define Vr   A3D_ELEM(V,(int)ZZ(r),(int)YY(r),(int)XX(r))

Definition at line 982 of file phantom.cpp.

Function Documentation

◆ operator<<() [1/10]

std::ostream& operator<< ( std::ostream &  o,
const Feature F 
)

Show feature not in the standard format but more informatively. This function is based on the std::cout << ... of each subclass. First shows the common part of the feature and then its specific part. Be careful that you must show a pointer to the feature!! \ Ex: Sphere sphere; std::cout << (Feature *) &sphere;

Definition at line 569 of file phantom.cpp.

570 {
571  if (F != nullptr)
572  {
573  o << "Feature --------" << std::endl;
574  o << " type: " << F->type << std::endl;
575  o << " add_assign: " << F->add_assign << std::endl;
576  o << " density: " << F->density << std::endl;
577  o << " center: " << F->center.transpose() << std::endl;
578  if (F->type == "sph")
579  o << *((Sphere *) F);
580  else if (F->type == "blo")
581  o << *((Blob *) F);
582  else if (F->type == "gau")
583  o << *((Gaussian *) F);
584  else if (F->type == "cyl")
585  o << *((Cylinder *) F);
586  else if (F->type == "dcy")
587  o << *((DCylinder *) F);
588  else if (F->type == "cub")
589  o << *((Cube *) F);
590  else if (F->type == "ell")
591  o << *((Ellipsoid *) F);
592  else if (F->type == "con")
593  o << *((Cone *) F);
594  }
595  return o;
596 }
Definition: phantom.h:1244
Definition: phantom.h:563
Matrix1D< double > center
Definition: phantom.h:119
double density
Definition: phantom.h:114
char add_assign
Definition: phantom.h:108
Matrix1D< T > transpose() const
Definition: matrix1d.cpp:644
Definition: phantom.h:1010
std::string type
Definition: phantom.h:101

◆ operator<<() [2/10]

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

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 599 of file phantom.cpp.

600 {
601  o << " Radius: " << f.radius << std::endl;
602  return o;
603 }
double radius
Sphere radius.
Definition: phantom.h:471

◆ operator<<() [3/10]

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

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

◆ operator<<() [4/10]

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

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 615 of file phantom.cpp.

616 {
617  o << " Sigma: " << f.sigma << std::endl;
618  return o;
619 }
double sigma
Sigma.
Definition: phantom.h:666

◆ operator<<() [5/10]

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

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 622 of file phantom.cpp.

623 {
624  o << " XRadius: " << f.xradius << std::endl;
625  o << " YRadius: " << f.yradius << std::endl;
626  o << " Height: " << f.height << std::endl;
627  o << " Rot: " << f.rot << std::endl;
628  o << " Tilt: " << f.tilt << std::endl;
629  o << " Psi: " << f.psi << std::endl;
630  return o;
631 }
double tilt
Second Euler angle.
Definition: phantom.h:430
double height
Cylinder height.
Definition: phantom.h:772
double yradius
Cylinder Y radius.
Definition: phantom.h:769
double rot
First Euler angle.
Definition: phantom.h:427
double psi
Third Euler angle.
Definition: phantom.h:433
double xradius
Cylinder X radius.
Definition: phantom.h:766

◆ operator<<() [6/10]

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

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 634 of file phantom.cpp.

635 {
636  o << " Radius: " << f.radius << std::endl;
637  o << " Height: " << f.height << std::endl;
638  o << " Separ.: " << f.separation << std::endl;
639  o << " Rot: " << f.rot << std::endl;
640  o << " Tilt: " << f.tilt << std::endl;
641  o << " Psi: " << f.psi << std::endl;
642  return o;
643 }
double height
Each cylinder height.
Definition: phantom.h:897
double tilt
Second Euler angle.
Definition: phantom.h:430
double separation
Separation between cylinders.
Definition: phantom.h:900
double rot
First Euler angle.
Definition: phantom.h:427
double radius
Cylinder radius.
Definition: phantom.h:894
double psi
Third Euler angle.
Definition: phantom.h:433

◆ operator<<() [7/10]

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

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 646 of file phantom.cpp.

647 {
648  o << " Xdim: " << f.xdim << std::endl;
649  o << " Ydim: " << f.ydim << std::endl;
650  o << " Zdim: " << f.zdim << std::endl;
651  o << " Rot: " << f.rot << std::endl;
652  o << " Tilt: " << f.tilt << std::endl;
653  o << " Psi: " << f.psi << std::endl;
654  return o;
655 }
double tilt
Second Euler angle.
Definition: phantom.h:430
double ydim
Y dimension before rotating.
Definition: phantom.h:1017
double rot
First Euler angle.
Definition: phantom.h:427
double zdim
Z dimension before rotating.
Definition: phantom.h:1020
double psi
Third Euler angle.
Definition: phantom.h:433
double xdim
X dimension before rotating.
Definition: phantom.h:1014

◆ operator<<() [8/10]

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

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 658 of file phantom.cpp.

659 {
660  o << " Xradius: " << f.xradius << std::endl;
661  o << " Yradius: " << f.yradius << std::endl;
662  o << " Zradius: " << f.zradius << std::endl;
663  o << " Rot: " << f.rot << std::endl;
664  o << " Tilt: " << f.tilt << std::endl;
665  o << " Psi: " << f.psi << std::endl;
666  return o;
667 }
double tilt
Second Euler angle.
Definition: phantom.h:430
double xradius
X radius before rotating.
Definition: phantom.h:1131
double rot
First Euler angle.
Definition: phantom.h:427
double psi
Third Euler angle.
Definition: phantom.h:433
double zradius
Z radius before rotating.
Definition: phantom.h:1137
double yradius
Y radius before rotating.
Definition: phantom.h:1134

◆ operator<<() [9/10]

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

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 670 of file phantom.cpp.

671 {
672  o << " Radius: " << f.radius << std::endl;
673  o << " Height: " << f.height << std::endl;
674  o << " Rot: " << f.rot << std::endl;
675  o << " Tilt: " << f.tilt << std::endl;
676  o << " Psi: " << f.psi << std::endl;
677  return o;
678 }
double tilt
Second Euler angle.
Definition: phantom.h:430
double height
Cone height.
Definition: phantom.h:1251
double rot
First Euler angle.
Definition: phantom.h:427
double psi
Third Euler angle.
Definition: phantom.h:433
double radius
Cone base radius.
Definition: phantom.h:1248

◆ operator<<() [10/10]

std::ostream& operator<< ( std::ostream &  o,
const Phantom P 
)

Show a phantom file. The more descriptive format is used instead of the standard Feature format

Definition at line 2343 of file phantom.cpp.

2344 {
2345  std::cout << "Phantom ---------------------------------------\n";
2346  std::cout << "Dimensions: " << P.xdim << " x " << P.ydim << " x " << P.zdim << std::endl;
2347  std::cout << "Background density: " << P.Background_Density << std::endl;
2348  std::cout << "phantom_scale : " << P.phantom_scale << std::endl;
2349  for (size_t i = 0; i < P.VF.size(); i++)
2350  o << P.VF[i];
2351  return o;
2352 }
double phantom_scale
Param file scale.
Definition: phantom.h:1377
int ydim
Final volume Y dimension.
Definition: phantom.h:1362
#define i
double Background_Density
Final volume background density.
Definition: phantom.h:1368
int zdim
Final volume Z dimension.
Definition: phantom.h:1365
int xdim
Final volume X dimension.
Definition: phantom.h:1359
std::vector< Feature * > VF
List with the features.
Definition: phantom.h:1380