IMP logo
IMP Reference Guide  2.20.0
The Integrative Modeling Platform
IMP::em2d Namespace Reference

Restraints using electron microscopy 2D images (class averages). More...

Detailed Description

Restraints using electron microscopy 2D images (class averages).

The main functionalities are:

  1. Raading and writing EM images
  2. Basic image processing: filtering, morphological operations, segmentation
  3. Image alignment and calculation of cross correlation
  4. Implements several Restraints.

The restraints vary based on how accurately the fit to the class averages is computed, which is usually related to the evaluation speed. Pick more accurate Restraints for higher resolution images and models. Below is the Restraints list sorted from the fastest and most simple to the slowest and most accurate.

  • PCAFitRestraint - compares how well the principal components of the segmented class average fit to the principal components of the particles
  • EM2DRestraint - implements FFT based image alignment. This Restraint in turn uses internally the Fine2DRegistrationRestraint. Don't use the latter one directly. The information obtained after matching a projection with the EM image is stored in RegistrationResult.

The module goes together with the EMageFit application, that uses the EM2DRestraint for modeling of macromolecular assemblies using class averages. The algorithm is described in the PNAS paper below.

As a side note, the class Image has a header that is specific for EM images, but if you don't care for that information, you can use the class to deal with any sort of image, not only EM.

OpenCV

The module works with OpenCV 2.1 or above.

Info

Author(s): Javier Velázquez-Muriel, Daniel Russel, Dina Schneidman

Maintainer: benmwebb

License: GPL This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Publications:

Classes

class  AverageDistanceLinkage
 Functor for hierarchical clustering based on average-linkage. More...
 
class  ChiSquaredScore
 Score based on Chi^2 = ((pixels_image - pixels_projection)/stddev_image)^2. More...
 
class  ClusterSet
 A class to store the clusters generated during hierarchical clustering. More...
 
class  CollisionCrossSection
 Determine the collision cross section for some projections of particles. More...
 
class  CompleteLinkage
 Functor for hierarchical clustering based on complete linkage. More...
 
class  DistanceFilter
 SubsetFilter for checking overlap between projections and images. More...
 
class  DistanceFilterTable
 
class  DummyRestraint
 Dummy restraint between two particles. More...
 
class  Em2DRestraint
 
class  Em2DRestraintParameters
 Parameters used by Em2DRestraint and ProjectionFinder. More...
 
class  EM2DScore
 
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  ImageReaderWriter
 Virtual class for reader/writers of images. More...
 
class  IntsOrder
 
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
 Management of projection masks. More...
 
class  MatchTemplateResult
 
class  MeanAbsoluteDifference
 Score based on the mean of the absolute difference. More...
 
class  ParticlesDummyRestraint
 Dummy restraint for a set of particles. Same use as DummyRestraint. More...
 
class  PCAFitRestraint
 Fast scoring of Particles against electron microscopy class averages. More...
 
class  PolarResamplingParameters
 
class  ProjectingOptions
 Parameters given as options to the get_projections() functions. More...
 
class  ProjectingParameters
 Parameters needed for the core projection routine. More...
 
class  ProjectionFinder
 Class to perform registration of model projections to images. More...
 
class  ProjectionMask
 
class  ProjectionParameters
 
class  ProjectionParametersScoreState
 
class  ProjectionStates
 
class  RegistrationResult
 Class to manage registration results. More...
 
class  RelativePositionMover
 
class  RigidBodiesImageFitRestraint
 Fit rigid bodies to an image. 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  SingleLinkage
 Functor for hierarchical clustering based on single linkage. More...
 
class  SpiderImageReaderWriter
 
class  TIFFImageReaderWriter
 Management of reading/writing TIFF images. More...
 

Typedefs

typedef IMP::Vector
< AverageDistanceLinkage
AverageDistanceLinkages
 
typedef IMP::Vector
< IMP::Pointer
< ChiSquaredScore > > 
ChiSquaredScores
 
typedef IMP::Vector
< IMP::WeakPointer
< ChiSquaredScore > > 
ChiSquaredScoresTemp
 
typedef IMP::Vector< ClusterSetClusterSets
 
typedef IMP::Vector
< IMP::Pointer
< CollisionCrossSection > > 
CollisionCrossSections
 
