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
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;
54
59
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; }
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
127
128#endif // __mlSelectedClusters_H
#define MLCLUSTERALGORITHM_EXPORT
Structure computes and holds all cluster information. For internal use.
Definition mlClusters.h:29
RefCountedBase class adds intrusive reference counting support to the Base class.
Class for filtering/selection clusters.
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)
Sets the selection state of the cluster at the given rank.
void setLargestClusterSelected()
Sets only the largest cluster to be selected.
Vector3 getBoundingBoxMaxOfSelectedClusters() const
Returns the max bounding box of the selected clusters, (-1,-1,-1) if no cluster is selected.
void setMaxClusterSize(MLdouble maxSize)
Sets the maximum cluster size under consideration of the volume factor.
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()
Sets the largest cluster on each slice to be selected.
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)
Sets whether the whole selection should be inverted.
bool isSelected(MLuint clusterRank) const
Returns whether a cluster with the given rank is selected.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
#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)
Same like ML_CLASS_HEADER_EXPORTED with a non existing export symbol.
MLuint64 MLuint
An unsigned ML integer type with at least 64 bits used for index calculations on very large images ev...
Definition mlTypeDefs.h:506
double MLdouble
Definition mlTypeDefs.h:217
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition mlTypeDefs.h:490