MeVisLab Toolbox Reference
mlSelectedClusters.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2014, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_SELECTED_CLUSTERS_H
14#define ML_SELECTED_CLUSTERS_H
15
16#include "mlClusters.h"
17
18ML_START_NAMESPACE
19
20ML_REFCOUNTED_PTR(SelectedClusters)
21
22
27{
28public:
29
32
36 void setSelectedAtVoxelPositions(const std::vector<ImageVector>& voxelPositions);
47
51 bool isSelected(MLint x, MLint y, MLint z) const;
53 bool isSelected(MLuint clusterRank) const;
54
59
61 void setVolumeFactor(MLdouble volumeFactor) { _volumeFactor = volumeFactor; }
63 void setMinClusterSize(MLdouble minSize) { _minClusterSize = minSize; }
66 void setMaxClusterSize(MLdouble maxSize) { _maxClusterSize = maxSize; }
67
70 void setInvertSelection(bool shouldInvert) { _invertSelection = shouldInvert; }
72 bool isSelectionInverted() const { return _invertSelection; }
75 void setSelected(MLuint clusterRank, bool selectionState = true);
76
81
86
91
93 Clusters* clusters() { return _clusters; }
94
95protected:
96
97private:
98
100
101 void clearSelectionStates();
102 void initializeSelectionStates(MLuint numClusters);
103 void copyInputSelection(SelectedClusters* selectedClusters);
104 bool isInsideImage(const ImageVector& position);
105 void invertSelection();
106
107 std::vector<char> _isSelected;
108
109 Clusters* _clusters;
110
111 MLdouble _volumeFactor;
112 MLdouble _minClusterSize;
113 MLdouble _maxClusterSize;
114 bool _invertSelection;
115
116 bool _hasInputSelection;
117 std::vector<char> _isInputSelected;
118
119 bool isEligibleForSelection(const ClusterInfo& cInfo, MLuint& rank);
120 bool isEligibleForSelection(const ClusterInfo& cInfo, MLdouble& volume, MLuint& rank);
121
122 ML_CLASS_HEADER(SelectedClusters);
123};
124
125
126ML_END_NAMESPACE
127
128#endif // __mlSelectedClusters_H
#define MLCLUSTERALGORITHM_EXPORT
Structure computes and holds all cluster information. For internal use.
Definition mlClusters.h:29
RefCountedBase()
Constructor.
MLuint getNumSelectedClusters() const
Returns the number of selected clusters.
MLuint getMaxRankOfSelectedClusters() const
Returns the maximum rank of selected clusters, 0 if no cluster is selected.
SelectedClusters(Clusters *clusters)
void setSelected(MLuint clusterRank, bool selectionState=true)
void setLargestClusterSelected()
Vector3 getBoundingBoxMaxOfSelectedClusters() const
Returns the max bounding box of the selected clusters, (-1,-1,-1) if no cluster is selected.
void setMaxClusterSize(MLdouble maxSize)
SelectedClusters(SelectedClusters *selectedClusters)
Vector3 getBoundingBoxMinOfSelectedClusters() const
Returns the min bounding box of the selected clusters, (-1,-1,-1) if no cluster is selected.
Vector3 getBoundingBoxMinOfClusterWithRank(MLuint rank) const
Returns the min bounding box of a cluster with the given rank.
void selectAllClusters()
Selects all clusters.
void runSelectionByClusterSizes()
Runs the selection by cluster sizes.
Clusters * clusters()
Returns a pointer to the internal clusters.
bool isSelected(MLint x, MLint y, MLint z) const
Returns whether a cluster at the position in the cluster volume is selected.
bool setLargestClusterOnEachSliceSelected()
void setMinClusterSize(MLdouble minSize)
Sets the minimum cluster size under consideration of the volume factor.
MLuint getMinRankOfSelectedClusters() const
Returns the minimum rank of selected clusters, 0 if no cluster is selected.
bool isSelectionInverted() const
Returns whether the selection should be inverted.
void deselectAllClusters()
Deselects all clusters.
Vector3 getBoundingBoxMaxOfClusterWithRank(MLuint rank) const
Returns the max bounding box of a cluster with the given rank.
void setVolumeFactor(MLdouble volumeFactor)
Sets a volume factor for a single voxel for filtering by cluster size.
void setSelectedByRank(MLuint rank)
Sets the cluster with the given rank selected.
void setSelectedAtVoxelPositions(const std::vector< ImageVector > &voxelPositions)
Sets the clusters at the given voxel positions selected.
void setInvertSelection(bool shouldInvert)
bool isSelected(MLuint clusterRank) const
Returns whether a cluster with the given rank is selected.
#define ML_REFCOUNTED_PTR(CLASSNAME)
Macro that defines convenience Ptr/ConstPtr typedefs to be used instead of intrusive_ptr templates.
#define ML_CLASS_HEADER(className)
MLuint64 MLuint
Definition mlTypeDefs.h:505
double MLdouble
Definition mlTypeDefs.h:216
MLint64 MLint
Definition mlTypeDefs.h:489
Tvec3< MLdouble > Vector3
A vector with three components of type double.
Definition mlVector3.h:286