CiftiLib
A C++ library for CIFTI-2 and CIFTI-1 files
|
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 |
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.
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. |
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.
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. |
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.
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. |
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.
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. |
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.
glIn | - Label to add. |
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.
glt | Label table that is to be appended. |
void LabelTable::clear | ( | ) |
Clear the labelTable.
void LabelTable::deleteLabel | ( | const int32_t | key | ) |
Remove the label with the specified key.
key | - key of label. |
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.
label | - label to remove. |
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.
usedLabelKeys | - Color keys that are in use. |
int32_t LabelTable::generateUnusedKey | ( | ) | const |
Generate an unused key.
std::set< int32_t > LabelTable::getKeys | ( | ) | const |
Get the valid keys of the labels in ascending order.
void LabelTable::getKeysAndNames | ( | std::map< int32_t, AString > & | keysAndNamesOut | ) | const |
Get all keys and names.
keysAndNamesOut | Map containing the pairs of corresponding keys and names. |
Label * LabelTable::getLabel | ( | const AString & | labelName | ) |
Get a Label from its name.
labelName | - Name of label that is sought. |
const Label * LabelTable::getLabel | ( | const AString & | labelName | ) | const |
Get a Label from its name.
labelName | - Name of label that is sought. |
Label * LabelTable::getLabel | ( | const int32_t | key | ) |
const Label * LabelTable::getLabel | ( | const int32_t | key | ) | const |
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.
key | - Key of label. |
void LabelTable::getLabelColor | ( | const int32_t | key, |
float | rgbaOut[4] | ||
) | const |
Get the color for a label.
key | - key of label. |
rgbaOut | - output, its color components |
int32_t LabelTable::getLabelKeyFromName | ( | const AString & | name | ) | const |
Get the key of a lable from its name.
name | Name to search for. |
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.
key | - key of label. |
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.
int32_t LabelTable::getUnassignedLabelKey | ( | ) | const |
Get the key for the unassigned label.
void LabelTable::insertLabel | ( | const Label * | labelIn | ) |
Insert the label using the labels key.
labelIn | - Label to insert (replaces an existing label with the same key). |
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.
key | - key of label |
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.
key | Key for label. |
name | Name of label. |
red | Red color component. |
green | Green color component. |
blue | Blue color component. |
alpha | Alpha color component. |
void LabelTable::setLabelColor | ( | const int32_t | key, |
const float | color[4] | ||
) |
Set the color of a label.
key | - key of label. |
color | - new color of label. |
void LabelTable::setLabelName | ( | const int32_t | key, |
const AString & | name | ||
) |
Set the name of a label.
key | - key of label. |
name | - new name of label. |
void LabelTable::setLabelSelected | ( | const int32_t | key, |
const bool | sel | ||
) |
Set the selection status of a label.
key | - key of label. |
sel | - new selection status. |
void LabelTable::setSelectionStatusForAllLabels | ( | const bool | newStatus | ) |
Set the selection status for all labels.
newStatus | New selection status. |