Medical Imaging Interaction Toolkit  2024.12.99-e34d570b
Medical Imaging Interaction Toolkit
mitk::MultiLabelSegmentation Class Reference

MultiLabelSegmentation class for handling labels and layers in a segmentation session. More...

#include <mitkLabelSetImage.h>

Inheritance diagram for mitk::MultiLabelSegmentation:
Collaboration diagram for mitk::MultiLabelSegmentation:

Public Types

enum  MergeStyle { MergeStyle::Replace, MergeStyle::Merge }
 
enum  OverwriteStyle { OverwriteStyle::RegardLocks, OverwriteStyle::IgnoreLocks }
 
using GroupIndexType = std::size_t
 
using LabelValueType = mitk::Label::PixelType
 
using ConstLabelVectorType = ConstLabelVector
 
using LabelVectorType = LabelVector
 
using LabelValueVectorType = std::vector< LabelValueType >
 
using GroupImageDimensionVectorType = std::vector< unsigned int >
 
- Public Types inherited from mitk::SlicedData
typedef SlicedData Self
 
typedef BaseData Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef itk::ImageRegion< RegionDimension > RegionType
 
typedef itk::Index< RegionDimension > IndexType
 
typedef IndexType::IndexValueType IndexValueType
 
typedef itk::Offset< RegionDimension > OffsetType
 
typedef OffsetType::OffsetValueType OffsetValueType
 
typedef itk::Size< RegionDimension > SizeType
 
typedef SizeType::SizeValueType SizeValueType
 
- Public Types inherited from mitk::BaseData
typedef BaseData Self
 
typedef itk::DataObject Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
- Public Types inherited from mitk::Identifiable
using UIDType = std::string
 

Public Member Functions

 mitkClassMacro (MultiLabelSegmentation, SlicedData)
 
bool IsSliceSet (int s=0, int t=0, int n=0) const override
 Check whether slice s at time t in channel n is set. More...
 
bool IsVolumeSet (int t=0, int n=0) const override
 Check whether volume at time t in channel n is set. More...
 
bool IsChannelSet (int n=0) const override
 Check whether the channel n is set. More...
 
unsigned int GetDimension () const
 Get dimension of the MultiLabelSegmentation instance. More...
 
const GroupImageDimensionVectorTypeGetDimensions () const
 Returns a vector of that contains the size (in pixel) for all dimensions of the MultiLabelSegmentation instance. It is simelar to mitk::Image::GetDimensions. More...
 
mitk::LabelAddLabel (Label *label, GroupIndexType groupID, bool addAsClone=true, bool correctLabelValue=true)
 Adds a label instance to a group of the multi label image. More...
 
mitk::LabelAddLabelWithContent (Label *label, const Image *labelContent, GroupIndexType groupID, LabelValueType contentLabelValue, bool addAsClone=true, bool correctLabelValue=true)
 Adds a label instance to a group of the multi label image including its pixel content. More...
 
mitk::LabelAddLabel (const std::string &name, const Color &color, GroupIndexType groupID)
 Adds a new label to a group of the image by providing name and color. More...
 
void RenameLabel (LabelValueType labelValue, const std::string &name, const Color &color)
 allows to adapt name and color of a certain label More...
 
void RemoveLabel (LabelValueType labelValue)
 Removes the label with the given value. The label is removed from the labelset and the pixel with the value of the label are set to UNLABELED_VALUE. More...
 
void RemoveLabels (const LabelValueVectorType &vectorOfLabelPixelValues)
 Removes labels from the mitk::MultiLabelSegmentation. The label is removed from the labelset and the pixel with the value of the label are set to UNLABELED_VALUE. If a label value does not exist, it will be ignored. More...
 
void EraseLabel (LabelValueType labelValue)
 Erases the label with the given value from the labelset image. The label itself will not be erased from the respective mitk::LabelSet. In order to remove the label itself use mitk::MultiLabelSegmentation::RemoveLabels() More...
 
void EraseLabels (const LabelValueVectorType &labelValues)
 Erases a list of labels with the given values from the labelset image. More...
 
void MergeLabel (LabelValueType targetLabelValue, LabelValueType sourceLabelValue, OverwriteStyle overwriteStyle=OverwriteStyle::RegardLocks)
 Merges the content of a source label into the target label. More...
 
void MergeLabels (LabelValueType targetLabelValue, const LabelValueVectorType &sourceLabelValues, OverwriteStyle overwriteStyle=OverwriteStyle::RegardLocks)
 Merges the content of a source labels into the target label. More...
 
GroupIndexType AddGroup (ConstLabelVector labels={})
 Adds a new group to the MultiLabelSegmentation. The new group will be set as the active one, if also labels are added. More...
 
GroupIndexType AddGroup (mitk::Image *layerImage, ConstLabelVector labels={})
 Adds a group based on a provided mitk::Image. More...
 
void InsertGroup (GroupIndexType groupID, ConstLabelVector labels={}, std::string name="")
 Inserts a new group to the MultiLabelSegmentation. The new group will be set as the active one, if also labels are added,. More...
 
void InsertGroup (GroupIndexType groupID, mitk::Image *layerImage, ConstLabelVector labels={}, std::string name="")
 Inserts a new group to the MultiLabelSegmentation. The new group will be set as the active one, if also labels are added. More...
 
void RemoveGroup (GroupIndexType group)
 Removes a whole group including all its labels. More...
 
bool ExistLabel (LabelValueType value) const
 Returns true if the value exists in the MultiLabelSegmentation instance. More...
 
bool ExistLabel (LabelValueType value, GroupIndexType groupIndex) const
 Checks if a label belongs in a certain spatial group. More...
 
bool ExistGroup (GroupIndexType index) const
 Returns true if the spatial group exists in the MultiLabelSegmentation instance. More...
 
GroupIndexType GetGroupIndexOfLabel (LabelValueType value) const
 
mitk::Label::ConstPointer GetLabel (LabelValueType value) const
 Returns the mitk::Label with the given value. More...
 
mitk::Label::Pointer GetLabel (LabelValueType value)
 
const ConstLabelVectorType GetLabels () const
 
const LabelVectorType GetLabels ()
 
const LabelValueVectorType GetAllLabelValues () const
 
const LabelVectorType GetLabelsByValue (const LabelValueVectorType &labelValues, bool ignoreMissing=true)
 Returns a vector with pointers to all labels in the MultiLabelSegmentation indicated by the passed label value vector. More...
 
const ConstLabelVectorType GetConstLabelsByValue (const LabelValueVectorType &labelValues, bool ignoreMissing=false) const
 Returns a vector with const pointers to all labels in the MultiLabelSegmentation indicated by the passed label value vector. For details see GetLabelsByValue();. More...
 
const LabelValueVectorType GetLabelValuesByGroup (GroupIndexType index) const
 Returns a vector of all label values located on the specified group. More...
 
