8 #ifndef IMPEM_RIGID_FITTING_H
9 #define IMPEM_RIGID_FITTING_H
19 #include <IMP/em/em_config.h>
34 typedef std::pair<algebra::Transformation3D, Float> FittingSolution;
36 bool operator()(
const FittingSolution &s1,
37 const FittingSolution &s2)
const {
38 return s1.second < s2.second;
53 "The index requested ("
54 << i <<
") in get_transformation is out of range ("
55 << fs_.size() <<
")" << std::endl);
65 "The index requested ("
66 << i <<
") in get_transformation is out of range ("
67 << fs_.size() <<
")" << std::endl);
70 void set_score(
unsigned int i,
Float score) {
72 "The index requested ("
73 << i <<
") in get_transformation is out of range ("
74 << fs_.size() <<
")" << std::endl);
75 fs_[i].second = score;
80 void sort(
bool reverse =
false);
84 for (
unsigned int i = 0; i < fs_.size(); i++)
85 fs_[i].first = fs_[i].first * t;
89 for (
unsigned int i = 0; i < fs_.size(); i++)
90 all_ts.push_back(fs_[i].first);
93 void show(std::ostream &out = std::cout)
const {
94 for (std::vector<FittingSolution>::const_iterator it = fs_.begin();
95 it != fs_.end(); it++) {
96 out <<
"(" << it->first <<
" , " << it->second <<
")" << std::endl;
101 std::vector<FittingSolution> fs_;
137 Int number_of_mc_steps = 10,
Int number_of_cg_steps = 100,
138 Float max_translation = 2.,
Float max_rotation = .3,
bool fast =
false);
171 Int number_of_optimization_runs = 5,
Int number_of_mc_steps = 10,
172 Int number_of_cg_steps = 100,
Float max_translation = 2.,
173 Float max_rotation = .3,
bool fast =
true) {
179 p, refiner, weight_key, dmap, rb_cen, display_log,
180 number_of_optimization_runs, number_of_mc_steps, number_of_cg_steps,
181 max_translation, max_rotation, fast);
208 Int number_of_mc_steps = 10,
Int number_of_cg_steps = 100,
209 Float max_translation = 2.,
Float max_rotation = .3);
233 Int max_voxels_translation = 2,
Int translation_step = 1,
234 Float max_angle_in_radians = 0.174,
Int number_of_rotations = 100);
255 IMPEMEXPORT FittingSolutions
258 bool fast_version =
false,
bool local_score =
false,
260 atom::Mass::get_mass_key());
276 transformations,
true);
289 FloatKey wei_key = atom::Mass::get_mass_key());
Simple conjugate gradients optimizer.
Calculate score based on fit to EM map.
Used to hold a set of related restraints.
algebra::Transformation3D get_transformation(unsigned int i) const
Get the score of the i'th solution.
Simple Monte Carlo optimizer.
Storage of a model, its restraints, constraints and particles.
A simple list of fitting solutions.
#define IMP_LOG_VERBOSE(expr)
algebra::Vector3D get_centroid(const XYZs &ps)
Get the centroid.
Class for handling density maps.
Class for handling density maps.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
functionality for defining rigid bodies
Float compute_fitting_score(const ParticlesTemp &ps, DensityMap *em_map, FloatKey wei_key=atom::Mass::get_mass_key())
Compute fitting scores for a given set of rigid transformations.
FittingSolutions compute_fitting_scores(DensityMap *em_map, core::RigidBody rb, Refiner *refiner, const algebra::Transformation3Ds &transformations)
Compute fitting scores for a given set of rigid transformations.
FittingSolutions local_rigid_fitting_around_point(Particle *p, Refiner *refiner, const FloatKey &weight_key, DensityMap *dmap, const algebra::Vector3D &anchor_centroid, OptimizerStates display_log, Int number_of_optimization_runs=5, Int number_of_mc_steps=10, Int number_of_cg_steps=100, Float max_translation=2., Float max_rotation=.3, bool fast=false)
Local rigid fitting of a rigid body around a center point.
virtual const ParticlesTemp get_refined(Particle *a) const =0
Refine the passed particle into a set of particles.
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
std::ostream & show(Hierarchy h, std::ostream &out=std::cout)
Print the hierarchy using a given decorator to display each node.
FittingSolutions local_rigid_fitting(Particle *p, Refiner *refiner, const FloatKey &weight_key, DensityMap *dmap, OptimizerStates display_log, Int number_of_optimization_runs=5, Int number_of_mc_steps=10, Int number_of_cg_steps=100, Float max_translation=2., Float max_rotation=.3, bool fast=true)
Local rigid fitting of a rigid body.
double Float
Basic floating-point value (could be float, double...)
Abstract class to implement hierarchical methods.
void multiply(const algebra::Transformation3D &t)
Class to handle individual particles of a Model object.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
int Int
Basic integer value.
FittingSolutions local_rigid_fitting_around_points(Particle *p, Refiner *refiner, const FloatKey &wei_key, DensityMap *dmap, const algebra::Vector3Ds &anchor_centroids, OptimizerStates display_log, Int number_of_optimization_runs=5, Int number_of_mc_steps=10, Int number_of_cg_steps=100, Float max_translation=2., Float max_rotation=.3)
Local rigid fitting of a rigid body around a set of center points.
FittingSolutions local_rigid_fitting_grid_search(const ParticlesTemp &ps, const FloatKey &wei_key, DensityMap *dmap, Int max_voxels_translation=2, Int translation_step=1, Float max_angle_in_radians=0.174, Int number_of_rotations=100)
Local grid search rigid fitting.
A decorator for a rigid body.
int get_number_of_solutions() const
Get the number of solutions in the set.
Float get_score(unsigned int i) const
Get the score of the i'th solution.