IMP
2.0.0
The Integrative Modeling Platform
|
See IMP.em2d Overview for more information.
Classes | |
class | CenteredMat |
class | ChiSquaredScore |
Score based on Chi^2 = ((pixels_iamge - pixels_projection)/stddev_image)^2. More... | |
class | DistanceFilterTable |
class | DummyRestraint |
Dummy restraint between two particles. More... | |
class | Em2DRestraint |
class | EM2DScore |
class | Fine2DRegistrationRestraint |
class | GridStates |
class | HasHigherCCC |
Comparison by value of the ccc. More... | |
class | HasLowerScore |
Compare two classes that return a score. More... | |
class | Image |
2D Electron Microscopy images in IMP More... | |
class | JPGImageReaderWriter |
Class to read and write EM images in JPG format. More... | |
class | LessPairBySecond |
Comparison of pairs by checking the second element. More... | |
class | MasksManager |
Manage of projection masks. More... | |
class | MatchTemplateResult |
class | ParticlesDummyRestraint |
Dummy restraint for a set of particles. Same use as DummyRestraint. More... | |
class | PolarResamplingParameters |
class | ProjectionFinder |
class to perform registration of model projections to images images More... | |
class | ProjectionMask |
class | ProjectionParameters |
class | ProjectionParametersScoreState |
class | ProjectionStates |
class | RegistrationResult |
Class to manage registration results. More... | |
class | ScoreFunction |
Base class for all scoring functions related to em2d. More... | |
class | SegmentationParameters |
Class to provide all the parameters to the segmentation function. More... | |
class | SpiderImageReaderWriter |
Functions | |
void | add_noise (cv::Mat &v, double op1, double op2, const String &mode="uniform", double df=3) |
Add noise to the values of a matrix. More... | |
void | add_noise (Image *im1, double op1, double op2, const String &mode="uniform", double df=3) |
void | apply_circular_mask (const cv::Mat &mat, cv::Mat &result, int radius, double value=0.0) |
void | apply_diffusion_filter (const cv::Mat &m, cv::Mat &result, double beta, double pixelsize, unsigned int time_steps) |
void | apply_diffusion_filter (Image *input, Image *filtered, double beta, double pixelsize, int time_steps) |
void | apply_mask (const cv::Mat &m, cv::Mat &result, const cvIntMat &mask, double val) |
Applies a binary mask to an image. More... | |
void | apply_mean_outside_mask (Image *img, double radius) |
void | apply_threshold (cv::Mat &m, cv::Mat &result, double threshold=0.0) |
void | apply_variance_filter (const cv::Mat &input, cv::Mat &filtered, int kernelsize) |
void | apply_variance_filter (Image *input, Image *filtered, int kernelsize) |
cvIntMat | create_circular_mask (int rows, int cols, int radius) |
Images | create_evenly_distributed_projections (const ParticlesTemp &ps, unsigned int n, const ProjectingOptions &options) |
void | crop (Image *img, const IntPair ¢er, int size) |
cv::Mat | crop (const cv::Mat &m, const IntPair ¢er, int size) |
void | do_combined_fill_holes_and_threshold (cv::Mat &m, cv::Mat &result, double n_stddevs, double threshold=0.0) |
Combines the fill holes and tresholding operations together with normalize. More... | |
void | do_combined_fill_holes_and_threshold (Image *input, Image *result, double n_stddevs) |
void | do_dilate_and_shrink_warp (cv::Mat &m, const cv::Mat &greyscale, cv::Mat &kernel) |
(U. Adiga, 2005) More... | |
void | do_extend_borders (Image *im1, Image *im2, unsigned int pix) |
void | do_extend_borders (cv::Mat &orig, cv::Mat &dst, unsigned int pix) |
void | do_fill_holes (const cv::Mat &m, cv::Mat &result, double h) |
Fills the holes in the matrix m of height h. More... | |
void | do_fill_holes (Image *input, Image *result, double n_stddevs) |
template<class LinkageFunction > | |
ClusterSet | do_hierarchical_agglomerative_clustering (const FloatsList &distances) |
void | do_histogram_stretching (cv::Mat &m, int boxes, int offset) |
int | do_labeling (const cvIntMat &m, cvIntMat &mat_to_label) |
Labeling function for a matrix. More... | |
void | do_matrix_to_image_flip (cv::Mat &m) |
void | do_morphologic_contrast_enhancement (const cv::Mat &m, cv::Mat &result, const cv::Mat &kernel, unsigned int iterations) |
void | do_morphologic_reconstruction (const cv::Mat &mask, cv::Mat &marker, int neighbors_mode=4) |
morphologic grayscale reconstruction (L Vincent, 1993) More... | |
void | do_normalize (Image *im, bool force=false) |
void | do_normalize (cv::Mat &m) |
Normalize a openCV matrix to mean 0 and stddev 1. It is done in place. | |
void | do_place (cv::Mat &mask, cv::Mat &m, const algebra::Vector2D &v) |
void | do_project_particles (const ParticlesTemp &ps, cv::Mat &m2, const algebra::Rotation3D &R, const algebra::Vector3D &translation, const ProjectingOptions &options, MasksManagerPtr masks) |
Projects a set of particles. This is the core function that others call. More... | |
algebra::Vector2Ds | do_project_vectors (const algebra::Vector3Ds &ps, const algebra::Rotation3D &R, const algebra::Vector3D &translation) |
Project the points contained in Vector3Ds to gen vectors in 2D. More... | |
algebra::Vector2Ds | do_project_vectors (const algebra::Vector3Ds &ps, const algebra::Rotation3D &R, const algebra::Vector3D &translation, const algebra::Vector3D ¢er) |
Project the points contained in Vector3Ds. More... | |
void | do_remove_small_objects (cvIntMat &m, double percentage, int background=0, int foreground=1) |
Removes small objects from a matrix of integers. More... | |
void | do_remove_small_objects (Image *input, double percentage, int background=0, int foreground=1) |
void | do_resample_polar (const cv::Mat &input, cv::Mat &resampled, const PolarResamplingParameters &polar_params) |
Resamples a matrix to polar coordinates. More... | |
void | do_resample_polar (Image *im1, Image *im2, const PolarResamplingParameters &polar_params) |
void | do_segmentation (const cv::Mat &m, cv::Mat &result, const SegmentationParameters ¶ms) |
Segmentation of images. More... | |
void | do_segmentation (Image *input, Image *result, const SegmentationParameters ¶ms) |
void | do_subtract_images (Image *first, Image *second, Image *result) |
void | get_autocorrelation2d (const cv::Mat &m, cv::Mat &corr) |
void | get_autocorrelation2d (Image *im1, Image *im2) |
void | get_autocorrelation2d_no_preprocessing (const cv::Mat &M, cv::Mat &corr) |
Autocorrelation without preprocessing. More... | |
double | get_average_rotation_error (const RegistrationResults &correct_RRs, const RegistrationResults &computed_RRs) |
double | get_average_shift_error (const RegistrationResults &correct_RRs, const RegistrationResults &computed_RRs) |
MatchTemplateResults | get_best_template_matches (const cv::Mat &m, const cv::Mat &templ, unsigned int n) |
ResultAlign2D | get_complete_alignment (const cv::Mat &input, cv::Mat &m_to_align, bool apply=false) |
em2d::ResultAlign2D | get_complete_alignment_no_preprocessing (const cv::Mat &input, const cv::Mat &INPUT, const cv::Mat &POLAR1, cv::Mat &m_to_align, const cv::Mat &POLAR2, bool apply=false) |
ResultAlign2D | get_complete_alignment_with_centers_no_preprocessing (const algebra::Vector2D ¢er1, const algebra::Vector2D ¢er2, const cv::Mat &AUTOC_POLAR1, const cv::Mat &AUTOC_POLAR2) |
void | get_correlation2d (const cv::Mat &A, const cv::Mat &B, cv::Mat &corr) |
Correlation matrix between two 2D matrices using FFT. More... | |
void | get_correlation2d (Image *im1, Image *im2, Image *corr) |
void | get_correlation2d_no_preprocessing (const cv::Mat &M1, const cv::Mat &M2, cv::Mat &corr) |
double | get_cross_correlation_coefficient (const cv::Mat &m1, const cv::Mat &m2) |
Computes the cross-correlation coefficient between to matrices. | |
double | get_cross_correlation_coefficient (Image *im1, Image *im2) |
Cross correlation between two images. More... | |
std::string | get_data_path (std::string file_name) |
Return the full path to installed data. More... | |
void | get_diffusion_filtering_partial_derivative (const cv::Mat &m, cv::Mat &der, double dx, double dy, double ang) |
void | get_domes (cv::Mat &m, cv::Mat &result, double h) |
Gets the domes of m with height h. More... | |
unsigned int | get_enclosing_image_size (const ParticlesTemp &ps, double pixel_size, unsigned int slack) |
RegistrationResults | get_evenly_distributed_registration_results (unsigned int n_projections) |
std::string | get_example_path (std::string file_name) |
Return the path to installed example data for this module. More... | |
void | get_fft_using_optimal_size (const cv::Mat &m, cv::Mat &M) |
double | get_global_score (const RegistrationResults &RRs) |
Floats | get_histogram (const cv::Mat &m, int bins) |
Computes the histogram of a matrix. More... | |
Floats | get_histogram (Image *img, int bins) |
double | get_mean (const cv::Mat &mat, const cvIntMat &mask) |
void | get_morphologic_gradient (const cv::Mat &m, cv::Mat &result, const cv::Mat &kernel) |
double | get_overlap_percentage (cv::Mat &m1, cv::Mat &m2, const IntPair ¢er) |
void | get_projection (em2d::Image *img, const ParticlesTemp &ps, const RegistrationResult ®, const ProjectingOptions &options, MasksManagerPtr masks=MasksManagerPtr(), String name="") |
Generates a projection from particles. More... | |
em2d::Images | get_projections (const ParticlesTemp &ps, const algebra::SphericalVector3Ds &vs, int rows, int cols, const ProjectingOptions &options, Strings names=Strings()) |
Generates projectios from particles. More... | |
em2d::Images | get_projections (const ParticlesTemp &ps, const RegistrationResults ®istration_values, int rows, int cols, const ProjectingOptions &options, Strings names=Strings()) |
Generates projectios from particles. More... | |
double | get_random_between_zero_and_one () |
RegistrationResults | get_random_registration_results (unsigned int n, double maximum_shift=5.0) |
Provides a set of random registration results (or parameters) More... | |
double | get_rotation_error (const RegistrationResult &rr1, const RegistrationResult &rr2) |
em2d::ResultAlign2D | get_rotational_alignment (const cv::Mat &input, cv::Mat &m_to_align, bool apply=false) |
ResultAlign2D | get_rotational_alignment_no_preprocessing (const cv::Mat &POLAR1, const cv::Mat &POLAR2) |
double | get_shift_error (const RegistrationResult &rr1, const RegistrationResult &rr2) |
Distance between the two in-plane translations. | |
void | get_spectrum (const cv::Mat &m, cv::Mat &real, cv::Mat &imag) |
void | get_transformed (const cv::Mat &input, cv::Mat &transformed, const algebra::Transformation2D &T) |
ResultAlign2D | get_translational_alignment (const cv::Mat &input, cv::Mat &m_to_align, bool apply=false) |
Aligns two matrices translationally. More... | |
ResultAlign2D | get_translational_alignment_no_preprocessing (const cv::Mat &M1, const cv::Mat &M2) |
Ints | get_unique_index (const algebra::Rotation3D &rot) |
void | my_meanStdDev (const cv::Mat &m, cv::Scalar &mean, cv::Scalar &stddev) |
template<class T > | |
void | print_vector (const std::vector< T > &v) |
Images | read_images (const Strings &names, const ImageReaderWriter *rw) |
RegistrationResults | read_registration_results (const String &filename) |
Reads a set of registration results. | |
void | save_images (Images images, const Strings &names, const ImageReaderWriter *rw) |
void | show (const cv::Mat &m, std::ostream &out=std::cout) |
Prints a OpenCV matrix. | |
template<typename T > | |
void | show (const cv::Mat_< T > &m, std::ostream &out=std::cout) |
Show a Mat_. | |
void | write_matrix (cv::Mat &m, std::string name) |
Quick and dirty way of writing a OpenCV matrix to a Spider image. | |
void | write_registration_results (String filename, const RegistrationResults &results) |
Writes a set of registration results. | |
void | write_vectors_as_pdb (const algebra::Vector2Ds vs, const String filename) |
void | write_vectors_as_pdb (const algebra::Vector3Ds vs, const String filename) |
Variables | |
const unsigned int | ALIGN2D_NO_PREPROCESSING = 0 |
Methods for registration used by the finder. | |
const unsigned int | ALIGN2D_PREPROCESSING = 1 |
const unsigned int | ALIGN2D_WITH_CENTERS = 2 |
typedef IMP::base::Vector< AverageDistanceLinkage > IMP::em2d::AverageDistanceLinkages |
Pass or store a set of AverageDistanceLinkage .
Definition at line 201 of file hierarchical_clustering.h.
Store a set of objects.
Definition at line 96 of file scores2D.h.
typedef IMP::base::Vector< ClusterSet > IMP::em2d::ClusterSets |
Pass or store a set of ClusterSet .
Definition at line 126 of file hierarchical_clustering.h.
typedef IMP::base::Vector<IMP::base::Pointer< CollisionCrossSection > > IMP::em2d::CollisionCrossSections |
Store a set of objects.
Definition at line 81 of file CollisionCrossSection.h.
typedef IMP::base::Vector< CompleteLinkage > IMP::em2d::CompleteLinkages |
Pass or store a set of CompleteLinkage .
Definition at line 178 of file hierarchical_clustering.h.
typedef IMP::base::Vector<IMP::base::Pointer< DistanceFilter > > IMP::em2d::DistanceFilters |
Store a set of objects.
Definition at line 59 of file domino_filters.h.
typedef IMP::base::Vector<IMP::base::Pointer< DistanceFilterTable > > IMP::em2d::DistanceFilterTables |
Store a set of objects.
Definition at line 44 of file domino_filter_tables.h.
Store a set of objects.
Definition at line 64 of file DummyRestraint.h.
typedef IMP::base::Vector< Em2DRestraintParameters > IMP::em2d::Em2DRestraintParametersList |
Pass or store a set of Em2DRestraintParameters .
Definition at line 72 of file ProjectionFinder.h.
Store a set of objects.
Definition at line 139 of file Em2DRestraint.h.
Store a set of objects.
Definition at line 110 of file scores2D.h.
typedef IMP::base::Vector<IMP::base::Pointer< Fine2DRegistrationRestraint > > IMP::em2d::Fine2DRegistrationRestraints |
Store a set of objects.
Definition at line 103 of file Fine2DRegistrationRestraint.h.
Store a set of objects.
Definition at line 71 of file domino_particle_states.h.
typedef IMP::base::Vector<IMP::base::Pointer< Image > > IMP::em2d::Images |
Pass or store a set of MasksManager .
Definition at line 210 of file ProjectionMask.h.
Pass or store a set of MatchTemplateResult .
Definition at line 91 of file image_processing.h.
typedef IMP::base::Vector<IMP::base::Pointer< MeanAbsoluteDifference > > IMP::em2d::MeanAbsoluteDifferences |
Store a set of objects.
Definition at line 118 of file scores2D.h.
typedef IMP::base::Vector<IMP::base::Pointer< ParticlesDummyRestraint > > IMP::em2d::ParticlesDummyRestraints |
Store a set of objects.
Definition at line 93 of file DummyRestraint.h.
Pass or store a set of PolarResamplingParameters .
Definition at line 195 of file PolarResamplingParameters.h.
typedef IMP::base::Vector< ProjectingOptions > IMP::em2d::ProjectingOptionsList |
typedef IMP::base::Vector< ProjectingParameters > IMP::em2d::ProjectingParametersList |
Store a set of objects.
Definition at line 243 of file ProjectionFinder.h.
Pass or store a set of ProjectionMask .
Definition at line 78 of file ProjectionMask.h.
Store a set of objects.
Definition at line 115 of file domino_particle_states.h.
Pass or store a set of RegistrationResult .
Definition at line 163 of file RegistrationResult.h.
typedef std::pair<algebra::Transformation2D,double> IMP::em2d::ResultAlign2D |
typedef IMP::base::Vector<IMP::base::Pointer< RigidBodiesImageFitRestraint > > IMP::em2d::RigidBodiesImageFitRestraints |
Store a set of objects.
Definition at line 89 of file RigidBodiesImageFitRestraint.h.
Store a set of objects.
Definition at line 84 of file scores2D.h.
Pass or store a set of SegmentationParameters .
Definition at line 73 of file image_processing.h.
typedef IMP::base::Vector< SingleLinkage > IMP::em2d::SingleLinkages |
Pass or store a set of SingleLinkage .
Definition at line 154 of file hierarchical_clustering.h.
typedef std::vector<algebra::Transformation3Ds > IMP::em2d::Transformation3DsList |
Class for the movement of rigid bodies respect to each other. The class is initiated with the rigid body that is going to move (let's call it A). Afterwards, one of more rigid bodies can be added as references. Each reference rigid body needs to specify the set of the internal (relative) transformations that A can have respect to it.
[in] |
Definition at line 34 of file RelativePositionMover.h.
void IMP::em2d::add_noise | ( | cv::Mat & | v, |
double | op1, | ||
double | op2, | ||
const String & | mode = "uniform" , |
||
double | df = 3 |
||
) |
Supported distributions:
void IMP::em2d::apply_circular_mask | ( | const cv::Mat & | mat, |
cv::Mat & | result, | ||
int | radius, | ||
double | value = 0.0 |
||
) |
Applies a circular to a matrix. The center of the mask is the center of the matrx.
[in] | Radius | of the mask |
void IMP::em2d::apply_diffusion_filter | ( | const cv::Mat & | m, |
cv::Mat & | result, | ||
double | beta, | ||
double | pixelsize, | ||
unsigned int | time_steps | ||
) |
Smoothing filter by application of the reaction-diffusion equation of Beltrami flow. Adiga, JSB, 2005
[in] | beta | contribution of diffusion versus edge enhancement. 0 - pure reaction, 90 - pure diffusion |
void IMP::em2d::apply_diffusion_filter | ( | Image * | input, |
Image * | filtered, | ||
double | beta, | ||
double | pixelsize, | ||
int | time_steps | ||
) |
Apply the diffusion filter
input | Input image |
filtered | The image containing the result |
beta | The beta parameter of the difussion filter |
pixelsize | The pixel size of the image |
time_steps | The number of time steps used for the diffusion |
Definition at line 309 of file Image.h.
void IMP::em2d::apply_mask | ( | const cv::Mat & | m, |
cv::Mat & | result, | ||
const cvIntMat & | mask, | ||
double | val | ||
) |
[in] | m | Input matrix |
[in] | result | matrix with the result |
[in] | mask | If the mask is 0, the result has the value of val. Otherwise is the value of m. |
[in] | value | value to apply when the mask is 0 |
void IMP::em2d::apply_mean_outside_mask | ( | Image * | img, |
double | radius | ||
) |
Fills the values that are outside a circle centered at the center of the image with the mean of the values inside the circle the matrix center
[in] | img | Image. It is modified in situ |
[in] | radius | of the circle |
void IMP::em2d::apply_threshold | ( | cv::Mat & | m, |
cv::Mat & | result, | ||
double | threshold = 0.0 |
||
) |
Applys a threshold to an image
[in] | threshold. | all pixels below this value are set to zero |
void IMP::em2d::apply_variance_filter | ( | const cv::Mat & | input, |
cv::Mat & | filtered, | ||
int | kernelsize | ||
) |
Variance filter for an image. Computes the variance for each pixel using the surrounding ones.
[in] | input | image with the data |
[out] | filtered | matrix result of the filtering with the variances |
[in] | kernelsize | The variance is computed using kernelsize x kernelsize pixels around each one. Kernelsize can only be odd. |
void IMP::em2d::apply_variance_filter | ( | Image * | input, |
Image * | filtered, | ||
int | kernelsize | ||
) |
cvIntMat IMP::em2d::create_circular_mask | ( | int | rows, |
int | cols, | ||
int | radius | ||
) |
Creates a circular matrix that is a mask
[in] | rows | |
[in] | cols | |
[in] | radius | The radius of the mask. The center of the mask is the center of the matrix |
Images IMP::em2d::create_evenly_distributed_projections | ( | const ParticlesTemp & | ps, |
unsigned int | n, | ||
const ProjectingOptions & | options | ||
) |
This function is slightly different than the other ones. Only generates evenly distributed projections and determines the size of the images that encloses the particles. Should not be used unless this is exactly what you want.
void IMP::em2d::crop | ( | Image * | img, |
const IntPair & | center, | ||
int | size | ||
) |
Crops an image.
[in] | img | Image to crop. It is modified in place |
[in] | center | The pixel used as the center for cropping |
[in] | size | The size of the new image |
cv::Mat IMP::em2d::crop | ( | const cv::Mat & | m, |
const IntPair & | center, | ||
int | size | ||
) |
Crop an image
[in] | m | Matrix to crop |
[in] | center | The pixel used as the center for cropping |
[in] | size | The size of the new image |
void IMP::em2d::do_combined_fill_holes_and_threshold | ( | cv::Mat & | m, |
cv::Mat & | result, | ||
double | n_stddevs, | ||
double | threshold = 0.0 |
||
) |
[in] | m | Input matrix |
[out] | result | the result matrix |
[in] | n_stddevs | Number of standard deviations used to compute the holes |
[in] | threshold | Removes values below the threshold value |
void IMP::em2d::do_dilate_and_shrink_warp | ( | cv::Mat & | m, |
const cv::Mat & | greyscale, | ||
cv::Mat & | kernel | ||
) |
[in] | m | binary matrix to dilate and shrink |
[in] | greyscale | greyscale matrix that controls the shrinking |
[in] | kernel | dilation kernel |
void IMP::em2d::do_extend_borders | ( | cv::Mat & | orig, |
cv::Mat & | dst, | ||
unsigned int | pix | ||
) |
Extends the bordes of an image
[in] | orig | The image to extend |
[in] | dst | The image destination |
[in] | pix | number of pixels to extend the borders |
void IMP::em2d::do_fill_holes | ( | const cv::Mat & | m, |
cv::Mat & | result, | ||
double | h | ||
) |
[in] | m | the input matrix |
[in] | result | the result matrix |
[in] | h | the height |
ClusterSet IMP::em2d::do_hierarchical_agglomerative_clustering | ( | const FloatsList & | distances | ) |
[in] | distances | Vector of Floats containing all the possible distances(i,j) between elements to cluster. Given N elements to cluster, there are N vectors of size N |
[in] | Function | to calculate distance between clusters. |
[out] | a | ClusterSet class containing all the clustering steps. |
Definition at line 216 of file hierarchical_clustering.h.
int IMP::em2d::do_labeling | ( | const cvIntMat & | m, |
cvIntMat & | mat_to_label | ||
) |
[in] | m | binary matrix to scan. The matrix needs to contain zeros and ones but they can be stored as doubles, floats or ints |
[out] | result | matrix it is returned as a matrix of ints |
[out] | labels | The number of labels in the image |
void IMP::em2d::do_matrix_to_image_flip | ( | cv::Mat & | m | ) |
Transforms a matrix as is given by FFT functions, into a image interpretation. Works the opposite way too.
m | The matrix to flip. The it is changed in situ |
void IMP::em2d::do_morphologic_contrast_enhancement | ( | const cv::Mat & | m, |
cv::Mat & | result, | ||
const cv::Mat & | kernel, | ||
unsigned int | iterations | ||
) |
morphologic enhancement of the contrast This function detects areas in the images and enhances the contrast between them
[in] | m | Imput matrix |
[out] | result | |
[in] | kernel | morphologic kernel to use |
[in] | iterations | Higher number, more contrast |
void IMP::em2d::do_morphologic_reconstruction | ( | const cv::Mat & | mask, |
cv::Mat & | marker, | ||
int | neighbors_mode = 4 |
||
) |
[in] | mask | image to reconstruct |
[out] | marker | this image contains the initial marker points and will contain the final result |
[in] | neighbors_mode | number of neighbors for a pixel to consider when doing the morphologic reconstruction (values: 4, 8). |
void IMP::em2d::do_normalize | ( | Image * | im, |
bool | force = false |
||
) |
Normalize an image subtracting the mean and dividing by the standard deviation
im | Image |
force | If true, the image is normalized even if the header says that it is already normalized |
void IMP::em2d::do_place | ( | cv::Mat & | mask, |
cv::Mat & | m, | ||
const algebra::Vector2D & | v | ||
) |
[in] | mask | matrix to place in m |
[in] | m | matrix |
[in] | v | Pixel of the matrix dest where the center of m is put. |
Definition at line 92 of file ProjectionMask.h.
void IMP::em2d::do_project_particles | ( | const ParticlesTemp & | ps, |
cv::Mat & | m2, | ||
const algebra::Rotation3D & | R, | ||
const algebra::Vector3D & | translation, | ||
const ProjectingOptions & | options, | ||
MasksManagerPtr | masks | ||
) |
[in] | ps | particles to project |
[in] | R | rotation to apply to the particles (respect to the centroid) |
[in] | translation | Translation to apply after rotation |
[in] | clear_matrix_before | If true the matrix is set to zero before projecting the particles. You want this 99% of the time, as setting to false will add one projection on top of the other |
algebra::Vector2Ds IMP::em2d::do_project_vectors | ( | const algebra::Vector3Ds & | ps, |
const algebra::Rotation3D & | R, | ||
const algebra::Vector3D & | translation | ||
) |
[in] | ps | the points |
[in] | R | Rotation to apply to the points to project them in the Z axis |
[in] | translation | translation to apply to the points |
algebra::Vector2Ds IMP::em2d::do_project_vectors | ( | const algebra::Vector3Ds & | ps, |
const algebra::Rotation3D & | R, | ||
const algebra::Vector3D & | translation, | ||
const algebra::Vector3D & | center | ||
) |
[in] | ps | the points |
[in] | R | Rotation to apply to the points to project them in the Z axis |
[in] | translation | translation to apply to the points |
[in] | center | Center point used for the rotation around it |
void IMP::em2d::do_remove_small_objects | ( | cvIntMat & | m, |
double | percentage, | ||
int | background = 0 , |
||
int | foreground = 1 |
||
) |
[in] | m | the matrix |
[in] | percentage | The percentage respect to the largest object that other objects have to be in order to survive the removal. |
[in] | background | value for the background after removed |
[in] | background | value for the foreground after removed |
void IMP::em2d::do_resample_polar | ( | const cv::Mat & | input, |
cv::Mat & | resampled, | ||
const PolarResamplingParameters & | polar_params | ||
) |
[in] | m | matrix to resample |
[out] | result | matrix to contain the resampling |
[in] | polar | params Parameters used for the resampling. Extremely useful for speeding up the procedure if they are given with the transformation maps, that can be built in the PolarResamplingParameters class |
void IMP::em2d::do_resample_polar | ( | Image * | im1, |
Image * | im2, | ||
const PolarResamplingParameters & | polar_params | ||
) |
Resample an image to polar coordinates
im1 | The input image |
im2 | The output image |
polar_params | The parameters used for the sampling |
void IMP::em2d::do_segmentation | ( | const cv::Mat & | m, |
cv::Mat & | result, | ||
const SegmentationParameters & | params | ||
) |
[in] | m | The EM image to segment |
[in] | result | The segmented image, with the shape of the molecule |
void IMP::em2d::do_subtract_images | ( | Image * | first, |
Image * | second, | ||
Image * | result | ||
) |
Subtract two images
first | First image |
second | The second image is subtracted from the second |
result | Result image |
void IMP::em2d::get_autocorrelation2d | ( | const cv::Mat & | m, |
cv::Mat & | corr | ||
) |
Computes the autocorrelation matrix
m | The input matrix |
corr | The result matrix containing the autocorrelation |
void IMP::em2d::get_autocorrelation2d | ( | Image * | im1, |
Image * | im2 | ||
) |
void IMP::em2d::get_autocorrelation2d_no_preprocessing | ( | const cv::Mat & | M, |
cv::Mat & | corr | ||
) |
[in] | M | matrix containing the dft |
[out] | corr | the matrix to store the autocorrelation. Must have the proper dimensions when passed Autocorrelation without preprocessing. |
M | matrix containing the dft | |
corr | The matrix to store the autocorrelation. Must have the proper dimensions when passed. |
MatchTemplateResults IMP::em2d::get_best_template_matches | ( | const cv::Mat & | m, |
const cv::Mat & | templ, | ||
unsigned int | n | ||
) |
Gets the n first matches between an image and a template
[in] | m | Matrix |
[in] | templ | Matrix with a template to be found in m |
[in] | n | Number of positions to recover |
ResultAlign2D IMP::em2d::get_complete_alignment | ( | const cv::Mat & | input, |
cv::Mat & | m_to_align, | ||
bool | apply = false |
||
) |
Aligns completely two matrices (rotationally and translationally). Uses the autocorrelation function to speed up the rotational alignment
[in] | input | Reference matrix |
[in] | m_to_align | Matrix to align to the reference |
[in] | apply | if true, apply the transformation to m_to_align after alignment |
em2d::ResultAlign2D IMP::em2d::get_complete_alignment_no_preprocessing | ( | const cv::Mat & | input, |
const cv::Mat & | INPUT, | ||
const cv::Mat & | POLAR1, | ||
cv::Mat & | m_to_align, | ||
const cv::Mat & | POLAR2, | ||
bool | apply = false |
||
) |
Aligns two matrices rotationally and translationally without performing preprocessing. Preprocessed data must be provided.
[in] | input | first matrix |
[in] | INPUT | fft of the first matrix |
[in] | POLAR1 | fft of the autocorrelation (in polars) of the input. |
[in] | m_to_align | the matrix to align with the input |
[in] | POLAR2 | fft of the autocorrelation (in polars) of m_to_align |
[in] | apply | true if m_to_align is transformed at the end |
ResultAlign2D IMP::em2d::get_complete_alignment_with_centers_no_preprocessing | ( | const algebra::Vector2D & | center1, |
const algebra::Vector2D & | center2, | ||
const cv::Mat & | AUTOC_POLAR1, | ||
const cv::Mat & | AUTOC_POLAR2 | ||
) |
Aligns two matrices (rotation and translation) using centers and no preprocessing. Preprocessed data must be provided.
[in] | center1 | weighted centroid of the reference matrix |
[in] | center2 | weighted centroid of the matrix to align |
[in] | AUTOC_POLAR1 | fft of the autocorrelation (in polars) of the input. |
[in] | AUTOC_POLAR2 | fft of the autocorrelation (in polars) of m_to_align |
void IMP::em2d::get_correlation2d | ( | const cv::Mat & | A, |
const cv::Mat & | B, | ||
cv::Mat & | corr | ||
) |
[in] | A | first matrix |
[in] | B | second matrix |
[out] | corr | matrix of results |
void IMP::em2d::get_correlation2d | ( | Image * | im1, |
Image * | im2, | ||
Image * | corr | ||
) |
void IMP::em2d::get_correlation2d_no_preprocessing | ( | const cv::Mat & | M1, |
const cv::Mat & | M2, | ||
cv::Mat & | corr | ||
) |
Correlation without preprocessing Returns the correlation matrix between two 2D matrices using FFT
[in] | M1 | matrix containing the dft of the first matrix |
[in] | M2 | matrix containing the dft of the second matrix |
[out] | corr | matrix of results (It MUST have the right size in advance) |
double IMP::em2d::get_cross_correlation_coefficient | ( | Image * | im1, |
Image * | im2 | ||
) |
Get the cross correlation coefficient between 2 images
im1 | First image |
im2 | Second image |
std::string IMP::em2d::get_data_path | ( | std::string | file_name | ) |
Each module has its own data directory, so be sure to use the version of this function in the correct module. To read the data file "data_library" that was placed in the data
directory of module "mymodule", do something like
This will ensure that the code works when IMP
is installed or used via the tools/imppy.sh
script.
void IMP::em2d::get_diffusion_filtering_partial_derivative | ( | const cv::Mat & | m, |
cv::Mat & | der, | ||
double | dx, | ||
double | dy, | ||
double | ang | ||
) |
Partial derivative with respect to time for an image filtered with difusion-reaction
[in] | m | input matrix |
[in] | der | output derivative matrix |
[in] | dx | - step for x |
[in] | dy | - step for y |
[in] | ang | - parameter for weight diffusion and edge detection (90-0) |
void IMP::em2d::get_domes | ( | cv::Mat & | m, |
cv::Mat & | result, | ||
double | h | ||
) |
[in] | m | the input matrix |
[in] | result | the result matrix |
[in] | h | the height |
unsigned int IMP::em2d::get_enclosing_image_size | ( | const ParticlesTemp & | ps, |
double | pixel_size, | ||
unsigned int | slack | ||
) |
Get an automatic size for an image that contains the particles
[in] | slack | is the number of pixels left as border |
RegistrationResults IMP::em2d::get_evenly_distributed_registration_results | ( | unsigned int | n_projections | ) |
Provides a set of registration results with directions of projection evenly distributed in the semisphere
[in] | n_projections | the number of requested projections |
std::string IMP::em2d::get_example_path | ( | std::string | file_name | ) |
Each module has its own example directory, so be sure to use the version of this function in the correct module. For example to read the file example_protein.pdb
located in the examples
directory of the IMP::atom module, do
This will ensure that the code works when IMP
is installed or used via the tools/imppy.sh
script.
void IMP::em2d::get_fft_using_optimal_size | ( | const cv::Mat & | m, |
cv::Mat & | M | ||
) |
Get the FFT of a matrix using padding with other matrix that can be computed with FFT in an optimal way. i.e. with a size that makes the FFT algorithm work faster
m | The input matrix |
M | The output matrix with the FFT |
double IMP::em2d::get_global_score | ( | const RegistrationResults & | RRs | ) |
Get the gloal score given a set of individual registration results from images
Floats IMP::em2d::get_histogram | ( | const cv::Mat & | m, |
int | bins | ||
) |
[in] | m | Matrix with the data |
[in] | bins | Number of bins to use in the histogram |
[out] | vector | with the values for each bin |
Floats IMP::em2d::get_histogram | ( | Image * | img, |
int | bins | ||
) |
double IMP::em2d::get_mean | ( | const cv::Mat & | mat, |
const cvIntMat & | mask | ||
) |
Mean of an matrix inside a mask
[in] | mat | The matrix |
[in] | mask | If a pixel is not zero, is considered for computing the mean |
void IMP::em2d::get_morphologic_gradient | ( | const cv::Mat & | m, |
cv::Mat & | result, | ||
const cv::Mat & | kernel | ||
) |
Morphologic gradient: dilation-erosion
[in] | m | Input matrix |
[out] | result | |
[in] | kernel | morphologic kernel |
double IMP::em2d::get_overlap_percentage | ( | cv::Mat & | m1, |
cv::Mat & | m2, | ||
const IntPair & | center | ||
) |
Get the percentage of overlap between two matrices. Two images are overlapping in a pixel if both have values > 0. The overlap is (pixels overlapping) / (pixels > 0 in m2)
[in] | m1 | First matrix |
[in] | m2 | Matrix used to check the overlap. This matrix can be of the same size of m1 or smaller. |
[in] | center | Indicates the position of m1 where to put the center m2. E.g., if center is (32,16) the center of m2 will be in the pixel (32,16) of m1. |
void IMP::em2d::get_projection | ( | em2d::Image * | img, |
const ParticlesTemp & | ps, | ||
const RegistrationResult & | reg, | ||
const ProjectingOptions & | options, | ||
MasksManagerPtr | masks = MasksManagerPtr() , |
||
String | name = "" |
||
) |
[in] | ps | particles to project |
[in] | reg | Registration value with the parameters of the projection |
[in] | masks | Precomputed masks for projecting the particles. Very useful for speeding the projection procedure if they are given. If nullptr, they are computed |
[out] | img | the projection will be stored here |
em2d::Images IMP::em2d::get_projections | ( | const ParticlesTemp & | ps, |
const algebra::SphericalVector3Ds & | vs, | ||
int | rows, | ||
int | cols, | ||
const ProjectingOptions & | options, | ||
Strings | names = Strings() |
||
) |
[in] | ps | particles to project |
[in] | vs | set of spherical vectors with the directions of projection |
[in] | rows | size of the images |
[in] | cols | |
[in] | options | Options for control the projecting |
[in] | names | names of the images |
em2d::Images IMP::em2d::get_projections | ( | const ParticlesTemp & | ps, |
const RegistrationResults & | registration_values, | ||
int | rows, | ||
int | cols, | ||
const ProjectingOptions & | options, | ||
Strings | names = Strings() |
||
) |
[in] | registration_values | Registration values with the parameters of the projections to generate |
RegistrationResults IMP::em2d::get_random_registration_results | ( | unsigned int | n, |
double | maximum_shift = 5.0 |
||
) |
[in] | n | the number of requested results |
[in] | maximum_shift | shift from the center in pixels |
double IMP::em2d::get_rotation_error | ( | const RegistrationResult & | rr1, |
const RegistrationResult & | rr2 | ||
) |
angle in the axis-angle representation of the rotation that takes first to second
em2d::ResultAlign2D IMP::em2d::get_rotational_alignment | ( | const cv::Mat & | input, |
cv::Mat & | m_to_align, | ||
bool | apply = false |
||
) |
Aligns two matrices rotationally. Based on the autocorrelation function of the matrices.
[in] | input | Reference matrix |
[in] | m_to_align | Matrix to align to the reference |
[in] | apply | if true, apply the transformation to m_to_align after alignment |
ResultAlign2D IMP::em2d::get_rotational_alignment_no_preprocessing | ( | const cv::Mat & | POLAR1, |
const cv::Mat & | POLAR2 | ||
) |
Computes the rotational alignment for two autocorrelation matrices It is assumed that the arguments are FFTs
[in] | M1 | fft of the first autocorrelation (in polars) |
[in] | M2 | fft of the second autocorrelation (in polars) |
void IMP::em2d::get_spectrum | ( | const cv::Mat & | m, |
cv::Mat & | real, | ||
cv::Mat & | imag | ||
) |
Computes the fft of a matrix and returns the real and imaginary matrices
m | The input matrix |
real | The matrix with the real part of the FFT matrix |
imag | The imaginary part of the FFT matrix |
void IMP::em2d::get_transformed | ( | const cv::Mat & | input, |
cv::Mat & | transformed, | ||
const algebra::Transformation2D & | T | ||
) |
Applies a transformation to a matrix. First rotates the matrix using the matrix center as the origin of the rotation, and then applies the translation
ResultAlign2D IMP::em2d::get_translational_alignment | ( | const cv::Mat & | input, |
cv::Mat & | m_to_align, | ||
bool | apply = false |
||
) |
[in] | input | Reference matrix |
[in] | m_to_align | Matrix to align to the reference |
[in] | apply | if true, apply the transformation to m_to_align after alignment |
ResultAlign2D IMP::em2d::get_translational_alignment_no_preprocessing | ( | const cv::Mat & | M1, |
const cv::Mat & | M2 | ||
) |
Aligns two matrices translationally without preprocessing. The preprocessed data must be provided.
[in] | M1 | the dft the first matrix (input) |
[in] | M2 | the dft of the matrix to align with the input |
Images IMP::em2d::read_images | ( | const Strings & | names, |
const ImageReaderWriter * | rw | ||
) |
Reads images from files (For compatibility with SPIDER format, the images are read from floats)
[in] | names | filenames of the images |
[in] | rw | reader/writer to use |
void IMP::em2d::save_images | ( | Images | images, |
const Strings & | names, | ||
const ImageReaderWriter * | rw | ||
) |
Saves images to files (For compatibility with SPIDER format, the images are written to floats)
[in] | images | Images to save |
[in] | names | filenames of the images |
[in] | rw | reader/writer to use |
void IMP::em2d::write_vectors_as_pdb | ( | const algebra::Vector2Ds | vs, |
const String | filename | ||
) |
Generate a PDB file from a set of Vector2D (all the points are C-alpha) and the Z coordinate is set to 0.