Medical Imaging Interaction Toolkit  2023.04.99-859410e3
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  using BaseProperty::operator=;
91 
92  protected:
93  typedef std::map<IndexValueType, std::string> SliceMapType;
94  typedef std::map<TimeStepType, SliceMapType> TimeMapType;
95 
97 
98  TemporoSpatialStringProperty(const char *string = nullptr);
99  TemporoSpatialStringProperty(const std::string &s);
100 
102 
103  std::pair<bool, ValueType> CheckValue(const TimeStepType &timeStep,
104  const IndexValueType &zSlice,
105  bool allowCloseTime = false,
106  bool allowCloseSlice = false) const;
107 
108  private:
109  // purposely not implemented
111 
112  itk::LightObject::Pointer InternalClone() const override;
113 
114  bool IsEqual(const BaseProperty &property) const override;
115  bool Assign(const BaseProperty &property) override;
116  };
117 
118  namespace PropertyPersistenceSerialization
119  {
121  MITKCORE_EXPORT::std::string serializeTemporoSpatialStringPropertyToJSON(const mitk::BaseProperty *prop);
122  }
123 
124  namespace PropertyPersistenceDeserialization
125  {
128  }
129 
130 #ifdef _MSC_VER
131 #pragma warning(pop)
132 #endif
133 
134 } // namespace mitk
135 
136 #endif
mitk::BaseProperty
Abstract base class for properties.
Definition: mitkBaseProperty.h:35
mitk::TemporoSpatialStringProperty::ValueType
std::string ValueType
Definition: mitkTemporoSpatialStringProperty.h:40
mitkNewMacro1Param
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:68
mitk::TemporoSpatialStringProperty::TimeMapType
std::map< TimeStepType, SliceMapType > TimeMapType
Definition: mitkTemporoSpatialStringProperty.h:94
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::TemporoSpatialStringProperty::IndexValueType
::itk::IndexValueType IndexValueType
Definition: mitkTemporoSpatialStringProperty.h:39
MitkCoreExports.h
mitk::TemporoSpatialStringProperty::SliceMapType
std::map< IndexValueType, std::string > SliceMapType
Definition: mitkTemporoSpatialStringProperty.h:93
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:96
mitkBaseProperty.h
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::PropertyPersistenceSerialization::serializeTemporoSpatialStringPropertyToJSON
MITKCORE_EXPORT::std::string serializeTemporoSpatialStringPropertyToJSON(const mitk::BaseProperty *prop)