IMP  2.2.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-2014 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,
36  Float threshold,
37  kernel::Model *m, int step = 1);
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 density2vectors(DensityMap *dmap,
50  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, Float resolution, Float apix,
65  int sig_cutoff = 3,
66  const FloatKey &weight_key = IMP::atom::Mass::get_mass_key());
67 
68 //! Resample a set of particles into a binarized density map
69 //! 1 for voxels containing particles and 0 otherwise
70 /**
71 Each such particle should have xyz radius and weight attributes
72 \param[in] ps the particles to sample
73 \param[in] resolution the resolution of the new sampled map
74 \param[in] apix the voxel size of the sampled map
75 \param[in] sig_cutoff sigma cutoff used in sampling
76 \param[in] weight_key the weight attribute key of the particles
77 \return the sampled density grid
78 See SampledDensityMap
79  */
81  const kernel::ParticlesTemp &ps, Float resolution, Float apix,
82  int sig_cutoff = 3,
83  const FloatKey &weight_key = IMP::atom::Mass::get_mass_key()) {
84 
86  ps, resolution, apix, weight_key, sig_cutoff, BINARIZED_SPHERE));
87  return dmap.release();
88 }
89 
90 //! Resample a set of particles into a density grid
91 /**
92 Each such particle should have xyz radius and weight attributes
93 \param[in] ps the particles to sample
94 \param[in] apix the voxel size of the surface map
95 \param[in] weight_key the weight attribute key of the particles
96 \return the surface grid
97 See SampledDensityMap
98  */
99 IMPEMEXPORT SurfaceShellDensityMap *particles2surface(
100  const kernel::ParticlesTemp &ps, Float apix,
101  const FloatKey &weight_key = IMP::atom::Mass::get_mass_key());
102 
103 IMPEMEXPORT Float
104  calculate_intersection_score(const SurfaceShellDensityMap *d1,
105  const SurfaceShellDensityMap *d2);
106 
107 IMPEM_END_NAMESPACE
108 #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:397
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:80
Sampled density map.
Key< 0, true > FloatKey
The type used to identify float attributes in the Particles.