typedef IMP::Vector
< IMP::WeakPointer
< CollisionCrossSection > > 
CollisionCrossSectionsTemp
 
typedef IMP::Vector
< CompleteLinkage
CompleteLinkages
 
typedef cv::MatConstIterator_
< double > 
cvDoubleConstMatIterator
 
typedef cv::Mat_< double > cvDoubleMat
 
typedef cv::MatIterator_< double > cvDoubleMatIterator
 
typedef cv::Mat_< int > cvIntMat
 
typedef cv::MatIterator_< int > cvIntMatIterator
 
typedef cv::Point_< int > cvPixel
 
typedef std::vector< cvPixel > cvPixels
 
typedef IMP::Vector
< IMP::Pointer< DistanceFilter > > 
DistanceFilters
 
typedef IMP::Vector
< IMP::WeakPointer
< DistanceFilter > > 
DistanceFiltersTemp
 
typedef IMP::Vector
< IMP::Pointer
< DistanceFilterTable > > 
DistanceFilterTables
 
typedef IMP::Vector
< IMP::WeakPointer
< DistanceFilterTable > > 
DistanceFilterTablesTemp
 
typedef IMP::Vector
< IMP::Pointer< DummyRestraint > > 
DummyRestraints
 
typedef IMP::Vector
< IMP::WeakPointer
< DummyRestraint > > 
DummyRestraintsTemp
 
typedef IMP::Vector
< Em2DRestraintParameters
Em2DRestraintParametersList
 
typedef IMP::Vector
< IMP::Pointer< Em2DRestraint > > 
Em2DRestraints
 
typedef IMP::Vector
< IMP::WeakPointer
< Em2DRestraint > > 
Em2DRestraintsTemp
 
typedef IMP::Vector
< IMP::Pointer< EM2DScore > > 
EM2DScores
 
typedef IMP::Vector
< IMP::WeakPointer< EM2DScore > > 
EM2DScoresTemp
 
typedef IMP::Vector
< IMP::Pointer< GridStates > > 
GridStatesList
 
typedef IMP::Vector
< IMP::WeakPointer< GridStates > > 
GridStatesListTemp
 
typedef IMP::Vector
< IMP::Pointer< Image > > 
Images
 A vector of reference counted pointers to EM images of type double. More...
 
typedef IMP::Vector
< IMP::WeakPointer< Image > > 
ImagesTemp
 
typedef std::map< Ints,
unsigned int, IntsOrder
KeyIndexMap
 
typedef std::vector< KeyIndexMap > KeyIndexMaps
 
typedef std::pair< Ints,
unsigned int > 
KeyIndexPair
 
typedef std::shared_ptr
< MasksManager
MasksManagerPtr
 
typedef IMP::Vector< MasksManagerMasksManagers
 
typedef IMP::Vector
< MatchTemplateResult
MatchTemplateResults
 
typedef IMP::Vector
< IMP::Pointer
< MeanAbsoluteDifference > > 
MeanAbsoluteDifferences
 
typedef IMP::Vector
< IMP::WeakPointer
< MeanAbsoluteDifference > > 
MeanAbsoluteDifferencesTemp
 
typedef IMP::Vector
< IMP::Pointer
< ParticlesDummyRestraint > > 
ParticlesDummyRestraints
 
typedef IMP::Vector
< IMP::WeakPointer
< ParticlesDummyRestraint > > 
ParticlesDummyRestraintsTemp
 
typedef IMP::Vector
< PolarResamplingParameters
PolarResamplingParametersList
 
typedef IMP::Vector
< ProjectingOptions
ProjectingOptionsList
 
typedef IMP::Vector
< ProjectingParameters
ProjectingParametersList
 
typedef IMP::Vector
< IMP::Pointer
< ProjectionFinder > > 
ProjectionFinders
 
typedef IMP::Vector
< IMP::WeakPointer
< ProjectionFinder > > 
ProjectionFindersTemp
 
typedef std::shared_ptr
< ProjectionMask
ProjectionMaskPtr
 
typedef IMP::Vector
< ProjectionMask
ProjectionMasks
 
typedef IMP::Vector
< ProjectionParameters
ProjectionParametersList
 
typedef IMP::Vector
< IMP::Pointer
< ProjectionStates > > 
ProjectionStatesList
 
typedef IMP::Vector
< IMP::WeakPointer
< ProjectionStates > > 
ProjectionStatesListTemp
 
