Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
mitkBaseProperty.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 mitkBaseProperty_h
14 #define mitkBaseProperty_h
15 
16 #include <MitkCoreExports.h>
17 #include <itkObjectFactory.h>
18 #include <mitkCommon.h>
19 #include <string>
20 #include <nlohmann/json_fwd.hpp>
21 
22 namespace mitk
23 {
36  class MITKCORE_EXPORT BaseProperty : public itk::Object
37  {
38  public:
40  itkCloneMacro(Self);
41 
46  bool
47  operator==(const BaseProperty &property) const;
48 
56  BaseProperty &operator=(const BaseProperty &property);
57 
63  bool AssignProperty(const BaseProperty &property);
64 
65  virtual std::string GetValueAsString() const;
66 
73  virtual bool ToJSON(nlohmann::json& j) const = 0;
74 
81  virtual bool FromJSON(const nlohmann::json& j) = 0;
82 
86  static const std::string VALUE_CANNOT_BE_CONVERTED_TO_STRING;
87 
88  protected:
89  BaseProperty();
90  BaseProperty(const BaseProperty &other);
91 
92  ~BaseProperty() override;
93 
94  private:
99  virtual bool IsEqual(const BaseProperty &property) const = 0;
100 
110  virtual bool Assign(const BaseProperty &) = 0;
111  };
112 
113 } // namespace mitk
114 
115 #endif
mitk::BaseProperty
Abstract base class for properties.
Definition: mitkBaseProperty.h:36
mitk::FromJSON
MITKCORE_EXPORT void FromJSON(const nlohmann::json &j, AffineTransform3D::Pointer transform)
Read transform from JSON array (16 elements, resp. 4x4 matrix).
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::BaseProperty::VALUE_CANNOT_BE_CONVERTED_TO_STRING
static const std::string VALUE_CANNOT_BE_CONVERTED_TO_STRING
Default return value if a property which can not be returned as string.
Definition: mitkBaseProperty.h:86
json
nlohmann::json json
Definition: mitkModelTestFixture.h:29
mitk::operator==
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
MitkCoreExports.h
mitkCommon.h
mitk::ToJSON
MITKCORE_EXPORT void ToJSON(nlohmann::json &j, AffineTransform3D::ConstPointer transform)
Write transform (4x4 matrix) as JSON array with 16 elements.
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15