8 #ifndef IMPEM_RIGID_FITTING_H
9 #define IMPEM_RIGID_FITTING_H
19 #include <IMP/em/em_config.h>
24 #include <boost/serialization/access.hpp>
25 #include <boost/serialization/vector.hpp>
28 namespace serialization {
29 template<
class Archive>
void serialize(Archive &ar,
30 std::pair<IMP::algebra::Transformation3D, IMP::Float> &g,
32 ar & g.first & g.second;
47 typedef std::pair<algebra::Transformation3D, Float> FittingSolution;
49 bool operator()(
const FittingSolution &s1,
50 const FittingSolution &s2)
const {
51 return s1.second < s2.second;
66 "The index requested ("
67 << i <<
") in get_transformation is out of range ("
68 << fs_.size() <<
")" << std::endl);
78 "The index requested ("
79 << i <<
") in get_transformation is out of range ("
80 << fs_.size() <<
")" << std::endl);
83 void set_score(
unsigned int i,
Float score) {
85 "The index requested ("
86 << i <<
") in get_transformation is out of range ("
87 << fs_.size() <<
")" << std::endl);
88 fs_[i].second = score;
93 void sort(
bool reverse =
false);
97 for (
unsigned int i = 0; i < fs_.size(); i++)
98 fs_[i].first = fs_[i].first * t;
102 for (
unsigned int i = 0; i < fs_.size(); i++)
103 all_ts.push_back(fs_[i].first);
106 void show(std::ostream &out = std::cout)
const {
107 for (std::vector<FittingSolution>::const_iterator it = fs_.begin();
108 it != fs_.end(); it++) {
109 out <<
"(" << it->first <<
" , " << it->second <<
")" << std::endl;
114 std::vector<FittingSolution> fs_;
117 friend class boost::serialization::access;
119 template<
class Archive>
void serialize(Archive &ar,
const unsigned int) {
157 Int number_of_mc_steps = 10,
Int number_of_cg_steps = 100,
158 Float max_translation = 2.,
Float max_rotation = .3,
bool fast =
false);
191 Int number_of_optimization_runs = 5,
Int number_of_mc_steps = 10,
192 Int number_of_cg_steps = 100,
Float max_translation = 2.,
193 Float max_rotation = .3,
bool fast =
true) {
199 p, refiner, weight_key, dmap, rb_cen, display_log,
200 number_of_optimization_runs, number_of_mc_steps, number_of_cg_steps,
201 max_translation, max_rotation, fast);
228 Int number_of_mc_steps = 10,
Int number_of_cg_steps = 100,
229 Float max_translation = 2.,
Float max_rotation = .3);
253 Int max_voxels_translation = 2,
Int translation_step = 1,
254 Float max_angle_in_radians = 0.174,
Int number_of_rotations = 100);
275 IMPEMEXPORT FittingSolutions
278 bool fast_version =
false,
bool local_score =
false,
280 atom::Mass::get_mass_key());
296 transformations,
true);
309 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.