IMP logo
IMP Reference Guide  2.15.0
The Integrative Modeling Platform
density_analysis.h
Go to the documentation of this file.
1 /**
2  * \file IMP/multifit/density_analysis.h
3  * \brief density analysis tools, such as segmentation
4  *
5  * Copyright 2007-2021 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPMULTIFIT_DENSITY_ANALYSIS_H
10 #define IMPMULTIFIT_DENSITY_ANALYSIS_H
11 
12 #include <IMP/em/DensityMap.h>
13 #include <IMP/multifit/multifit_config.h>
14 #include <boost/graph/adjacency_list.hpp>
15 #include <boost/pending/disjoint_sets.hpp>
16 #include <boost/graph/incremental_components.hpp>
17 #include <boost/graph/graph_utility.hpp>
18 
19 IMPMULTIFIT_BEGIN_NAMESPACE
20 
21 //! Returns a map containing all density without the background
22 /**
23 \param[in] dmap the density map to segment
24 \param[in] threshold consider only voxels above this threshold
25 \param[in] edge_threshold consider only voxels above this threshold
26 \return the segmented map
27  */
28 IMPMULTIFITEXPORT em::DensityMap *remove_background(em::DensityMap *dmap,
29  float threshold,
30  float edge_threshold);
31 
32 //! Return connected components based on density values
33 /**
34  \param[in] dmap the density map to analyze
35  \param[in] threshold consider only voxels above this threshold
36  \param[in] edge_threshold an edge is added between
37  two neighboring voxels if their density difference is below this threshold
38  \return List of indexes for each connected component
39 */
40 IMPMULTIFITEXPORT
41 IntsList get_connected_components(em::DensityMap *dmap, float threshold,
42  float edge_threshold);
43 
44 //! Segment a density map using the anchor graph.
45 /** All voxels above the threshold are segmented into the given number
46  of clusters, and neighboring clusters are linked.
47 
48  \param[in] dmap the density map to segment
49  \param[in] apix the map spacing in angstroms per pixel
50  \param[in] density_threshold consider only voxels over this threshold
51  \param[in] num_means the number of segments to generate
52  \param[in] pdb_filename write cluster centers as CA atoms in PDB format
53  \param[in] cmm_filename if not empty, write clusters in CMM format
54  \param[in] seg_filename if not empty, write segments in MRC format
55  \param[in] txt_filename if not empty, write anchors in text format
56  */
57 IMPMULTIFITEXPORT
58 void get_segmentation(em::DensityMap *dmap, double apix,
59  double density_threshold, int num_means,
60  const std::string pdb_filename,
61  const std::string cmm_filename,
62  const std::string seg_filename,
63  const std::string txt_filename);
64 
65 IMPMULTIFIT_END_NAMESPACE
66 #endif /* IMPMULTIFIT_DENSITY_ANALYSIS_H */
IntsList get_connected_components(em::DensityMap *dmap, float threshold, float edge_threshold)
Return connected components based on density values.
em::DensityMap * remove_background(em::DensityMap *dmap, float threshold, float edge_threshold)
Returns a map containing all density without the background.
Class for handling density maps.
IMP::Vector< Ints > IntsList
Standard way to pass a bunch of Ints values.
Definition: types.h:56
void get_segmentation(em::DensityMap *dmap, double apix, double density_threshold, int num_means, const std::string pdb_filename, const std::string cmm_filename, const std::string seg_filename, const std::string txt_filename)
Segment a density map using the anchor graph.