typedef IMP::Vector
< RegistrationResult
RegistrationResults
 
typedef std::pair
< algebra::Transformation2D,
double > 
ResultAlign2D
 
typedef IMP::Vector
< IMP::Pointer
< RigidBodiesImageFitRestraint > > 
RigidBodiesImageFitRestraints
 
typedef IMP::Vector
< IMP::WeakPointer
< RigidBodiesImageFitRestraint > > 
RigidBodiesImageFitRestraintsTemp
 
typedef IMP::Vector
< IMP::Pointer< ScoreFunction > > 
ScoreFunctions
 
typedef IMP::Vector
< IMP::WeakPointer
< ScoreFunction > > 
ScoreFunctionsTemp
 
typedef IMP::Vector
< SegmentationParameters
SegmentationParametersList
 
typedef IMP::Vector
< SingleLinkage
SingleLinkages
 
typedef std::vector
< algebra::Transformation3Ds
Transformation3DsList
 

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 &center, int size)
 
cv::Mat crop (const cv::Mat &m, const IntPair &center, 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 thresholding 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 &grayscale, 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)
 Function to perform agglomerative clustering. More...
 
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. More...
 
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 &center)
 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 &params)
 Segmentation of images. More...
 
void do_segmentation (Image *input, Image *result, const SegmentationParameters &params)
 
void do_subtract_images (Image *first, Image *second, Image *result)
 
void get_autocorrelation2d (const cv::Mat &m, cv::Mat &corr)
 Computes the autocorrelation matrix. More...
 
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 &center1, const algebra::Vector2D &center2, 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)
 Correlation without preprocessing. More...
 
double get_cross_correlation_coefficient (const cv::Mat &m1, const cv::Mat &m2)
 Computes the cross-correlation coefficient between to matrices. More...
 
double get_cross_correlation_coefficient (Image *im1, Image *im2)
 Cross correlation between two images. 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)
 Get an automatic size for an image that contains the particles. More...
 
RegistrationResults get_evenly_distributed_registration_results (unsigned int n_projections)
 
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 &center)
 
void get_projection (em2d::Image *img, const ParticlesTemp &ps, const RegistrationResult &reg, 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 projections from particles. More...
 
em2d::Images get_projections (const ParticlesTemp &ps, const RegistrationResults &registration_values, int rows, int cols, const ProjectingOptions &options, Strings names=Strings())
 Generates projections from particles. More...
 
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. More...
 
void 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. More...
 
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)
 Map a rotation to a list of 4 "unique" integers. More...
 
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. More...
 
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. More...
 
template<typename T >
void show (const cv::Mat_< T > &m, std::ostream &out=std::cout)
 Show a Mat_. More...
 
void write_matrix (cv::Mat &m, std::string name)
 Quick and dirty way of writing a OpenCV matrix to a Spider image. More...
 
void write_registration_results (String filename, const RegistrationResults &results)
 Writes a set of registration results. More...
 
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. More...
 
const unsigned int ALIGN2D_PREPROCESSING = 1
 
const unsigned int ALIGN2D_WITH_CENTERS = 2
 

Standard module functions

All IMP modules have a set of standard functions to help get information about the module and about files associated with the module.

std::string get_module_version ()
 Return the version of this module, as a string. More...
 
std::string get_module_name ()
 
std::string get_data_path (std::string file_name)
 Return the full path to one of this module's data files. More...
 
std::string get_example_path (std::string file_name)
 Return the full path to one of this module's example files. More...
 

Typedef Documentation

A vector of reference-counting object pointers.

Definition at line 91 of file scores2D.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
ChiSquaredScore

Definition at line 91 of file scores2D.h.

Pass or store a set of ClusterSet .

Definition at line 119 of file hierarchical_clustering.h.

A vector of reference-counting object pointers.

Definition at line 73 of file CollisionCrossSection.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
CollisionCrossSection

Definition at line 73 of file CollisionCrossSection.h.

Pass or store a set of CompleteLinkage .

Definition at line 171 of file hierarchical_clustering.h.

A vector of reference-counting object pointers.

Definition at line 63 of file domino_filters.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
DistanceFilter

Definition at line 63 of file domino_filters.h.

A vector of reference-counting object pointers.

Definition at line 51 of file domino_filter_tables.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
DistanceFilterTable

