Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
mitkTemporoSpatialStringProperty.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 mitkTemporoSpatialStringProperty_h
14 #define mitkTemporoSpatialStringProperty_h
15 
16 #include <itkConfigure.h>
17 
18 #include "mitkBaseProperty.h"
19 #include <MitkCoreExports.h>
20 
21 #include "mitkTimeGeometry.h"
22 
23 #include <string>
24 
25 namespace mitk
26 {
27 #ifdef _MSC_VER
28 #pragma warning(push)
29 #pragma warning(disable : 4522)
30 #endif
31 
37  {
38  public:
39  typedef ::itk::IndexValueType IndexValueType;
40  typedef std::string ValueType;
41 
43 
44  itkFactorylessNewMacro(Self);
45 
46  itkCloneMacro(Self);
49 
52  ValueType GetValue() const;
55  ValueType GetValue(const TimeStepType &timeStep,
56  const IndexValueType &zSlice,
57  bool allowCloseTime = false,
58  bool allowCloseSlice = false) const;
59  ValueType GetValueBySlice(const IndexValueType &zSlice, bool allowClose = false) const;
60  ValueType GetValueByTimeStep(const TimeStepType &timeStep, bool allowClose = false) const;
61 
62  bool HasValue() const;
63  bool HasValue(const TimeStepType &timeStep,
64  const IndexValueType &zSlice,
65  bool allowCloseTime = false,
66  bool allowCloseSlice = false) const;
67  bool HasValueBySlice(const IndexValueType &zSlice, bool allowClose = false) const;
68  bool HasValueByTimeStep(const TimeStepType &timeStep, bool allowClose = false) const;
69 
71  std::vector<IndexValueType> GetAvailableSlices(const TimeStepType& timeStep) const;
73  std::vector<TimeStepType> GetAvailableTimeSteps(const IndexValueType& slice) const;
75  std::vector<TimeStepType> GetAvailableTimeSteps() const;
77  std::vector<IndexValueType> GetAvailableSlices() const;
78 
79  void SetValue(const TimeStepType &timeStep, const IndexValueType &zSlice, const ValueType &value);
80 
81  void SetValue(const ValueType &value);
82 
83  std::string GetValueAsString() const override;
84 
88  bool IsUniform() const;
89 
90  bool ToJSON(nlohmann::json& j) const override;
91  bool FromJSON(const nlohmann::json& j) override;
92 
93  using BaseProperty::operator=;
94 
95  protected:
96  typedef std::map<IndexValueType, std::string> SliceMapType;
97  typedef std::map<TimeStepType, SliceMapType> TimeMapType;
98 
100 
101  TemporoSpatialStringProperty(const char *string = nullptr);
102  TemporoSpatialStringProperty(const std::string &s);
103 
105 
106  std::pair<bool, ValueType> CheckValue(const TimeStepType &timeStep,
107  const IndexValueType &zSlice,
108  bool allowCloseTime = false,
109  bool allowCloseSlice = false) const;
110 
111  private:
112  // purposely not implemented
114 
115  itk::LightObject::Pointer InternalClone() const override;
116 
117  bool IsEqual(const BaseProperty &property) const override;
118  bool Assign(const BaseProperty &property) override;
119  };
120 
121  namespace PropertyPersistenceSerialization
122  {
125  }
126 
127  namespace PropertyPersistenceDeserialization
128  {
131  }
132 
141 
142 #ifdef _MSC_VER
143 #pragma warning(pop)
144 #endif
145 
146 } // namespace mitk
147 
148 #endif
mitk::BaseProperty
Abstract base class for properties.
Definition: mitkBaseProperty.h:36
mitk::TemporoSpatialStringProperty::ValueType
std::string ValueType
Definition: mitkTemporoSpatialStringProperty.h:40
mitk::FromJSON
MITKCORE_EXPORT void FromJSON(const nlohmann::json &j, AffineTransform3D::Pointer transform)
Read transform from JSON array (16 elements, resp. 4x4 matrix).
mitkNewMacro1Param
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:68
mitk::TemporoSpatialStringProperty::TimeMapType
std::map< TimeStepType, SliceMapType > TimeMapType
Definition: mitkTemporoSpatialStringProperty.h:97
itk::SmartPointer< Self >
mitk::TemporoSpatialStringProperty
Property for time and space resolved string values.
Definition: mitkTemporoSpatialStringProperty.h:36
mitkTimeGeometry.h
mitk::PropertyPersistenceDeserialization::deserializeJSONToTemporoSpatialStringProperty
MITKCORE_EXPORT mitk::BaseProperty::Pointer deserializeJSONToTemporoSpatialStringProperty(const std::string &value)
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::PropertyPersistenceSerialization::serializeTemporoSpatialStringPropertyToJSON
MITKCORE_EXPORT std::string serializeTemporoSpatialStringPropertyToJSON(const mitk::BaseProperty *prop)
mitk::TemporoSpatialStringProperty::IndexValueType
::itk::IndexValueType IndexValueType
Definition: mitkTemporoSpatialStringProperty.h:39
json
nlohmann::json json
Definition: mitkModelTestFixture.h:29
MitkCoreExports.h
mitk::TemporoSpatialStringProperty::SliceMapType
std::map< IndexValueType, std::string > SliceMapType
Definition: mitkTemporoSpatialStringProperty.h:96
mitk::TemporoSpatialStringProperty::Pointer
itk::SmartPointer< Self > Pointer
Definition: mitkTemporoSpatialStringProperty.h:42
mitk::ExtractTimeStepFromTemporoSpatialStringProperty
TemporoSpatialStringProperty::Pointer MITKCORE_EXPORT ExtractTimeStepFromTemporoSpatialStringProperty(const TemporoSpatialStringProperty *tsProperty, TimeStepType ts)
mitk::ToJSON
MITKCORE_EXPORT void ToJSON(nlohmann::json &j, AffineTransform3D::ConstPointer transform)
Write transform (4x4 matrix) as JSON array with 16 elements.
mitk::TimeStepType
std::size_t TimeStepType
Definition: mitkTimeGeometry.h:27
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::TemporoSpatialStringProperty::m_Values
TimeMapType m_Values
Definition: mitkTemporoSpatialStringProperty.h:99
mitkBaseProperty.h
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15