cifti::LabelTable Class Reference

## Public Member Functions

| LabelTable (const LabelTable &glt)
LabelTable & | operator= (const LabelTable &glt)
bool | matches (const LabelTable &rhs, const bool checkColors=false) const
bool | operator== (const LabelTable &rhs) const
bool | operator!= (const LabelTable &rhs) const
void | clear ()
std::map< int32_t, int32_t > | append (const LabelTable &glt)
int32_t | addLabel (const AString &labelName, const float red, const float green, const float blue, const float alpha)
int32_t | addLabel (const AString &labelName, const float red, const float green, const float blue)
int32_t | addLabel (const AString &labelName, const int32_t red, const int32_t green, const int32_t blue, const int32_t alpha)
int32_t | addLabel (const AString &labelName, const int32_t red, const int32_t green, const int32_t blue)
int32_t | addLabel (const Label *glt)
void | deleteLabel (const int32_t key)
void | deleteLabel (const Label *label)
void | deleteUnusedLabels (const std::set< int32_t > &usedLabelKeys)
void | insertLabel (const Label *label)
int32_t | getLabelKeyFromName (const AString &name) const
const Label * | getLabel (const AString &labelName) const
Label * | getLabel (const AString &labelName)
const Label * | getLabel (const int32_t key) const
Label * | getLabel (const int32_t key)
int32_t | getUnassignedLabelKey () const
int32_t | getNumberOfLabels () const
AString | getLabelName (const int32_t key) const
void | setLabelName (const int32_t key, const AString &name)
void | setLabel (const int32_t key, const AString &name, const float red, const float green, const float blue, const float alpha)
bool | isLabelSelected (const int32_t key) const
void | setLabelSelected (const int32_t key, const bool sel)
void | setSelectionStatusForAllLabels (const bool newStatus)
float | getLabelAlpha (const int32_t key) const
void | getLabelColor (const int32_t key, float rgbaOut[4]) const
void | setLabelColor (const int32_t key, const float color[4])
void | createLabelsForKeys (const std::set< int32_t > &newKeys)
void | writeXML (XmlWriter &xmlWriter) const
void | readXml (XmlReader &xml)
std::set< int32_t > | getKeys () const
void | getKeys (std::vector< int32_t > &keysOut) const
void | getKeysAndNames (std::map< int32_t, AString > &keysAndNamesOut) const
int32_t | generateUnusedKey () const

## Member Function Documentation

## addLabel() [1/5]

int32_t LabelTable::addLabel | ( | const AString & | labelName,
|  | const float | red,
|  | const float | green,
|  | const float | blue )

Add a label. If a label with the name exists, its colors are replaced with these color components.

Parameters

  labelName | Name of label.
  red | Red color component ranging 0.0 to 1.0.
  green | Green color component ranging 0.0 to 1.0.
  blue | Blue color component ranging 0.0 to 1.0.

Returns
  Index of the existing label, or, if no label exists with name, index of new label.

## addLabel() [2/5]

int32_t LabelTable::addLabel | ( | const AString & | labelName,
|  | const float | red,
|  | const float | green,
|  | const float | blue,
|  | const float | alpha )

Add a label. If a label with the name exists, its colors are replaced with these color components.

Parameters

  labelName | Name of label.
  red | Red color component ranging 0.0 to 1.0.
  green | Green color component ranging 0.0 to 1.0.
  blue | Blue color component ranging 0.0 to 1.0.
  alpha | Alpha color component ranging 0.0 to 1.0.

Returns
  Index of the existing label, or, if no label exists with name, index of new label.

## addLabel() [3/5]

int32_t LabelTable::addLabel | ( | const AString & | labelName,
|  | const int32_t | red,
|  | const int32_t | green,
|  | const int32_t | blue )

Add a label. If a label with the name exists, its colors are replaced with these color components.

Parameters

  labelName | Name of label.
  red | Red color component ranging 0 to 255.
  green | Green color component ranging 0 to 255.
  blue | Blue color component ranging 0 to 255.

Returns
  Index of the existing label, or, if no label exists with name, index of new label.

## addLabel() [4/5]

int32_t LabelTable::addLabel | ( | const AString & | labelName,
|  | const int32_t | red,
|  | const int32_t | green,
|  | const int32_t | blue,
|  | const int32_t | alpha )

Add a label. If a label with the name exists, its colors are replaced with these color components.

Parameters

  labelName | Name of label.
  red | Red color component ranging 0 to 255.
  green | Green color component ranging 0 to 255.
  blue | Blue color component ranging 0 to 255.
  alpha | Alpha color component ranging 0 to 255.

Returns
  Index of the existing label, or, if no label exists with name, index of new label.

## addLabel() [5/5]

int32_t LabelTable::addLabel | ( | const Label * | glIn | ) |

Add a label to the label table. If the label's key is already in the label table, a new key is created. If a label of the same name already exists, the key of the existing label is returned and its color is overridden.

Parameters

  glIn | - Label to add.

Returns
  Key of the label, possibly different than its original key.

## append()

std::map< int32_t, int32_t > LabelTable::append | ( | const LabelTable & | glt | ) |

Append a label table to this label table. Since labels may be duplicated, the map returned that converts the keys of the appended LabelTable to keys for "this" label table.

Parameters

  glt | Label table that is to be appended.

Returns
  A map where the keys are the keys in the label table that is passed as a parameter and the values are the keys into "this" label table.

## clear()

void LabelTable::clear | ( |  | ) |

Clear the labelTable.

## deleteLabel() [1/2]

