CortidQCT  1.2.2.52
Namespaces | Functions
ColorToLabelMapIO.cpp File Reference

Color to label maps IO functions implementations. More...

#include "ColorToLabelMapIO.h"
#include <gsl/gsl>
#include <yaml-cpp/yaml.h>
#include <exception>
Include dependency graph for ColorToLabelMapIO.cpp:

Namespaces

 CortidQCT
 Name namespace for CortidQCT library.
 
 CortidQCT::ColorToLabelMaps
 Namespace containing color to label maps.
 

Functions

CustomMap CortidQCT::ColorToLabelMaps::IO::loadCustomMapFromYAMLNode (YAML::Node const &node)
 Reads a custom color to label map from the given yaml node. More...
 
ColorRGB CortidQCT::ColorToLabelMaps::IO::loadColorRGBFromYAMLNode (YAML::Node const &node)
 Reads a ColorRGB from a YAML node. More...
 

Detailed Description

Color to label maps IO functions implementations.

Author
Stefan Reinhold

Function Documentation

ColorRGB CortidQCT::ColorToLabelMaps::IO::loadColorRGBFromYAMLNode ( YAML::Node const &  node)

Reads a ColorRGB from a YAML node.

The YAML node must be a sequence of 3 unsigned integers

Parameters
nodeThe YAML node to read the color from.
Exceptions
YAML::Exceptionon parsing failure
std::invalid_argumentif the YAML node is malformed.
Returns
A ColorRGB value
CustomMap CortidQCT::ColorToLabelMaps::IO::loadCustomMapFromYAMLNode ( YAML::Node const &  node)

Reads a custom color to label map from the given yaml node.

The YAML format is as follows: [[R1, G1, B1], L1], [R2, G2, B2, L2]], where Rx, Gx, Bx, L, are the x-th red, green, blue color components and label values, respectively. The color components must be given as unsigned 8-bit integers in the range [0, 255]. Optional the color map can be specified as a map type. Then the data specification above will go under the 'map' key and optionally, a undefinedLabel can be set.

Parameters
nodeThe YAML node to read the map from
Exceptions
YAML::Exceptionon failure.
std::invalid_argumentif the YAML node is malformed
Returns
A ColorToLabelMaps::CustomMap object.