Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::Label Class Reference

A data structure describing a label in a multi-label segmentation. More...

#include <mitkLabel.h>

Inheritance diagram for mitk::Label:
Collaboration diagram for mitk::Label:

Public Types

enum class  AlgorithmType { Undefined , MANUAL , SEMIAUTOMATIC , AUTOMATIC }
 Enumeration describing how a label was created or refined. More...
 
typedef unsigned short PixelType
 Pixel type used for label values (unsigned short). More...
 
- Public Types inherited from mitk::PropertyList
typedef std::map< std::string, BaseProperty::Pointer > PropertyMap
 
typedef std::pair< std::string, BaseProperty::Pointer > PropertyMapElementType
 

Public Member Functions

 mitkClassMacro (Label, mitk::PropertyList)
 
 mitkNewMacro2Param (Self, PixelType, const std::string &)
 
void SetLocked (bool locked)
 Sets the lock state of the label. More...
 
bool GetLocked () const
 Returns the lock state of the label. More...
 
void SetVisible (bool visible)
 Sets the visibility state of the label for rendering. More...
 
bool GetVisible () const
 Returns the visibility state of the label. More...
 
void SetOpacity (float opacity)
 Sets the opacity of the label for rendering. More...
 
float GetOpacity () const
 Returns the opacity of the label. More...
 
void SetName (const std::string &name)
 Sets the (class) name of the label. More...
 
std::string GetName () const
 Returns the (class) name of the label. More...
 
void SetTrackingID (const std::string &trackingID)
 Sets the DICOM tracking ID of the label. More...
 
std::string GetTrackingID () const
 Returns the DICOM tracking ID of the label. More...
 
bool HasTrackingID () const
 Returns whether a tracking ID property is set on the label. More...
 
void SetTrackingUID (const std::string &trackingUID)
 Sets the DICOM tracking unique identifier (UID) of the label. More...
 
std::string GetTrackingUID () const
 Returns the DICOM tracking unique identifier (UID) of the label. More...
 
bool HasTrackingUID () const
 Returns whether a tracking UID property is set on the label. More...
 
void SetDescription (const std::string &description)
 Sets a textual description for the label. More...
 
std::string GetDescription () const
 Returns the textual description of the label. More...
 
mitk::Point3D GetCenterOfMassIndex () const
 Returns the center of mass of the label as image index coordinates. More...
 
mitk::Point3D GetCenterOfMassCoordinates () const
 Returns the center of mass of the label in world coordinates. More...
 
void ResetCenterOfMass ()
 Resets (clears) the center of mass properties. More...
 
itk::ModifiedTimeType GetCenterOfMassMTime () const
 Returns the modification time of the last center of mass property update. More...
 
void UpdateCenterOfMass (const mitk::Point3D &index, const mitk::Point3D &coordinates)
 Updates the center of mass with new index and world coordinates. More...
 
void SetColor (const mitk::Color &color)
 Sets the display color of the label. More...
 
const mitk::Color & GetColor () const
 Returns the display color of the label. More...
 
void SetValue (PixelType pixelValue)
 Sets the pixel value that identifies this label in the segmentation image. More...
 
PixelType GetValue () const
 Returns the pixel value that identifies this label in the segmentation image. More...
 
void SetAlgorithmType (AlgorithmType algoType)
 Sets the algorithm type that was used to create or modify this label. More...
 
void SetAlgorithmTypeStr (const std::string &algoType)
 Sets the algorithm type from a string representation. More...
 
AlgorithmType GetAlgorithmType () const
 Returns the algorithm type used to create or modify this label. More...
 
std::string GetAlgorithmTypeStr () const
 Returns the algorithm type as a string. More...
 
void SetAlgorithmName (const std::string &algoName)
 Sets the name of the algorithm used to create or modify this label. More...
 
std::string GetAlgorithmName () const
 Returns the name of the algorithm used to create or modify this label. More...
 
bool HasAlgorithmName () const
 Returns whether an algorithm name property is set on the label. More...
 
void AddToolUse (AlgorithmType algoType, const std::string &algoName)
 Records that a tool/operation contributed to this label, updating algorithm type and name. More...
 
void MergeToolUses (const Label *other)
 Absorbs another label's recorded provenance (algorithm type and tool names) into this one. More...
 
void SetAnatomicRegion (const DICOMCodeSequenceWithModifiers &code, std::size_t index=0)
 Sets an anatomic region code at the specified index. More...
 
