CortidQCT
1.2.2.52
|
A customaizable color to label map. More...
#include <ColorToLabelMap.h>
Public Types | |
using | LabelType = std::uint64_t |
using | Table = std::unordered_map< ColorRGB, LabelType > |
Public Member Functions | |
template<class Scalar , class Label > | |
operator ColorToLabelMap< Label, Scalar > () const | |
Return a ColorToLabelMap representing the current map. | |
template<class Label , class Scalar > | |
Label | operator() (Scalar red, Scalar green, Scalar blue) const |
Converts a RGB color to a label using the pre-defined lookup table. More... | |
CustomMap & | loadFromFile (std::string const &filename) |
Loads the custom map from a YAML file. More... | |
Static Public Member Functions | |
static CustomMap | fromFile (std::string const &filename) |
Convenience initializer to load custom map from file. More... | |
Public Attributes | |
Table | table |
mapping table More... | |
LabelType | undefinedLabel {0} |
A customaizable color to label map.
|
inlinestatic |
Convenience initializer to load custom map from file.
CustomMap & CortidQCT::ColorToLabelMaps::CustomMap::loadFromFile | ( | std::string const & | filename | ) |
Loads the custom map from a YAML file.
filename | Path to the yaml file |
std::invalid_argument | if loading fails |
|
inline |
Converts a RGB color to a label using the pre-defined lookup table.
Scalar | scalar type of the color components (floating point) |
Label | label type, must be constructible from std::unit64_t |
red | red compnent in range [0, 1] |
green | green component in range [0, 1] |
blue | blue component in range [0, 1] |
undefinedLabel
is returned. Table CortidQCT::ColorToLabelMaps::CustomMap::table |
mapping table
Maps RGB colors to labels. Defautl value maps the colors red, green, yellow, green, magenta, cyan to 0, 1, 2, 3, 4, 5, respectively.
LabelType CortidQCT::ColorToLabelMaps::CustomMap::undefinedLabel {0} |
The label that is returned when no matching entry in the table can be found