Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef __mitkLabelSet_H_
18 #define __mitkLabelSet_H_
19 
20 #include "MitkMultilabelExports.h"
21 #include <mitkLookupTable.h>
22 #include <mitkMessage.h>
23 
24 #include <itkObject.h>
25 #include <itkObjectFactory.h>
26 
27 #include <mitkLabel.h>
28 
29 namespace mitk
30 {
31  //
32  // Documentation
33  // @brief LabelSet containing the labels corresponding to a segmentation session.
34  // @ingroup Data
35  //
36 
37  class MITKMULTILABEL_EXPORT LabelSet : public itk::Object
38  {
39  public:
40  mitkClassMacroItkParent(LabelSet, itk::Object);
41  itkNewMacro(Self);
42 
44 
45  typedef std::map<PixelType, Label::Pointer> LabelContainerType;
46  typedef LabelContainerType::const_iterator LabelContainerConstIteratorType;
47  typedef LabelContainerType::iterator LabelContainerIteratorType;
48 
61 
74 
87 
92 
106 
109  LabelContainerConstIteratorType IteratorConstBegin() const;
110 
113  LabelContainerConstIteratorType IteratorConstEnd() const;
114 
117  LabelContainerIteratorType IteratorBegin();
118 
121  LabelContainerIteratorType IteratorEnd();
122 
126  void OnLabelModified();
127 
130  void SetLayer(unsigned int);
131 
134  void SetActiveLabel(PixelType);
135 
138  void RemoveLabel(PixelType);
139 
142  bool ExistLabel(PixelType);
143 
146  void AddLabel(mitk::Label *label);
147 
150  void AddLabel(const std::string &name, const Color &color);
151 
154  void RenameLabel(PixelType, const std::string &, const Color &);
155 
158  unsigned int GetNumberOfLabels() const;
159 
162  void SetAllLabelsVisible(bool);
163 
166  void SetAllLabelsLocked(bool);
167 
170  void RemoveAllLabels();
171 
174  Label *GetActiveLabel() { return GetLabel(m_ActiveLabelValue); }
177  const Label *GetActiveLabel() const { return GetLabel(m_ActiveLabelValue); }
180  Label *GetLabel(PixelType pixelValue);
181 
184  const Label *GetLabel(PixelType pixelValue) const;
185 
186  itkGetMacro(Layer, int) itkGetConstMacro(Layer, int) itkGetModifiableObjectMacro(LookupTable, mitk::LookupTable)
187 
190  void SetLookupTable(LookupTable *lut);
191 
194  void UpdateLookupTable(PixelType pixelValue);
195 
196  protected:
197  LabelSet();
198  LabelSet(const LabelSet &);
199 
200  mitkCloneMacro(Self)
201 
202  virtual ~LabelSet();
203 
204  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
205 
206  LabelContainerType m_LabelContainer;
207 
208  LookupTable::Pointer m_LookupTable;
209 
210  PixelType m_ActiveLabelValue;
211 
212  unsigned int m_Layer;
213  };
214 
230  MITKMULTILABEL_EXPORT bool Equal(const mitk::LabelSet &leftHandSide,
231  const mitk::LabelSet &rightHandSide,
232  ScalarType eps,
233  bool verbose);
234 
235 } // namespace mitk
236 
237 #endif // __mitkLabelSet_H_
Message AllLabelsModifiedEvent
AllLabelsModifiedEvent is emitted whenever a new label has been removed from the LabelSet.
Definition: mitkLabelSet.h:105
Label * GetActiveLabel()
Definition: mitkLabelSet.h:174
double ScalarType
STL namespace.
DataCollection - Class to facilitate loading/accessing structured data.
A data structure describing a label.
Definition: mitkLabel.h:35
#define MITKMULTILABEL_EXPORT
LabelContainerType::iterator LabelContainerIteratorType
Definition: mitkLabelSet.h:47
Message AddLabelEvent
AddLabelEvent is emitted whenever a new label has been added to the LabelSet.
Definition: mitkLabelSet.h:60
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:53
std::map< PixelType, Label::Pointer > LabelContainerType
Definition: mitkLabelSet.h:45
Event/message/notification class.
Definition: mitkMessage.h:572
LabelContainerType::const_iterator LabelContainerConstIteratorType
Definition: mitkLabelSet.h:46
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
#define mitkCloneMacro(classname)
Definition: mitkCommon.h:162
Message ModifyLabelEvent
ModifyLabelEvent is emitted whenever a label has been modified from the LabelSet. ...
Definition: mitkLabelSet.h:86
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.
Message RemoveLabelEvent
RemoveLabelEvent is emitted whenever a new label has been removed from the LabelSet.
Definition: mitkLabelSet.h:73
MITKCORE_EXPORT const ScalarType eps
unsigned short PixelType
Definition: mitkLabel.h:40
mitk::Label::PixelType PixelType
Definition: mitkLabelSet.h:41
Message1< PixelType > ActiveLabelEvent
ActiveLabelEvent is emitted whenever a label has been set as active in the LabelSet.
Definition: mitkLabelSet.h:91
const Label * GetActiveLabel() const
Definition: mitkLabelSet.h:177
The LookupTable class mitk wrapper for a vtkLookupTableThis class can be used to color images with a ...