IMP  2.0.0
The Integrative Modeling Platform
CollisionCrossSection.h
Go to the documentation of this file.
1 /**
2  * \file CollisionCrossSection.h
3  * \brief
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPEM2D_COLLISION_CROSS_SECTION_H
10 #define IMPEM2D_COLLISION_CROSS_SECTION_H
11 
12 
13 
16 #include "IMP/em2d/project.h"
17 #include "IMP/macros.h"
18 #include "IMP/Particle.h"
19 
20 IMPEM2D_BEGIN_NAMESPACE
21 
22 class IMPEM2DEXPORT CollisionCrossSection: public IMP::base::Object {
23 public:
24 
25  /*!
26  \param[in] n_projections Number of projections to use for obtaining the CCS
27  \param[in] resolution "Resolution" to use to generate the projections.
28  \param[in] pixel_size size in A/pix to use when generating the projections
29  \param[in] projection_image_size. The size of the projections to generate
30  for this value you should request a size so that:
31  pixel_size * projection_image_size >= Max distance between two
32  particles.
33  */
34  CollisionCrossSection(unsigned int n_projections,
35  double resolution,
36  double pixel_size,
37  double projection_image_size
38  );
39 
40 
41  /**
42  * Particles used to calculate their collision cross section
43  * @param ps The particles
44  */
45  void set_model_particles(const ParticlesTemp &ps);
46 
47  /**
48  * Returns the collision cross section. Before using this function you need
49  * to set the particles with set_model_particles()
50  * @return The value of the collision cross section
51  */
52  double get_ccs() const;
53 
54  /**
55  * Shows information about the class
56  * @param out Stream used to show the information
57  */
58  void show(std::ostream &out) const {
59  out << "Collision Cross section." << std::endl;
60  }
61  IMP_OBJECT_METHODS( CollisionCrossSection);
62 
63 protected:
64 
65  /*! Gets the sum of the values in the pixels with value > 0
66  \param[in] m The projected area is computed for this matrix
67  \param[out] Values of the area
68  */
69  double get_projected_area(const cv::Mat &m) const;
70 
71  unsigned int n_projections_;
72  double resolution_;
73  double pixel_size_;
74  unsigned int img_size_;
75  bool particles_set_;
77  cv::Mat average_projection_;
78  em2d::MasksManagerPtr masks_manager_;
79  double collision_cross_section_;
80 };
81 IMP_OBJECTS(CollisionCrossSection, CollisionCrossSections);
82 
83 IMPEM2D_END_NAMESPACE
84 
85 #endif /* IMPEM2D_COLLISION_CROSS_SECTION_H */