Medical Imaging Interaction Toolkit  2018.4.99-389bf124
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 
70  std::vector<IndexValueType> GetAvailableSlices(const TimeStepType &timeStep) const;
71  std::vector<TimeStepType> GetAvailableTimeSteps() const;
72 
73  void SetValue(const TimeStepType &timeStep, const IndexValueType &zSlice, const ValueType &value);
74 
75  void SetValue(const ValueType &value);
76 
77  std::string GetValueAsString() const override;
78 
79  using BaseProperty::operator=;
80 
81  protected:
82  typedef std::map<IndexValueType, std::string> SliceMapType;
83  typedef std::map<TimeStepType, SliceMapType> TimeMapType;
84 
85  TimeMapType m_Values;
86 
87  TemporoSpatialStringProperty(const char *string = nullptr);
88  TemporoSpatialStringProperty(const std::string &s);
89 
91 
92  std::pair<bool, ValueType> CheckValue(const TimeStepType &timeStep,
93  const IndexValueType &zSlice,
94  bool allowCloseTime = false,
95  bool allowCloseSlice = false) const;
96 
97  private:
98  // purposely not implemented
100 
101  itk::LightObject::Pointer InternalClone() const override;
102 
103  bool IsEqual(const BaseProperty &property) const override;
104  bool Assign(const BaseProperty &property) override;
105  };
106 
107  namespace PropertyPersistenceSerialization
108  {
110  MITKCORE_EXPORT::std::string serializeTemporoSpatialStringPropertyToJSON(const mitk::BaseProperty *prop);
111  }
112 
113  namespace PropertyPersistenceDeserialization
114  {
117  }
118 
119 #ifdef _MSC_VER
120 #pragma warning(pop)
121 #endif
122 
123 } // namespace mitk
124 
125 #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.