20 #ifndef MIRTK_ConnectedComponents_H 21 #define MIRTK_ConnectedComponents_H 23 #include "mirtk/ImageToImage.h" 25 #include "mirtk/Array.h" 26 #include "mirtk/OrderedSet.h" 27 #include "mirtk/NeighborhoodOffsets.h" 48 template <
class TVoxel = GreyPixel>
134 const string lstr =
ToLower(str);
135 if (lstr ==
"none" || lstr ==
"no ordering") {
137 }
else if (lstr ==
"largest" || lstr ==
"largestfirst" || lstr ==
"largest first") {
139 }
else if (lstr ==
"smallest" || lstr ==
"smallestfirst" || lstr ==
"smallest first") {
150 template <
class TVoxel>
153 return _ComponentSize[label-1];
159 #endif // MIRTK_ConnectedComponents_H ConnectedComponents(ConnectedComponentsOrdering=CC_LargestFirst, ConnectivityType=CONNECTIVITY_26)
Constructor.
virtual void Initialize()
Initialize the filter execution.
virtual ~ConnectedComponents()
Destructor.
No sorting of output components.
mirtkReadOnlyAttributeMacro(int, NumberOfComponents)
Number of connected components.
ConnectedComponentsOrdering
Enumeration of possible orderings of connected components.
string ToLower(const string &)
Convert string to lowercase letters.
mirtkPublicAttributeMacro(ConnectedComponentsOrdering, Ordering)
Ordering of output components.
mirtkAttributeMacro(NeighborhoodOffsets, Offsets)
List of voxel offsets of the neighborhood.
virtual void Finalize()
Finalize the filter execution.
TVoxel VoxelType
Input/output image voxel type.
string ToString(const EnergyMeasure &value, int w, char c, bool left)
Convert energy measure enumeration value to string.
bool FromString(const char *str, EnergyMeasure &value)
Convert energy measure string to enumeration value.
virtual void Run()
Run erosion.
int ComponentSize(VoxelType label) const
ConnectivityType
Type of image connectivity, i.e., number of neighbors for each voxel.
virtual void DeleteComponent(VoxelType)