ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkMeanImageFunction.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 itkMeanImageFunction_h
19 #define itkMeanImageFunction_h
20 
21 #include "itkImageFunction.h"
22 #include "itkNumericTraits.h"
23 
24 namespace itk
25 {
44 template< typename TInputImage, typename TCoordRep = float >
46  public ImageFunction< TInputImage,
47  typename NumericTraits< typename TInputImage::PixelType >::RealType,
48  TCoordRep >
49 {
50 public:
51 
54  typedef ImageFunction< TInputImage,
56  TCoordRep > Superclass;
57 
60 
62  itkTypeMacro(MeanImageFunction, ImageFunction);
63 
65  itkNewMacro(Self);
66 
68  typedef TInputImage InputImageType;
69 
72 
74  typedef typename Superclass::IndexType IndexType;
75 
78 
80  typedef typename Superclass::PointType PointType;
81 
83  itkStaticConstMacro(ImageDimension, unsigned int,
84  InputImageType::ImageDimension);
85 
89 
91  virtual RealType EvaluateAtIndex(const IndexType & index) const ITK_OVERRIDE;
92 
94  virtual RealType Evaluate(const PointType & point) const ITK_OVERRIDE
95  {
96  IndexType index;
97 
98  this->ConvertPointToNearestIndex(point, index);
99  return this->EvaluateAtIndex(index);
100  }
101 
103  const ContinuousIndexType & cindex) const ITK_OVERRIDE
104  {
105  IndexType index;
106 
107  this->ConvertContinuousIndexToNearestIndex(cindex, index);
108  return this->EvaluateAtIndex(index);
109  }
110 
113  itkSetMacro(NeighborhoodRadius, unsigned int);
114  itkGetConstReferenceMacro(NeighborhoodRadius, unsigned int);
116 
117 protected:
120  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
121 
122 private:
123  MeanImageFunction(const Self &) ITK_DELETE_FUNCTION;
124  void operator=(const Self &) ITK_DELETE_FUNCTION;
125 
126  unsigned int m_NeighborhoodRadius;
127 };
128 } // end namespace itk
129 
130 #ifndef ITK_MANUAL_INSTANTIATION
131 #include "itkMeanImageFunction.hxx"
132 #endif
133 
134 #endif
SmartPointer< Self > Pointer
Light weight base class for most itk classes.
Point< TCoordRep, itkGetStaticConstMacro(ImageDimension) > PointType
Calculate the mean value in the neighborhood of a pixel.
Superclass::IndexType IndexType
Superclass::ContinuousIndexType ContinuousIndexType
void PrintSelf(std::ostream &os, Indent indent) const override
SmartPointer< const Self > ConstPointer
virtual RealType EvaluateAtIndex(const IndexType &index) const override
NumericTraits< typename InputImageType::PixelType >::RealType RealType
ImageFunction< TInputImage, typename NumericTraits< typename TInputImage::PixelType >::RealType, TCoordRep > Superclass
InputImageType::IndexType IndexType
static const unsigned int ImageDimension
Superclass::OutputType OutputType
ContinuousIndex< TCoordRep, itkGetStaticConstMacro(ImageDimension) > ContinuousIndexType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual RealType Evaluate(const PointType &point) const override
virtual RealType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const override
Superclass::PointType PointType
void ConvertContinuousIndexToNearestIndex(const ContinuousIndexType &cindex, IndexType &index) const
Evaluates a function of an image at specified position.