const LabelValueVectorType GetLabelValuesByName (GroupIndexType index, const std::string_view name) const
 Returns a vector of all label values located on the specified group having a certain name. More...
 
std::vector< std::string > GetLabelClassNames () const
 
std::vector< std::string > GetLabelClassNamesByGroup (GroupIndexType index) const
 
LabelValueType GetUnusedLabelValue () const
 
virtual bool GetUnlabeledLabelLock () const
 
virtual void SetUnlabeledLabelLock (bool _arg)
 
virtual void UnlabeledLabelLockOn ()
 
virtual void UnlabeledLabelLockOff ()
 
void SetAllLabelsVisible (bool visible)
 
void SetAllLabelsVisibleByGroup (GroupIndexType group, bool visible)
 
void SetAllLabelsVisibleByName (GroupIndexType group, const std::string_view name, bool visible)
 
bool IsLabelLocked (LabelValueType value) const
 
void SetAllLabelsLocked (bool locked)
 
void SetAllLabelsLockedByGroup (GroupIndexType group, bool locked)
 
void SetAllLabelsLockedByName (GroupIndexType group, const std::string_view name, bool locked)
 
void ReplaceGroupLabels (const GroupIndexType groupID, const ConstLabelVectorType &newLabels)
 Replaces the labels of a group with a given vector of labels. More...
 
void ReplaceGroupLabels (const GroupIndexType groupID, const LabelVectorType &newLabels)
 
void ReplaceLabels (const ConstLabelVectorType &labelsUpdates)
 Replaces the labels in the segmentation by their passed counterparts. More...
 
void ReplaceLabels (const LabelVectorType &newLabels)
 
mitk::ImageGetGroupImage (GroupIndexType groupID)
 
const mitk::ImageGetGroupImage (GroupIndexType groupID) const
 
void UpdateGroupImage (GroupIndexType groupID, const mitk::Image *sourceImage, TimeStepType timestep, TimeStepType sourceTimestep=0)
 
void ClearGroupImage (GroupIndexType groupID)
 clears all label pixel content from the indicated group. More...
 
void ClearGroupImage (GroupIndexType groupID, TimeStepType timestep)
 clears all label pixel content from the indicated group. More...
 
void ClearGroupImages ()
 clears all label pixel content of all groups. More...
 
void ClearGroupImages (TimeStepType timestep)
 clears all label pixel content of all groups in one time step. More...
 
const std::string & GetGroupName (GroupIndexType groupID) const
 
void SetGroupName (GroupIndexType groupID, const std::string &name)
 
 itkGetModifiableObjectMacro (LookupTable, mitk::LookupTable)
 
void SetLookupTable (LookupTable *lut)
 
void UpdateLookupTable (LabelValueType pixelValue)
 
void Initialize () override
 
void Initialize (const mitk::Image *templateImage, bool resetLabels=true, bool ensure1stGroup=true)
 Initialize new (or re-initialize) the segmentation based on the properties and geometric information of a passed image. The pixel content will be reseted. More...
 
void Initialize (const mitk::TimeGeometry *geometry, bool resetLabels=true, bool ensure1stGroup=true)
 Initialize new (or re-initialize) the segmentation based on the passed time geometry information. The pixel content will be reseted. More...
 
void InitializeByLabeledImage (const mitk::Image *image)
 Initialize a new mitk::MultiLabelSegmentation by a given image. For all distinct pixel values of the parameter image new labels will be created. If the number of distinct pixel values exceeds mitk::Label::MAX_LABEL_VALUE an exception will be raised. More...
 
itk::ModifiedTimeType GetMTime () const override
 
void UpdateCenterOfMass (LabelValueType pixelValue)
 
More...
 
bool IsEmpty (const Label *label, TimeStepType t=0) const
 Checks if a label is empty at a given time step (does not contain any pixels). More...
 
bool IsEmpty (LabelValueType pixelValue, TimeStepType t=0) const
 
unsigned int GetActiveLayer () const
 Gets the ID of the currently active group. More...
 
void SetActiveLabel (LabelValueType label)
 
LabelGetActiveLabel ()
 
const LabelGetActiveLabel () const
 
unsigned int GetNumberOfLabels (unsigned int group) const
 Get the number of all existing mitk::Labels for a given group. More...
 
unsigned int GetTotalNumberOfLabels () const
 Returns the number of all labels summed up across all layers. More...
 
unsigned int GetNumberOfGroups () const
 
virtual bool IsEmpty () const
 Check whether object contains data (at least at one point in time), e.g., a set of points may be empty. More...
 
- Public Member Functions inherited from mitk::SlicedData
virtual std::vector< std::string > GetClassHierarchy () const override
 
virtual const char * GetClassName () const
 
 itkStaticConstMacro (RegionDimension, unsigned int, 5)
 
void UpdateOutputInformation () override
 
void PrepareForNewData () override
 
void SetRequestedRegionToLargestPossibleRegion () override
 
bool RequestedRegionIsOutsideOfTheBufferedRegion () override
 
bool VerifyRequestedRegion () override
 Verify that the RequestedRegion is within the LargestPossibleRegion. More...
 
void SetRequestedRegion (const itk::DataObject *data) override
 
virtual void SetRequestedRegion (SlicedData::RegionType *region)
 
void SetLargestPossibleRegion (SlicedData::RegionType *region)
 Sets the largest possible region. The largest possible region is the entire region occupied by the data object. Note that the largest possible region should always be bigger then the requested region of a certain operation. More...
 
const RegionTypeGetLargestPossibleRegion () const
 
virtual const RegionTypeGetRequestedRegion () const
 
void CopyInformation (const itk::DataObject *data) override
 
unsigned int GetNumberOfChannels () const
 Get the number of channels. More...
 
SlicedGeometry3DGetSlicedGeometry (unsigned int t=0) const
 Convenience access method for the geometry, which is of type SlicedGeometry3D (or a sub-class of it). More...
 
const SlicedGeometry3DGetUpdatedSlicedGeometry (unsigned int t=0)
 Convenience access method for the geometry, which is of type SlicedGeometry3D (or a sub-class of it). More...
 
void SetGeometry (BaseGeometry *aGeometry3D) override
 Set the BaseGeometry of the data, which will be referenced (not copied!). It has to be a sub-class of SlicedGeometry3D. More...
 
void SetOrigin (const Point3D &origin) override
 Convenience method for setting the origin of the SlicedGeometry3D instances of all time steps. More...
 
virtual void SetSpacing (const ScalarType aSpacing[])
 Convenience method for setting the spacing of the SlicedGeometry3D instances of all time steps. More...
 
virtual void SetSpacing (mitk::Vector3D aSpacing)
 Convenience method for setting the spacing of the SlicedGeometry3D instances of all time steps. More...
 
- Public Member Functions inherited from mitk::BaseData
BaseProperty::ConstPointer GetConstProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const override
 Get property by its key. More...
 
