Medical Imaging Interaction Toolkit  2018.04.99-aba3194f
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 
208  LabelContainerType m_LabelContainer;
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_
Message AllLabelsModifiedEvent
AllLabelsModifiedEvent is emitted whenever a new label has been removed from the LabelSet.
Definition: mitkLabelSet.h:101
MITKCORE_EXPORT const ScalarType eps
Label * GetActiveLabel()
Definition: mitkLabelSet.h:172
double ScalarType
LookupTable::Pointer m_LookupTable
Definition: mitkLabelSet.h:210
DataCollection - Class to facilitate loading/accessing structured data.
A data structure describing a label.
Definition: mitkLabel.h:28
#define MITKMULTILABEL_EXPORT
LabelContainerType::iterator LabelContainerIteratorType
Definition: mitkLabelSet.h:43
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.
PixelType m_ActiveLabelValue
Definition: mitkLabelSet.h:212
unsigned int m_Layer
Definition: mitkLabelSet.h:214
LabelContainerType m_LabelContainer
Definition: mitkLabelSet.h:208
Message AddLabelEvent
AddLabelEvent is emitted whenever a new label has been added to the LabelSet.
Definition: mitkLabelSet.h:56
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:49
std::map< PixelType, Label::Pointer > LabelContainerType
Definition: mitkLabelSet.h:41
Event/message/notification class.
Definition: mitkMessage.h:452
LabelContainerType::const_iterator LabelContainerConstIteratorType
Definition: mitkLabelSet.h:42
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
#define mitkCloneMacro(classname)
Definition: mitkCommon.h:158
Message ModifyLabelEvent
ModifyLabelEvent is emitted whenever a label has been modified from the LabelSet. ...
Definition: mitkLabelSet.h:82
Message RemoveLabelEvent
RemoveLabelEvent is emitted whenever a new label has been removed from the LabelSet.
Definition: mitkLabelSet.h:69
const Label * GetActiveLabel() const
Definition: mitkLabelSet.h:175
unsigned short PixelType
Definition: mitkLabel.h:33
mitk::Label::PixelType PixelType
Definition: mitkLabelSet.h:37
Message1< PixelType > ActiveLabelEvent
ActiveLabelEvent is emitted whenever a label has been set as active in the LabelSet.
Definition: mitkLabelSet.h:87
The LookupTable class mitk wrapper for a vtkLookupTableThis class can be used to color images with a ...