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