Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitkLabel.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 mitkLabel_h
14 #define mitkLabel_h
15 
16 #include "MitkMultilabelExports.h"
17 #include <mitkColorProperty.h>
18 #include <mitkPropertyList.h>
19 #include <mitkPoint.h>
20 #include <mitkVector.h>
21 
22 namespace mitk
23 {
24  //##
25  //##Documentation
26  //## @brief A data structure describing a label.
27  //## @ingroup Data
28  //##
30  {
31  public:
33 
34  typedef unsigned short PixelType;
35 
36  itkNewMacro(Self);
37  mitkNewMacro2Param(Self, PixelType, const std::string&);
38 
40  static const PixelType MAX_LABEL_VALUE;
41 
42  //** Value indicating pixels that are not labeled at all.*/
43  static constexpr PixelType UNLABELED_VALUE = 0;
44 
45  void SetLocked(bool locked);
46  bool GetLocked() const;
47 
48  void SetVisible(bool visible);
49  bool GetVisible() const;
50 
51  void SetOpacity(float opacity);
52  float GetOpacity() const;
53 
54  void SetName(const std::string &name);
55  std::string GetName() const;
56 
57  std::string GetTrackingID() const;
58 
59  void SetCenterOfMassIndex(const mitk::Point3D &center);
60  mitk::Point3D GetCenterOfMassIndex() const;
61 
62  void SetCenterOfMassCoordinates(const mitk::Point3D &center);
63  mitk::Point3D GetCenterOfMassCoordinates() const;
64 
65  void SetColor(const mitk::Color &);
66  const mitk::Color &GetColor() const;
67 
68  void SetValue(PixelType pixelValue);
69  PixelType GetValue() const;
70 
71  void SetLayer(unsigned int layer);
72  unsigned int GetLayer() const;
73 
74  void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName = "", bool fallBackOnDefaultContext = false) override;
75 
76  using itk::Object::Modified;
77  void Modified() { Superclass::Modified(); }
78  Label();
79  Label(PixelType value, const std::string& name);
80  ~Label() override;
81 
82  protected:
83  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
84 
85  Label(const Label &other);
86 
87  private:
88  itk::LightObject::Pointer InternalClone() const override;
89  };
90 
91  using LabelVector = std::vector<Label::Pointer>;
92  using ConstLabelVector = std::vector<Label::ConstPointer>;
93 
108  MITKMULTILABEL_EXPORT bool Equal(const mitk::Label &leftHandSide,
109  const mitk::Label &rightHandSide,
110  ScalarType eps,
111  bool verbose);
112 
113 } // namespace mitk
114 
115 #endif
mitk::eps
const MITKCORE_EXPORT ScalarType eps
MITKMULTILABEL_EXPORT
#define MITKMULTILABEL_EXPORT
Definition: MitkMultilabelExports.h:15
mitk::ConstLabelVector
std::vector< Label::ConstPointer > ConstLabelVector
Definition: mitkLabel.h:92
mitk::BaseProperty
Abstract base class for properties.
Definition: mitkBaseProperty.h:36
mitkNewMacro2Param
#define mitkNewMacro2Param(classname, typea, typeb)
Definition: mitkCommon.h:81
mitk::Color
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
Definition: mitkColorProperty.h:38
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.
mitkPoint.h
mitk::Label::PixelType
unsigned short PixelType
Definition: mitkLabel.h:34
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::Label::MAX_LABEL_VALUE
static const PixelType MAX_LABEL_VALUE
The maximum value a label can get: Since the value is of type unsigned short MAX_LABEL_VALUE = 65535.
Definition: mitkLabel.h:40
mitk::Label
A data structure describing a label.
Definition: mitkLabel.h:29
mitk::Point< ScalarType, 3 >
mitkPropertyList.h
mitk::PixelType
Class for defining the data type of pixels.
Definition: mitkPixelType.h:51
mitk::Label::Modified
void Modified()
Definition: mitkLabel.h:77
mitk::PropertyList
Key-value list holding instances of BaseProperty.
Definition: mitkPropertyList.h:56
mitk::LabelVector
std::vector< Label::Pointer > LabelVector
Definition: mitkLabel.h:91
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitkColorProperty.h
mitkVector.h
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20
MitkMultilabelExports.h