Medical Imaging Interaction Toolkit  2018.4.99-c0f884b2
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_HEADER
14 #define MITKTEMPOROSPATIALSTRINGPROPERTY_H_HEADER
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 
96  TimeMapType m_Values;
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
#define MITKCORE_EXPORT
MITKCORE_EXPORT::std::string serializeTemporoSpatialStringPropertyToJSON(const mitk::BaseProperty *prop)
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:72
DataCollection - Class to facilitate loading/accessing structured data.
Abstract base class for properties.
std::map< TimeStepType, SliceMapType > TimeMapType
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
std::vcl_size_t TimeStepType
std::map< IndexValueType, std::string > SliceMapType
MITKCORE_EXPORT mitk::BaseProperty::Pointer deserializeJSONToTemporoSpatialStringProperty(const std::string &value)
Property for time and space resolved string values.