IMP  2.0.1
The Integrative Modeling Platform
converters.h
Go to the documentation of this file.
1 /**
2  * \file IMP/em/converters.h
3  * \brief Converters of density values
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPEM_CONVERTERS_H
10 #define IMPEM_CONVERTERS_H
11 
12 #include <IMP/em/em_config.h>
13 #include <IMP/base_types.h>
14 #include <IMP/macros.h>
15 #include "DensityMap.h"
16 #include "SampledDensityMap.h"
17 #include "SurfaceShellDensityMap.h"
18 #include <IMP/Particle.h>
19 #include "IMP/core/XYZ.h"
20 #include "IMP/algebra/Vector3D.h"
21 
22 IMPEM_BEGIN_NAMESPACE
23 
24 //! Converts a density grid to a set of paritlces
25 /**
26 Each such particle will be have xyz attributes and a density_val attribute of
27 type Float.
28 \param[in] dmap the density map
29 \param[in] threshold only voxels with density above the given threshold will
30  be converted to particles
31 \param[in] m model to store the new particles
32 \param[in] step sample every X steps in each direction
33 \return particles corresponding to all voxels above the threshold
34  */
35 IMPEMEXPORT Particles density2particles(DensityMap *dmap, Float threshold,
36  Model *m,int step=1);
37 
38 
39 //! Converts a density grid to a set of paritlces
40 /**
41 Each such particle will be have xyz attributes and a density_val attribute of
42 type Float.
43 \param[in] dmap the density map
44 \param[in] threshold only voxels with density above the given threshold will
45  be converted to particles
46 \return a set of vector3Ds corresponding to the positions of all voxels
47  above the threshold
48  */
49 IMPEMEXPORT algebra::Vector3Ds
50  density2vectors(DensityMap *dmap, Float threshold);
51 
52 //! Resample a set of particles into a density grid
53 /**
54 Each such particle should have xyz, radius and weight attributes
55 \param[in] ps the particles to sample
56 \param[in] resolution the resolution of the new sampled map
57 \param[in] apix the voxel size of the sampled map
58 \param[in] sig_cutoff sigma cutoff used in sampling
59 \param[in] weight_key the weight attribute key of the particles
60 \return the sampled density grid
61 \relatesalso SampledDensityMap
62  */
63 IMPEMEXPORT SampledDensityMap * particles2density(
64  const ParticlesTemp &ps,
65  Float resolution, Float apix,
66  int sig_cutoff=3,
67  const FloatKey &weight_key=IMP::atom::Mass::get_mass_key());
68 
69 
70 //! Resample a set of particles into a binarized density map
71 //! 1 for voxels containing particles and 0 otherwise
72 /**
73 Each such particle should have xyz radius and weight attributes
74 \param[in] ps the particles to sample
75 \param[in] resolution the resolution of the new sampled map
76 \param[in] apix the voxel size of the sampled map
77 \param[in] sig_cutoff sigma cutoff used in sampling
78 \param[in] weight_key the weight attribute key of the particles
79 \return the sampled density grid
80 \relatesalso SampledDensityMap
81  */
83  const ParticlesTemp &ps,
84  Float resolution, Float apix,
85  int sig_cutoff=3,
86  const FloatKey &weight_key=IMP::atom::Mass::get_mass_key()) {
87 
88  IMP::Pointer<SampledDensityMap> dmap(new SampledDensityMap(
89  ps, resolution,
90  apix,weight_key,sig_cutoff,
91  BINARIZED_SPHERE));
92  return dmap.release();
93 
94 }
95 
96 
97 //! Resample a set of particles into a density grid
98 /**
99 Each such particle should have xyz radius and weight attributes
100 \param[in] ps the particles to sample
101 \param[in] apix the voxel size of the surface map
102 \param[in] weight_key the weight attribute key of the particles
103 \return the surface grid
104 \relatesalso SampledDensityMap
105  */
106 IMPEMEXPORT SurfaceShellDensityMap * particles2surface(
107  const ParticlesTemp &ps,Float apix,
108  const FloatKey &weight_key=IMP::atom::Mass::get_mass_key());
109 
110 IMPEMEXPORT Float calculate_intersection_score(
111  const SurfaceShellDensityMap *d1,
112  const SurfaceShellDensityMap *d2);
113 
114 
115 
116 
117 IMPEM_END_NAMESPACE
118 #endif /* IMPEM_CONVERTERS_H */