CiftiLib
A C++ library for CIFTI-2 and CIFTI-1 files
Public Member Functions | Static Public Member Functions | List of all members
cifti::Label Class Reference

Public Member Functions

 Label (const int32_t key, const AString &name)
 
 Label (const int32_t key, const AString &name, const float red, const float green, const float blue, const float alpha)
 
 Label (const int32_t key, const AString &name, const double red, const double green, const double blue, const double alpha)
 
 Label (const int32_t key, const AString &name, const float rgba[])
 
 Label (const int32_t key, const AString &name, const int32_t red, const int32_t green, const int32_t blue, const int32_t alpha)
 
 Label (const int32_t key, const AString &name, const int32_t rgba[])
 
 Label (const int32_t key)
 
 Label (const Label &gl)
 
Labeloperator= (const Label &gl)
 
int32_t hashCode ()
 
bool equals (const Label &)
 
int32_t operator< (const Label &gl)
 
int32_t getKey () const
 
void setKey (const int32_t key)
 
AString getName () const
 
void setName (const AString &name)
 
bool isSelected () const
 
void setSelected (const bool selected)
 
float * getColor () const
 
void getColor (float rgbaOut[]) const
 
void setColor (const float rgba[])
 
int32_t * getColorInt () const
 
void setColorInt (const int32_t rgba[])
 
float getRed () const
 
float getGreen () const
 
float getBlue () const
 
float getAlpha () const
 
bool matches (const Label &rhs, const bool checkColor=false) const
 

Static Public Member Functions

static void getDefaultColor (float rgbaOut[4])
 
static int32_t getInvalidLabelKey ()
 

Constructor & Destructor Documentation

◆ Label() [1/7]

Label::Label ( const int32_t  key,
const AString &  name 
)

Constructor.

Parameters
key- key of the label.
name- name of label.

◆ Label() [2/7]

Label::Label ( const int32_t  key,
const AString &  name,
const float  red,
const float  green,
const float  blue,
const float  alpha 
)
explicit

Constructor.

Parameters
key- Key of the label.
name- name of label.
red- red color component, zero to one.
green- green color component, zero to one.
blue- blue color component, zero to one.
alpha- alpha color component, zero to one.

◆ Label() [3/7]

Label::Label ( const int32_t  key,
const AString &  name,
const double  red,
const double  green,
const double  blue,
const double  alpha 
)
explicit

Constructor.

Parameters
key- Key of the label.
name- name of label.
red- red color component, zero to one.
green- green color component, zero to one.
blue- blue color component, zero to one.
alpha- alpha color component, zero to one.

◆ Label() [4/7]

Label::Label ( const int32_t  key,
const AString &  name,
const float  rgba[] 
)

Constructor.

Parameters
key- Key of the label.
name- name of label.
rgba- red, green, blue, alpha color componenents, zero to one.

◆ Label() [5/7]

Label::Label ( const int32_t  key,
const AString &  name,
const int32_t  red,
const int32_t  green,
const int32_t  blue,
const int32_t  alpha 
)
explicit

Constructor.

Parameters
key- Key of the label.
name- name of label.
red- red color component, zero to two-fifty-five.
green- green color component, zero to two-fifty-five.
blue- blue color component, zero to two-fifty-five.
alpha- alpha color component, zero to two-fifty-five.

◆ Label() [6/7]

Label::Label ( const int32_t  key,
const AString &  name,
const int32_t  rgba[] 
)

Constructor.

Parameters
key- Key of the label.
name- name of label.
rgba- red, green, blue, alpha color componenents, zero to 255.

◆ Label() [7/7]

Label::Label ( const int32_t  key)

Constructor.

Parameters
key- Key of the label.

Member Function Documentation

◆ equals()

bool Label::equals ( const Label gl)

Determine if two labels are equal. Two Labels are equal if they have the same "key".

Parameters
gllabel for comparison.
Returns
true if equal, else false.

◆ getAlpha()

float Label::getAlpha ( ) const

Get the alpha color component for this label.

Returns
alpha color component.

◆ getBlue()

float Label::getBlue ( ) const

Get the blue color component for this label.

Returns
blue color component.

◆ getColor() [1/2]

float * Label::getColor ( ) const

Get the color components.

Returns
A four-dimensional array of floats containing the red, green, blue, and alpha components with values ranging from 0.0 to 1.0. User MUST delete[] returned array.

◆ getColor() [2/2]

void Label::getColor ( float  rgbaOut[]) const

Get the color components.

Parameters
rgbaOutfour dimensional array into which are loaded, red, green, blue, and alpha components ranging 0.0. to 1.0.

◆ getColorInt()

int32_t * Label::getColorInt ( ) const

Get the colors as integers ranging 0 to 255.

Returns
Four-dimensional array containing color components. User must delete[] the returned array.

◆ getDefaultColor()

void Label::getDefaultColor ( float  rgbaOut[4])
static

Get the default color.

Parameters
rgbaOutouput, a four-dimensional array of floats containing the red, green, blue, and alpha components with values ranging from 0.0 to 1.0.

◆ getGreen()

float Label::getGreen ( ) const

Get the green color component for this label.

Returns
green color component.

◆ getInvalidLabelKey()

static int32_t cifti::Label::getInvalidLabelKey ( )
inlinestatic
Returns
The invalid label key.

◆ getKey()

int32_t Label::getKey ( ) const

Get the key of this label.

Returns
key of the label.

◆ getName()

AString Label::getName ( ) const

Get the name.

Returns
Name of label.

◆ getRed()

float Label::getRed ( ) const

Get the red color component for this label.

Returns
red color component.

◆ isSelected()

bool Label::isSelected ( ) const

Is this label selected (for display)?

Returns
true if label selected for display, else false.

◆ operator<()

int32_t Label::operator< ( const Label gl)

Compare this label to another label using the indices of the labels.

Parameters
gl- Compare to this Label.
Returns
negative if "this" is less, positive if "this" is greater, else zero.

◆ setColor()

void Label::setColor ( const float  rgba[])

Set the color components.

Parameters
rgba- A four-dimensional array of floats containing the red, green, blue, and alpha components with values ranging from 0.0 to 1.0.

◆ setColorInt()

void Label::setColorInt ( const int32_t  rgba[])

Set the colors with integers ranging 0 to 255.

Parameters
rgba- four-dimensional array with colors ranging 0 to 255.

◆ setKey()

void Label::setKey ( const int32_t  key)

Set the key of this label. DO NOT call this method on a label retrieved from the label table.

Parameters
key- New key for this label.

◆ setName()

void Label::setName ( const AString &  name)

Set the name.

Parameters
name- new name for label.

◆ setSelected()

void Label::setSelected ( const bool  selected)

Set the label selected (for display).

Parameters
selected- new selection status.

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