void LabelTable::deleteLabel | ( | const int32_t | key | ) |

Remove the label with the specified key.

Parameters

  key | - key of label.

## deleteLabel() [2/2]

void LabelTable::deleteLabel | ( | const Label * | label | ) |

Remove a label from the label table. This method WILL DELETE the label passed in so the caller should never use the parameter passed after this call.

Parameters

  label | - label to remove.

## deleteUnusedLabels()

void LabelTable::deleteUnusedLabels | ( | const std::set< int32_t > & | usedLabelKeys | ) |

Remove unused labels from the label table. Note that the unassigned label is not removed, even if it is unused.

Parameters

  usedLabelKeys | - Color keys that are in use.

## generateUnusedKey()

int32_t LabelTable::generateUnusedKey | ( |  | ) | const

Generate an unused key.

Returns
  An unused key.

## getKeys()

std::set< int32_t > LabelTable::getKeys | ( |  | ) | const

Get the valid keys of the labels in ascending order.

Returns
  A Set containing the valid keys of the label in ascending order.

## getKeysAndNames()

void LabelTable::getKeysAndNames | ( | std::map< int32_t, AString > & | keysAndNamesOut | ) | const

Get all keys and names.

Parameters

  keysAndNamesOut | Map containing the pairs of corresponding keys and names.

## getLabel() [1/4]

Label * LabelTable::getLabel | ( | const AString & | labelName | ) |

Get a Label from its name.

Parameters

  labelName | - Name of label that is sought.

Returns
  Reference to label with name or null if no matching label.

## getLabel() [2/4]

const Label * LabelTable::getLabel | ( | const AString & | labelName | ) | const

Get a Label from its name.

Parameters

  labelName | - Name of label that is sought.

Returns
  Reference to label with name or null if no matching label.

## getLabel() [3/4]

Label * LabelTable::getLabel | ( | const int32_t | key | ) |

Get the Label at the specified key.

Parameters

  key | - Key of Label entry.

Returns
  The Label at the specified key or null if the there is not a label at the specified key.

## getLabel() [4/4]

const Label * LabelTable::getLabel | ( | const int32_t | key | ) | const

Get the Label at the specified key.

Parameters

  key | - Key of Label entry.

Returns
  The Label at the specified key or null if the there is not a label at the specified key.

## getLabelAlpha()

float LabelTable::getLabelAlpha | ( | const int32_t | key | ) | const

Get the alpha color component for a label. If the key is not a valid label, an alpha of zero is returned.

Parameters

  key | - Key of label.

Returns
  Alpha for label or zero if invalid key.

## getLabelColor()

void LabelTable::getLabelColor | ( | const int32_t | key,
|  | float | rgbaOut[4] ) const

Get the color for a label.

Parameters

  key | - key of label.
  rgbaOut | - output, its color components

## getLabelKeyFromName()

int32_t LabelTable::getLabelKeyFromName | ( | const AString & | name | ) | const

Get the key of a lable from its name.

Parameters

  name | Name to search for.

Returns
  Key of Name or Label::getInvalidLabelKey() if not found.

## getLabelName()

AString LabelTable::getLabelName | ( | const int32_t | key | ) | const

Get the name of the label at the key. If there is no label at the key an empty string is returned.

Parameters

  key | - key of label.

Returns
  Name of label at inkeydex.

## getNumberOfLabels()

int32_t LabelTable::getNumberOfLabels | ( |  | ) | const

Get the number of labels. This value is one greater than the last label key. Note that not every key may have a label. If there are no labels this returns 0.

Returns
  Number of labels.

## getUnassignedLabelKey()

int32_t LabelTable::getUnassignedLabelKey | ( |  | ) | const

Get the key for the unassigned label.

Returns
  Index of key for unassigned label. A valid key will always be returned.

## insertLabel()

void LabelTable::insertLabel | ( | const Label * | labelIn | ) |

Insert the label using the labels key.

Parameters

  labelIn | - Label to insert (replaces an existing label with the same key).

## isLabelSelected()

bool LabelTable::isLabelSelected | ( | const int32_t | key | ) | const

Get the selection status of the label at the specified key. If there is no label at the key, false is returned.

Parameters

  key | - key of label

Returns
  selection status of label.

## setLabel()

void LabelTable::setLabel | ( | const int32_t | key,
|  | const AString & | name,
|  | const float | red,
|  | const float | green,
|  | const float | blue,
|  | const float | alpha )

Set a label. If a label with the specified key exists, it is replaced.

Parameters

  key | Key for label.
  name | Name of label.
  red | Red color component.
  green | Green color component.
  blue | Blue color component.
  alpha | Alpha color component.

## setLabelColor()

void LabelTable::setLabelColor | ( | const int32_t | key,
|  | const float | color[4] )

Set the color of a label.

Parameters

  key | - key of label.
  color | - new color of label.

## setLabelName()

void LabelTable::setLabelName | ( | const int32_t | key,
|  | const AString & | name )

Set the name of a label.

Parameters

  key | - key of label.
  name | - new name of label.

## setLabelSelected()

void LabelTable::setLabelSelected | ( | const int32_t | key,
|  | const bool | sel )

Set the selection status of a label.

Parameters

  key | - key of label.
  sel | - new selection status.

## setSelectionStatusForAllLabels()

void LabelTable::setSelectionStatusForAllLabels | ( | const bool | newStatus | ) |

Set the selection status for all labels.

Parameters

  newStatus | New selection status.

The documentation for this class was generated from the following files:

- LabelTable.h
- LabelTable.cxx