IMP  2.1.0
The Integrative Modeling Platform
SurfaceShellDensityMap.h
Go to the documentation of this file.
1 /**
2  * \file IMP/em/SurfaceShellDensityMap.h
3  * \brief Represent a molecule as shells of distance from the surface
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPEM_SURFACE_SHELL_DENSITY_MAP_H
10 #define IMPEM_SURFACE_SHELL_DENSITY_MAP_H
11 
12 #include <IMP/em/em_config.h>
13 #include "exp.h"
14 #include "SampledDensityMap.h"
15 #include "DensityHeader.h"
16 #include "def.h"
17 #include <vector>
18 
19 IMPEM_BEGIN_NAMESPACE
20 
21 #define IMP_DEFAULT_NUM_SHELLS 5
22 #define IMP_SIG_CUTOFF 3
23 
24 //! The class repersents a molecule as shells of distance from the surface
25 /**
26  */
27 class IMPEMEXPORT SurfaceShellDensityMap: public SampledDensityMap
28 {
29 #define IMP_BACKGROUND_VAL 0.0
30 #define IMP_SURFACE_VAL 1.0
31 public:
32 
33  //! Creates a new density map.
34  /** The header of the map is not determined and no data is being allocated
35  */
37 
38  //! Creates a new density map.
39  //! The size of the map is determined by the header and the data is allocated.
41 
42  //! Generatea a surface shell density map from the input particles.
43  /** /param[in] ps particles with XYZ, radius and weight attributes
44  /param[in] voxel_size the voxel size.
45  /note the voxel size and the number of shells determines
46  the resolution/accuracy of the surface rasterization._
47  */
49  float voxel_size,
51  int num_shells=IMP_DEFAULT_NUM_SHELLS);
52 
53  //! Resample the grid to consist of density shells of a model
54  /**
55  All voxels that are outside of the model defined by the particles will be
56  set to zero.
57  Voxels on the surface between the model and the background
58  will be set of 1.
59  The interior voxels will be assign value according to their
60  corresponding shell ( the value increases as the voxel is farthrer away
61  from the surface).
62  */
63 void resample();
64  //! Set the value of the map voxels as either scene or background
65  /**
66  /param[in] scene_val all voxels corredponsing to particles will
67  be set to this value
68  */
69  void binaries(float scene_val);
70  //! Checks if the one of the nieghbors of the voxel is a background voxel
71  /**
72  /param[in] voxel_ind the index of the voxel
73  /return true is the at least of the nieghbors of the voxel is
74  in the background
75  */
76  bool has_background_neighbor(long voxel_ind) const;
78 protected:
79 
80 
81  //! Finds all of the voxels that are part of the surface
82  //! (i.e, seperate background from scene)
83  /**
84  /param[in] shell indexes of all of the surface particles
85  will be stored here.
86  */
87  void set_surface_shell(std::vector<long> *shell);
88  void set_kernel();
89  void set_neighbor_mask();
90  float surface_val_;
91  std::vector<long> neighbor_shift_;
92  std::vector<emreal> neighbor_dist_;
93  int num_shells_;
94 };
95 
97 IMPEM_END_NAMESPACE
98 
99 #endif /* IMPEM_SURFACE_SHELL_DENSITY_MAP_H */
static FloatKey get_mass_key()
Definitions for EMBED.
Metadata for a density file.
virtual void resample()
Resample beads on an EM grid.
#define IMP_REF_COUNTED_DESTRUCTOR(Name)
Ref counted objects should have private destructors.
An approximation of the exponential function.
Class for sampling a density map from particles.
The class repersents a molecule as shells of distance from the surface.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Sampled density map.