15 #include "itkNaryFunctorImageFilter.h" 16 #include "itkNumericTraits.h" 28 template<
class TInput,
class TOutput >
32 typedef typename NumericTraits< TOutput >::RealType RealType;
35 inline TOutput operator()(
const std::vector< TInput > & B)
37 RealType meanVal = NumericTraits< TOutput >::Zero;
38 for(
unsigned int i=0; i< B.size(); i++ )
40 meanVal += static_cast< RealType >(B[i]);
42 meanVal = meanVal / B.size();
44 return static_cast<TOutput>( meanVal );
46 bool operator== (
const Mean&)
const 50 bool operator!= (
const Mean&)
const 80 template <
class TInputImage,
class TOutputImage>
83 NaryFunctorImageFilter<TInputImage,TOutputImage,
84 Functor::Mean<typename TInputImage::PixelType, typename TOutputImage::PixelType > >
89 typedef NaryFunctorImageFilter<TInputImage,TOutputImage,
91 typename TInputImage::PixelType > > Superclass;
92 typedef SmartPointer<Self> Pointer;
93 typedef SmartPointer<const Self> ConstPointer;
100 NaryFunctorImageFilter);
102 #ifdef ITK_USE_CONCEPT_CHECKING 104 itkConceptMacro(InputConvertibleToOutputCheck,
105 (Concept::Convertible<
typename TInputImage::PixelType,
106 typename TOutputImage::PixelType>));
107 itkConceptMacro(InputHasZeroCheck,
108 (Concept::HasZero<typename TInputImage::PixelType>));
117 NaryMeanImageFilter(
const Self&);
118 void operator=(
const Self&);
Helper class for calculating mean of images which interfaces with NaryMeanImageFilter.
Definition: itkNaryMeanImageFilter.h:29
NaryMeanImageFilter Self
Standard class typedefs.
Definition: itkNaryMeanImageFilter.h:88
Implements an operator for pixel-wise averaging of two images.
Definition: itkNaryMeanImageFilter.h:81