Definition at line 51 of file domino_filter_tables.h.

A vector of reference-counting object pointers.

Definition at line 62 of file DummyRestraint.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
DummyRestraint

Definition at line 62 of file DummyRestraint.h.

A vector of reference-counting object pointers.

Definition at line 141 of file em2d/Em2DRestraint.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
Em2DRestraint

Definition at line 141 of file em2d/Em2DRestraint.h.

A vector of reference-counting object pointers.

Definition at line 105 of file scores2D.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
EM2DScore

Definition at line 105 of file scores2D.h.

A vector of reference-counting object pointers.

Definition at line 67 of file domino_particle_states.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
GridStates

Definition at line 67 of file domino_particle_states.h.

A vector of reference counted pointers to EM images of type double.

A vector of reference-counting object pointers.

Definition at line 191 of file Image.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
Image

Definition at line 191 of file Image.h.

Pass or store a set of MasksManager .

Definition at line 221 of file ProjectionMask.h.

Pass or store a set of MatchTemplateResult .

Definition at line 102 of file image_processing.h.

A vector of reference-counting object pointers.

Definition at line 115 of file scores2D.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
MeanAbsoluteDifference

Definition at line 115 of file scores2D.h.

A vector of reference-counting object pointers.

Definition at line 91 of file DummyRestraint.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
ParticlesDummyRestraint

Definition at line 91 of file DummyRestraint.h.

Pass or store a set of ProjectingOptions .

Definition at line 115 of file project.h.

Pass or store a set of ProjectingParameters .

Definition at line 61 of file project.h.

A vector of reference-counting object pointers.

Definition at line 222 of file ProjectionFinder.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
ProjectionFinder

Definition at line 222 of file ProjectionFinder.h.

Pass or store a set of ProjectionMask .

Definition at line 75 of file ProjectionMask.h.

A vector of reference-counting object pointers.

Definition at line 108 of file domino_particle_states.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
ProjectionStates

Definition at line 108 of file domino_particle_states.h.

Pass or store a set of RegistrationResult .

Definition at line 164 of file RegistrationResult.h.

Definition of the result of an alignment. Contains the transformation to apply to the matrix to align and the cross correlation of the solution

Definition at line 22 of file align2D.h.

A vector of reference-counting object pointers.

Definition at line 87 of file RigidBodiesImageFitRestraint.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
RigidBodiesImageFitRestraint

Definition at line 87 of file RigidBodiesImageFitRestraint.h.

A vector of reference-counting object pointers.

Definition at line 79 of file scores2D.h.

A vector of weak (non reference-counting) pointers to specified objects.

See Also
ScoreFunction

Definition at line 79 of file scores2D.h.

Pass or store a set of SingleLinkage .

Definition at line 148 of file hierarchical_clustering.h.

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.

Definition at line 27 of file RelativePositionMover.h.

Function Documentation

void IMP::em2d::add_noise ( cv::Mat &  v,
double  op1,
double  op2,
const String &  mode = "uniform",
double  df = 3 
)

Add noise to the values of a matrix.

Supported distributions:

  • uniform distribution, giving the range (lower, upper). DEFAULT
  • Gaussian distribution, giving the mean and the standard deviation
    add_noise(v1,0, 1);
    // uniform distribution between 0 and 1
    v1.add_noise(0, 1, "uniform");
    // the same
    v1.add_noise(0, 1, "gaussian");
    // Gaussian distribution with 0 mean and stddev=1
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 matrix.

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

beta is the contribution of diffusion versus edge enhancement: 0 - pure reaction, 90 - pure diffusion

Note
The function only works for matrices containing doubles
void IMP::em2d::apply_diffusion_filter ( Image *  input,
Image *  filtered,
double  beta,
double  pixelsize,
int  time_steps 
)

Apply the diffusion filter

Parameters
inputInput image
filteredThe image containing the result
betaThe beta parameter of the diffusion filter
pixelsizeThe pixel size of the image
time_stepsThe number of time steps used for the diffusion

Definition at line 279 of file Image.h.

+ Here is the call graph for this function:

void IMP::em2d::apply_mask ( const cv::Mat &  m,
cv::Mat &  result,
const cvIntMat &  mask,
double  val 
)

Applies a binary mask to an image.

