ITK  5.4.0
Insight Toolkit
itkSpatialObjectProperty.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * https://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkSpatialObjectProperty_h
19 #define itkSpatialObjectProperty_h
20 
21 #include <string>
22 #include <map>
23 
24 #include "itkLightObject.h"
25 #include "itkRGBAPixel.h"
26 #include "itkTimeStamp.h"
27 #include "itkObjectFactory.h"
28 
29 #include "ITKSpatialObjectsExport.h"
30 
31 namespace itk
32 {
38 class ITKSpatialObjects_EXPORT SpatialObjectProperty
39 {
40 public:
42 
43  virtual ~SpatialObjectProperty() = default;
44 
46 
48 
49  virtual void
50  Clear();
51 
52  void
53  SetColor(const ColorType & color)
54  {
55  m_Color = color;
56  }
57 
58  ColorType &
60  {
61  return m_Color;
62  }
63 
64  const ColorType &
65  GetColor() const
66  {
67  return m_Color;
68  }
69 
70  void
71  SetColor(double r, double g, double b);
72 
73  void
74  SetRed(double r);
75  double
76  GetRed() const;
77 
78  void
79  SetGreen(double g);
80  double
81  GetGreen() const;
82 
83  void
84  SetBlue(double b);
85  double
86  GetBlue() const;
87 
88  void
89  SetAlpha(double a);
90  double
91  GetAlpha() const;
92 
93  void
94  SetName(const std::string & name)
95  {
96  m_Name = name;
97  }
98 
99  std::string &
101  {
102  return m_Name;
103  }
104 
105  const std::string &
106  GetName() const
107  {
108  return m_Name;
109  }
110 
111  void
112  SetTagScalarValue(const std::string & tag, double value);
113  void
114  SetTagStringValue(const std::string & tag, const std::string & value);
115 
116  bool
117  GetTagScalarValue(const std::string & tag, double & value) const;
118  double
119  GetTagScalarValue(const std::string & tag) const
120  {
121  double value = 0;
122  this->GetTagScalarValue(tag, value);
123  return value;
124  }
125 
126  bool
127  GetTagStringValue(const std::string & tag, std::string & value) const;
128  std::string
129  GetTagStringValue(const std::string & tag) const
130  {
131  std::string value = "";
132  this->GetTagStringValue(tag, value);
133  return value;
134  }
135 
136 
137  std::map<std::string, double> &
138  GetTagScalarDictionary();
139  const std::map<std::string, double> &
140  GetTagScalarDictionary() const;
141  std::map<std::string, std::string> &
142  GetTagStringDictionary();
143  const std::map<std::string, std::string> &
144  GetTagStringDictionary() const;
145 
146  void
147  SetTagScalarDictionary(const std::map<std::string, double> & dict);
148  void
149  SetTagStringDictionary(const std::map<std::string, std::string> & dict);
150 
151  void
152  Print(std::ostream & os) const
153  {
154  this->PrintSelf(os, 3);
155  }
156 
157  Self &
158  operator=(const SpatialObjectProperty & rhs);
159 
160 protected:
161  void
162  PrintSelf(std::ostream & os, Indent indent) const;
163 
164 private:
165  ColorType m_Color{};
166 
167  std::string m_Name{};
168 
169  std::map<std::string, double> m_ScalarDictionary{};
170  std::map<std::string, std::string> m_StringDictionary{};
171 };
172 
173 } // namespace itk
174 
175 #endif // __SpatialObjectProperty_h
itk::SpatialObjectProperty::GetName
const std::string & GetName() const
Definition: itkSpatialObjectProperty.h:106
itkObjectFactory.h
itkTimeStamp.h
itk::SpatialObjectProperty::GetName
std::string & GetName()
Definition: itkSpatialObjectProperty.h:100
itkRGBAPixel.h
itk::SpatialObjectProperty::Print
void Print(std::ostream &os) const
Definition: itkSpatialObjectProperty.h:152
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::SpatialObjectProperty::GetColor
const ColorType & GetColor() const
Definition: itkSpatialObjectProperty.h:65
itk::SpatialObjectProperty
Definition: itkSpatialObjectProperty.h:38
itk::SpatialObjectProperty::GetTagScalarValue
double GetTagScalarValue(const std::string &tag) const
Definition: itkSpatialObjectProperty.h:119
itk::SpatialObjectProperty::SetColor
void SetColor(const ColorType &color)
Definition: itkSpatialObjectProperty.h:53
itk::SpatialObjectProperty::GetColor
ColorType & GetColor()
Definition: itkSpatialObjectProperty.h:59
itk::SpatialObjectProperty::SetName
void SetName(const std::string &name)
Definition: itkSpatialObjectProperty.h:94
itk::RGBAPixel< double >
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
AddImageFilter
Definition: itkAddImageFilter.h:81
itkLightObject.h
itk::SpatialObjectProperty::GetTagStringValue
std::string GetTagStringValue(const std::string &tag) const
Definition: itkSpatialObjectProperty.h:129