IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
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-2022 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>
17#include <IMP/spb/spb_config.h>
18
19IMPSPB_BEGIN_NAMESPACE
20/** A restraint for using EM2D cross-corr in a Bayesian way
21 \include EM2DRestraint.cpp
22 */
23
24class IMPSPBEXPORT EM2DRestraint : public spb::ISDRestraint {
25 Particles ps_;
27 int constr_type_;
29 Float rows_;
30 Float cols_;
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 override;
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
75 override;
77
79};
80
81IMPSPB_END_NAMESPACE
82
83#endif /* IMPSPB_EM2D_RESTRAINT_H */
IMP images for Electron Microscopy Copyright 2007-2026 IMP Inventors. All rights reserved.
A nullptr-initialized pointer to an IMP Object.
Registration results class Copyright 2007-2022 IMP Inventors. All rights reserved.
A decorator for scale parameters particles.
Class for adding derivatives from restraints to the model.
Class to handle individual particles of a Model object.
Definition Particle.h:45
Parameters given as options to the get_projections() functions.
Definition project.h:67
virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
IMP::ModelObjectsTemp do_get_inputs() const override
EM2DRestraint(Particles ps, Particle *sigma, std::string ifile, Float px_size, Float res)
EM2D cross correlation is used to score models in a Bayesian way.
Apply an NOE distance restraint between two particles.
IMP::Vector< RegistrationResult > RegistrationResults
Vector< Pointer< Particle > > Particles
A list of reference-counted Particle objects.
Definition base_types.h:138
double Float
Basic floating-point value (could be float, double...).
Definition types.h:19
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
Definition base_types.h:122
IMP::Vector< Float > Floats
Standard way to pass a bunch of Float values.
Definition types.h:46
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Generation of projections from models or density maps Copyright 2007-2026 IMP Inventors....
A lognormal restraint that uses the ISPA model to model NOE-derived distance fit.
A smart pointer to a ref-counted Object that is a class member.
Definition Pointer.h:144