Parameters
[in]mInput matrix
[in]resultmatrix with the result
[in]maskIf the mask is 0, the result has the value of val. Otherwise is the value of m.
[in]valvalue 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

Parameters
[in]imgImage. It is modified in situ
[in]radiusof the circle
void IMP::em2d::apply_threshold ( cv::Mat &  m,
cv::Mat &  result,
double  threshold = 0.0 
)

Applies a threshold to an image threshold is a value such that 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.

Parameters
[in]inputimage with the data
[out]filteredmatrix result of the filtering with the variances
[in]kernelsizeThe 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 
)

Apply a variance filter to an image

Parameters
inputInput image
filteredThe image containing the result
kernelsizeThe size of the kernel to use. The matrix used as kernel will have the same number of rows and columns

Definition at line 266 of file Image.h.

+ Here is the call graph for this function:

cvIntMat IMP::em2d::create_circular_mask ( int  rows,
int  cols,
int  radius 
)

Creates a circular matrix that is a mask

Parameters
[in]rows
[in]cols
[in]radiusThe radius of the mask. The center of the mask is the center of the matrix
Returns
A binary matrix (0/1) with value 1 inside the radius
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.

Parameters
[in]imgImage to crop. It is modified in place
[in]centerThe pixel used as the center for cropping
[in]sizeThe size of the new image
cv::Mat IMP::em2d::crop ( const cv::Mat &  m,
const IntPair &  center,
int  size 
)

Crop an image

Parameters
[in]mMatrix to crop
[in]centerThe pixel used as the center for cropping
[in]sizeThe size of the new image
Returns
A matrix with the cropped region
void IMP::em2d::do_combined_fill_holes_and_threshold ( cv::Mat &  m,
cv::Mat &  result,
double  n_stddevs,
double  threshold = 0.0 
)

Combines the fill holes and thresholding operations together with normalize.

Parameters
[in]mInput matrix
[out]resultthe result matrix
[in]n_stddevsNumber of standard deviations used to compute the holes
[in]thresholdRemoves values below the threshold value
Note
The function does normalize -> fill_holes -> normalize -> threshold -> normalize
void IMP::em2d::do_dilate_and_shrink_warp ( cv::Mat &  m,
const cv::Mat &  grayscale,
cv::Mat &  kernel 
)

(U. Adiga, 2005)

Parameters
[in]mbinary matrix to dilate and shrink
[in]grayscalegrayscale matrix that controls the shrinking
[in]kerneldilation kernel
Note
Only tested with binary matrices m with background =0 and foreground = 1
void IMP::em2d::do_extend_borders ( cv::Mat &  orig,
cv::Mat &  dst,
unsigned int  pix 
)

Extends the borders of an image

Parameters
[in]origThe image to extend
[in]dstThe image destination
[in]pixnumber of pixels to extend the borders
void IMP::em2d::do_fill_holes ( const cv::Mat &  m,
cv::Mat &  result,
double  h 
)

Fills the holes in the matrix m of height h.

Parameters
[in]mthe input matrix
[in]resultthe result matrix
[in]hthe height
Note
The function does not work in-place
template<class LinkageFunction >
ClusterSet IMP::em2d::do_hierarchical_agglomerative_clustering ( const FloatsList &  distances)

Function to perform agglomerative clustering.

Parameters
[in]distancesVector 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
Returns
a ClusterSet class containing all the clustering steps.

Definition at line 203 of file hierarchical_clustering.h.

+ Here is the call graph for this function:

int IMP::em2d::do_labeling ( const cvIntMat &  m,
cvIntMat &  mat_to_label 
)

Labeling function for a matrix.

Parameters
[in]mbinary matrix to scan. The matrix needs to contain zeros and ones but they can be stored as doubles, floats or ints
[out]mat_to_labelmatrix it is returned as a matrix of ints
Returns
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.

Parameters
mThe 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

Parameters
[in]mInput matrix
[out]result
[in]kernelmorphologic kernel to use
[in]iterationsHigher number, more contrast
void IMP::em2d::do_morphologic_reconstruction ( const cv::Mat &  mask,
cv::Mat &  marker,
int  neighbors_mode = 4 
)

morphologic grayscale reconstruction (L Vincent, 1993)

Parameters
[in]maskimage to reconstruct
[out]markerthis image contains the initial marker points and will contain the final result
[in]neighbors_modenumber 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

