MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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:
31
35 void setSelectedAtVoxelPositions(const std::vector<ImageVector>& voxelPositions);
46
50 bool isSelected(MLint x, MLint y, MLint z) const;
53
58
61 {
62 _volumeFactor = volumeFactor;
63 }
66 {
67 _minClusterSize = minSize;
68 }
72 {
73 _maxClusterSize = maxSize;
74 }
75
79 {
80 _invertSelection = shouldInvert;
81 }
84 {
85 return _invertSelection;
86 }
90
95
100
105
108 {
109 return _clusters;
110 }
111
112protected:
113private:
115 {}
116
117 void clearSelectionStates();
118 void initializeSelectionStates(MLuint numClusters);
119 void copyInputSelection(SelectedClusters* selectedClusters);
120 bool isInsideImage(const ImageVector& position);
121 void invertSelection();
122
123 std::vector<char> _isSelected;
124
125 Clusters* _clusters;
126
127 MLdouble _volumeFactor;
128 MLdouble _minClusterSize;
129 MLdouble _maxClusterSize;
130 bool _invertSelection;
131
132 bool _hasInputSelection;
133 std::vector<char> _isInputSelected;
134
135 bool isEligibleForSelection(const ClusterInfo& cInfo, MLuint& rank);
136 bool isEligibleForSelection(const ClusterInfo& cInfo, MLdouble& volume, MLuint& rank);
137
138 ML_CLASS_HEADER(SelectedClusters);
139};
140
141
143
144#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:505
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:489