Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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) itkCloneMacro(Self) mitkNewMacro1Param(TemporoSpatialStringProperty, const char *);
46 
49  ValueType GetValue() const;
52  ValueType GetValue(const TimeStepType &timeStep,
53  const IndexValueType &zSlice,
54  bool allowCloseTime = false,
55  bool allowCloseSlice = false) const;
56  ValueType GetValueBySlice(const IndexValueType &zSlice, bool allowClose = false) const;
57  ValueType GetValueByTimeStep(const TimeStepType &timeStep, bool allowClose = false) const;
58 
59  bool HasValue() const;
60  bool HasValue(const TimeStepType &timeStep,
61  const IndexValueType &zSlice,
62  bool allowCloseTime = false,
63  bool allowCloseSlice = false) const;
64  bool HasValueBySlice(const IndexValueType &zSlice, bool allowClose = false) const;
65  bool HasValueByTimeStep(const TimeStepType &timeStep, bool allowClose = false) const;
66 
67  std::vector<IndexValueType> GetAvailableSlices(const TimeStepType &timeStep) const;
68  std::vector<TimeStepType> GetAvailableTimeSteps() const;
69 
70  void SetValue(const TimeStepType &timeStep, const IndexValueType &zSlice, const ValueType &value);
71 
72  void SetValue(const ValueType &value);
73 
74  std::string GetValueAsString() const override;
75 
76  using BaseProperty::operator=;
77 
78  protected:
79  typedef std::map<IndexValueType, std::string> SliceMapType;
80  typedef std::map<TimeStepType, SliceMapType> TimeMapType;
81 
82  TimeMapType m_Values;
83 
84  TemporoSpatialStringProperty(const char *string = nullptr);
85  TemporoSpatialStringProperty(const std::string &s);
86 
88 
89  std::pair<bool, ValueType> CheckValue(const TimeStepType &timeStep,
90  const IndexValueType &zSlice,
91  bool allowCloseTime = false,
92  bool allowCloseSlice = false) const;
93 
94  private:
95  // purposely not implemented
97 
98  itk::LightObject::Pointer InternalClone() const override;
99 
100  bool IsEqual(const BaseProperty &property) const override;
101  bool Assign(const BaseProperty &property) override;
102  };
103 
104  namespace PropertyPersistenceSerialization
105  {
107  MITKCORE_EXPORT::std::string serializeTemporoSpatialStringPropertyToJSON(const mitk::BaseProperty *prop);
108  }
109 
110  namespace PropertyPersistenceDeserialization
111  {
114  }
115 
116 #ifdef _MSC_VER
117 #pragma warning(pop)
118 #endif
119 
120 } // namespace mitk
121 
122 #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.