Parameters
imImage
forceIf true, the image is normalized even if the header says that it is already normalized
void IMP::em2d::do_normalize ( cv::Mat &  m)

Normalize a openCV matrix to mean 0 and stddev 1. It is done in place.

void IMP::em2d::do_place ( cv::Mat &  mask,
cv::Mat &  m,
const algebra::Vector2D &  v 
)
Parameters
[in]maskmatrix to place in m
[in]mmatrix
[in]vPixel of the matrix dest where the center of m is put.

Definition at line 116 of file ProjectionMask.h.

+ Here is the call graph for this function:

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 
)

Projects a set of particles. This is the core function that others call.

Parameters
[in]psparticles to project
[in]m2
[in]Rrotation to apply to the particles (respect to the centroid)
[in]translationTranslation to apply after rotation
[in]options
[in]masks
Note
See the function get_projection() for the rest of the parameters
algebra::Vector2Ds IMP::em2d::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.

Parameters
[in]psthe points
[in]RRotation to apply to the points to project them in the Z axis
[in]translationtranslation to apply to the points
Returns
A set of Vector2D with the projected points
algebra::Vector2Ds IMP::em2d::do_project_vectors ( const algebra::Vector3Ds &  ps,
const algebra::Rotation3D &  R,
const algebra::Vector3D &  translation,
const algebra::Vector3D &  center 
)

Project the points contained in Vector3Ds.

Parameters
[in]psthe points
[in]RRotation to apply to the points to project them in the Z axis
[in]translationtranslation to apply to the points
[in]centerCenter point used for the rotation around it
Returns
A set of Vector2D with the projected points
void IMP::em2d::do_remove_small_objects ( cvIntMat &  m,
double  percentage,
int  background = 0,
int  foreground = 1 
)

Removes small objects from a matrix of integers.

Parameters
[in]mthe matrix
[in]percentageThe percentage respect to the largest object that other objects have to be in order to survive the removal.
[in]backgroundvalue for the background after removed
[in]foregroundvalue for the foreground after removed
void IMP::em2d::do_resample_polar ( const cv::Mat &  input,
cv::Mat &  resampled,
const PolarResamplingParameters &  polar_params 
)

Resamples a matrix to polar coordinates.

Parameters
[in]inputmatrix to resample
[out]resampledresult matrix to contain the resampling
[in]polar_paramsParameters 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

Parameters
im1The input image
im2The output image
polar_paramsThe parameters used for the sampling
void IMP::em2d::do_segmentation ( const cv::Mat &  m,
cv::Mat &  result,
const SegmentationParameters &  params 
)

Segmentation of images.

Parameters
[in]mThe EM image to segment
[in]resultThe segmented image, with the shape of the molecule
[in]params
void IMP::em2d::do_subtract_images ( Image *  first,
Image *  second,
Image *  result 
)

Subtract two images

Parameters
firstFirst image
secondThe second image is subtracted from the second
resultResult image
void IMP::em2d::get_autocorrelation2d ( const cv::Mat &  m,
cv::Mat &  corr 
)

Computes the autocorrelation matrix.

Parameters
mThe input matrix
corrThe result matrix containing the autocorrelation
void IMP::em2d::get_autocorrelation2d ( Image *  im1,
Image *  im2 
)

Compute the autocorrelation for an image

Parameters
im1The input image
im2The output image

Definition at line 226 of file Image.h.

+ Here is the call graph for this function:

void IMP::em2d::get_autocorrelation2d_no_preprocessing ( const cv::Mat &  M,
cv::Mat &  corr 
)

Autocorrelation without preprocessing.

Parameters
[in]Mmatrix containing the dft
[out]corrthe 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

Parameters
[in]mMatrix
[in]templMatrix with a template to be found in m
[in]nNumber 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

Parameters
[in]inputReference matrix
[in]m_to_alignMatrix to align to the reference
[in]applyif true, apply the transformation to m_to_align after alignment
Returns
The result. Check the definition of ResultAlign2D
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.

Parameters
[in]inputfirst matrix
[in]INPUTfft of the first matrix
[in]POLAR1fft of the autocorrelation (in polars) of the input.
[in]m_to_alignthe matrix to align with the input
[in]POLAR2fft of the autocorrelation (in polars) of m_to_align
[in]applytrue if m_to_align is transformed at the end
Returns
The result. Check the definition of ResultAlign2D
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.

Parameters
[in]center1weighted centroid of the reference matrix
[in]center2weighted centroid of the matrix to align
[in]AUTOC_POLAR1fft of the autocorrelation (in polars) of the input.
[in]AUTOC_POLAR2fft of the autocorrelation (in polars) of m_to_align
Returns
The result. Check the definition of ResultAlign2D
void IMP::em2d::get_correlation2d ( const cv::Mat &  A,
const cv::Mat &  B,
cv::Mat &  corr 
)

Correlation matrix between two 2D matrices using FFT.

Parameters
[in]Afirst matrix
[in]Bsecond matrix
[out]corrmatrix of results
void IMP::em2d::get_correlation2d ( Image *  im1,
Image *  im2,
Image *  corr 
)

Compute the cross correlation matrix between two images

Parameters
im1First input image
im2First second image
corrThe output image of cross correlation values

Definition at line 236 of file Image.h.

+ Here is the call graph for this function:

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
Parameters
[in]M1matrix containing the dft of the first matrix
[in]M2matrix containing the dft of the second matrix
[out]corrmatrix of results (It MUST have the right size in advance)
double IMP::em2d::get_cross_correlation_coefficient ( const cv::Mat &  m1,
const cv::Mat &  m2 
)

Computes the cross-correlation coefficient between to matrices.

double IMP::em2d::get_cross_correlation_coefficient ( Image *  im1,
Image *  im2 
)

Cross correlation between two images.

Get the cross correlation coefficient between 2 images

Parameters
im1First image
im2Second image
Returns
The value of the coefficient. Ranges from 0 to 1
std::string IMP::em2d::get_data_path ( std::string  file_name)

Return the full path to one of this module's data files.

To read the data file "data_library" that was placed in the data directory of this module, do something like

std::ifstream in(IMP::em2d::get_data_path("data_library"));

This will ensure that the code works both when IMP is installed or if used via the setup_environment.sh script.

Note
Each module has its own data directory, so be sure to use this function from the correct module.
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 diffusion-reaction

Parameters
[in]minput matrix
[in]deroutput 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 
)

Gets the domes of m with height h.

Parameters
[in]mthe input matrix
[in]resultthe result matrix
[in]hthe height
Note
The function does not work in-place
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.

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 hemisphere

Parameters
[in]n_projectionsthe number of requested projections
std::string IMP::em2d::get_example_path ( std::string  file_name)

Return the full path to one of this module's example files.

To read the example file "example_protein.pdb" that was placed in the examples directory of this module, do something like

std::ifstream in(IMP::em2d::get_example_path("example_protein.pdb"));

This will ensure that the code works both when IMP is installed or if used via the setup_environment.sh script.

Note
Each module has its own example directory, so be sure to use this function from the correct module.
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

Parameters
mThe input matrix
MThe output matrix with the FFT
Note
The output matrix can have (and frequently will have) different dimensions than the input matrix
double IMP::em2d::get_global_score ( const RegistrationResults &  RRs)

Get the global score given a set of individual registration results from images

Note
The function checks what time of registration results are given.
  • If the registration results correspond to a coarse registration, the score is based on the cross-correlation (currently, the score is a mean of the cross-correlation coefficients.
  • If the registration results are obtained after a fine registration, the score is the average of all the registration scores. This score g depends on the function selected. Eg. EM2DScore.
Floats IMP::em2d::get_histogram ( const cv::Mat &  m,
int  bins 
)

Computes the histogram of a matrix.

Parameters
[in]mMatrix with the data
[in]binsNumber of bins to use in the histogram
Returns
vector with the values for each bin
Floats IMP::em2d::get_histogram ( Image *  img,
int  bins 
)

Gets an histogram of the values of the image

Parameters
imgThe image
binsThe number of bins to use to build the histogram
Returns
The histogram: number of points per bin

Definition at line 255 of file Image.h.

+ Here is the call graph for this function:

double IMP::em2d::get_mean ( const cv::Mat &  mat,
const cvIntMat &  mask 
)

Mean of an matrix inside a mask

Parameters
[in]matThe matrix
[in]maskIf a pixel is not zero, is considered for computing the mean
Returns
The mean
std::string IMP::em2d::get_module_version ( )

Return the version of this module, as a string.

Note
This function is only available in Python.

Definition at line 5 of file EMageFit/__init__.py.

void IMP::em2d::get_morphologic_gradient ( const cv::Mat &  m,
cv::Mat &  result,
const cv::Mat &  kernel 
)

Morphologic gradient: dilation-erosion

Parameters
[in]mInput matrix
[out]result
[in]kernelmorphologic 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)

