OpenMS
|
data structure to store 2D data to be clustered e.g. (m/z, retention time) coordinates from multiplex filtering More...
#include <OpenMS/COMPARISON/CLUSTERING/ClusteringGrid.h>
Public Types | |
typedef std::pair< int, int > | CellIndex |
typedef DPosition< 2 > | Point |
Public Member Functions | |
ClusteringGrid (const std::vector< double > &grid_spacing_x, const std::vector< double > &grid_spacing_y) | |
constructor taking two vectors More... | |
std::vector< double > | getGridSpacingX () const |
returns grid spacing in x direction More... | |
std::vector< double > | getGridSpacingY () const |
returns grid spacing in y direction More... | |
void | addCluster (const CellIndex &cell_index, const int &cluster_index) |
adds a cluster to this grid cell More... | |
void | removeCluster (const CellIndex &cell_index, const int &cluster_index) |
removes a cluster from this grid cell and removes the cell if no other cluster left More... | |
void | removeAllClusters () |
removes all clusters from this grid (and hence all cells) More... | |
std::list< int > | getClusters (const CellIndex &cell_index) const |
returns clusters in this grid cell More... | |
CellIndex | getIndex (const Point &position) const |
returns grid cell index (i,j) for the positions (x,y) More... | |
bool | isNonEmptyCell (const CellIndex &cell_index) const |
checks if there are clusters at this cell index More... | |
int | getCellCount () const |
returns number of grid cells occupied by one or more clusters More... | |
Private Attributes | |
const std::vector< double > | grid_spacing_x_ |
spacing of the grid in x and y direction More... | |
const std::vector< double > | grid_spacing_y_ |
std::pair< double, double > | range_x_ |
[min, max] of the grid in x and y direction More... | |
std::pair< double, double > | range_y_ |
std::map< CellIndex, std::list< int > > | cells_ |
grid cell index mapped to a list of clusters in it More... | |
data structure to store 2D data to be clustered e.g. (m/z, retention time) coordinates from multiplex filtering
typedef std::pair<int,int> CellIndex |
coordinates of a grid cell
ClusteringGrid | ( | const std::vector< double > & | grid_spacing_x, |
const std::vector< double > & | grid_spacing_y | ||
) |
constructor taking two vectors
grid_spacing_x | grid spacing in x direction |
grid_spacing_y | grid spacing in y direction |
void addCluster | ( | const CellIndex & | cell_index, |
const int & | cluster_index | ||
) |
adds a cluster to this grid cell
cell_index | cell index (i,j) on the grid |
cluster_index | index of the cluster in the cluster list |
Referenced by GridBasedClustering< Metric >::cluster(), GridBasedClustering< Metric >::extendClustersY(), and GridBasedClustering< Metric >::init_().
int getCellCount | ( | ) | const |
returns number of grid cells occupied by one or more clusters
std::list<int> getClusters | ( | const CellIndex & | cell_index | ) | const |
returns clusters in this grid cell
cell_index | cell index (i,j) on the grid |
Referenced by GridBasedClustering< Metric >::extendClustersY(), and GridBasedClustering< Metric >::findNearestNeighbour_().
std::vector<double> getGridSpacingX | ( | ) | const |
returns grid spacing in x direction
Referenced by GridBasedClustering< Metric >::extendClustersY().
std::vector<double> getGridSpacingY | ( | ) | const |
returns grid spacing in y direction
Referenced by GridBasedClustering< Metric >::extendClustersY().
returns grid cell index (i,j) for the positions (x,y)
position | coordinates (x,y) on the grid |
Referenced by GridBasedClustering< Metric >::cluster(), GridBasedClustering< Metric >::extendClustersY(), GridBasedClustering< Metric >::findNearestNeighbour_(), and GridBasedClustering< Metric >::init_().
bool isNonEmptyCell | ( | const CellIndex & | cell_index | ) | const |
checks if there are clusters at this cell index
cell_index | cell index (i,j) on the grid |
Exception::IllegalArgument | if the coordinates (x,y) lie outside the grid. |
Exception::InvalidValue | if one of the two indices is negative. |
Referenced by GridBasedClustering< Metric >::extendClustersY(), and GridBasedClustering< Metric >::findNearestNeighbour_().
void removeAllClusters | ( | ) |
removes all clusters from this grid (and hence all cells)
void removeCluster | ( | const CellIndex & | cell_index, |
const int & | cluster_index | ||
) |
removes a cluster from this grid cell and removes the cell if no other cluster left
cell_index | cell index (i,j) on the grid |
cluster_index | index of the cluster in the cluster list |
Referenced by GridBasedClustering< Metric >::cluster(), GridBasedClustering< Metric >::extendClustersY(), and GridBasedClustering< Metric >::init_().
|
private |
grid cell index mapped to a list of clusters in it
|
private |
spacing of the grid in x and y direction
|
private |
|
private |
[min, max] of the grid in x and y direction
|
private |