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 our 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.
virtual const ParticlesTemp get_refined(Particle *a) const =0
Refine the passed particle into a set of particles.
Import IMP/kernel/RestraintSet.h in the namespace.
algebra::Transformation3D get_transformation(unsigned int i) const
Get the score of the i'th solution.
Simple Monte Carlo optimizer.
FittingSolutions local_rigid_fitting_grid_search(const kernel::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 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 kernel::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.
Import IMP/kernel/ScoreState.h in the namespace.
Class to handle individual model particles.
Storage of a model, its restraints, constraints and particles.
Classes to handle individual model particles. (Note that implementation of inline functions in in int...
IMP::base::Vector< IMP::base::Pointer< OptimizerState > > OptimizerStates
void show(Hierarchy h, std::ostream &out=std::cout)
Print out a molecular hierarchy.
double Float
Basic floating-point value (could be float, double...)
void multiply(const algebra::Transformation3D &t)
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
int Int
Basic integer value.
Import IMP/kernel/OptimizerState.h in the namespace.
FittingSolutions local_rigid_fitting_around_points(kernel::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.
A decorator for a rigid body.
FittingSolutions local_rigid_fitting_around_point(kernel::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.
Abstract class to implement hierarchical methods.
int get_number_of_solutions() const
Get the number of solutions in the set.
FittingSolutions local_rigid_fitting(kernel::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.
Float get_score(unsigned int i) const
Get the score of the i'th solution.