ITK  5.1.0
Insight Toolkit
itkShapeLabelObjectAccessors.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  * http://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 itkShapeLabelObjectAccessors_h
19 #define itkShapeLabelObjectAccessors_h
20 
22 #include "itkIntTypes.h"
23 
24 /*
25  *
26  * This code was contributed in the Insight Journal paper:
27  * "Label object representation and manipulation with ITK"
28  * by Lehmann G.
29  * https://hdl.handle.net/1926/584
30  * http://www.insight-journal.org/browse/publication/176
31  *
32  */
33 
34 namespace itk
35 {
36 namespace Functor
37 {
38 template <typename TLabelObject>
40 {
41 public:
42  using LabelObjectType = TLabelObject;
44 
45  inline AttributeValueType
46  operator()(const LabelObjectType * labelObject) const
47  {
48  return labelObject->GetNumberOfPixels();
49  }
50 };
51 
52 template <typename TLabelObject>
54 {
55 public:
56  using LabelObjectType = TLabelObject;
58 
59  inline AttributeValueType
60  operator()(const LabelObjectType * labelObject) const
61  {
62  return labelObject->GetBoundingBox();
63  }
64 };
65 
66 template <typename TLabelObject>
68 {
69 public:
70  using LabelObjectType = TLabelObject;
71  using AttributeValueType = double;
72 
73  inline AttributeValueType
74  operator()(const LabelObjectType * labelObject) const
75  {
76  return labelObject->GetPhysicalSize();
77  }
78 };
79 
80 template <typename TLabelObject>
82 {
83 public:
84  using LabelObjectType = TLabelObject;
86 
87  inline AttributeValueType
88  operator()(const LabelObjectType * labelObject) const
89  {
90  return labelObject->GetNumberOfPixelsOnBorder();
91  }
92 };
93 
94 template <typename TLabelObject>
96 {
97 public:
98  using LabelObjectType = TLabelObject;
99  using AttributeValueType = double;
100 
101  inline AttributeValueType
102  operator()(const LabelObjectType * labelObject) const
103  {
104  return labelObject->GetPerimeterOnBorder();
105  }
106 };
107 
108 template <typename TLabelObject>
110 {
111 public:
112  using LabelObjectType = TLabelObject;
113  using AttributeValueType = typename LabelObjectType::CentroidType;
114 
115  inline AttributeValueType
116  operator()(const LabelObjectType * labelObject) const
117  {
118  return labelObject->GetCentroid();
119  }
120 };
121 
122 template <typename TLabelObject>
124 {
125 public:
126  using LabelObjectType = TLabelObject;
127  using AttributeValueType = double;
128 
129  inline AttributeValueType
130  operator()(const LabelObjectType * labelObject) const
131  {
132  return labelObject->GetFeretDiameter();
133  }
134 };
135 
136 template <typename TLabelObject>
138 {
139 public:
140  using LabelObjectType = TLabelObject;
142 
143  inline AttributeValueType
144  operator()(const LabelObjectType * labelObject) const
145  {
146  return labelObject->GetPrincipalMoments();
147  }
148 };
149 
150 template <typename TLabelObject>
152 {
153 public:
154  using LabelObjectType = TLabelObject;
155  using AttributeValueType = typename LabelObjectType::MatrixType;
156 
157  inline AttributeValueType
158  operator()(const LabelObjectType * labelObject) const
159  {
160  return labelObject->GetPrincipalAxes();
161  }
162 };
163 
164 template <typename TLabelObject>
166 {
167 public:
168  using LabelObjectType = TLabelObject;
169  using AttributeValueType = double;
170 
171  inline AttributeValueType
172  operator()(const LabelObjectType * labelObject) const
173  {
174  return labelObject->GetElongation();
175  }
176 };
177 
178 template <typename TLabelObject>
180 {
181 public:
182  using LabelObjectType = TLabelObject;
183  using AttributeValueType = double;
184 
185  inline AttributeValueType
186  operator()(const LabelObjectType * labelObject) const
187  {
188  return labelObject->GetPerimeter();
189  }
190 };
191 
192 template <typename TLabelObject>
194 {
195 public:
196  using LabelObjectType = TLabelObject;
197  using AttributeValueType = double;
198 
199  inline AttributeValueType
200  operator()(const LabelObjectType * labelObject) const
201  {
202  return labelObject->GetRoundness();
203  }
204 };
205 
206 template <typename TLabelObject>
208 {
209 public:
210  using LabelObjectType = TLabelObject;
211  using AttributeValueType = double;
212 
213  inline AttributeValueType
214  operator()(const LabelObjectType * labelObject) const
215  {
216  return labelObject->GetEquivalentSphericalRadius();
217  }
218 };
219 
220 template <typename TLabelObject>
222 {
223 public:
224  using LabelObjectType = TLabelObject;
225  using AttributeValueType = double;
226 
227  inline AttributeValueType
228  operator()(const LabelObjectType * labelObject) const
229  {
230  return labelObject->GetEquivalentSphericalPerimeter();
231  }
232 };
233 
234 template <typename TLabelObject>
236 {
237 public:
238  using LabelObjectType = TLabelObject;
240 
241  inline AttributeValueType
242  operator()(const LabelObjectType * labelObject) const
243  {
244  return labelObject->GetEquivalentEllipsoidDiameter();
245  }
246 };
247 
248 template <typename TLabelObject>
250 {
251 public:
252  using LabelObjectType = TLabelObject;
253  using AttributeValueType = double;
254 
255  inline AttributeValueType
256  operator()(const LabelObjectType * labelObject) const
257  {
258  return labelObject->GetFlatness();
259  }
260 };
261 
262 template <typename TLabelObject>
264 {
265 public:
266  using LabelObjectType = TLabelObject;
267  using AttributeValueType = double;
268 
269  inline AttributeValueType
270  operator()(const LabelObjectType * labelObject) const
271  {
272  return labelObject->GetPerimeterOnBorderRatio();
273  }
274 };
275 
276 } // namespace Functor
277 } // end namespace itk
278 
279 #endif
itk::Functor::PerimeterOnBorderLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:102
itk::Functor::EquivalentSphericalRadiusLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:214
itk::Functor::BoundingBoxLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:53
itk::Functor::PrincipalAxesLabelObjectAccessor::AttributeValueType
typename LabelObjectType::MatrixType AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:155
itk::Functor::PhysicalSizeLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:70
itk::Functor::NumberOfPixelsLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:39
itk::Functor::PerimeterLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:179
itk::Functor::EquivalentSphericalPerimeterLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:224
itk::Functor::FlatnessLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:256
itk::Functor::PhysicalSizeLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:71
itk::GTest::TypedefsAndConstructors::Dimension2::VectorType
ImageBaseType::SpacingType VectorType
Definition: itkGTestTypedefsAndConstructors.h:53
itk::Functor::PerimeterOnBorderRatioLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:266
itk::Functor::PerimeterLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:182
itk::Functor::ElongationLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:165
itk::Functor::EquivalentEllipsoidDiameterLabelObjectAccessor::AttributeValueType
typename LabelObjectType::VectorType AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:239
itk::Functor::NumberOfPixelsOnBorderLabelObjectAccessor::AttributeValueType
SizeValueType AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:85
itk::Functor::EquivalentEllipsoidDiameterLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:238
itk::Functor::EquivalentSphericalRadiusLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:207
itk::Functor::PerimeterLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:186
itk::Functor::EquivalentSphericalRadiusLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:211
itk::Functor::PhysicalSizeLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:67
itk::Functor::NumberOfPixelsLabelObjectAccessor::AttributeValueType
SizeValueType AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:43
itk::Functor::FlatnessLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:253
itk::Functor::CentroidLabelObjectAccessor::AttributeValueType
typename LabelObjectType::CentroidType AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:113
itk::Functor::PerimeterLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:183
itk::Functor::PrincipalAxesLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:158
itk::Functor::CentroidLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:109
itk::Functor::PrincipalMomentsLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:144
itk::Functor::PhysicalSizeLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:74
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::Functor::CentroidLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:112
itk::Functor::FeretDiameterLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:127
itk::Functor::NumberOfPixelsLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:46
itk::Functor::PrincipalMomentsLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:140
itk::Functor::FlatnessLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:252
itk::Functor::NumberOfPixelsOnBorderLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:84
itk::Functor::EquivalentSphericalRadiusLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:210
itk::Functor::PerimeterOnBorderLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:95
itk::Functor::EquivalentSphericalPerimeterLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:228
itk::Functor::EquivalentEllipsoidDiameterLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:242
itk::Functor::PrincipalAxesLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:154
itkIntTypes.h
itk::Functor::RoundnessLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:197
itk::Functor::RoundnessLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:200
itk::Functor::PerimeterOnBorderRatioLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:263
itk::Functor::FeretDiameterLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:123
itk::Functor::CentroidLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:116
itk::Functor::NumberOfPixelsOnBorderLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:88
itk::Functor::PerimeterOnBorderRatioLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:267
itkLabelObjectAccessors.h
itk::Functor::ElongationLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:172
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkArray.h:26
itk::Functor::ElongationLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:169
itk::Functor::EquivalentEllipsoidDiameterLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:235
itk::Functor::NumberOfPixelsLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:42
itk::Functor::PerimeterOnBorderLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:99
itk::Functor::FlatnessLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:249
itk::Functor::BoundingBoxLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:60
itk::Functor::EquivalentSphericalPerimeterLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:221
itk::Functor::FeretDiameterLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:130
itk::Functor::FeretDiameterLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:126
itk::Functor::BoundingBoxLabelObjectAccessor::AttributeValueType
typename LabelObjectType::RegionType AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:57
itk::Functor::RoundnessLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:196
itk::Functor::PrincipalAxesLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:151
itk::Functor::NumberOfPixelsOnBorderLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:81
itk::Functor::ElongationLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:168
itk::Functor::PrincipalMomentsLabelObjectAccessor::AttributeValueType
typename LabelObjectType::VectorType AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:141
itk::Functor::PerimeterOnBorderLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:98
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::Functor::EquivalentSphericalPerimeterLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkShapeLabelObjectAccessors.h:225
itk::Functor::PrincipalMomentsLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:137
itk::Functor::RoundnessLabelObjectAccessor
Definition: itkShapeLabelObjectAccessors.h:193
itk::Functor::BoundingBoxLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkShapeLabelObjectAccessors.h:56
itk::Functor::PerimeterOnBorderRatioLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkShapeLabelObjectAccessors.h:270