IMP logo
IMP Reference Guide  2.6.2
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-2016 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 //! Convert a density grid to a set of particles
25 /** Each such particle will have xyz attributes and a density_val attribute
26  of type Float.
27  \param[in] dmap the density map
28  \param[in] threshold only voxels with density above the given threshold will
29  be converted to particles
30  \param[in] m model to store the new particles
31  \param[in] step sample every X steps in each direction
32  \return particles corresponding to all voxels above the threshold
33  */
34 IMPEMEXPORT Particles density2particles(DensityMap *dmap,
35  Float threshold,
36  Model *m, int step = 1);
37 
38 //! Convert a density grid to a set of vectors
39 /** \param[in] dmap the density map
40  \param[in] threshold only voxels with density above the given threshold will
41  be converted to vectors
42  \return Vector3Ds corresponding to the positions of all voxels
43  above the threshold
44  */
45 IMPEMEXPORT algebra::Vector3Ds density2vectors(DensityMap *dmap,
46  Float threshold);
47 
48 //! Resample a set of particles into a density grid
49 /**
50 Each such particle should have xyz, radius and weight attributes
51 \param[in] ps the particles to sample
52 \param[in] resolution the resolution of the new sampled map
53 \param[in] apix the voxel size of the sampled map
54 \param[in] sig_cutoff sigma cutoff used in sampling
55 \param[in] weight_key the weight attribute key of the particles
56 \return the sampled density grid
57 \see SampledDensityMap
58  */
59 IMPEMEXPORT SampledDensityMap *particles2density(
60  const ParticlesTemp &ps, Float resolution, Float apix,
61  int sig_cutoff = 3,
62  const FloatKey &weight_key = IMP::atom::Mass::get_mass_key());
63 
64 //! Resample a set of particles into a binarized density map
65 //! 1 for voxels containing particles and 0 otherwise
66 /**
67 Each such particle should have xyz radius and weight attributes
68 \param[in] ps the particles to sample
69 \param[in] resolution the resolution of the new sampled map
70 \param[in] apix the voxel size of the sampled map
71 \param[in] sig_cutoff sigma cutoff used in sampling
72 \param[in] weight_key the weight attribute key of the particles
73 \return the sampled density grid
74 \see SampledDensityMap
75  */
77  const ParticlesTemp &ps, Float resolution, Float apix,
78  int sig_cutoff = 3,
79  const FloatKey &weight_key = IMP::atom::Mass::get_mass_key()) {
80 
82  ps, resolution, apix, weight_key, sig_cutoff, BINARIZED_SPHERE));
83  return dmap.release();
84 }
85 
86 //! Resample a set of particles into a density grid
87 /**
88 Each such particle should have xyz radius and weight attributes
89 \param[in] ps the particles to sample
90 \param[in] apix the voxel size of the surface map
91 \param[in] weight_key the weight attribute key of the particles
92 \return the surface grid
93 \see SampledDensityMap
94  */
95 IMPEMEXPORT SurfaceShellDensityMap *particles2surface(
96  const ParticlesTemp &ps, Float apix,
97  const FloatKey &weight_key = IMP::atom::Mass::get_mass_key());
98 
99 IMPEMEXPORT Float
100  calculate_intersection_score(const SurfaceShellDensityMap *d1,
101  const SurfaceShellDensityMap *d2);
102 
103 IMPEM_END_NAMESPACE
104 #endif /* IMPEM_CONVERTERS_H */
O * release()
Relinquish control of the raw pointer stored in the Pointer.
static FloatKey get_mass_key()
Basic types used by IMP.
Particles density2particles(DensityMap *dmap, Float threshold, Model *m, int step=1)
Convert a density grid to a set of particles.
algebra::Vector3Ds density2vectors(DensityMap *dmap, Float threshold)
Convert a density grid to a set of vectors.
Vector< VectorD< 3 > > Vector3Ds
Definition: VectorD.h:397
SampledDensityMap * particles2binarized_density(const ParticlesTemp &ps, Float resolution, Float apix, int sig_cutoff=3, const FloatKey &weight_key=IMP::atom::Mass::get_mass_key())
Definition: converters.h:76
Represent a molecule as shells of distance from the surface.
SampledDensityMap * particles2density(const 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.
Various general useful macros for IMP.
Simple XYZ decorator.
A smart pointer to a reference counted object.
Definition: Pointer.h:87
Class for handling density maps.
Class for sampling a density map from particles.
Key< 0, true > FloatKey
The type used to identify float attributes in the Particles.
Definition: base_types.h:32
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
SurfaceShellDensityMap * particles2surface(const ParticlesTemp &ps, Float apix, const FloatKey &weight_key=IMP::atom::Mass::get_mass_key())
Resample a set of particles into a density grid.
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:20
Simple 3D vector class.
Sampled density map.