DICOMCodeSequenceWithModifiers GetAnatomicRegion (std::size_t index=0) const
 Gets an anatomic region code at the specified index. More...
 
std::size_t GetAnatomicRegionCount () const
 Gets the number of anatomic region codes stored. More...
 
void RemoveAnatomicRegion (std::size_t index)
 Removes an anatomic region code at the specified index. More...
 
void SetPrimaryAnatomicStructure (const DICOMCodeSequenceWithModifiers &code, std::size_t index=0)
 Sets a primary anatomic structure code at the specified index. More...
 
DICOMCodeSequenceWithModifiers GetPrimaryAnatomicStructure (std::size_t index=0) const
 Gets a primary anatomic structure code at the specified index. More...
 
std::size_t GetPrimaryAnatomicStructureCount () const
 Gets the number of primary anatomic structure codes stored. More...
 
void RemovePrimaryAnatomicStructure (std::size_t index)
 Removes a primary anatomic structure code at the specified index. More...
 
void SetSegmentedPropertyCategory (const DICOMCodeSequence &code)
 Sets the segmented property category code. More...
 
std::optional< DICOMCodeSequence > GetSegmentedPropertyCategory () const
 Gets the segmented property category code. More...
 
void SetSegmentedPropertyType (const DICOMCodeSequenceWithModifiers &code)
 Sets the segmented property type code with optional modifiers. More...
 
std::optional< DICOMCodeSequenceWithModifiers > GetSegmentedPropertyType () const
 Gets the segmented property type code with modifiers. More...
 
void SetProperty (const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
 Sets a property on this label. More...
 
BaseProperty::ConstPointer GetConstProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const override
 Returns a const pointer to the property with the given key. More...
 
BaseProperty * GetNonConstProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) override
 Returns a non-const pointer to the property with the given key. More...
 
void Modified ()
 Marks this label as modified. More...
 
void Update (const Label *templateLabel, bool updateLabelValue=false)
 Function updates the property values of a label provided as templates. If a property exists in the destination label only the value will be updated (therefor observers and pointers stay valid). If the property does not exist, it will be cloned and added. No properties will be removed. More...
 
 Label ()
 Default constructor. Creates a label with default properties. More...
 
 Label (PixelType value, const std::string &name)
 Constructor that creates a label with a specified pixel value and name. More...
 
 ~Label () override
 Destructor. More...
 
- Public Member Functions inherited from mitk::PropertyList
 mitkClassMacroItkParent (PropertyList, itk::Object)
 
Pointer Clone () const
 
std::vector< std::string > GetPropertyKeys (const std::string &contextName="", bool includeDefaultContext=false) const override
 Retrieve all property keys. More...
 
std::vector< std::string > GetPropertyContextNames () const override
 Return available property context names. More...
 
void RemoveProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
 Remove a property from the list by key. More...
 
mitk::BaseProperty * GetProperty (const std::string &propertyKey) const
 Get a property by its name. More...
 
void ReplaceProperty (const std::string &propertyKey, BaseProperty *property)
 Replace a property object in the list by a new one. More...
 
void ConcatenatePropertyList (PropertyList *pList, bool replace=false)
 Merge another PropertyList into this one. More...
 
template<typename T >
bool GetPropertyValue (const char *propertyKey, T &value) const
 Convenience access method for GenericProperty<T> properties. More...
 
bool GetBoolProperty (const char *propertyKey, bool &boolValue) const
 Convenience method to access the value of a BoolProperty. More...
 
bool Get (const char *propertyKey, bool &boolValue) const
 Shortcut for GetBoolProperty(). More...
 
void SetBoolProperty (const char *propertyKey, bool boolValue)
 Convenience method to set the value of a BoolProperty. More...
 
void Set (const char *propertyKey, bool boolValue)
 Shortcut for SetBoolProperty(). More...
 
bool GetIntProperty (const char *propertyKey, int &intValue) const
 Convenience method to access the value of an IntProperty. More...
 
bool Get (const char *propertyKey, int &intValue) const
 Shortcut for GetIntProperty(). More...
 
void SetIntProperty (const char *propertyKey, int intValue)
 Convenience method to set the value of an IntProperty. More...
 
void Set (const char *propertyKey, int intValue)
 Shortcut for SetIntProperty(). More...
 
