ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkVectorMeanImageFunction.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 __itkVectorMeanImageFunction_h
19 #define __itkVectorMeanImageFunction_h
20 
21 #include "itkImageFunction.h"
22 #include "itkNumericTraits.h"
23 
24 namespace itk
25 {
44 template< class TInputImage, class TCoordRep = float >
45 class ITK_EXPORT VectorMeanImageFunction:
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 
63 
65  itkNewMacro(Self);
66 
68  typedef TInputImage InputImageType;
69 
71  typedef typename Superclass::OutputType OutputType;
72 
74  typedef typename Superclass::IndexType IndexType;
75 
77  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
78 
80  typedef typename Superclass::PointType PointType;
81 
83  itkStaticConstMacro(ImageDimension, unsigned int,
84  InputImageType::ImageDimension);
85 
88 
90  virtual RealType EvaluateAtIndex(const IndexType & index) const;
91 
93  virtual RealType Evaluate(const PointType & point) const
94  {
95  IndexType index;
96 
97  this->ConvertPointToNearestIndex(point, index);
98  return this->EvaluateAtIndex(index);
99  }
100 
101  virtual RealType EvaluateAtContinuousIndex(
102  const ContinuousIndexType & cindex) const
103  {
104  IndexType index;
105 
106  this->ConvertContinuousIndexToNearestIndex(cindex, index);
107  return this->EvaluateAtIndex(index);
108  }
109 
112  itkSetMacro(NeighborhoodRadius, unsigned int);
113  itkGetConstReferenceMacro(NeighborhoodRadius, unsigned int);
114 protected:
117  void PrintSelf(std::ostream & os, Indent indent) const;
119 
120 private:
121  VectorMeanImageFunction(const Self &); //purposely not implemented
122  void operator=(const Self &); //purposely not implemented
123 
124  unsigned int m_NeighborhoodRadius;
125 };
126 } // end namespace itk
127 
128 // Define instantiation macro for this template.
129 #define ITK_TEMPLATE_VectorMeanImageFunction(_, EXPORT, TypeX, TypeY) \
130  namespace itk \
131  { \
132  _( 2 ( class EXPORT VectorMeanImageFunction< ITK_TEMPLATE_2 TypeX > ) ) \
133  namespace Templates \
134  { \
135  typedef VectorMeanImageFunction< ITK_TEMPLATE_2 TypeX > \
136  VectorMeanImageFunction##TypeY; \
137  } \
138  }
139 
140 #if ITK_TEMPLATE_EXPLICIT
141 #include "Templates/itkVectorMeanImageFunction+-.h"
142 #endif
143 
144 #if ITK_TEMPLATE_TXX
145 #include "itkVectorMeanImageFunction.hxx"
146 #endif
147 
148 #endif
149