Medical Imaging Interaction Toolkit  2022.10.99-fe4dd45b
Medical Imaging Interaction Toolkit
mitkLabelSet.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef __mitkLabelSet_H_
14 #define __mitkLabelSet_H_
15 
16 #include "MitkMultilabelExports.h"
17 #include <mitkLookupTable.h>
18 #include <mitkMessage.h>
19 
20 #include <itkObject.h>
21 #include <itkObjectFactory.h>
22 
23 #include <mitkLabel.h>
24 
25 namespace mitk
26 {
27  //
28  // Documentation
29  // @brief LabelSet containing the labels corresponding to a segmentation session.
30  // @ingroup Data
31  //
32 
33  class MITKMULTILABEL_EXPORT LabelSet : public itk::Object
34  {
35  public:
36  mitkClassMacroItkParent(LabelSet, itk::Object);
37  itkNewMacro(Self);
38 
40 
41  typedef std::map<PixelType, Label::Pointer> LabelContainerType;
42  typedef LabelContainerType::const_iterator LabelContainerConstIteratorType;
43  typedef LabelContainerType::iterator LabelContainerIteratorType;
44 
57 
70 
83 
88 
102 
105  LabelContainerConstIteratorType IteratorConstBegin() const;
106 
109  LabelContainerConstIteratorType IteratorConstEnd() const;
110 
113  LabelContainerIteratorType IteratorBegin();
114 
117  LabelContainerIteratorType IteratorEnd();
118 
122  void OnLabelModified();
123 
126  void SetLayer(unsigned int);
127 
130  void SetActiveLabel(PixelType);
131 
134  void RemoveLabel(PixelType);
135 
138  bool ExistLabel(PixelType);
139 
142  void AddLabel(mitk::Label *label);
143 
146  void AddLabel(const std::string &name, const Color &color);
147 
150  void RenameLabel(PixelType, const std::string &, const Color &);
151 
154  unsigned int GetNumberOfLabels() const;
155 
158  void SetAllLabelsVisible(bool);
159 
162  void SetAllLabelsLocked(bool);
163 
166  void RemoveAllLabels();
167 
168  void SetNextActiveLabel();
169 
172  Label *GetActiveLabel() { return GetLabel(m_ActiveLabelValue); }
175  const Label *GetActiveLabel() const { return GetLabel(m_ActiveLabelValue); }
178  Label *GetLabel(PixelType pixelValue);
179 
182  const Label *GetLabel(PixelType pixelValue) const;
183 
184  itkGetMacro(Layer, int);
185 
186  itkGetConstMacro(Layer, int);
187 
188  itkGetModifiableObjectMacro(LookupTable, mitk::LookupTable);
189 
192  void SetLookupTable(LookupTable *lut);
193 
196  void UpdateLookupTable(PixelType pixelValue);
197 
198  protected:
199  LabelSet();
200  LabelSet(const LabelSet &);
201 
202  mitkCloneMacro(Self);
203 
204  ~LabelSet() override;
205 
206  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
207 
209 
211 
213 
214  unsigned int m_Layer;
215  };
216 
232  MITKMULTILABEL_EXPORT bool Equal(const mitk::LabelSet &leftHandSide,
233  const mitk::LabelSet &rightHandSide,
234  ScalarType eps,
235  bool verbose);
236 
237 } // namespace mitk
238 
239 #endif // __mitkLabelSet_H_
mitk::eps
const MITKCORE_EXPORT ScalarType eps
MITKMULTILABEL_EXPORT
#define MITKMULTILABEL_EXPORT
Definition: MitkMultilabelExports.h:15
mitk::LabelSet::AllLabelsModifiedEvent
Message AllLabelsModifiedEvent
AllLabelsModifiedEvent is emitted whenever a new label has been removed from the LabelSet.
Definition: mitkLabelSet.h:101
mitk::LabelSet::m_LookupTable
LookupTable::Pointer m_LookupTable
Definition: mitkLabelSet.h:210
mitkLabel.h
mitk::LabelSet::GetActiveLabel
const Label * GetActiveLabel() const
Definition: mitkLabelSet.h:175
mitk::Message1< PixelType >
mitk::LabelSet::PixelType
mitk::Label::PixelType PixelType
Definition: mitkLabelSet.h:37
mitk::LabelSet
Definition: mitkLabelSet.h:33
mitk::LabelSet::LabelContainerIteratorType
LabelContainerType::iterator LabelContainerIteratorType
Definition: mitkLabelSet.h:43
mitk::LabelSet::m_LabelContainer
LabelContainerType m_LabelContainer
Definition: mitkLabelSet.h:208
mitk::Color
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
Definition: mitkColorProperty.h:35
mitk::LabelSet::m_ActiveLabelValue
PixelType m_ActiveLabelValue
Definition: mitkLabelSet.h:212
mitk::Equal
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
itk::SmartPointer< Self >
mitk::LookupTable
The LookupTable class mitk wrapper for a vtkLookupTable.
Definition: mitkLookupTable.h:42
mitk::Label::PixelType
unsigned short PixelType
Definition: mitkLabel.h:33
mitk::LabelSet::GetActiveLabel
Label * GetActiveLabel()
Definition: mitkLabelSet.h:172
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitkLookupTable.h
mitk::Label
A data structure describing a label.
Definition: mitkLabel.h:28
mitk::LabelSet::m_Layer
unsigned int m_Layer
Definition: mitkLabelSet.h:214
mitkMessage.h
mitk::LabelSet::RemoveLabelEvent
Message RemoveLabelEvent
RemoveLabelEvent is emitted whenever a new label has been removed from the LabelSet.
Definition: mitkLabelSet.h:69
mitk::PixelType
Class for defining the data type of pixels.
Definition: mitkPixelType.h:51
mitk::LabelSet::ModifyLabelEvent
Message ModifyLabelEvent
ModifyLabelEvent is emitted whenever a label has been modified from the LabelSet.
Definition: mitkLabelSet.h:82
mitk::LabelSet::LabelContainerConstIteratorType
LabelContainerType::const_iterator LabelContainerConstIteratorType
Definition: mitkLabelSet.h:42
mitk::LabelSet::AddLabelEvent
Message AddLabelEvent
AddLabelEvent is emitted whenever a new label has been added to the LabelSet.
Definition: mitkLabelSet.h:56
mitkCloneMacro
#define mitkCloneMacro(classname)
Definition: mitkCommon.h:154
mitk::LabelSet::LabelContainerType
std::map< PixelType, Label::Pointer > LabelContainerType
Definition: mitkLabelSet.h:41
mitk::LabelSet::ActiveLabelEvent
Message1< PixelType > ActiveLabelEvent
ActiveLabelEvent is emitted whenever a label has been set as active in the LabelSet.
Definition: mitkLabelSet.h:87
mitk::Message
Event/message/notification class.
Definition: mitkMessage.h:452
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20
MitkMultilabelExports.h