std::vector< std::string > GetPropertyKeys (const std::string &contextName="", bool includeDefaultContext=false) const override
 Query keys of existing properties. More...
 
std::vector< std::string > GetPropertyContextNames () const override
 Query names of existing contexts. More...
 
BasePropertyGetNonConstProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) override
 Get property by its key. More...
 
void SetProperty (const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
 Add new or change existent property. More...
 
void RemoveProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
 Removes a property. If the property does not exist, nothing will be done. More...
 
const mitk::TimeGeometryGetTimeGeometry () const
 Return the TimeGeometry of the data as const pointer. More...
 
mitk::TimeGeometryGetTimeGeometry ()
 Return the TimeGeometry of the data as pointer. More...
 
const mitk::TimeGeometryGetUpdatedTimeGeometry ()
 Return the TimeGeometry of the data. More...
 
virtual void Expand (unsigned int timeSteps)
 Expands the TimeGeometry to a number of TimeSteps. More...
 
const mitk::BaseGeometryGetUpdatedGeometry (int t=0)
 Return the BaseGeometry of the data at time t. More...
 
mitk::BaseGeometryGetGeometry (int t=0) const
 Return the geometry, which is a TimeGeometry, of the data as non-const pointer. More...
 
void UpdateOutputInformation () override
 Update the information for this BaseData (the geometry in particular) so that it can be used as an output of a BaseProcess. More...
 
void CopyInformation (const itk::DataObject *data) override
 Copy information from the specified data set. More...
 
virtual bool IsInitialized () const
 Check whether the data has been initialized, i.e., at least the Geometry and other header data has been set. More...
 
virtual void Clear ()
 Calls ClearData() and InitializeEmpty();. More...
 
virtual bool IsEmptyTimeStep (unsigned int t) const
 Check whether object contains data (at a specified time), e.g., a set of points may be empty. More...
 
virtual bool IsEmpty () const
 Check whether object contains data (at least at one point in time), e.g., a set of points may be empty. More...
 
void ExecuteOperation (Operation *operation) override
 overwrite if the Data can be called by an Interactor (StateMachine). More...
 
virtual void SetTimeGeometry (TimeGeometry *geometry)
 Set the TimeGeometry of the data, which will be referenced (not copied!). More...
 
virtual void SetClonedGeometry (const BaseGeometry *aGeometry3D)
 Set a clone of the provided Geometry as Geometry of the data. Assumes the data object has only 1 time step ( is a 3D object ) and creates a new TimeGeometry. If an TimeGeometry has already been set for the object, it will be replaced after calling this function. More...
 
virtual void SetClonedTimeGeometry (const TimeGeometry *geometry)
 Set a clone of the provided TimeGeometry as TimeGeometry of the data. More...
 
virtual void SetClonedGeometry (const BaseGeometry *aGeometry3D, unsigned int time)
 Set a clone of the provided geometry as BaseGeometry of a given time step. More...
 
mitk::PropertyList::Pointer GetPropertyList () const
 Get the data's property list. More...
 
void SetPropertyList (PropertyList *propertyList)
 Set the data's property list. More...
 
mitk::BaseProperty::Pointer GetProperty (const char *propertyKey) const
 Get the property (instance of BaseProperty) with key propertyKey from the PropertyList, and set it to this, respectively;. More...
 
void SetProperty (const char *propertyKey, BaseProperty *property)
 
itk::SmartPointer< mitk::BaseDataSourceGetSource () const
 Get the process object that generated this data object. More...
 
unsigned int GetTimeSteps () const
 Get the number of time steps from the TimeGeometry As the base data has not a data vector given by itself, the number of time steps is defined over the time sliced geometry. In sub classes, a better implementation could be over the length of the data vector. More...
 
itk::ModifiedTimeType GetMTime () const override
 Get the modified time of the last change of the contents this data object or its geometry. More...
 
void Graft (const DataObject *) override
 
- Public Member Functions inherited from mitk::OperationActor
 itkTypeMacroNoParent (OperationActor) virtual ~OperationActor()
 
- Public Member Functions inherited from mitk::Identifiable
 Identifiable ()
 
 Identifiable (const UIDType &uid)
 
 Identifiable (const Identifiable &)=delete
 
 Identifiable (Identifiable &&) noexcept
 
virtual ~Identifiable ()
 
Identifiableoperator= (const Identifiable &)=delete
 
Identifiableoperator= (Identifiable &&other) noexcept
 
virtual UIDType GetUID () const
 Get unique ID of an object. 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 ()
 

Static Public Member Functions

static Pointer New ()
 
static PixelType GetPixelType ()
 
static LabelValueVectorType ExtractLabelValuesFromLabelVector (const ConstLabelVectorType &labels)
 
static LabelValueVectorType ExtractLabelValuesFromLabelVector (const LabelVectorType &labels)
 
static ConstLabelVectorType ConvertLabelVectorConst (const LabelVectorType &labels)
 
- Static Public Member Functions inherited from mitk::SlicedData
static const char * GetStaticNameOfClass ()
 
- Static Public Member Functions inherited from mitk::BaseData
static const char * GetStaticNameOfClass ()
 

Public Attributes

Message AfterChangeLayerEvent
 AfterchangeLayerEvent (e.g. used for GUI integration) As soon as active labelset was changed, the signal emits. Emitted by SetActiveLabel();. More...
 

Static Public Attributes

const static LabelValueType UNLABELED_VALUE
 

Protected Member Functions

 mitkCloneMacro (Self)
 
 MultiLabelSegmentation ()
 
 MultiLabelSegmentation (const MultiLabelSegmentation &other)
 
 ~MultiLabelSegmentation () override
 
void OnLabelModified (const Object *sender, const itk::EventObject &)
 
void AddLabelToMap (LabelValueType labelValue, Label *label, GroupIndexType groupID)
 
void RemoveLabelFromMap (LabelValueType labelValue)
 
void RegisterLabel (Label *label)
 
void ReleaseLabel (Label *label)
 
void ApplyToLabels (const LabelValueVectorType &values, std::function< void(Label *)> &&lambda)
 
void VisitLabels (const LabelValueVectorType &values, std::function< void(const Label *)> &&lambda) const
 
template<typename ImageType >
void CalculateCenterOfMassProcessing (ImageType *input, LabelValueType index)
 
template<typename ImageType >
void EraseLabelProcessing (ImageType *input, LabelValueType index)
 
template<typename MultiLabelSegmentationType , typename ImageType >
void InitializeByLabeledImageProcessing (MultiLabelSegmentationType *input, const ImageType *other)
 
LabelValueVectorType GetUsedLabelValues () const
 
- Protected Member Functions inherited from mitk::SlicedData
 SlicedData ()
 
 SlicedData (const SlicedData &other)
 
 ~SlicedData () override
 
- Protected Member Functions inherited from mitk::BaseData
 BaseData ()
 
 BaseData (const BaseData &other)
 
 ~BaseData () override
 
virtual void InitializeTimeGeometry (unsigned int timeSteps=1)
 Initialize the TimeGeometry for a number of time steps. The TimeGeometry is initialized empty and evenly timed. In many cases it will be necessary to overwrite this in sub-classes. More...
 
virtual void ClearData ()
 reset to non-initialized state, release memory More...
 
virtual void InitializeEmpty ()
 Pure virtual; Must be used in subclasses to get a data object to a valid state. Should at least create one empty object and call Superclass::InitializeTimeGeometry() to ensure an existing valid geometry. More...
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
- Protected Member Functions inherited from mitk::Identifiable
virtual void SetUID (const UIDType &uid)
 

Protected Attributes

LabelValueType m_ActiveLabelValue
 
- Protected Attributes inherited from mitk::SlicedData
RegionType m_LargestPossibleRegion
 
RegionType m_RequestedRegion
 
bool m_RequestedRegionInitialized
 
RegionType m_BufferedRegion
 
bool m_UseLargestPossibleRegion
 
- Protected Attributes inherited from mitk::BaseData
bool m_LastRequestedRegionWasOutsideOfTheBufferedRegion
 
unsigned int m_SourceOutputIndexDuplicate
 
bool m_Initialized
 

Detailed Description

MultiLabelSegmentation class for handling labels and layers in a segmentation session.

Events that are potentially send by the class in regard to groups or labels:

  • LabelAddedEvent is emitted whenever a new label has been added.
  • LabelModifiedEvent is emitted whenever a label has been modified.
  • LabelRemovedEvent is emitted whenever a label has been removed.
  • LabelsChangedEvent is emitted when labels are changed (added, removed, modified). In difference to the other label events LabelsChanged is send only one time after the modification of the MultiLableImage instance is finished. So e.g. even if 4 labels are changed by a merge operation, this event will only be sent once (compared to LabelRemoved or LabelModified).
  • GroupAddedEvent is emitted whenever a new group has been added.
  • GroupModifiedEvent is emitted whenever a group has been modified.
  • GroupRemovedEvent is emitted whenever a label has been removed.

Definition at line 43 of file mitkLabelSetImage.h.

Member Typedef Documentation

◆ ConstLabelVectorType

◆ GroupImageDimensionVectorType

Definition at line 99 of file mitkLabelSetImage.h.

◆ GroupIndexType

Definition at line 56 of file mitkLabelSetImage.h.

◆ LabelValueType

◆ LabelValueVectorType

◆ LabelVectorType

Member Enumeration Documentation

◆ MergeStyle

Enumerator
Replace 
Merge 

Definition at line 66 of file mitkLabelSetImage.h.

◆ OverwriteStyle

Enumerator
RegardLocks 
IgnoreLocks 

Definition at line 74 of file mitkLabelSetImage.h.

Constructor & Destructor Documentation

◆ MultiLabelSegmentation() [1/2]

mitk::MultiLabelSegmentation::MultiLabelSegmentation ( )
protected

◆ MultiLabelSegmentation() [2/2]

mitk::MultiLabelSegmentation::MultiLabelSegmentation ( const MultiLabelSegmentation other)
protected

◆ ~MultiLabelSegmentation()

mitk::MultiLabelSegmentation::~MultiLabelSegmentation ( )
overrideprotected

Member Function Documentation

◆ AddGroup() [1/2]

GroupIndexType mitk::MultiLabelSegmentation::AddGroup ( ConstLabelVector  labels = {})

Adds a new group to the MultiLabelSegmentation. The new group will be set as the active one, if also labels are added.

Parameters
labelsLabels that will be added to the new group if provided
Returns
the group ID of the new group

◆ AddGroup() [2/2]

GroupIndexType mitk::MultiLabelSegmentation::AddGroup ( mitk::Image layerImage,
ConstLabelVector  labels = {} 
)

Adds a group based on a provided mitk::Image.

Parameters
layerImageis added to the vector of label images
labelslabels that will be cloned and added to the new group if provided
Returns
the group ID of the new group
Precondition
layerImage must be valid instance
layerImage needs to have the same geometry then the segmentation
layerImage must have the pixel value equal to LabelValueType.

◆ AddLabel() [1/2]

mitk::Label* mitk::MultiLabelSegmentation::AddLabel ( const std::string &  name,
const Color color,
GroupIndexType  groupID 
)

Adds a new label to a group of the image by providing name and color.

Parameters
name(Class) name of the label instance that should be added.
colorColor of the new label instance.
groupIDThe id of the group the label should be added to.
Returns
Instance of the label as it was added to the label set.
Precondition
groupID must indicate an existing group.

◆ AddLabel() [2/2]

mitk::Label* mitk::MultiLabelSegmentation::AddLabel ( Label label,
GroupIndexType  groupID,
bool  addAsClone = true,
bool  correctLabelValue = true 
)

Adds a label instance to a group of the multi label image.

Remarks
By default, if the pixel value of the label is already used in the image, the label will get a new none conflicting value assigned. This can be controlled by correctLabelValue.
Parameters
labelInstance of an label that should be added or used as template
groupIDThe id of the group the label should be added to.
addAsCloneFlag that controls, if the passed instance should be added (false; the image will then take ownership, be aware that e.g. event observers will be added) a clone of the instance (true).
correctLabelValueFlag that controls, if the value of the passed label should be correct, if this value is already used in the multi label image. True: Conflicting values will be corrected, be assigning a none conflicting value. False: If the value is conflicting an exception will be thrown.
Returns
Instance of the label as it was added to the label set.
Precondition
label must point to a valid instance.
If correctLabelValue==false, label value must be non conflicting.
groupID must indicate an existing group.

◆ AddLabelToMap()

void mitk::MultiLabelSegmentation::AddLabelToMap ( LabelValueType  labelValue,
Label label,
GroupIndexType  groupID 
)
protected

Helper to ensure that the maps are correctly populated for a new label instance.

◆ AddLabelWithContent()

mitk::Label* mitk::MultiLabelSegmentation::AddLabelWithContent ( Label label,
const Image labelContent,
GroupIndexType  groupID,
LabelValueType  contentLabelValue,
bool  addAsClone = true,
bool  correctLabelValue = true 
)

Adds a label instance to a group of the multi label image including its pixel content.

Remarks
By default, if the pixel value of the label is already used in the image, the label will get a new none conflicting value assigned. This can be controlled by correctLabelValue.
Parameters
labelInstance of a label that should be added or used as template
groupIDThe id of the group the label should be added to.
labelContentPointer to an image that contains the pixel content of the label that should be added.
contentLabelValuePixel value in the content image that indicates the label (may not be the same like the label value used in the segmentation after addition).
addAsCloneFlag that controls, if the passed instance should be added (false; the image will then take ownership, be aware that e.g. event observers will be added) a clone of the instance (true).
correctLabelValueFlag that controls, if the value of the passed label should be corrected, if this value is already used in the multi label image. True: Conflicting values will be corrected, by assigning a none conflicting value. False: If the value is conflicting an exception will be thrown.
Returns
Instance of the label as it was added to the label set.
Precondition
label must point to a valid instance.
If correctLabelValue==false, label value must be non conflicting.
groupID must indicate an existing group.
labelContent must point to a valid image that has the same geometry like the segmentation.

◆ ApplyToLabels()

void mitk::MultiLabelSegmentation::ApplyToLabels ( const LabelValueVectorType values,
std::function< void(Label *)> &&  lambda 
)
protected

Helper class used internally to apply lambda functions to the labels specified by the passed label value vector.

◆ CalculateCenterOfMassProcessing()

template<typename ImageType >
void mitk::MultiLabelSegmentation::CalculateCenterOfMassProcessing ( ImageType *  input,
LabelValueType  index 
)
protected

◆ ClearGroupImage() [1/2]

void mitk::MultiLabelSegmentation::ClearGroupImage ( GroupIndexType  groupID)

clears all label pixel content from the indicated group.

Precondition
groupID must point to a valid group.

◆ ClearGroupImage() [2/2]

void mitk::MultiLabelSegmentation::ClearGroupImage ( GroupIndexType  groupID,
TimeStepType  timestep 
)

clears all label pixel content from the indicated group.

Precondition
groupID must point to a valid group.
timestep must be a valid.

◆ ClearGroupImages() [1/2]

void mitk::MultiLabelSegmentation::ClearGroupImages ( )

clears all label pixel content of all groups.

Precondition
groupID must point to a valid group.

◆ ClearGroupImages() [2/2]

void mitk::MultiLabelSegmentation::ClearGroupImages ( TimeStepType  timestep)

clears all label pixel content of all groups in one time step.

Precondition
timestep must be a valid.

◆ ConvertLabelVectorConst()

static ConstLabelVectorType mitk::MultiLabelSegmentation::ConvertLabelVectorConst ( const LabelVectorType labels)
static

Helper function that converts a given vector of label instance pointers into a vector of const pointers.

◆ EraseLabel()

void mitk::MultiLabelSegmentation::EraseLabel ( LabelValueType  labelValue)

Erases the label with the given value from the labelset image. The label itself will not be erased from the respective mitk::LabelSet. In order to remove the label itself use mitk::MultiLabelSegmentation::RemoveLabels()

Parameters
labelValuethe pixel value of the label that will be erased from the labelset image
Precondition
labelValue must exist.

◆ EraseLabelProcessing()

template<typename ImageType >
void mitk::MultiLabelSegmentation::EraseLabelProcessing ( ImageType *  input,
LabelValueType  index 
)
protected

◆ EraseLabels()

void mitk::MultiLabelSegmentation::EraseLabels ( const LabelValueVectorType labelValues)

Erases a list of labels with the given values from the labelset image.

Parameters
labelValuesthe list of pixel values of the labels that will be erased from the labelset image
Precondition
label values must exist

◆ ExistGroup()

bool mitk::MultiLabelSegmentation::ExistGroup ( GroupIndexType  index) const

Returns true if the spatial group exists in the MultiLabelSegmentation instance.

Parameters
indexGroup index of the group that should be checked for existence.

◆ ExistLabel() [1/2]

bool mitk::MultiLabelSegmentation::ExistLabel ( LabelValueType  value) const

Returns true if the value exists in the MultiLabelSegmentation instance.

◆ ExistLabel() [2/2]

bool mitk::MultiLabelSegmentation::ExistLabel ( LabelValueType  value,
GroupIndexType  groupIndex 
) const

Checks if a label belongs in a certain spatial group.

Parameters
valuethe label value
groupIndexIndex of the spatial group which should be checked for the label
Returns
true if the label exists otherwise false

◆ ExtractLabelValuesFromLabelVector() [1/2]

static LabelValueVectorType mitk::MultiLabelSegmentation::ExtractLabelValuesFromLabelVector ( const ConstLabelVectorType labels)
static

Helper function that can be used to extract a vector of label values of a vector of label instance pointers.

◆ ExtractLabelValuesFromLabelVector() [2/2]

static LabelValueVectorType mitk::MultiLabelSegmentation::ExtractLabelValuesFromLabelVector ( const LabelVectorType labels)
static

Helper function that can be used to extract a vector of label values are vector of label instances.

◆ GetActiveLabel() [1/2]

Label* mitk::MultiLabelSegmentation::GetActiveLabel ( )

◆ GetActiveLabel() [2/2]

const Label* mitk::MultiLabelSegmentation::GetActiveLabel ( ) const

◆ GetActiveLayer()

unsigned int mitk::MultiLabelSegmentation::GetActiveLayer ( ) const

Gets the ID of the currently active group.

Returns
the ID of the active group
Precondition
at least on group must exist.

◆ GetAllLabelValues()

const LabelValueVectorType mitk::MultiLabelSegmentation::GetAllLabelValues ( ) const

Returns a vector of all label values currently defined in the MultiLabelSegmentation instance.

◆ GetConstLabelsByValue()

const ConstLabelVectorType mitk::MultiLabelSegmentation::GetConstLabelsByValue ( const LabelValueVectorType labelValues,
bool  ignoreMissing = false 
) const

Returns a vector with const pointers to all labels in the MultiLabelSegmentation indicated by the passed label value vector. For details see GetLabelsByValue();.

◆ GetDimension()

unsigned int mitk::MultiLabelSegmentation::GetDimension ( ) const

Get dimension of the MultiLabelSegmentation instance.

◆ GetDimensions()

const GroupImageDimensionVectorType& mitk::MultiLabelSegmentation::GetDimensions ( ) const

Returns a vector of that contains the size (in pixel) for all dimensions of the MultiLabelSegmentation instance. It is simelar to mitk::Image::GetDimensions.

◆ GetGroupImage() [1/2]

mitk::Image* mitk::MultiLabelSegmentation::GetGroupImage ( GroupIndexType  groupID)

Returns the pointer to the image that contains the labeling of the indicate group.

Precondition
groupID must reference an existing group.

◆ GetGroupImage() [2/2]

const mitk::Image* mitk::MultiLabelSegmentation::GetGroupImage ( GroupIndexType  groupID) const

Returns the pointer to the image that contains the labeling of the indicate group.

Precondition
groupID must reference an existing group.

◆ GetGroupIndexOfLabel()

GroupIndexType mitk::MultiLabelSegmentation::GetGroupIndexOfLabel ( LabelValueType  value) const

Returns the group id of the based label value.

Precondition
label value must exists.

◆ GetGroupName()

const std::string& mitk::MultiLabelSegmentation::GetGroupName ( GroupIndexType  groupID) const

Returns the name of the indicated group. String may be empty if no name was defined. Remark: The name neither is guaranteed to be defined nor that it is unique. Use the index to uniquely refer to a group.

Precondition
groupID must reference an existing group.

◆ GetLabel() [1/2]

mitk::Label::Pointer mitk::MultiLabelSegmentation::GetLabel ( LabelValueType  value)

◆ GetLabel() [2/2]

mitk::Label::ConstPointer mitk::MultiLabelSegmentation::GetLabel ( LabelValueType  value) const

Returns the mitk::Label with the given value.

Parameters
valuethe pixel value of the label
Returns
smart pointer to the label instance if defined in the segmentation, otherwise nullptr.
Remarks
The label is returned as smart pointer, because the MultiLabelSegmentation instance gives no guarantee how long the label instance will be a valid label of the segmentation. If you hold the label instance for a longer time, you must expect that it is not valid anymore (Either because the label id was removed or the label instance was replaced). It is valid as long it points to the same label instance like a recent GetLabel() call.

◆ GetLabelClassNames()

std::vector<std::string> mitk::MultiLabelSegmentation::GetLabelClassNames ( ) const

Returns a vector with (class) names of all label instances used in the segmentation (over all groups)

◆ GetLabelClassNamesByGroup()

std::vector<std::string> mitk::MultiLabelSegmentation::GetLabelClassNamesByGroup ( GroupIndexType  index) const

Returns a vector with (class) names of all label instances present in a certain group.

Parameters
indexID of the group, for which the label class names should be returned
Precondition
Indicated group must exist.

◆ GetLabels() [1/2]

const LabelVectorType mitk::MultiLabelSegmentation::GetLabels ( )

◆ GetLabels() [2/2]

const ConstLabelVectorType mitk::MultiLabelSegmentation::GetLabels ( ) const

Returns a vector with pointers to all labels currently defined in the MultiLabelSegmentation instance.

◆ GetLabelsByValue()

const LabelVectorType mitk::MultiLabelSegmentation::GetLabelsByValue ( const LabelValueVectorType labelValues,
bool  ignoreMissing = true 
)

Returns a vector with pointers to all labels in the MultiLabelSegmentation indicated by the passed label value vector.

Parameters
labelValuesVector of values of labels that should be returned.
ignoreMissingIf true (default), unknown labels Will be skipped in the result. If false, an exception will be raised, if a label is requested.

◆ GetLabelValuesByGroup()

const LabelValueVectorType mitk::MultiLabelSegmentation::GetLabelValuesByGroup ( GroupIndexType  index) const

Returns a vector of all label values located on the specified group.

Parameters
indexthe index of the group for which the vector of labels should be retrieved. If an invalid index is passed an exception will be raised.
Returns
the respective vector of label values.
Precondition
group index must exist.

◆ GetLabelValuesByName()

const LabelValueVectorType mitk::MultiLabelSegmentation::GetLabelValuesByName ( GroupIndexType  index,
const std::string_view  name 
) const

Returns a vector of all label values located on the specified group having a certain name.

Parameters
indexthe index of the group for which the vector of labels should be retrieved. If an invalid index is passed an exception will be raised.
nameName of the label instances one is looking for.
Returns
the respective vector of label values.
Precondition
group index must exist.

◆ GetMTime()

itk::ModifiedTimeType mitk::MultiLabelSegmentation::GetMTime ( ) const
override

Override default version. It will return the highest MTime of all group images and self.

◆ GetNumberOfGroups()

unsigned int mitk::MultiLabelSegmentation::GetNumberOfGroups ( ) const

◆ GetNumberOfLabels()

unsigned int mitk::MultiLabelSegmentation::GetNumberOfLabels ( unsigned int  group) const

Get the number of all existing mitk::Labels for a given group.

Parameters
groupthe group ID for which the active mitk::Labels should be retrieved
Returns
the number of all existing mitk::Labels for the given group

◆ GetPixelType()

static PixelType mitk::MultiLabelSegmentation::GetPixelType ( )
static

◆ GetTotalNumberOfLabels()

unsigned int mitk::MultiLabelSegmentation::GetTotalNumberOfLabels ( ) const

Returns the number of all labels summed up across all layers.

Returns
the overall number of labels across all layers

◆ GetUnlabeledLabelLock()

virtual bool mitk::MultiLabelSegmentation::GetUnlabeledLabelLock ( ) const
virtual

◆ GetUnusedLabelValue()

LabelValueType mitk::MultiLabelSegmentation::GetUnusedLabelValue ( ) const

Helper that returns an unused label value, that could be used e.g. if one wants to define a label externally before adding it.

Returns
A label value currently not in use.
Remarks
is no unused label value can be provided an exception will be thrown.

◆ GetUsedLabelValues()

LabelValueVectorType mitk::MultiLabelSegmentation::GetUsedLabelValues ( ) const
protected

helper needed for ensuring unique values. returns a sorted list of all labels (including the value for Unlabeled pixels..

◆ Initialize() [1/3]

void mitk::MultiLabelSegmentation::Initialize ( )
override

Initializes the instance by completely resetting it and releasing all group images. The geometric information is kept.

◆ Initialize() [2/3]

void mitk::MultiLabelSegmentation::Initialize ( const mitk::Image templateImage,
bool  resetLabels = true,
bool  ensure1stGroup = true 
)

Initialize new (or re-initialize) the segmentation based on the properties and geometric information of a passed image. The pixel content will be reseted.

Parameters
templateImageTemplate for the initialization
resetLabelsIndicate if the labels should be reseted on initialization. True (default): all label and group informations will be removed. False: label information and groups are kept, but all pixel information will be erased (cf EraseLabel(...)).
ensure1stGroupIndicates if the initialization guarantees that the first group always exists afterwards (true) or if after initialization no group will be added even if no group is defined (false; e.g if labels are reseted or instance has no groups so far)

◆ Initialize() [3/3]

void mitk::MultiLabelSegmentation::Initialize ( const mitk::TimeGeometry geometry,
bool  resetLabels = true,
bool  ensure1stGroup = true 
)

Initialize new (or re-initialize) the segmentation based on the passed time geometry information. The pixel content will be reseted.

Parameters
geometryTime geometry that should be used.
resetLabelsIndicate if the labels should be reseted on initialization. True (default): all label and group informations will be removed. False: label information and groups are kept, but all pixel information will be erased (cf EraseLabel(...)).
ensure1stGroupIndicates if the initialization guarantees that the first group always exists afterwards (true) or if after initialization no group will be added even if no group is defined (false; e.g if labels are reseted or instance has no groups so far)

◆ InitializeByLabeledImage()

void mitk::MultiLabelSegmentation::InitializeByLabeledImage ( const mitk::Image image)

Initialize a new mitk::MultiLabelSegmentation by a given image. For all distinct pixel values of the parameter image new labels will be created. If the number of distinct pixel values exceeds mitk::Label::MAX_LABEL_VALUE an exception will be raised.

Parameters
imagethe image which is used for initialization

◆ InitializeByLabeledImageProcessing()

template<typename MultiLabelSegmentationType , typename ImageType >
void mitk::MultiLabelSegmentation::InitializeByLabeledImageProcessing ( MultiLabelSegmentationType *  input,
const ImageType *  other 
)
protected

◆ InsertGroup() [1/2]

void mitk::MultiLabelSegmentation::InsertGroup ( GroupIndexType  groupID,
ConstLabelVector  labels = {},
std::string  name = "" 
)

Inserts a new group to the MultiLabelSegmentation. The new group will be set as the active one, if also labels are added,.

Parameters
groupIDID/position of the group where it should be inserted. If the group should be inserted at the end groupID has to be the current number of groups.
labelsLabels that will be added to the new group if provided
nameDisplay name of the inserted group

◆ InsertGroup() [2/2]

void mitk::MultiLabelSegmentation::InsertGroup ( GroupIndexType  groupID,
mitk::Image layerImage,
ConstLabelVector  labels = {},
std::string  name = "" 
)

Inserts a new group to the MultiLabelSegmentation. The new group will be set as the active one, if also labels are added.

Parameters
groupIDID/position of the group where it should be inserted. If the group should be inserted at the end groupID has to be the current number of groups.
layerImagecontains the label pixel information that should be directly added for the new inserted group.
labelsLabels that will be added to the new group if provided
nameDisplay name of the inserted group
Precondition
layerImage must be valid instance
layerImage needs to have the same geometry then the segmentation
layerImage must have the pixel value equal to LabelValueType.

◆ IsChannelSet()

bool mitk::MultiLabelSegmentation::IsChannelSet ( int  n = 0) const
overridevirtual

Check whether the channel n is set.

Implements mitk::SlicedData.

◆ IsEmpty() [1/3]

virtual bool mitk::BaseData::IsEmpty

Check whether object contains data (at least at one point in time), e.g., a set of points may be empty.

Warning
Returns IsInitialized()==false by default for compatibility reasons. Override in sub-classes that support distinction between empty/non-empty state.

◆ IsEmpty() [2/3]

bool mitk::MultiLabelSegmentation::IsEmpty ( const Label label,
TimeStepType  t = 0 
) const

Checks if a label is empty at a given time step (does not contain any pixels).

◆ IsEmpty() [3/3]

bool mitk::MultiLabelSegmentation::IsEmpty ( LabelValueType  pixelValue,
TimeStepType  t = 0 
) const

◆ IsLabelLocked()

bool mitk::MultiLabelSegmentation::IsLabelLocked ( LabelValueType  value) const

Returns the lock state of the label (including UnlabeledLabel value).

Precondition
Requested label does exist.

◆ IsSliceSet()

bool mitk::MultiLabelSegmentation::IsSliceSet ( int  s = 0,
int  t = 0,
int  n = 0 
) const
overridevirtual

Check whether slice s at time t in channel n is set.

Implements mitk::SlicedData.

◆ IsVolumeSet()

bool mitk::MultiLabelSegmentation::IsVolumeSet ( int  t = 0,
int  n = 0 
) const
overridevirtual

Check whether volume at time t in channel n is set.

Implements mitk::SlicedData.

◆ itkGetModifiableObjectMacro()

mitk::MultiLabelSegmentation::itkGetModifiableObjectMacro ( LookupTable  ,
mitk::LookupTable   
)

◆ MergeLabel()

void mitk::MultiLabelSegmentation::MergeLabel ( LabelValueType  targetLabelValue,
LabelValueType  sourceLabelValue,
OverwriteStyle  overwriteStyle = OverwriteStyle::RegardLocks 
)

Merges the content of a source label into the target label.

Parameters
targetLabelValueThe value of the label that should be the merged label.
sourceLabelValueThe value of the label that should be merged into the specified one
overwriteStyleControls if the merge operation should regard the label locks in the group of the target label.
Precondition
targetLabelValue must exist.
sourceLabelValue must exist.
Remarks
the group that is modified by the operation is defined by the targetLabelValue. So you can do mergings across groups. This will result in copying the source contents. If you want to remove the content of the source labels that must be done explicitly by calling EraseLabel(s) (if you just want to remove the pixel content) or RemoveLabel(s) (if you want remove the label completely)

◆ MergeLabels()

void mitk::MultiLabelSegmentation::MergeLabels ( LabelValueType  targetLabelValue,
const LabelValueVectorType sourceLabelValues,
OverwriteStyle  overwriteStyle = OverwriteStyle::RegardLocks 
)

Merges the content of a source labels into the target label.

Parameters
targetLabelValueThe value of the label that should be the merged label.
sourceLabelValuesThe values of the labels that should be merged into the target label with merge style "Merge".
overwriteStyleControls if/how the merge operation should regard the label locks in the group of the target label.
Precondition
targetLabelValue must exist.
sourceLabelValues must exist.
Remarks
If a spatial group is empty after the operation, it might be removed. The removal of an spatial group might invalidate any other spatial group index (due to new sorting/ordering).

◆ mitkClassMacro()

mitk::MultiLabelSegmentation::mitkClassMacro ( MultiLabelSegmentation  ,
SlicedData   
)

◆ mitkCloneMacro()

mitk::MultiLabelSegmentation::mitkCloneMacro ( Self  )
protected

◆ New()

static Pointer mitk::MultiLabelSegmentation::New ( )
static

◆ OnLabelModified()

void mitk::MultiLabelSegmentation::OnLabelModified ( const Object *  sender,
const itk::EventObject &   
)
protected

◆ RegisterLabel()

void mitk::MultiLabelSegmentation::RegisterLabel ( Label label)
protected

Helper to ensure label events are correctly connected and lookup table is updated for a new label instance.

◆ ReleaseLabel()

void mitk::MultiLabelSegmentation::ReleaseLabel ( Label label)
protected

Helper to ensure label events are unregistered.

◆ RemoveGroup()

void mitk::MultiLabelSegmentation::RemoveGroup ( GroupIndexType  group)

Removes a whole group including all its labels.

Remarks
with removing a group all groups with greater index will be re-indexed to close the gap. Hence externally stored spatial group indices may become invalid.
Parameters
groupGroup index of the spatial group that should be removed. If the spatial group does not exist, an exception will be raised.
Precondition
group index must be valid.

◆ RemoveLabel()

void mitk::MultiLabelSegmentation::RemoveLabel ( LabelValueType  labelValue)

Removes the label with the given value. The label is removed from the labelset and the pixel with the value of the label are set to UNLABELED_VALUE.

Parameters
labelValuethe pixel value of the label to be removed. If the label is unknown, the method will return without doing anything.

◆ RemoveLabelFromMap()

void mitk::MultiLabelSegmentation::RemoveLabelFromMap ( LabelValueType  labelValue)
protected

◆ RemoveLabels()

void mitk::MultiLabelSegmentation::RemoveLabels ( const LabelValueVectorType vectorOfLabelPixelValues)

Removes labels from the mitk::MultiLabelSegmentation. The label is removed from the labelset and the pixel with the value of the label are set to UNLABELED_VALUE. If a label value does not exist, it will be ignored.

Parameters
vectorOfLabelPixelValuesa list of labels to be removed

◆ RenameLabel()

void mitk::MultiLabelSegmentation::RenameLabel ( LabelValueType  labelValue,
const std::string &  name,
const Color color 
)

allows to adapt name and color of a certain label

Parameters
labelValueValue of the label that should be changed
nameNew name for the label
colorNew color for the label
Precondition
Indicated label value must exist.

◆ ReplaceGroupLabels() [1/2]

void mitk::MultiLabelSegmentation::ReplaceGroupLabels ( const GroupIndexType  groupID,
const ConstLabelVectorType newLabels 
)

Replaces the labels of a group with a given vector of labels.

Remarks
The passed label instances will be cloned before added to ensure clear ownership of the new labels.
The pixel content of the old labels will not be removed.
Parameters
groupIDThe index of the group that should have its labels replaced
newLabelsThe vector of new labels
Precondition
Group that should be replaced must exist.
new label values must not be used in other groups.

◆ ReplaceGroupLabels() [2/2]

void mitk::MultiLabelSegmentation::ReplaceGroupLabels ( const GroupIndexType  groupID,
const LabelVectorType newLabels 
)

◆ ReplaceLabels() [1/2]

void mitk::MultiLabelSegmentation::ReplaceLabels ( const ConstLabelVectorType labelsUpdates)

Replaces the labels in the segmentation by their passed counterparts.

Remarks
The passed label instances will be cloned before added to ensure clear ownership of the new labels.
The pixel content of the old labels will not be removed.
In difference to ReplaceGroupLabels only existing labels will be "update" (no matter the group) no labels will be removed or added.
Parameters
labelsUpdatesThe vector of label replacements
Precondition
all label values of labelsUpdates must exist in the segmentation.
new label values must not be used in other groups.

◆ ReplaceLabels() [2/2]

void mitk::MultiLabelSegmentation::ReplaceLabels ( const LabelVectorType newLabels)

◆ SetActiveLabel()

void mitk::MultiLabelSegmentation::SetActiveLabel ( LabelValueType  label)

◆ SetAllLabelsLocked()

void mitk::MultiLabelSegmentation::SetAllLabelsLocked ( bool  locked)

Set the lock state of all label instances accordingly to the passed state.

◆ SetAllLabelsLockedByGroup()

void mitk::MultiLabelSegmentation::SetAllLabelsLockedByGroup ( GroupIndexType  group,
bool  locked 
)

Set the lock state of all label instances in a group accordingly to the passed state.

Precondition
The specified group must exist.

◆ SetAllLabelsLockedByName()

void mitk::MultiLabelSegmentation::SetAllLabelsLockedByName ( GroupIndexType  group,
const std::string_view  name,
bool  locked 
)

Set the lock state of all label instances In a group with a given class name accordingly to the passed state.

Precondition
The specified group must exist.

◆ SetAllLabelsVisible()

void mitk::MultiLabelSegmentation::SetAllLabelsVisible ( bool  visible)

Set the visibility of all label instances accordingly to the passed state.

◆ SetAllLabelsVisibleByGroup()

void mitk::MultiLabelSegmentation::SetAllLabelsVisibleByGroup ( GroupIndexType  group,
bool  visible 
)

Set the visibility of all label instances in a group accordingly to the passed state.

Precondition
The specified group must exist.

◆ SetAllLabelsVisibleByName()

void mitk::MultiLabelSegmentation::SetAllLabelsVisibleByName ( GroupIndexType  group,
const std::string_view  name,
bool  visible 
)

Set the visibility of all label instances In a group with a given class name accordingly to the passed state.

Precondition
The specified group must exist.

◆ SetGroupName()

void mitk::MultiLabelSegmentation::SetGroupName ( GroupIndexType  groupID,
const std::string &  name 
)

Set the name of a group.

Precondition
groupID must reference an existing group.

◆ SetLookupTable()

void mitk::MultiLabelSegmentation::SetLookupTable ( LookupTable lut)

◆ SetUnlabeledLabelLock()

virtual void mitk::MultiLabelSegmentation::SetUnlabeledLabelLock ( bool  _arg)
virtual

◆ UnlabeledLabelLockOff()

virtual void mitk::MultiLabelSegmentation::UnlabeledLabelLockOff ( )
virtual

◆ UnlabeledLabelLockOn()

virtual void mitk::MultiLabelSegmentation::UnlabeledLabelLockOn ( )
virtual

◆ UpdateCenterOfMass()

void mitk::MultiLabelSegmentation::UpdateCenterOfMass ( LabelValueType  pixelValue)


◆ UpdateGroupImage()

void mitk::MultiLabelSegmentation::UpdateGroupImage ( GroupIndexType  groupID,
const mitk::Image sourceImage,
TimeStepType  timestep,
TimeStepType  sourceTimestep = 0 
)

Updates a group image by copying a given source image content.

Remarks
the pixel content of the sourceImage will be simply copied. It won't be checked if the source only contains valid label values for the group. This must be ensured by the callee of the function. If only some labels should be transfered/updated, TransferLabelContent(...) is a better option.
Precondition
sourceImage must point to a valid image
groupID must indicate an existing group
sourceImage and this instance must have the same time geometry.

◆ UpdateLookupTable()

void mitk::MultiLabelSegmentation::UpdateLookupTable ( LabelValueType  pixelValue)

Updates the lookup table for a label indicated by the passed label value using the color of the label.

Precondition
labelValue must exist.

◆ VisitLabels()

void mitk::MultiLabelSegmentation::VisitLabels ( const LabelValueVectorType values,
std::function< void(const Label *)> &&  lambda 
) const
protected

Helper class used internally to for visiting the labels specified by the passed label value vector with the lambda function.

Member Data Documentation

◆ AfterChangeLayerEvent

Message mitk::MultiLabelSegmentation::AfterChangeLayerEvent

AfterchangeLayerEvent (e.g. used for GUI integration) As soon as active labelset was changed, the signal emits. Emitted by SetActiveLabel();.

Definition at line 51 of file mitkLabelSetImage.h.

◆ m_ActiveLabelValue

LabelValueType mitk::MultiLabelSegmentation::m_ActiveLabelValue
protected

Definition at line 627 of file mitkLabelSetImage.h.

◆ UNLABELED_VALUE

const static LabelValueType mitk::MultiLabelSegmentation::UNLABELED_VALUE
static

Definition at line 62 of file mitkLabelSetImage.h.


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