ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkStatisticsLabelObjectAccessors.h
Go to the documentation of this file.
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 __itkStatisticsLabelObjectAccessors_h
00019 #define __itkStatisticsLabelObjectAccessors_h
00020 #include "itkShapeLabelObjectAccessors.h"
00021 
00022 /*
00023  *
00024  * This code was contributed in the Insight Journal paper:
00025  * "Label object representation and manipulation with ITK"
00026  * by Lehmann G.
00027  * http://hdl.handle.net/1926/584
00028  * http://www.insight-journal.org/browse/publication/176
00029  *
00030  */
00031 
00032 namespace itk
00033 {
00034 namespace Functor
00035 {
00036 template< class TLabelObject >
00037 class ITK_EXPORT MinimumLabelObjectAccessor
00038 {
00039 public:
00040   typedef TLabelObject LabelObjectType;
00041   typedef double       AttributeValueType;
00042 
00043   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00044   {
00045     return labelObject->GetMinimum();
00046   }
00047 };
00048 
00049 template< class TLabelObject >
00050 class ITK_EXPORT MaximumLabelObjectAccessor
00051 {
00052 public:
00053   typedef TLabelObject LabelObjectType;
00054   typedef double       AttributeValueType;
00055 
00056   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00057   {
00058     return labelObject->GetMaximum();
00059   }
00060 };
00061 
00062 template< class TLabelObject >
00063 class ITK_EXPORT MeanLabelObjectAccessor
00064 {
00065 public:
00066   typedef TLabelObject LabelObjectType;
00067   typedef double       AttributeValueType;
00068 
00069   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00070   {
00071     return labelObject->GetMean();
00072   }
00073 };
00074 
00075 template< class TLabelObject >
00076 class ITK_EXPORT SumLabelObjectAccessor
00077 {
00078 public:
00079   typedef TLabelObject LabelObjectType;
00080   typedef double       AttributeValueType;
00081 
00082   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00083   {
00084     return labelObject->GetSum();
00085   }
00086 };
00087 
00088 template< class TLabelObject >
00089 class ITK_EXPORT StandardDeviationLabelObjectAccessor
00090 {
00091 public:
00092   typedef TLabelObject LabelObjectType;
00093   typedef double       AttributeValueType;
00094 
00095   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00096   {
00097     return labelObject->GetStandardDeviation();
00098   }
00099 };
00100 
00101 template< class TLabelObject >
00102 class ITK_EXPORT VarianceLabelObjectAccessor
00103 {
00104 public:
00105   typedef TLabelObject LabelObjectType;
00106   typedef double       AttributeValueType;
00107 
00108   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00109   {
00110     return labelObject->GetVariance();
00111   }
00112 };
00113 
00114 template< class TLabelObject >
00115 class ITK_EXPORT MedianLabelObjectAccessor
00116 {
00117 public:
00118   typedef TLabelObject LabelObjectType;
00119   typedef double       AttributeValueType;
00120 
00121   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00122   {
00123     return labelObject->GetMedian();
00124   }
00125 };
00126 
00127 template< class TLabelObject >
00128 class ITK_EXPORT MaximumIndexLabelObjectAccessor
00129 {
00130 public:
00131   typedef TLabelObject                        LabelObjectType;
00132   typedef typename LabelObjectType::IndexType AttributeValueType;
00133 
00134   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00135   {
00136     return labelObject->GetMaximumIndex();
00137   }
00138 };
00139 
00140 template< class TLabelObject >
00141 class ITK_EXPORT MinimumIndexLabelObjectAccessor
00142 {
00143 public:
00144   typedef TLabelObject                        LabelObjectType;
00145   typedef typename LabelObjectType::IndexType AttributeValueType;
00146 
00147   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00148   {
00149     return labelObject->GetMinimumIndex();
00150   }
00151 };
00152 
00153 template< class TLabelObject >
00154 class ITK_EXPORT CenterOfGravityLabelObjectAccessor
00155 {
00156 public:
00157   typedef TLabelObject                        LabelObjectType;
00158   typedef typename LabelObjectType::PointType AttributeValueType;
00159 
00160   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00161   {
00162     return labelObject->GetCenterOfGravity();
00163   }
00164 };
00165 
00166 /*
00167 template< class TLabelObject >
00168 class ITK_EXPORT CentralMomentsLabelObjectAccessor
00169 {
00170 public:
00171   typedef TLabelObject LabelObjectType;
00172   typedef typename LabelObjectType::MatrixType AttributeValueType;
00173 
00174   inline AttributeValueType operator()( const LabelObjectType * labelObject ) const
00175     {
00176     return labelObject->GetCentralMoments();
00177     }
00178   };
00179 */
00180 
00181 template< class TLabelObject >
00182 class ITK_EXPORT WeightedPrincipalMomentsLabelObjectAccessor
00183 {
00184 public:
00185   typedef TLabelObject                         LabelObjectType;
00186   typedef typename LabelObjectType::VectorType AttributeValueType;
00187 
00188   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00189   {
00190     return labelObject->GetWeightedPrincipalMoments();
00191   }
00192 };
00193 
00194 template< class TLabelObject >
00195 class ITK_EXPORT WeightedPrincipalAxesLabelObjectAccessor
00196 {
00197 public:
00198   typedef TLabelObject                         LabelObjectType;
00199   typedef typename LabelObjectType::MatrixType AttributeValueType;
00200 
00201   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00202   {
00203     return labelObject->GetWeightedPrincipalAxes();
00204   }
00205 };
00206 
00207 template< class TLabelObject >
00208 class ITK_EXPORT KurtosisLabelObjectAccessor
00209 {
00210 public:
00211   typedef TLabelObject LabelObjectType;
00212   typedef double       AttributeValueType;
00213 
00214   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00215   {
00216     return labelObject->GetKurtosis();
00217   }
00218 };
00219 
00220 template< class TLabelObject >
00221 class ITK_EXPORT SkewnessLabelObjectAccessor
00222 {
00223 public:
00224   typedef TLabelObject LabelObjectType;
00225   typedef double       AttributeValueType;
00226 
00227   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00228   {
00229     return labelObject->GetSkewness();
00230   }
00231 };
00232 
00233 template< class TLabelObject >
00234 class ITK_EXPORT WeightedElongationLabelObjectAccessor
00235 {
00236 public:
00237   typedef TLabelObject LabelObjectType;
00238   typedef double       AttributeValueType;
00239 
00240   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00241   {
00242     return labelObject->GetWeightedElongation();
00243   }
00244 };
00245 
00246 template< class TLabelObject >
00247 class ITK_EXPORT HistogramLabelObjectAccessor
00248 {
00249 public:
00250   typedef TLabelObject LabelObjectType;
00251 
00252   typedef typename LabelObjectType::HistogramType *AttributeValueType;
00253 
00254   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00255   {
00256     return labelObject->GetHistogram();
00257   }
00258 };
00259 
00260 template< class TLabelObject >
00261 class ITK_EXPORT WeightedFlatnessLabelObjectAccessor
00262 {
00263 public:
00264   typedef TLabelObject LabelObjectType;
00265   typedef double       AttributeValueType;
00266 
00267   inline AttributeValueType operator()(const LabelObjectType *labelObject) const
00268   {
00269     return labelObject->GetWeightedFlatness();
00270   }
00271 };
00272 }
00273 } // end namespace itk
00274 
00275 #endif
00276