IMP  2.3.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-2014 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  \note the voxel size and the number of shells determines
44  the resolution/accuracy of the surface rasterization.
45  */
46  SurfaceShellDensityMap(const kernel::ParticlesTemp &ps, float voxel_size,
47  IMP::FloatKey mass_key =
49  int num_shells = IMP_DEFAULT_NUM_SHELLS);
50 
51  //! Resample the grid to consist of density shells of a model
52  /**
53  All voxels that are outside of the model defined by the particles will be
54  set to zero.
55  Voxels on the surface between the model and the background
56  will be set of 1.
57  The interior voxels will be assign value according to their
58  corresponding shell ( the value increases as the voxel is further away
59  from the surface).
60  */
61  void resample();
62  //! Set the value of the map voxels as either scene or background
63  /**
64  \param[in] scene_val all voxels corresponding to particles will
65  be set to this value
66  */
67  void binaries(float scene_val);
68  //! Checks if the one of the neighbors of the voxel is a background voxel
69  /**
70  \param[in] voxel_ind the index of the voxel
71  \return true if at least one of the neighbors of the voxel is
72  in the background
73  */
74  bool has_background_neighbor(long voxel_ind) const;
76 
77  protected:
78  //! Finds all of the voxels that are part of the surface
79  //! (i.e, separate background from scene)
80  /**
81  \param[in] shell indexes of all of the surface particles
82  will be stored here.
83  */
84  void set_surface_shell(std::vector<long> *shell);
85  void set_kernel();
86  void set_neighbor_mask();
87  float surface_val_;
88  std::vector<long> neighbor_shift_;
89  std::vector<emreal> neighbor_dist_;
90  int num_shells_;
91 };
92 
94 IMPEM_END_NAMESPACE
95 
96 #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:52
Sampled density map.