IMP logo
IMP Reference Guide  2.12.0
The Integrative Modeling Platform
spb/Em2DRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/spb/EM2DRestraint.h
3  * \brief A restraint for using EM2D cross-corr in a Bayesian way
4  *
5  * Copyright 2007-2019 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPSPB_EM2D_RESTRAINT_H
10 #define IMPSPB_EM2D_RESTRAINT_H
11 #include <IMP/Pointer.h>
12 #include <IMP/em2d/Image.h>
14 #include <IMP/em2d/project.h>
15 #include <IMP/isd/Scale.h>
16 #include <IMP/spb/ISDRestraint.h>
17 #include "spb_config.h"
18 
19 IMPSPB_BEGIN_NAMESPACE
20 /** A restraint for using EM2D cross-corr in a Bayesian way
21  \include EM2DRestraint.cpp
22  */
23 
24 class IMPSPBEXPORT EM2DRestraint : public spb::ISDRestraint {
25  Particles ps_;
27  int constr_type_;
29  Float rows_;
30  Float cols_;
31  em2d::ProjectingOptions options_;
33  Floats fmod_grid_;
34  Floats grid_;
35 
36  void read_image(std::string ifile, Float px_size, Float res);
37  double get_truncated_normalization(double mean, double sigma) const;
38  double get_normal_pdf(double mean, double sigma, double x) const;
39  void init_grid(const Floats& sigma_grid);
40  int get_closest(std::vector<double> const& vec, double value) const;
41 
42  public:
43  //! EM2D cross correlation is used to score models in a Bayesian way.
44 
45  EM2DRestraint(Particles ps, Particle* sigma, std::string ifile, Float px_size,
46  Float res);
47 
48  EM2DRestraint(Particles ps, Floats sigma_grid, Floats fmod_grid,
49  std::string ifile, Float px_size, Float res);
50 
51  // set particles
52  void set_particles(Particles ps);
53 
54  // get cross correlation
55  double get_cross_correlation() const;
56 
57  // get marginalized likelihood
58  double get_marginal_element(double fmod) const;
59 
60  // get likelihood
61  double get_element(double fmod, double sigma) const;
62 
63  // get probability
64  double get_probability() const;
65 
66  /** This macro declares the basic needed methods: evaluate and show
67  */
68  // IMP_RESTRAINT(EM2DRestraint);
69  //
70  /** This macro declares the basic needed methods: evaluate and show
71  * */
72  // IMP_RESTRAINT( UniformBoundedRestraint);
73 
74  virtual double unprotected_evaluate(IMP::DerivativeAccumulator* accum) const
77 
79 };
80 
81 IMPSPB_END_NAMESPACE
82 
83 #endif /* IMPSPB_EM2D_RESTRAINT_H */
Generation of projections from models or density maps Copyright 2007-2019 IMP Inventors. All rights reserved.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
A decorator for scale parameters particles.
Parameters given as options to the get_projections() functions.
Definition: project.h:59
IMP images for Electron Microscopy using openCV matrices Copyright 2007-2019 IMP Inventors. All rights reserved.
A smart pointer to a ref-counted Object that is a class member.
Definition: Pointer.h:146
A lognormal restraint that uses the ISPA model to model NOE-derived distance fit. ...
A nullptr-initialized pointer to an IMP Object.
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:20
Class to handle individual particles of a Model object.
Definition: Particle.h:41
Apply an NOE distance restraint between two particles.
Registration results class Copyright 2007-2019 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.