Xmipp
v3.23.11-Nereus
|
#include <phantom.h>
Public Member Functions | |
virtual void | prepare ()=0 |
void | assign (const Feature &F) |
virtual void | rotate (const Matrix2D< double > &E) |
virtual void | rotate_center (const Matrix2D< double > &E) |
virtual int | point_inside (const Matrix1D< double > &r, Matrix1D< double > &aux) const =0 |
int | point_inside (const Matrix1D< double > &r) const |
virtual double | density_inside (const Matrix1D< double > &r, Matrix1D< double > &aux) const =0 |
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 |
Feature * | encircle (double radius=0) const |
virtual Feature * | scale (double factor) const =0 |
Feature * | background (int back_mode, double back_param) const |
virtual double | intersection (const Matrix1D< double > &direction, const Matrix1D< double > &passing_point, Matrix1D< double > &r, Matrix1D< double > &u) const =0 |
double | intersection (const Matrix1D< double > &direction, const Matrix1D< double > &passing_point) const |
virtual double | volume () const =0 |
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) |
virtual void | feat_printf (FILE *fh) const =0 |
virtual void | feat_printm (MetaData &MD, size_t id)=0 |
void | readCommon (char *line) |
void | readCommon (MDRow &row) |
void | read (MDRow &row) |
virtual void | read_specific (const std::vector< double > &vector)=0 |
Public Attributes | |
std::string | type |
char | add_assign |
double | density |
Matrix1D< double > | center |
double | max_distance |
Friends | |
std::ostream & | operator<< (std::ostream &o, const Feature *F) |
Feature superclass. This is a superclass from which all features (cones, cylinders, ...) inherit. It contains all general information common to all feature classes, then the subclasses give the specific parameters for the feature.
void Feature::assign | ( | const Feature & | F | ) |
Feature * Feature::background | ( | int | back_mode, |
double | back_param | ||
) | const |
Return a pointer to a feature which is the background of the actual one. You can specify two ways of computing the background, either as a sphere surrounding the feature or as an enlarged version of the feature. This is chosen giving the modes ENLARGE_MODE or SPHERE_MODE. Depending on the mode used the background parameter is understood as the sphere radius or as the scaling factor.
Definition at line 1662 of file phantom.cpp.
void Feature::corners | ( | const MultidimArray< double > & | V, |
Matrix1D< double > & | corner1, | ||
Matrix1D< double > & | corner2 | ||
) |
Define 3D corners for a feature. This function returns two Z3 points where the feature is confined. The volume borders are taken into account and you might make a for using these two values like this: \Ex:
Definition at line 967 of file phantom.cpp.
|
pure virtual |
Speeded up density inside a feature, VIRTUAL!!. This function MUST be implemented for each subclass with NON constant density as blobs and tells you if a point is inside the feature or not plus give you information about the density of the feature at that point. If the point is inside returns 1 multiplied by the density of the NORMALIZED feature and if not, returns 0. The point is given in the vector r, and aux is an auxiliar vector with dimension 3 (must be externally resized) used to do some computations. This auxiliar vector must be supplied in order to gain speed as no memory allocating and freeing is needed.
Implemented in Cone, Ellipsoid, Cube, DCylinder, Cylinder, Gaussian, Blob, and Sphere.
void Feature::draw_in | ( | MultidimArray< double > & | V, |
int | color_mode = INTERNAL , |
||
double | colour = -1 |
||
) |
Draw a feature in a Volume. This function draws a feature in a volume (*V). The word "colour" is a little misleading as the colour really refers to a grey-level global density. Ie, the default mode (INTERNAL) draws the feature with its own density and discards the "colour" given in the function call. However, you may change this colour, set a new global density and draw the volume with this given density. This option is useful to generate easily a labelled volume.
The Add-Assign behaviour is the one of the feature if the colour is internally defined, or Assign if the colour is externally given. In the assign behaviour a voxel value is assigned to the volume if the voxel there is smaller than the value we pretend to assign.
A voxel is drawn with a colour proportional to the number of Vertex inside the features. The volume is not cleaned at the beginning. \ Ex:
Definition at line 983 of file phantom.cpp.
Feature * Feature::encircle | ( | double | radius = 0 | ) | const |
Produce a sphere envolving the feature. This function returns a pointer to a feature (a sphere) with the same center, density, and feature behaviour as the given feature. The radius could be given in voxel units or if you leave it 0 then the radius is computed as 1.5 times the max_distance of this feature
Definition at line 1644 of file phantom.cpp.
|
pure virtual |
Print the feature in the Feature format, VIRTUAL!!!. This function prints the feature in the Standard Feature format (readable by this library). Notice that the standard format is different for each specific feature. See Phantoms for more information about the supported file format.
Implemented in Cone, Ellipsoid, Cube, DCylinder, Cylinder, Gaussian, Blob, and Sphere.
|
pure virtual |
|
pure virtual |
Speeded Up intersection of a feature with a ray, VIRTUAL!!!. This function returns the length of the intersection between the ray defined by its direction and a passing point and the actual feature (whose center and dimensions are known by itself).
r and u are auxiliar vectors of dimension 3, they must be supplied in order to gain speed. r is the passing point expressed in the feature coordinate system, and u is the direction in the same coordinate system.
Implemented in Cone, Ellipsoid, Cube, DCylinder, Cylinder, Gaussian, Blob, and Sphere.
|
inline |
Intersection of a feature with a ray. This function does the same as the previous one but you needn't provide extra auxiliar vectors.
Definition at line 274 of file phantom.h.
int Feature::intersects_sphere | ( | const Matrix1D< double > & | r, |
double | radius, | ||
Matrix1D< double > & | aux1, | ||
Matrix1D< double > & | aux2, | ||
Matrix1D< double > & | aux3 | ||
) | const |
Speeded up sphere intersecting feature. This function returns TRUE if a sphere of a given radius has any voxel inside this feature. r is the center of the sphere in R3. This speeded up function needs two vectors with dimension 3 externally resized.
Definition at line 936 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 222 of file phantom.h.
void Feature::mean_variance_in_plane | ( | Image< double > * | V, |
double | z, | ||
double & | mean, | ||
double & | var | ||
) |
Mean and variance in a given plane. Given a plane z=z0, this function returns the mean and variance values of the volume (*V) in the voxels inside this feature. A voxel is considered to belong to the feature if it is totally inside the feature. If the plane is outside the volume scope the result is mean=variance=0
Definition at line 1929 of file phantom.cpp.
|
pure virtual |
Speeded up point inside a feature, VIRTUAL!!. This function MUST be implemented for each subclass and tells you if a point is inside the feature or not. If the point is inside returns 1 and if not, returns 0. The point is given in the vector r, and aux is an auxiliar vector with dimension 3 (must be externally resized) used to do some computations. This auxiliar vector must be supplied in order to gain speed as no memory allocating and freeing is needed.
Implemented in Cone, Ellipsoid, Cube, DCylinder, Cylinder, Gaussian, Blob, and Sphere.
|
inline |
|
pure virtual |
void Feature::project_to | ( | Projection & | P, |
const Matrix2D< double > & | VP, | ||
const Matrix2D< double > & | PV | ||
) | const |
Project feature onto a projection plane. Projection is a class itself which has got inside the direction of projection. The projection plane is not cleaned (set all values to 0) when entering this function, but the projection of this feature is added to the already stored one. The projection plane is supposed to have its logical origin in the right place (normally, the middle of the image) before entering the function. An oversampling technique is used in order to produce better projections, the projection in one pixel is computed from the value of 4 points near the pixel, you can modify the subsampling value (actually 2x2=4) by changing a constant at the beginning of the function.
The matrix VP (3x3) is used to define how to relate a point in the 3D universal coordinate to the projection plane. So a point ru in the universal coordinate system, projects to VP*r. PV must be the inverse of the forwarding projection matrix.
Definition at line 1293 of file phantom.cpp.
void Feature::read | ( | MDRow & | row | ) |
Definition at line 213 of file phantom.cpp.
|
pure 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.
Implemented in Cone, Ellipsoid, Cube, DCylinder, Cylinder, Gaussian, Blob, and Sphere.
void Feature::readCommon | ( | char * | line | ) |
Read common part of the feature description. The common part is the feature type, the behaviour, density and center. The description is passed as a line. Exceptions are thrown if the description doesn't conform the standard specification.
Definition at line 177 of file phantom.cpp.
void Feature::readCommon | ( | MDRow & | row | ) |
Definition at line 196 of file phantom.cpp.
|
virtual |
Rotate the whole feature. Rotate this feature using a rotation matrix. The center as well as the feature itself is rotated.
Reimplemented in Oriented_Feature.
Definition at line 159 of file phantom.cpp.
|
virtual |
Rotate only the center. Rotate the center of this feature only around the phantom center
Definition at line 151 of file phantom.cpp.
|
pure virtual |
Return a scaled version of this feature, VIRTUAL!!!. This function returns a pointer to a feature (of the same type as the feature for which the function was called, ie, if you scale a sphere the result is a sphere, if you scale a cone, the result is a cone, ...) that is a scaled version of the actual feature (see each specific implementation to see which is the relatioship between the two features). This function is useful to define backgrounds with the same shape of the given feature.
Implemented in Cone, Ellipsoid, Cube, DCylinder, Cylinder, Gaussian, Blob, and Sphere.
void Feature::selfApplyGeometry | ( | const Matrix2D< double > & | A | ) |
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 matrix must be the desired transformation (i.e., new coordinate=A*old_coordinate. Don't worry because the selfApplyGeometry of Phantom take cares of passing to this function the appropriate matrix. No check is done about the size of A.
Only the center is transformed, the feature will keep the same size.
Definition at line 1078 of file phantom.cpp.
void Feature::shift | ( | double | shiftX, |
double | shiftY, | ||
double | shiftZ | ||
) |
Shift. Shift the feature a given amount of voxels. The new center is the old center plus the given shift, and that's all
Definition at line 1070 of file phantom.cpp.
void Feature::sketch_in | ( | MultidimArray< double > & | V, |
double | colour = 2 |
||
) |
Draw the surface of the feature. This function draws the surface of the feature at the given volume. A voxel is said to belong to the surface if the number of corners inside the feature meets 1<=n<=7. The default gray_level with which voxels will be drawn is 2 (normally higher than the usual volume grey levels, and the behaviour of the voxels drawn is Assign.
Definition at line 1051 of file phantom.cpp.
|
pure virtual |
int Feature::voxel_inside | ( | const Matrix1D< double > & | r, |
Matrix1D< double > & | aux1, | ||
Matrix1D< double > & | aux2 | ||
) | const |
Speeded up voxel inside a feature. A voxel is compound of 8 subvoxels. This function returns the number of subvoxel centers falling inside the feature. The voxel size is supposed to be 1, and r is the center of the voxel in R3. This speeded up function needs two vectors with dimension 3 externally resized.
Definition at line 845 of file phantom.cpp.
|
inline |
Voxel inside a feature. This function is based in the previous one. It makes the same but you needn't supply the auxiliar vectors.
Definition at line 192 of file phantom.h.
double Feature::voxel_inside_by_normalized_density | ( | const Matrix1D< double > & | r, |
Matrix1D< double > & | aux1, | ||
Matrix1D< double > & | aux2 | ||
) | const |
A voxel is compound of 8 subvoxels. This function returns the number of subvoxel centers falling inside the feature multiplied by the normalized feature density. That is, the value of the density is always 1 at the origin The voxel size is supposed to be 1, and r is the center of the voxel in R3. This speeded up function needs two vectors with dimension 3 externally resized.
Definition at line 880 of file phantom.cpp.
|
friend |
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.
char Feature::add_assign |
Feature behaviour. This flag indicates how the feature behaves inside the voxel volume. If this flag is set to '+' then the voxels occupied by this feature are incremented with the feature value. If the flag is set to '=' then the voxels are set to to the same value of the feature.
Matrix1D<double> Feature::center |
double Feature::density |
double Feature::max_distance |
Maximum distance from the center. This value is a precalculated and tells the maximum distance from any point belonging to the feature to its center. This is used to speed up some functions not considering voxels which we know are beyond the scope of this feature.
std::string Feature::type |