Parameters
[in]m1First matrix
[in]m2Matrix used to check the overlap. This matrix can be of the same size of m1 or smaller.
[in]centerIndicates 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 = "" 
)

Generates a projection from particles.

Parameters
[in]img
[in]psparticles to project
[in]regRegistration value with the parameters of the projection
[in]options
[in]masksPrecomputed masks for projecting the particles. Very useful for speeding the projection procedure if they are given. If nullptr, they are computed
[in]name
Returns
img the projection will be stored here
Note
See the function get_projections() for the rest of the parameters
em2d::Images IMP::em2d::get_projections ( const ParticlesTemp &  ps,
const algebra::SphericalVector3Ds &  vs,
int  rows,
int  cols,
const ProjectingOptions &  options,
Strings  names = Strings() 
)

Generates projections from particles.

Parameters
[in]psparticles to project
[in]vsset of spherical vectors with the directions of projection
[in]rowssize of the images
[in]cols
[in]optionsOptions for control the projecting
[in]namesnames 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() 
)

Generates projections from particles.

registration_values describes registration values with the parameters of the projections to generate.

Note
See the function get_projections() for the rest of the parameters
RegistrationResults IMP::em2d::get_random_registration_results ( unsigned int  n,
double  maximum_shift = 5.0 
)

Provides a set of random registration results (or parameters)

Parameters
[in]nthe number of requested results
[in]maximum_shiftshift 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.

Parameters
[in]inputReference matrix
[in]m_to_alignMatrix to align to the reference
[in]applyif true, apply the transformation to m_to_align after alignment
Returns
The result. Check the definition of ResultAlign2D
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

Parameters
[in]POLAR1fft of the first autocorrelation (in polars)
[in]POLAR2fft of the second autocorrelation (in polars)
Returns
The result. Check the definition of ResultAlign2D
double IMP::em2d::get_shift_error ( const RegistrationResult &  rr1,
const RegistrationResult &  rr2 
)

Distance between the two in-plane translations.

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.

Parameters
mThe input matrix
realThe matrix with the real part of the FFT matrix
imagThe 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 
)

Aligns two matrices translationally.

Parameters
[in]inputReference matrix
[in]m_to_alignMatrix to align to the reference
[in]applyif true, apply the transformation to m_to_align after alignment
Returns
The result. Check the definition of ResultAlign2D
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.

Parameters
[in]M1the dft the first matrix (input)
[in]M2the dft of the matrix to align with the input
Returns
The result. Check the definition of ResultAlign2D
Ints IMP::em2d::get_unique_index ( const algebra::Rotation3D &  rot)

Map a rotation to a list of 4 "unique" integers.

Each integer is simply the integer part and the first 2 decimal places of the floating point value from the quaternion. This list of integers can then be used as a key for rotations.

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)

Parameters
[in]namesfilenames of the images
[in]rwreader/writer to use
RegistrationResults IMP::em2d::read_registration_results ( const String &  filename)

Reads a set of registration results.

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)

Parameters
[in]imagesImages to save
[in]namesfilenames of the images
[in]rwreader/writer to use
void IMP::em2d::show ( const cv::Mat &  m,
std::ostream &  out = std::cout 
)

Prints a OpenCV matrix.

template<typename T >
void IMP::em2d::show ( const cv::Mat_< T > &  m,
std::ostream &  out = std::cout 
)

Show a Mat_.

Definition at line 47 of file opencv_interface.h.

void IMP::em2d::write_matrix ( cv::Mat &  m,
std::string  name 
)

Quick and dirty way of writing a OpenCV matrix to a Spider image.

void IMP::em2d::write_registration_results ( String  filename,
const RegistrationResults &  results 
)

Writes a set of registration results.

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.

Note
This version deals with the problem of having more than 10000 points

Variable Documentation

const unsigned int IMP::em2d::ALIGN2D_NO_PREPROCESSING = 0

Methods for registration used by the finder.

Definition at line 33 of file ProjectionFinder.h.