bool GetFloatProperty (const char *propertyKey, float &floatValue) const
 Convenience method to access the value of a FloatProperty. More...
 
bool Get (const char *propertyKey, float &floatValue) const
 Shortcut for GetFloatProperty(). More...
 
void SetFloatProperty (const char *propertyKey, float floatValue)
 Convenience method to set the value of a FloatProperty. More...
 
void Set (const char *propertyKey, float floatValue)
 Shortcut for SetFloatProperty(). More...
 
bool GetDoubleProperty (const char *propertyKey, double &doubleValue) const
 Convenience method to access the value of a DoubleProperty. More...
 
bool Get (const char *propertyKey, double &doubleValue) const
 Shortcut for GetDoubleProperty(). More...
 
void SetDoubleProperty (const char *propertyKey, double doubleValue)
 Convenience method to set the value of a DoubleProperty. More...
 
void Set (const char *propertyKey, double doubleValue)
 Shortcut for SetDoubleProperty(). More...
 
bool GetStringProperty (const char *propertyKey, std::string &stringValue) const
 Convenience method to access the value of a StringProperty. More...
 
bool Get (const char *propertyKey, std::string &stringValue) const
 Shortcut for GetStringProperty(). More...
 
void SetStringProperty (const char *propertyKey, const char *stringValue)
 Convenience method to set the value of a StringProperty. More...
 
void Set (const char *propertyKey, const char *stringValue)
 Shortcut for SetStringProperty() accepting a C-string. More...
 
void Set (const char *propertyKey, const std::string &stringValue)
 Shortcut for SetStringProperty() accepting a std::string. More...
 
itk::ModifiedTimeType GetMTime () const override
 Get the modification timestamp of the list. More...
 
bool DeleteProperty (const std::string &propertyKey)
 Remove a property from the list/map by key. More...
 
const PropertyMap * GetMap () const
 Get a read-only pointer to the internal property map. More...
 
bool IsEmpty () const
 Check whether the property list contains no properties. More...
 
virtual void Clear ()
 Remove all properties from the list. More...
 
void ToJSON (nlohmann::json &j) const
 Serialize the property list to JSON. More...
 
void FromJSON (const nlohmann::json &j)
 Deserialize the property list from JSON. More...
 
- Public Member Functions inherited from mitk::IPropertyOwner
 ~IPropertyOwner () override
 
