IMP  2.1.1
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/base/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 kernel::Restraint
27 {
28 public:
29 
30  /**
31  * Constructs the restraint. Use the setup() function after construction
32  */
34 
35 
36  /**
37  * Initialization function. To be called after setting the model for the
38  * restraint
39  * @param ps The particles used for the registration
40  * @param params The parameters used to project the images
41  * @param scoring_model The model that is projected.
42  * @param score_function The function that is used to score the similarity
43  * between a projection of the model and the EM image
44  * @param masks A manager containing the masks used for projecting.
45  */
46  void setup(kernel::ParticlesTemp &ps, const ProjectingParameters &params,
47  kernel::Model *scoring_model,
48  ScoreFunction *score_function,
49  MasksManagerPtr masks=MasksManagerPtr());
50 
51 
52  /**
53  * Sets the image to use by the restraint to perform the fine search of
54  * the projection registration parameters
55  * @param subject The subject image
56  */
57  void set_subject_image(em2d::Image *subject);
58 
59  /**
60  * Get the final values for the parameters after the optimization performed
61  * by this restraint
62  * @return The registration result
63  */
64  RegistrationResult get_final_registration() const;
65 
66  virtual double
67  unprotected_evaluate(IMP::kernel::DerivativeAccumulator *accum)
68  const IMP_OVERRIDE;
69  virtual IMP::kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
71 
72  /**
73  * Get the number of times that the function was called
74  * @return The number of calls
75  */
76  unsigned int get_calls() const { return calls_;}
77 
78 private:
79 
80 
81  base::Pointer<Image> subject_;
82  mutable base::Pointer<Image> projection_;
83  // Subject particle (it is going to be the parameters for the subject)
84  mutable base::Pointer<kernel::Particle> subj_params_particle_;
85  // Decorator for the subject particle
87  // Access point for the particles
89  // Projection masks for the particles
90  MasksManagerPtr masks_;
91  double resolution_,pixelsize_;
92  base::Pointer<ScoreFunction> score_function_;
93  ProjectingParameters params_;
94 
95  mutable unsigned int calls_;
96 };
97 
99 
100 
101 
102 IMPEM2D_END_NAMESPACE
103 
104 #endif /* IMPEM2D_FINE_2DREGISTRATION_RESTRAINT_H */
Generation of projections from models or density maps Copyright 2007-2013 IMP Inventors. All rights reserved.
Class for adding derivatives from restraints to the model.
projection masks Copyright 2007-2013 IMP Inventors. All rights reserved.
Decorator for projection parameters Copyright 2007-2013 IMP Inventors. All rights reserved...
A nullptr-initialized pointer to an IMP Object.
Simple 2D vector class.
Simple atom decorator.
A smart pointer to a reference counted object.
Definition: base/Pointer.h:87
Import IMP/kernel/macros.h in the namespace.
IMP images for Electron Microscopy using openCV matrices Copyright 2007-2013 IMP Inventors. All rights reserved.
Scoring functions for 2D Copyright 2007-2013 IMP Inventors. All rights reserved.
A restraint is a term in an IMP ScoringFunction.
Base class for all scoring functions related to em2d.
Definition: scores2D.h:58
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Parameters needed for the core projection routine.
Definition: project.h:31
virtual ModelObjectsTemp do_get_inputs() const =0
Class to manage registration results.
Registration results class Copyright 2007-2013 IMP Inventors. All rights reserved.
2D Electron Microscopy images in IMP
Definition: Image.h:32
Class for storing model, its restraints, constraints, and particles.