ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkShapeLabelObjectAccessors.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 operator()(const LabelObjectType *labelObject) const
46  {
47  return labelObject->GetNumberOfPixels();
48  }
49 };
50 
51 template< typename TLabelObject >
53 {
54 public:
55  using LabelObjectType = TLabelObject;
57 
58  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
59  {
60  return labelObject->GetBoundingBox();
61  }
62 };
63 
64 template< typename TLabelObject >
66 {
67 public:
68  using LabelObjectType = TLabelObject;
69  using AttributeValueType = double;
70 
71  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
72  {
73  return labelObject->GetPhysicalSize();
74  }
75 };
76 
77 template< typename TLabelObject >
79 {
80 public:
81  using LabelObjectType = TLabelObject;
83 
84  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
85  {
86  return labelObject->GetNumberOfPixelsOnBorder();
87  }
88 };
89 
90 template< typename TLabelObject >
92 {
93 public:
94  using LabelObjectType = TLabelObject;
95  using AttributeValueType = double;
96 
97  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
98  {
99  return labelObject->GetPerimeterOnBorder();
100  }
101 };
102 
103 template< typename TLabelObject >
105 {
106 public:
107  using LabelObjectType = TLabelObject;
108  using AttributeValueType = typename LabelObjectType::CentroidType;
109 
110  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
111  {
112  return labelObject->GetCentroid();
113  }
114 };
115 
116 template< typename TLabelObject >
118 {
119 public:
120  using LabelObjectType = TLabelObject;
121  using AttributeValueType = double;
122 
123  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
124  {
125  return labelObject->GetFeretDiameter();
126  }
127 };
128 
129 template< typename TLabelObject >
131 {
132 public:
133  using LabelObjectType = TLabelObject;
135 
136  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
137  {
138  return labelObject->GetPrincipalMoments();
139  }
140 };
141 
142 template< typename TLabelObject >
144 {
145 public:
146  using LabelObjectType = TLabelObject;
147  using AttributeValueType = typename LabelObjectType::MatrixType;
148 
149  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
150  {
151  return labelObject->GetPrincipalAxes();
152  }
153 };
154 
155 template< typename TLabelObject >
157 {
158 public:
159  using LabelObjectType = TLabelObject;
160  using AttributeValueType = double;
161 
162  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
163  {
164  return labelObject->GetElongation();
165  }
166 };
167 
168 template< typename TLabelObject >
170 {
171 public:
172  using LabelObjectType = TLabelObject;
173  using AttributeValueType = double;
174 
175  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
176  {
177  return labelObject->GetPerimeter();
178  }
179 };
180 
181 template< typename TLabelObject >
183 {
184 public:
185  using LabelObjectType = TLabelObject;
186  using AttributeValueType = double;
187 
188  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
189  {
190  return labelObject->GetRoundness();
191  }
192 };
193 
194 template< typename TLabelObject >
196 {
197 public:
198  using LabelObjectType = TLabelObject;
199  using AttributeValueType = double;
200 
201  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
202  {
203  return labelObject->GetEquivalentSphericalRadius();
204  }
205 };
206 
207 template< typename TLabelObject >
209 {
210 public:
211  using LabelObjectType = TLabelObject;
212  using AttributeValueType = double;
213 
214  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
215  {
216  return labelObject->GetEquivalentSphericalPerimeter();
217  }
218 };
219 
220 template< typename TLabelObject >
222 {
223 public:
224  using LabelObjectType = TLabelObject;
226 
227  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
228  {
229  return labelObject->GetEquivalentEllipsoidDiameter();
230  }
231 };
232 
233 template< typename TLabelObject >
235 {
236 public:
237  using LabelObjectType = TLabelObject;
238  using AttributeValueType = double;
239 
240  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
241  {
242  return labelObject->GetFlatness();
243  }
244 };
245 
246 template< typename TLabelObject >
248 {
249 public:
250  using LabelObjectType = TLabelObject;
251  using AttributeValueType = double;
252 
253  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
254  {
255  return labelObject->GetPerimeterOnBorderRatio();
256  }
257 };
258 
259 }
260 } // end namespace itk
261 
262 #endif
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
unsigned long SizeValueType
Definition: itkIntTypes.h:83
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
typename LabelObjectType::MatrixType AttributeValueType
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
typename LabelObjectType::CentroidType AttributeValueType
typename LabelObjectType::RegionType AttributeValueType
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const