IMP logo
IMP Reference Guide  2.5.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-2015 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 represents a molecule as shells of distance from the surface
25 /**
26  */
27 class IMPEMEXPORT SurfaceShellDensityMap : public SampledDensityMap {
28 #define IMP_BACKGROUND_VAL 0.0
29 #define IMP_SURFACE_VAL 1.0
30  public:
31  //! Creates a new density map.
32  /** The header of the map is not determined and no data is being allocated
33  */
35 
36  //! Creates a new density map.
37  //! The size of the map is determined by the header and the data is allocated.
39 
40  //! Generate a surface shell density map from the input particles.
41  /** \param[in] ps particles with XYZ, radius and weight attributes
42  \param[in] voxel_size the voxel size.
43  \param[in] mass_key key to use to weight particles
44  \param[in] num_shells number of shells
45  \note the voxel size and the number of shells determines
46  the resolution/accuracy of the surface rasterization.
47  */
48  SurfaceShellDensityMap(const ParticlesTemp &ps, float voxel_size,
49  IMP::FloatKey mass_key =
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 further 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 corresponding to particles will
67  be set to this value
68  */
69  void binaries(float scene_val);
70  //! Checks if the one of the neighbors of the voxel is a background voxel
71  /**
72  \param[in] voxel_ind the index of the voxel
73  \return true if at least one of the neighbors of the voxel is
74  in the background
75  */
76  bool has_background_neighbor(long voxel_ind) const;
78 
79  protected:
80  //! Finds all of the voxels that are part of the surface
81  //! (i.e, separate background from scene)
82  /**
83  \param[in] shell indexes of all of the surface particles
84  will be stored here.
85  */
86  void set_surface_shell(std::vector<long> *shell);
87  void set_kernel();
88  void set_neighbor_mask();
89  float surface_val_;
90  std::vector<long> neighbor_shift_;
91  std::vector<emreal> neighbor_dist_;
92  int num_shells_;
93 };
94 
96 IMPEM_END_NAMESPACE
97 
98 #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 represents a molecule as shells of distance from the surface.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Definition: object_macros.h:42
Sampled density map.