IMP  2.0.0
The Integrative Modeling Platform
Fine2DRegistrationRestraint.h
Go to the documentation of this file.
1 /**
2  * \file Fine2DRegistrationRestraint.h
3  * \brief Alignment of 2D projections of a 3D volume
4  * Copyright 2007-2013 IMP Inventors. All rights reserved.
5 */
6 
7 #ifndef IMPEM2D_FINE_2DREGISTRATION_RESTRAINT_H
8 #define IMPEM2D_FINE_2DREGISTRATION_RESTRAINT_H
9 
10 #include "IMP/em2d/em2d_config.h"
11 #include "IMP/em2d/project.h"
15 #include "IMP/em2d/Image.h"
16 #include "IMP/em2d/scores2D.h"
17 #include "IMP/algebra/Vector2D.h"
18 #include "IMP/atom/Atom.h"
19 #include "IMP/Pointer.h"
20 #include "IMP/macros.h"
21 
22 IMPEM2D_BEGIN_NAMESPACE
23 
24 //! Performs the fine search for the registration values in order to register
25 //! a model projection with an image
26 class IMPEM2DEXPORT Fine2DRegistrationRestraint : public Restraint
27 {
28 public:
29 
30  /**
31  * Constructs the restraint. Use the setup() function after construction
32  */
34  projection_ = new Image();
35  projection_->set_was_used(true);
36  projection_->set_name("projection-in-fine2d");
37  subject_ = new Image();
38  subject_->set_was_used(true);
39  subject_->set_name("subject-in-fine2d");
40  };
41 
42 
43  /**
44  * Initialization function. To be called after setting the model for the
45  * restraint
46  * @param ps The particles used for the registration
47  * @param params The parameters used to project the images
48  * @param scoring_model The model that is projected.
49  * @param score_function The function that is used to score the similarity
50  * between a projection of the model and the EM image
51  * @param masks A manager containing the masks used for projecting.
52  */
53  void setup(ParticlesTemp &ps, const ProjectingParameters &params,
54  Model *scoring_model,
55  ScoreFunction *score_function,
56  MasksManagerPtr masks=MasksManagerPtr());
57 
58 
59  /**
60  * Sets the image to use by the restraint to perform the fine search of
61  * the projection registration parameters
62  * @param subject The subject image
63  */
64  void set_subject_image(em2d::Image *subject);
65 
66  /**
67  * Get the final values for the parameters after the optimization performed
68  * by this restraint
69  * @return The registration result
70  */
71  RegistrationResult get_final_registration() const;
72 
74 
75  ObjectsTemp get_input_objects() const;
76 
77  /**
78  * Get the number of times that the function was called
79  * @return The number of calls
80  */
81  unsigned int get_calls() const { return calls_;}
82 
83 private:
84 
85 
86  Pointer<Image> subject_;
87  mutable Pointer<Image> projection_;
88  // Subject particle (it is going to be the parameters for the subject)
89  mutable Pointer<Particle> subj_params_particle_;
90  // Decorator for the subject particle
92  // Access point for the particles
93  ParticlesTemp ps_;
94  // Projection masks for the particles
95  MasksManagerPtr masks_;
96  double resolution_,pixelsize_;
97  Pointer<ScoreFunction> score_function_;
98  ProjectingParameters params_;
99 
100  mutable unsigned int calls_;
101 };
102 
104 
105 
106 
107 IMPEM2D_END_NAMESPACE
108 
109 #endif /* IMPEM2D_FINE_2DREGISTRATION_RESTRAINT_H */