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  bool
119  GetTagStringValue(const std::string & tag, std::string & value) const;
120 
121  std::map<std::string, double> &
122  GetTagScalarDictionary();
123  const std::map<std::string, double> &
124  GetTagScalarDictionary() const;
125  std::map<std::string, std::string> &
126  GetTagStringDictionary();
127  const std::map<std::string, std::string> &
128  GetTagStringDictionary() const;
129 
130  void
131  SetTagScalarDictionary(const std::map<std::string, double> & dict);
132  void
133  SetTagStringDictionary(const std::map<std::string, std::string> & dict);
134 
135  void
136  Print(std::ostream & os) const
137  {
138  this->PrintSelf(os, 3);
139  }
140 
141  Self &
142  operator=(const SpatialObjectProperty & rhs);
143 
144 protected:
145  void
146  PrintSelf(std::ostream & os, Indent indent) const;
147 
148 private:
149  ColorType m_Color{};
150 
151  std::string m_Name{};
152 
153  std::map<std::string, double> m_ScalarDictionary{};
154  std::map<std::string, std::string> m_StringDictionary{};
155 };
156 
157 } // namespace itk
158 
159 #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:136
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::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