Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef MITKTEMPOROSPATIALSTRINGPROPERTY_H_HEADER
18 #define MITKTEMPOROSPATIALSTRINGPROPERTY_H_HEADER
19 
20 #include <itkConfigure.h>
21 
22 #include "mitkBaseProperty.h"
23 #include <MitkCoreExports.h>
24 
25 #include "mitkTimeGeometry.h"
26 
27 #include <string>
28 
29 namespace mitk
30 {
31 #ifdef _MSC_VER
32 #pragma warning(push)
33 #pragma warning(disable : 4522)
34 #endif
35 
41  {
42  public:
43  typedef ::itk::IndexValueType IndexValueType;
44  typedef std::string ValueType;
45 
47 
48  itkFactorylessNewMacro(Self) itkCloneMacro(Self) mitkNewMacro1Param(TemporoSpatialStringProperty, const char *);
49  mitkNewMacro1Param(TemporoSpatialStringProperty, const std::string &);
50 
53  ValueType GetValue() const;
56  ValueType GetValue(const TimeStepType &timeStep,
57  const IndexValueType &zSlice,
58  bool allowCloseTime = false,
59  bool allowCloseSlice = false) const;
60  ValueType GetValueBySlice(const IndexValueType &zSlice, bool allowClose = false) const;
61  ValueType GetValueByTimeStep(const TimeStepType &timeStep, bool allowClose = false) const;
62 
63  bool HasValue() const;
64  bool HasValue(const TimeStepType &timeStep,
65  const IndexValueType &zSlice,
66  bool allowCloseTime = false,
67  bool allowCloseSlice = false) const;
68  bool HasValueBySlice(const IndexValueType &zSlice, bool allowClose = false) const;
69  bool HasValueByTimeStep(const TimeStepType &timeStep, bool allowClose = false) const;
70 
71  std::vector<IndexValueType> GetAvailableSlices(const TimeStepType &timeStep) const;
72  std::vector<TimeStepType> GetAvailableTimeSteps() const;
73 
74  void SetValue(const TimeStepType &timeStep, const IndexValueType &zSlice, const ValueType &value);
75 
76  void SetValue(const ValueType &value);
77 
78  virtual std::string GetValueAsString() const override;
79 
80  using BaseProperty::operator=;
81 
82  protected:
83  typedef std::map<IndexValueType, std::string> SliceMapType;
84  typedef std::map<TimeStepType, SliceMapType> TimeMapType;
85 
86  TimeMapType m_Values;
87 
88  TemporoSpatialStringProperty(const char *string = nullptr);
89  TemporoSpatialStringProperty(const std::string &s);
90 
91  TemporoSpatialStringProperty(const TemporoSpatialStringProperty &);
92 
93  std::pair<bool, ValueType> CheckValue(const TimeStepType &timeStep,
94  const IndexValueType &zSlice,
95  bool allowCloseTime = false,
96  bool allowCloseSlice = false) const;
97 
98  private:
99  // purposely not implemented
100  TemporoSpatialStringProperty &operator=(const TemporoSpatialStringProperty &);
101 
102  itk::LightObject::Pointer InternalClone() const override;
103 
104  virtual bool IsEqual(const BaseProperty &property) const override;
105  virtual bool Assign(const BaseProperty &property) override;
106  };
107 
108  namespace PropertyPersistenceSerialization
109  {
111  MITKCORE_EXPORT::std::string serializeTemporoSpatialStringPropertyToJSON(const mitk::BaseProperty *prop);
112  }
113 
114  namespace PropertyPersistenceDeserialization
115  {
118  }
119 
120 #ifdef _MSC_VER
121 #pragma warning(pop)
122 #endif
123 
124 } // namespace mitk
125 
126 #endif
#define MITKCORE_EXPORT
MITKCORE_EXPORT::std::string serializeTemporoSpatialStringPropertyToJSON(const mitk::BaseProperty *prop)
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:76
STL namespace.
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:44
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.