IMP  2.1.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/kernel/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 kernel::Particles density2particles(DensityMap *dmap, Float threshold,
36  kernel::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 See SampledDensityMap
62  */
63 IMPEMEXPORT SampledDensityMap * particles2density(
64  const kernel::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 See SampledDensityMap
81  */
83  const kernel::ParticlesTemp &ps,
84  Float resolution, Float apix,
85  int sig_cutoff=3,
86  const FloatKey &weight_key=IMP::atom::Mass::get_mass_key()) {
87 
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 See SampledDensityMap
105  */
106 IMPEMEXPORT SurfaceShellDensityMap * particles2surface(
107  const kernel::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 */
static FloatKey get_mass_key()
Import IMP/kernel/base_types.h in the namespace.
algebra::Vector3Ds density2vectors(DensityMap *dmap, Float threshold)
Converts a density grid to a set of paritlces.
SurfaceShellDensityMap * particles2surface(const kernel::ParticlesTemp &ps, Float apix, const FloatKey &weight_key=IMP::atom::Mass::get_mass_key())
Resample a set of particles into a density grid.
SampledDensityMap * particles2density(const kernel::ParticlesTemp &ps, Float resolution, Float apix, int sig_cutoff=3, const FloatKey &weight_key=IMP::atom::Mass::get_mass_key())
Resample a set of particles into a density grid.
A smart pointer to a reference counted object.
Definition: base/Pointer.h:87
Represent a molecule as shells of distance from the surface.
Import IMP/kernel/macros.h in the namespace.
O * release()
Relinquish control of the raw pointer stored in the Pointer.
Simple xyz decorator.
Class for handling density maps.
Class for sampling a density map from particles.
base::Vector< VectorD< 3 > > Vector3Ds
Definition: VectorD.h:589
IMP::kernel::Model Model
Classes to handle individual model particles.
double Float
Basic floating-point value (could be float, double...)
Definition: base/types.h:20
Simple 3D vector class.
kernel::Particles density2particles(DensityMap *dmap, Float threshold, kernel::Model *m, int step=1)
Converts a density grid to a set of paritlces.
SampledDensityMap * particles2binarized_density(const kernel::ParticlesTemp &ps, Float resolution, Float apix, int sig_cutoff=3, const FloatKey &weight_key=IMP::atom::Mass::get_mass_key())
Definition: converters.h:82
Sampled density map.
Key< 0, true > FloatKey
The type used to identify float attributes in the Particles.