IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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-2022 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"
18#include <IMP/Particle.h>
19#include "IMP/core/XYZ.h"
21
22IMPEM_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 */
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 */
46 Float threshold);
47
48//! Resample a set of particles into a density grid
49/**
50Each 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 */
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/**
67Each 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/**
88Each 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 */
96 const ParticlesTemp &ps, Float apix,
97 const FloatKey &weight_key = IMP::atom::Mass::get_mass_key());
98
99IMPEMEXPORT Float
100 calculate_intersection_score(const SurfaceShellDensityMap *d1,
101 const SurfaceShellDensityMap *d2);
102
103IMPEM_END_NAMESPACE
104#endif /* IMPEM_CONVERTERS_H */
Class for handling density maps.
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Sampled density map.
Represent a molecule as shells of distance from the surface.
Simple XYZ decorator.
Simple 3D vector class.
Basic types used by IMP.
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
static FloatKey get_mass_key()
Class for handling density maps.
Definition DensityMap.h:95
Class for sampling a density map from particles.
The class represents a molecule as shells of distance from the surface.
Various general useful macros for IMP.
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
algebra::Vector3Ds density2vectors(DensityMap *dmap, Float threshold)
Convert a density grid to a set of vectors.
Particles density2particles(DensityMap *dmap, Float threshold, Model *m, int step=1)
Convert a density grid to a set of particles.
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.
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.
Vector< VectorD< 3 > > Vector3Ds
Definition VectorD.h:409
Vector< Pointer< Particle > > Particles
A list of reference-counted Particle objects.
Definition base_types.h:138
double Float
Basic floating-point value (could be float, double...).
Definition types.h:19
Key< 0 > FloatKey
The type used to identify float attributes in the Particles.
Definition base_types.h:32
A smart pointer to a reference counted object.
Definition Pointer.h:88