Xmipp
v3.23.11-Nereus
|
#include <phantom.h>
Public Member Functions | |
Phantom () | |
Phantom (const FileName &fn_phantom) | |
Phantom (const Phantom &other) | |
~Phantom () | |
Phantom & | operator= (const Phantom &P) |
Assignment. More... | |
void | clear () |
int | FeatNo () |
Feature * | operator() (int i) |
const Feature * | operator() (int i) const |
void | add (Feature *f) |
void | assign (const Phantom &P) |
void | prepare () |
Prepare for work. More... | |
double | max_distance () const |
Return the maximum distance of any feature to the volume center. More... | |
double | volume () const |
Return the volume of all the features. More... | |
void | read (const FileName &fn_phantom, bool apply_scale=true) |
void | write (const FileName &fn_phantom="") |
int | voxel_inside_any_feat (const Matrix1D< double > &r, Matrix1D< double > &aux1, Matrix1D< double > &aux2) const |
int | voxel_inside_any_feat (const Matrix1D< double > &r) const |
int | any_feature_intersects_sphere (const Matrix1D< double > &r, double radius, Matrix1D< double > &aux1, Matrix1D< double > &aux2, Matrix1D< double > &aux3) const |
int | any_feature_intersects_sphere (const Matrix1D< double > &r, double radius) const |
void | draw_in (MultidimArray< double > &V) |
void | label (MultidimArray< double > &V) |
void | sketch_in (MultidimArray< double > &V, int clean=DONT_CLEAN, double colour=2) |
void | shift (double shiftX, double shiftY, double shiftZ) |
void | rotate (const Matrix2D< double > &E) |
void | selfApplyGeometry (const Matrix2D< double > &A, int inv) |
void | project_to (Projection &P, int Ydim, int Xdim, double rot, double tilt, double psi, const Matrix2D< double > *A=nullptr) const |
void | project_to (Projection &P, double rot, double tilt, double psi, const Matrix2D< double > *A=nullptr) const |
void | project_to (Projection &P, const Matrix2D< double > &VP, double disappearing_th=1.0) const |
void | surface (double z0, double radius, int direction, Image< double > *P) const |
Public Attributes | |
FileName | fn |
Filename. More... | |
int | xdim |
Final volume X dimension. More... | |
int | ydim |
Final volume Y dimension. More... | |
int | zdim |
Final volume Z dimension. More... | |
double | Background_Density |
Final volume background density. More... | |
double | current_scale |
Has been the scale applied? More... | |
double | param_file_scale |
Param file scale. More... | |
double | phantom_scale |
Param file scale. More... | |
std::vector< Feature * > | VF |
List with the features. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &o, const Phantom &f) |
Phantom class. The phantom class is simply a list (STL vector) of features plus some information about the size of the final volume to generate and its background density. This is the class that will interact with the reconstruction programs as the features classes themselves haven't got enough information to generate the final volume. The file format to generate the phantom is described in the previous page (Phantoms).
This class is thought to be filled from a file, and doesn't give many facilities to update it from program. This is something to do.
Here goes an example of how to manage loops in the phantom class,
Phantom::Phantom | ( | ) |
Empty constructor. The empty phantom is 0x0x0, background density=0, no feature is inside and no name.
Definition at line 1967 of file phantom.cpp.
|
inline |
Construct from a phantom file. Construct the phantom according to the specifications of the given file. The file must accomplish the structure given in Phantoms.
Definition at line 1390 of file phantom.h.
Phantom::Phantom | ( | const Phantom & | other | ) |
Copy constructor. The empty phantom is 0x0x0, background density=0, no feature is inside and no name.
Definition at line 1976 of file phantom.cpp.
|
inline |
Destructor. All features are freed.
|
inline |
int Phantom::any_feature_intersects_sphere | ( | const Matrix1D< double > & | r, |
double | radius, | ||
Matrix1D< double > & | aux1, | ||
Matrix1D< double > & | aux2, | ||
Matrix1D< double > & | aux3 | ||
) | const |
Speeded up sphere intersecting any feature. This function returns the first feature in the list intersecting a sphere with center r in R3 and the given radius. In none, 0 is returned. This speeded up function needs two vectors with dimension 3 externally resized.
Definition at line 2416 of file phantom.cpp.
|
inline |
Sphere intersecting feature. This function is based in the previous one. It makes the same but you needn't supply the auxiliar vectors.
Definition at line 1515 of file phantom.h.
void Phantom::assign | ( | const Phantom & | P | ) |
Another function for assignment.
void Phantom::clear | ( | ) |
Clear the phantom. Force the phantom to be empty. All features are freed.
Definition at line 1981 of file phantom.cpp.
void Phantom::draw_in | ( | MultidimArray< double > & | V | ) |
Draw the phantom in the volume. The volume is cleaned, resized to the phantom size and its origin is set at the center of the volume. Then every feature is drawn into the volume
Definition at line 2432 of file phantom.cpp.
|
inline |
void Phantom::label | ( | MultidimArray< double > & | V | ) |
Label a volume after the phantom. The volume is cleaned, resized to the phantom size and its origin is set at the center of the volume. Then every feature is drawn into the volume using different densities. Background has got density 0, the border for first feature density -1, the first feature has got density 1, the second 2 and its border -2, ...
Definition at line 2443 of file phantom.cpp.
double Phantom::max_distance | ( | ) | const |
Return the maximum distance of any feature to the volume center.
Definition at line 2070 of file phantom.cpp.
|
inline |
|
inline |
Assignment.
Definition at line 1991 of file phantom.cpp.
void Phantom::prepare | ( | ) |
void Phantom::project_to | ( | Projection & | P, |
int | Ydim, | ||
int | Xdim, | ||
double | rot, | ||
double | tilt, | ||
double | psi, | ||
const Matrix2D< double > * | A = nullptr |
||
) | const |
Project phantom from a direction. The direction is specified by the 3 Euler angles (as usual, rot=1st, tilt=2nd, psi=3rd), the projection size is (Ydim x Xdim) given in the function call, the projection logical origin is set at the physical center of the image. The projection is cleaned and then the projection of the phantom is computed. A matrix A (3x3) can be supplied in order to apply a deformation in the projection plane. A must be such that
Definition at line 2511 of file phantom.cpp.
void Phantom::project_to | ( | Projection & | P, |
double | rot, | ||
double | tilt, | ||
double | psi, | ||
const Matrix2D< double > * | A = nullptr |
||
) | const |
Project phantom from a direction. The same as before but this time the projection is supposed to be already resized and with the right center. The phantom projection is added to the already drawn projection.
Definition at line 2535 of file phantom.cpp.
void Phantom::project_to | ( | Projection & | P, |
const Matrix2D< double > & | VP, | ||
double | disappearing_th = 1.0 |
||
) | const |
Project phantom using a conversion matrix. The same as before but this time the projection is supposed to be already resized and with the right center. The phantom projection is added to the already drawn projeciton. Euler angles of the projection are not set and the phantom volume is projected to the projection plane making use of the matrix provided (3x3) which is the needed transformation from the volume to the projection plane. Inside the projection plane only the first two coordinates are valid. If disappearing_th < 1 then the ith phantom feature is skiped with a provability = 1-disappearing_th
Definition at line 2551 of file phantom.cpp.
void Phantom::read | ( | const FileName & | fn_phantom, |
bool | apply_scale = true |
||
) |
Read a phantom file. The file must accomplish the structure given in Phantoms .
If you don't apply the scale then all spatial coordinates are expressed in the given scale units. I.e., if the scale is 0.25 that means that every voxel in the voxel phantom represent 4 length units (usually Angstroms). If the scale is applied, then coordinates are expressed in voxel edge units. Otherwise, coordinates are expressed in length units (usually Angstroms).
We recommend apply_scale=false only if you plan to modify the description file without produstd::cing projections, voxel phantoms, ...
Definition at line 2088 of file phantom.cpp.
void Phantom::rotate | ( | const Matrix2D< double > & | E | ) |
void Phantom::selfApplyGeometry | ( | const Matrix2D< double > & | A, |
int | inv | ||
) |
Apply a general geometric transformation. The transformation must be defined by a 4x4 matrix that can be generated using the geometric functions in xmippGeometry or xmippMatrix2D. The inv argument is either IS_INV or IS_NOT_INV. Matrices coming out from xmippGeometry for rotations, shifts, ... are not INV.
An exception is thrown if the matrix A is not valid.
Definition at line 2493 of file phantom.cpp.
void Phantom::shift | ( | double | shiftX, |
double | shiftY, | ||
double | shiftZ | ||
) |
Shift. Shift all features in the phantom a given amount of voxels. See Feature::shift.
Definition at line 2479 of file phantom.cpp.
void Phantom::sketch_in | ( | MultidimArray< double > & | V, |
int | clean = DONT_CLEAN , |
||
double | colour = 2 |
||
) |
Sketch the surface of the phantom in the volume. This function allows you to draw only the surface of every feature (see Feature::sketch_in to see when a voxel is said to belong to the feature surface). The input volume might be cleaned (resized and the logical origin set at the physical center) or not according to the labels CLEAN or DONT_CLEAN (by default). The grey level for those voxels can be defined (by default, 2) and the colour is assigned
Definition at line 2467 of file phantom.cpp.
void Phantom::surface | ( | double | z0, |
double | radius, | ||
int | direction, | ||
Image< double > * | P | ||
) | const |
Surface of the phantom as in AFM. This function produces the surface of a phantom in a given image when measuring rays go POS_NEG or NEG_POS (from Z positive to Z negative, and viceversa). If rays reach point z0 and the phantom is not reached the surface for that point is z0, otherwise it is the z of the last voxel which is still outside the phantom.
This function throws an exception if z0 is outside the volume definition. If z0 is equal to zdim then it is not used.
The radius is the probe radius for the surface generation.
If the output image is not resized, it is resized to the Y and X dimensions of the phantom.
Definition at line 2565 of file phantom.cpp.
double Phantom::volume | ( | ) | const |
Return the volume of all the features.
Definition at line 2079 of file phantom.cpp.
int Phantom::voxel_inside_any_feat | ( | const Matrix1D< double > & | r, |
Matrix1D< double > & | aux1, | ||
Matrix1D< double > & | aux2 | ||
) | const |
Speeded up voxel inside any feature. This function tells you if the voxel of size 1x1x1 whose center is at position r is inside any of the features. A voxel is said to be inside a feature if it shares at least 1 corner with the feature. This function returns the first feature of the list containing the voxel. Features are numbered as 1, 2, ... If the voxel is not in any feature the function returns 0.
aux1 and aux2, are two vectors of dimension 3. They must be supplied in order to gain speed in the calculations. This is very useful when checking if many voxels are inside any feature. See also Feature::voxel_inside to know more.
Definition at line 2395 of file phantom.cpp.
|
inline |
Voxel inside any feature. The same as the previous one but you needn't supply the extra auxiliar vectors.
Definition at line 1495 of file phantom.h.
void Phantom::write | ( | const FileName & | fn_phantom = "" | ) |
Write a phantom file in the standard feature format. You may rename the file or not giving a different name in the write call.
Definition at line 2355 of file phantom.cpp.
|
friend |
Show a phantom file. The more descriptive format is used instead of the standard Feature format
Definition at line 2343 of file phantom.cpp.
double Phantom::Background_Density |
double Phantom::current_scale |
std::vector<Feature*> Phantom::VF |