virtual bool PropertyIsOwned (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const
 Checks if a certain property exists. More...
 
- Public Member Functions inherited from mitk::IPropertyProvider
virtual ~IPropertyProvider ()
 Virtual destructor. More...
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from mitk::PropertyList
static Pointer New ()
 

Static Public Attributes

static const PixelType MAX_LABEL_VALUE
 The maximum value a label can have (65535 for unsigned short). More...
 
static constexpr PixelType UNLABELED_VALUE
 Value indicating pixels that are not labeled at all (background). More...
 

Protected Member Functions

void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
 Label (const Label &other)
 
 mitkCloneMacro (Label)
 
void SetCenterOfMassIndex (const mitk::Point3D &center)
 
void SetCenterOfMassCoordinates (const mitk::Point3D &center)
 
mitk::BaseProperty * GetProperty (const std::string &propertyKey) const
 Get a property by its name. More...
 
- Protected Member Functions inherited from mitk::PropertyList
 PropertyList ()
 
 PropertyList (const Self &other)
 
 ~PropertyList () override
 
 mitkCloneMacro (Self)
 

Additional Inherited Members

- Protected Attributes inherited from mitk::PropertyList
PropertyMap m_Properties
 Map of properties. More...
 

Detailed Description

A data structure describing a label in a multi-label segmentation.

Label is the central descriptor for labeled regions in a MultiLabelSegmentation. It stores metadata such as name, color, visibility, lock state, opacity, and DICOM code sequences (anatomic region, primary anatomic structure, segmented property category/type). Label inherits from PropertyList, so all metadata is stored as properties.

Each label has a unique pixel value (PixelType) that identifies it within the segmentation image. Labels can be locked to prevent overwriting and can be set visible/invisible for rendering.

See also
MultiLabelSegmentation, LabelSetImageHelper

Definition at line 100 of file mitkLabel.h.

Member Typedef Documentation

◆ PixelType

typedef unsigned short mitk::Label::PixelType

Pixel type used for label values (unsigned short).

Definition at line 106 of file mitkLabel.h.

Member Enumeration Documentation

◆ AlgorithmType

Enumeration describing how a label was created or refined.

Enumerator
Undefined 

Undefined/unknown algorithm type.

MANUAL 

Label created manually by user with simple tools (e.g. Add tool).

SEMIAUTOMATIC 

Label created or refined with algorithmic assistance (e.g. nnInteractive).

AUTOMATIC 

Label created fully automatically by an algorithm (e.g. nnUNet).

Definition at line 282 of file mitkLabel.h.

Constructor & Destructor Documentation

◆ Label() [1/3]

mitk::Label::Label ( )

Default constructor. Creates a label with default properties.

Defaults: locked=true, visible=true, opacity=0.6, color=white, name="Unknown label name", value=UNLABELED_VALUE.

◆ Label() [2/3]

mitk::Label::Label ( PixelType  value,
const std::string &  name 
)

Constructor that creates a label with a specified pixel value and name.

Parameters
[in]valueThe pixel value for this label.
[in]nameThe name for this label.

◆ ~Label()

mitk::Label::~Label ( )
override

Destructor.

◆ Label() [3/3]

mitk::Label::Label ( const Label &  other)
protected

Member Function Documentation

◆ AddToolUse()

void mitk::Label::AddToolUse ( AlgorithmType  algoType,
const std::string &  algoName 
)

Records that a tool/operation contributed to this label, updating algorithm type and name.

Type: the first contribution to a still-Undefined label defines its type; any type already present (a genuine MANUAL loaded from a DICOM SEG, or a prior tool's type) is preserved, and a later tool of a different type mixes the result to SEMIAUTOMATIC. Name: for internally-created labels, algorithm_name starts with the "MITK Segmentation" prefix; the first dedicated tool is appended after ": " and further tools after "|" (e.g. "MITK Segmentation: nnUNet|Paint"). A name still equal to just the prefix means no dedicated tool has been recorded yet.

Remarks
The encoding reserves the separators "|" and ": ". To keep the provenance string parseable, those characters are sanitized to "#" inside algoName (a warning is logged when this happens) rather than rejected; an empty algoName is ignored. Tool names should use plain spaces (e.g. "Boolean Union", "Morphological Closing", "Interpolation").
Idempotent for repeated identical use (type stable, name de-duplicated), so it is safe under the many small writes a single interaction (e.g. a paint drag) produces.
Note
Externally-loaded provenance names that do not carry the MITK prefix are kept as-is; a later in-MITK tool simply appends to them and mixes the type as usual.

◆ GetAlgorithmName()

std::string mitk::Label::GetAlgorithmName ( ) const

Returns the name of the algorithm used to create or modify this label.

Returns
The algorithm name string.

◆ GetAlgorithmType()

AlgorithmType mitk::Label::GetAlgorithmType ( ) const

Returns the algorithm type used to create or modify this label.

Returns
The AlgorithmType enum value.

◆ GetAlgorithmTypeStr()

std::string mitk::Label::GetAlgorithmTypeStr ( ) const

Returns the algorithm type as a string.

Returns
String representation of the algorithm type.

◆ GetAnatomicRegion()

DICOMCodeSequenceWithModifiers mitk::Label::GetAnatomicRegion ( std::size_t  index = 0) const

Gets an anatomic region code at the specified index.

Parameters
indexThe index of the code to retrieve (default: 0)
Returns
The DICOMCodeSequenceWithModifiers at the specified index, or an empty code if not found

◆ GetAnatomicRegionCount()

std::size_t mitk::Label::GetAnatomicRegionCount ( ) const

Gets the number of anatomic region codes stored.

Returns
The count of anatomic region codes

◆ GetCenterOfMassCoordinates()

mitk::Point3D mitk::Label::GetCenterOfMassCoordinates ( ) const

Returns the center of mass of the label in world coordinates.

Returns
The center of mass in world (physical) coordinates.
See also
GetCenterOfMassIndex, UpdateCenterOfMass

◆ GetCenterOfMassIndex()

mitk::Point3D mitk::Label::GetCenterOfMassIndex ( ) const

Returns the center of mass of the label as image index coordinates.

Returns
The center of mass in index coordinates.
See also
GetCenterOfMassCoordinates, UpdateCenterOfMass

◆ GetCenterOfMassMTime()

itk::ModifiedTimeType mitk::Label::GetCenterOfMassMTime ( ) const

Returns the modification time of the last center of mass property update.

Returns
The modification timestamp.

◆ GetColor()

const mitk::Color& mitk::Label::GetColor ( ) const

Returns the display color of the label.

Returns
Reference to the RGB color. Default is white (1, 1, 1).

◆ GetConstProperty()

BaseProperty::ConstPointer mitk::Label::GetConstProperty ( const std::string &  propertyKey,
const std::string &  contextName = "",
bool  fallBackOnDefaultContext = true 
) const
overridevirtual

Returns a const pointer to the property with the given key.

Parameters
[in]propertyKeyThe key of the property.
[in]contextNameOptional context name (default: empty).
[in]fallBackOnDefaultContextIf true, fall back to the default context (default: true).
Returns
Const smart pointer to the property, or nullptr if not found.

Reimplemented from mitk::PropertyList.

◆ GetDescription()

std::string mitk::Label::GetDescription ( ) const

Returns the textual description of the label.

Returns
The description string.

◆ GetLocked()

bool mitk::Label::GetLocked ( ) const

Returns the lock state of the label.

Returns
true if the label is locked, false otherwise. Default is true.

◆ GetName()

std::string mitk::Label::GetName ( ) const

Returns the (class) name of the label.

Returns
The label name string.

◆ GetNonConstProperty()

BaseProperty* mitk::Label::GetNonConstProperty ( const std::string &  propertyKey,
const std::string &  contextName = "",
bool  fallBackOnDefaultContext = true 
)
overridevirtual

Returns a non-const pointer to the property with the given key.

Parameters
[in]propertyKeyThe key of the property.
[in]contextNameOptional context name (default: empty).
[in]fallBackOnDefaultContextIf true, fall back to the default context (default: true).
Returns
Pointer to the property, or nullptr if not found.

Reimplemented from mitk::PropertyList.

◆ GetOpacity()

float mitk::Label::GetOpacity ( ) const

Returns the opacity of the label.

Returns
Opacity value in [0.0, 1.0].

◆ GetPrimaryAnatomicStructure()

DICOMCodeSequenceWithModifiers mitk::Label::GetPrimaryAnatomicStructure ( std::size_t  index = 0) const

Gets a primary anatomic structure code at the specified index.

Parameters
indexThe index of the code to retrieve (default: 0)
Returns
The DICOMCodeSequenceWithModifiers at the specified index, or an empty code if not found

◆ GetPrimaryAnatomicStructureCount()

std::size_t mitk::Label::GetPrimaryAnatomicStructureCount ( ) const

Gets the number of primary anatomic structure codes stored.

Returns
The count of primary anatomic structure codes

◆ GetProperty()

mitk::BaseProperty* mitk::PropertyList::GetProperty
protected

Get a property by its name.

Parameters
[in]propertyKeyThe key identifying the property.
Returns
A raw pointer to the property, or nullptr if no property with the given key exists.

◆ GetSegmentedPropertyCategory()

std::optional<DICOMCodeSequence> mitk::Label::GetSegmentedPropertyCategory ( ) const

Gets the segmented property category code.

Returns
The DICOMCodeSequence representing the segmented property category

◆ GetSegmentedPropertyType()

std::optional<DICOMCodeSequenceWithModifiers> mitk::Label::GetSegmentedPropertyType ( ) const

Gets the segmented property type code with modifiers.

Returns
The DICOMCodeSequenceWithModifiers representing the segmented property type

◆ GetTrackingID()

std::string mitk::Label::GetTrackingID ( ) const

Returns the DICOM tracking ID of the label.

Returns
The tracking ID string.

◆ GetTrackingUID()

std::string mitk::Label::GetTrackingUID ( ) const

Returns the DICOM tracking unique identifier (UID) of the label.

Returns
The tracking UID string.

◆ GetValue()

PixelType mitk::Label::GetValue ( ) const

Returns the pixel value that identifies this label in the segmentation image.

Returns
The pixel value of the label.

◆ GetVisible()

bool mitk::Label::GetVisible ( ) const

Returns the visibility state of the label.

Returns
true if the label is visible, false otherwise. Default is true.

◆ HasAlgorithmName()

bool mitk::Label::HasAlgorithmName ( ) const

Returns whether an algorithm name property is set on the label.

Distinguishes "property absent" from "property present" (GetAlgorithmName returns the "MITK Segmentation" fallback in the absent case, so it cannot make this distinction). Persistence readers and AddToolUse only set the property when there is a real name to record, so a false result means no algorithm name was ever recorded for this label.

◆ HasTrackingID()

bool mitk::Label::HasTrackingID ( ) const

Returns whether a tracking ID property is set on the label.

Distinguishes "property absent" from "property present but empty". GetTrackingID returns "" in both cases. Persistence readers set the property only when the source carried a non-empty value, so a true result indicates a real tracking identifier on the source.

◆ HasTrackingUID()

bool mitk::Label::HasTrackingUID ( ) const

Returns whether a tracking UID property is set on the label.

Distinguishes "property absent" from "property present but empty" (see HasTrackingID). GetTrackingUID returns "" in both cases. Persistence readers set the property only when the source carried a non-empty value, so a true result indicates a real tracking UID on the source.

◆ MergeToolUses()

void mitk::Label::MergeToolUses ( const Label *  other)

Absorbs another label's recorded provenance (algorithm type and tool names) into this one.

Intended for content-merging operations (e.g. merging labels): the target should reflect that it now contains the source's algorithmically-derived content. The source's type is mixed into this label's type with the same rule as AddToolUse (a differing defined type yields SEMIAUTOMATIC), and each tool name recorded on the source is appended (de-duplicated) to this label's tool chain.

Parameters
[in]otherThe source label whose provenance is absorbed. Must not be null.
Remarks
A source with type but no recorded tool name (e.g. a vendor MANUAL label) contributes only its type. A source with an Undefined type contributes nothing.

◆ mitkClassMacro()

mitk::Label::mitkClassMacro ( Label  ,
mitk::PropertyList   
)

◆ mitkCloneMacro()

mitk::Label::mitkCloneMacro ( Label  )
protected

◆ mitkNewMacro2Param()

mitk::Label::mitkNewMacro2Param ( Self  ,
PixelType  ,
const std::string &   
)

◆ Modified()

void mitk::Label::Modified ( )
inline

Marks this label as modified.

Definition at line 475 of file mitkLabel.h.

◆ New()

static Pointer mitk::Label::New ( )
static

◆ PrintSelf()

void mitk::Label::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
overrideprotected

◆ RemoveAnatomicRegion()

void mitk::Label::RemoveAnatomicRegion ( std::size_t  index)

Removes an anatomic region code at the specified index.

Parameters
indexThe index of the code to remove

◆ RemovePrimaryAnatomicStructure()

void mitk::Label::RemovePrimaryAnatomicStructure ( std::size_t  index)

Removes a primary anatomic structure code at the specified index.

Parameters
indexThe index of the code to remove

◆ ResetCenterOfMass()

void mitk::Label::ResetCenterOfMass ( )

Resets (clears) the center of mass properties.

◆ SetAlgorithmName()

void mitk::Label::SetAlgorithmName ( const std::string &  algoName)

Sets the name of the algorithm used to create or modify this label.

Parameters
[in]algoNameThe algorithm name string.

◆ SetAlgorithmType()

void mitk::Label::SetAlgorithmType ( AlgorithmType  algoType)

Sets the algorithm type that was used to create or modify this label.

Parameters
[in]algoTypeThe algorithm type.

◆ SetAlgorithmTypeStr()

void mitk::Label::SetAlgorithmTypeStr ( const std::string &  algoType)

Sets the algorithm type from a string representation.

Parameters
[in]algoTypeString representation ("MANUAL", "SEMIAUTOMATIC", "AUTOMATIC", or "Undefined").

◆ SetAnatomicRegion()

void mitk::Label::SetAnatomicRegion ( const DICOMCodeSequenceWithModifiers &  code,
std::size_t  index = 0 
)

Sets an anatomic region code at the specified index.

Parameters
codeThe DICOMCodeSequenceWithModifiers representing the anatomic region
indexThe index at which to store the code (default: 0)

◆ SetCenterOfMassCoordinates()

void mitk::Label::SetCenterOfMassCoordinates ( const mitk::Point3D &  center)
protected

◆ SetCenterOfMassIndex()

void mitk::Label::SetCenterOfMassIndex ( const mitk::Point3D &  center)
protected

◆ SetColor()

void mitk::Label::SetColor ( const mitk::Color &  color)

Sets the display color of the label.

Parameters
[in]colorThe RGB color to use for rendering this label.

◆ SetDescription()

void mitk::Label::SetDescription ( const std::string &  description)

Sets a textual description for the label.

Parameters
[in]descriptionThe description string.

◆ SetLocked()

void mitk::Label::SetLocked ( bool  locked)

Sets the lock state of the label.

Parameters
[in]lockedIf true, the label is locked and its pixels cannot be overwritten by other operations that respect locks.

◆ SetName()

void mitk::Label::SetName ( const std::string &  name)

Sets the (class) name of the label.

Parameters
[in]nameThe name string, e.g. "Liver" or "Tumor".

◆ SetOpacity()

void mitk::Label::SetOpacity ( float  opacity)

Sets the opacity of the label for rendering.

Parameters
[in]opacityOpacity value in [0.0, 1.0]. Default is 0.6.

◆ SetPrimaryAnatomicStructure()

void mitk::Label::SetPrimaryAnatomicStructure ( const DICOMCodeSequenceWithModifiers &  code,
std::size_t  index = 0 
)

Sets a primary anatomic structure code at the specified index.

Parameters
codeThe DICOMCodeSequenceWithModifiers representing the primary anatomic structure
indexThe index at which to store the code (default: 0)

◆ SetProperty()

void mitk::Label::SetProperty ( const std::string &  propertyKey,
BaseProperty *  property,
const std::string &  contextName = "",
bool  fallBackOnDefaultContext = false 
)
overridevirtual

Sets a property on this label.

Parameters
[in]propertyKeyThe key of the property.
[in]propertyPointer to the property to set.
[in]contextNameOptional context name (default: empty).
[in]fallBackOnDefaultContextIf true, fall back to the default context (default: false).

Reimplemented from mitk::PropertyList.

◆ SetSegmentedPropertyCategory()

void mitk::Label::SetSegmentedPropertyCategory ( const DICOMCodeSequence &  code)

Sets the segmented property category code.

Parameters
codeThe DICOMCodeSequence representing the segmented property category

◆ SetSegmentedPropertyType()

void mitk::Label::SetSegmentedPropertyType ( const DICOMCodeSequenceWithModifiers &  code)

Sets the segmented property type code with optional modifiers.

Parameters
codeThe DICOMCodeSequenceWithModifiers representing the segmented property type

◆ SetTrackingID()

void mitk::Label::SetTrackingID ( const std::string &  trackingID)

Sets the DICOM tracking ID of the label.

Parameters
[in]trackingIDThe tracking ID string.

◆ SetTrackingUID()

void mitk::Label::SetTrackingUID ( const std::string &  trackingUID)

Sets the DICOM tracking unique identifier (UID) of the label.

Parameters
[in]trackingUIDThe tracking UID string.

◆ SetValue()

void mitk::Label::SetValue ( PixelType  pixelValue)

Sets the pixel value that identifies this label in the segmentation image.

Parameters
[in]pixelValueThe pixel value for this label.

◆ SetVisible()

void mitk::Label::SetVisible ( bool  visible)

Sets the visibility state of the label for rendering.

Parameters
[in]visibleIf true, the label is rendered visibly.

◆ Update()

void mitk::Label::Update ( const Label *  templateLabel,
bool  updateLabelValue = false 
)

Function updates the property values of a label provided as templates. If a property exists in the destination label only the value will be updated (therefor observers and pointers stay valid). If the property does not exist, it will be cloned and added. No properties will be removed.

Parameters
templateLabelLabel instance that provides the new values for properties
updateLabelValueIndicate if also the label value should be updated.

◆ UpdateCenterOfMass()

void mitk::Label::UpdateCenterOfMass ( const mitk::Point3D &  index,
const mitk::Point3D &  coordinates 
)

Updates the center of mass with new index and world coordinates.

Parameters
[in]indexThe center of mass in image index coordinates.
[in]coordinatesThe center of mass in world coordinates.

Member Data Documentation

◆ MAX_LABEL_VALUE

const PixelType mitk::Label::MAX_LABEL_VALUE
static

The maximum value a label can have (65535 for unsigned short).

Definition at line 112 of file mitkLabel.h.

◆ UNLABELED_VALUE

constexpr PixelType mitk::Label::UNLABELED_VALUE
staticconstexpr

Value indicating pixels that are not labeled at all (background).

Definition at line 115 of file mitkLabel.h.


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