IMP  2.2.1
The Integrative Modeling Platform
Gaussian3D.h
Go to the documentation of this file.
1 /**
2  * \file IMP/algebra/Gaussian3D.h
3  * \brief gaussian shape
4  *
5  * Copyright 2007-2014 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPALGEBRA_GAUSSIAN3D_H
10 #define IMPALGEBRA_GAUSSIAN3D_H
11 
12 #include <IMP/algebra/algebra_config.h>
13 #include "Transformation3D.h"
14 #include "ReferenceFrame3D.h"
15 #include <IMP/algebra/VectorD.h>
17 #include <IMP/algebra/eigen3/Eigen/Dense>
18 
19 IMPALGEBRA_BEGIN_NAMESPACE
20 
21 /** A gaussian distribution in 3D.
22 
23  The variances are along the axis of the reference frame.
24 */
25 class Gaussian3D : public GeometricPrimitiveD<3> {
26  ReferenceFrame3D tr_;
27  Vector3D variances_;
28 
29  public:
30  Gaussian3D() {}
31  Gaussian3D(const ReferenceFrame3D &tr, const Vector3D &variances)
32  : tr_(tr), variances_(variances) {}
33 
34  const ReferenceFrame3D &get_reference_frame() const { return tr_; }
35  const Vector3D &get_variances() const { return variances_; }
36  inline const Vector3D &get_center() const {
37  return get_reference_frame().get_transformation_to().get_translation();
38  }
39  IMP_SHOWABLE_INLINE(Gaussian3D, out << tr_ << ": " << variances_);
40 };
42 
43 /** Return the covariance matrix from a given set of standard deviations in
44  the passed reference frame. */
45 IMPALGEBRAEXPORT IMP_Eigen::Matrix3d get_covariance(const Gaussian3D &g);
46 
47 /** Return a Gaussian centered at the origin from a covariance matrix. */
48 IMPALGEBRAEXPORT Gaussian3D
49  get_gaussian_from_covariance(const IMP_Eigen::Matrix3d &covariance,
50  const Vector3D &center);
51 
52 /** Rasterize the gaussians to a grid.*/
53 IMPALGEBRAEXPORT DenseGrid3D<float> get_rasterized(const Gaussian3Ds &gmm,
54  const Floats &weights,
55  double cell_width,
56  const BoundingBox3D &bb);
57 
58 IMPALGEBRA_END_NAMESPACE
59 
60 #endif /* IMPALGEBRA_GAUSSIAN3D_H */
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
DenseGrid3D< float > get_rasterized(const Gaussian3Ds &gmm, const Floats &weights, double cell_width, const BoundingBox3D &bb)
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
IMP_Eigen::Matrix3d get_covariance(const Gaussian3D &g)
A reference frame in 3D.
const Transformation3D & get_transformation_to() const
Simple D vector class.
Simple 3D transformation class.
Gaussian3D get_gaussian_from_covariance(const IMP_Eigen::Matrix3d &covariance, const Vector3D &center)
VectorD< 3 > Vector3D
Definition: VectorD.h:395
All grids that are in the python API should be defined here.
Simple 3D rotation class.