ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkShapeLabelObjectAccessors_h 00019 #define __itkShapeLabelObjectAccessors_h 00020 00021 #include "itkLabelObjectAccessors.h" 00022 #include "itkIntTypes.h" 00023 00024 /* 00025 * 00026 * This code was contributed in the Insight Journal paper: 00027 * "Label object representation and manipulation with ITK" 00028 * by Lehmann G. 00029 * http://hdl.handle.net/1926/584 00030 * http://www.insight-journal.org/browse/publication/176 00031 * 00032 */ 00033 00034 namespace itk 00035 { 00036 namespace Functor 00037 { 00038 template< class TLabelObject > 00039 class ITK_EXPORT NumberOfPixelsLabelObjectAccessor 00040 { 00041 public: 00042 typedef TLabelObject LabelObjectType; 00043 typedef SizeValueType AttributeValueType; 00044 00045 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00046 { 00047 return labelObject->GetNumberOfPixels(); 00048 } 00049 }; 00050 00051 template< class TLabelObject > 00052 class ITK_EXPORT BoundingBoxLabelObjectAccessor 00053 { 00054 public: 00055 typedef TLabelObject LabelObjectType; 00056 typedef typename LabelObjectType::RegionType AttributeValueType; 00057 00058 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00059 { 00060 return labelObject->GetBoundingBox(); 00061 } 00062 }; 00063 00064 template< class TLabelObject > 00065 class ITK_EXPORT PhysicalSizeLabelObjectAccessor 00066 { 00067 public: 00068 typedef TLabelObject LabelObjectType; 00069 typedef double AttributeValueType; 00070 00071 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00072 { 00073 return labelObject->GetPhysicalSize(); 00074 } 00075 }; 00076 00077 template< class TLabelObject > 00078 class ITK_EXPORT NumberOfPixelsOnBorderLabelObjectAccessor 00079 { 00080 public: 00081 typedef TLabelObject LabelObjectType; 00082 typedef SizeValueType AttributeValueType; 00083 00084 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00085 { 00086 return labelObject->GetNumberOfPixelsOnBorder(); 00087 } 00088 }; 00089 00090 template< class TLabelObject > 00091 class ITK_EXPORT PerimeterOnBorderLabelObjectAccessor 00092 { 00093 public: 00094 typedef TLabelObject LabelObjectType; 00095 typedef double AttributeValueType; 00096 00097 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00098 { 00099 return labelObject->GetPerimeterOnBorder(); 00100 } 00101 }; 00102 00103 template< class TLabelObject > 00104 class ITK_EXPORT CentroidLabelObjectAccessor 00105 { 00106 public: 00107 typedef TLabelObject LabelObjectType; 00108 typedef typename LabelObjectType::CentroidType AttributeValueType; 00109 00110 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00111 { 00112 return labelObject->GetCentroid(); 00113 } 00114 }; 00115 00116 template< class TLabelObject > 00117 class ITK_EXPORT FeretDiameterLabelObjectAccessor 00118 { 00119 public: 00120 typedef TLabelObject LabelObjectType; 00121 typedef double AttributeValueType; 00122 00123 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00124 { 00125 return labelObject->GetFeretDiameter(); 00126 } 00127 }; 00128 00129 template< class TLabelObject > 00130 class ITK_EXPORT PrincipalMomentsLabelObjectAccessor 00131 { 00132 public: 00133 typedef TLabelObject LabelObjectType; 00134 typedef typename LabelObjectType::VectorType AttributeValueType; 00135 00136 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00137 { 00138 return labelObject->GetPrincipalMoments(); 00139 } 00140 }; 00141 00142 template< class TLabelObject > 00143 class ITK_EXPORT PrincipalAxesLabelObjectAccessor 00144 { 00145 public: 00146 typedef TLabelObject LabelObjectType; 00147 typedef typename LabelObjectType::MatrixType AttributeValueType; 00148 00149 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00150 { 00151 return labelObject->GetPrincipalAxes(); 00152 } 00153 }; 00154 00155 template< class TLabelObject > 00156 class ITK_EXPORT ElongationLabelObjectAccessor 00157 { 00158 public: 00159 typedef TLabelObject LabelObjectType; 00160 typedef double AttributeValueType; 00161 00162 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00163 { 00164 return labelObject->GetElongation(); 00165 } 00166 }; 00167 00168 template< class TLabelObject > 00169 class ITK_EXPORT PerimeterLabelObjectAccessor 00170 { 00171 public: 00172 typedef TLabelObject LabelObjectType; 00173 typedef double AttributeValueType; 00174 00175 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00176 { 00177 return labelObject->GetPerimeter(); 00178 } 00179 }; 00180 00181 template< class TLabelObject > 00182 class ITK_EXPORT RoundnessLabelObjectAccessor 00183 { 00184 public: 00185 typedef TLabelObject LabelObjectType; 00186 typedef double AttributeValueType; 00187 00188 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00189 { 00190 return labelObject->GetRoundness(); 00191 } 00192 }; 00193 00194 template< class TLabelObject > 00195 class ITK_EXPORT EquivalentSphericalRadiusLabelObjectAccessor 00196 { 00197 public: 00198 typedef TLabelObject LabelObjectType; 00199 typedef double AttributeValueType; 00200 00201 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00202 { 00203 return labelObject->GetEquivalentSphericalRadius(); 00204 } 00205 }; 00206 00207 template< class TLabelObject > 00208 class ITK_EXPORT EquivalentSphericalPerimeterLabelObjectAccessor 00209 { 00210 public: 00211 typedef TLabelObject LabelObjectType; 00212 typedef double AttributeValueType; 00213 00214 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00215 { 00216 return labelObject->GetEquivalentSphericalPerimeter(); 00217 } 00218 }; 00219 00220 template< class TLabelObject > 00221 class ITK_EXPORT EquivalentEllipsoidDiameterLabelObjectAccessor 00222 { 00223 public: 00224 typedef TLabelObject LabelObjectType; 00225 typedef typename LabelObjectType::VectorType AttributeValueType; 00226 00227 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00228 { 00229 return labelObject->GetEquivalentEllipsoidDiameter(); 00230 } 00231 }; 00232 00233 template< class TLabelObject > 00234 class ITK_EXPORT FlatnessLabelObjectAccessor 00235 { 00236 public: 00237 typedef TLabelObject LabelObjectType; 00238 typedef double AttributeValueType; 00239 00240 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00241 { 00242 return labelObject->GetFlatness(); 00243 } 00244 }; 00245 00246 template< class TLabelObject > 00247 class ITK_EXPORT PerimeterOnBorderRatioLabelObjectAccessor 00248 { 00249 public: 00250 typedef TLabelObject LabelObjectType; 00251 typedef double AttributeValueType; 00252 00253 inline AttributeValueType operator()(const LabelObjectType *labelObject) const 00254 { 00255 return labelObject->GetPerimeterOnBorderRatio(); 00256 } 00257 }; 00258 00259 } 00260 } // end namespace itk 00261 00262 #endif 00263