ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkMedianImageFunction.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 __itkMedianImageFunction_h
19 #define __itkMedianImageFunction_h
20 
21 #include "itkImageFunction.h"
22 #include "itkNumericTraits.h"
23 
24 namespace itk
25 {
46 template< typename TInputImage, typename TCoordRep = float >
48  public ImageFunction< TInputImage, typename TInputImage::PixelType,
49  TCoordRep >
50 {
51 public:
52 
55  typedef ImageFunction< TInputImage, typename TInputImage::PixelType,
56  TCoordRep > Superclass;
57 
60 
62  itkTypeMacro(MedianImageFunction, ImageFunction);
63 
65  itkNewMacro(Self);
66 
68  typedef TInputImage InputImageType;
70 
73 
75  typedef typename Superclass::IndexType IndexType;
76 
79 
81  typedef typename Superclass::PointType PointType;
82 
84  itkStaticConstMacro(ImageDimension, unsigned int,
85  InputImageType::ImageDimension);
86 
88  virtual OutputType EvaluateAtIndex(const IndexType & index) const;
89 
91  virtual OutputType Evaluate(const PointType & point) const
92  {
93  IndexType index;
94 
95  this->ConvertPointToNearestIndex(point, index);
96  return this->EvaluateAtIndex(index);
97  }
98 
100  const ContinuousIndexType & cindex) const
101  {
102  IndexType index;
103 
104  this->ConvertContinuousIndexToNearestIndex(cindex, index);
105  return this->EvaluateAtIndex(index);
106  }
107 
110  itkSetMacro( NeighborhoodRadius, unsigned int );
111  itkGetConstReferenceMacro( NeighborhoodRadius, unsigned int );
113 
114 protected:
117  void PrintSelf(std::ostream & os, Indent indent) const;
118 
119 private:
120  MedianImageFunction(const Self &); //purposely not implemented
121  void operator=(const Self &); //purposely not implemented
122 
123  unsigned int m_NeighborhoodRadius;
124 
125 };
126 } // end namespace itk
127 
128 #ifndef ITK_MANUAL_INSTANTIATION
129 #include "itkMedianImageFunction.hxx"
130 #endif
131 
132 #endif
void PrintSelf(std::ostream &os, Indent indent) const
Superclass::IndexType IndexType
Light weight base class for most itk classes.
Point< TCoordRep, itkGetStaticConstMacro(ImageDimension) > PointType
SmartPointer< const Self > ConstPointer
void ConvertPointToNearestIndex(const PointType &point, IndexType &index) const
static const unsigned int ImageDimension
ImageFunction< TInputImage, typename TInputImage::PixelType, TCoordRep > Superclass
Superclass::InputPixelType InputPixelType
InputImageType::PixelType InputPixelType
InputImageType::IndexType IndexType
virtual OutputType Evaluate(const PointType &point) const
Calculate the median value in the neighborhood of a pixel.
ContinuousIndex< TCoordRep, itkGetStaticConstMacro(ImageDimension) > ContinuousIndexType
virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const
virtual OutputType EvaluateAtIndex(const IndexType &index) const
Superclass::OutputType OutputType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
void ConvertContinuousIndexToNearestIndex(const ContinuousIndexType &cindex, IndexType &index) const
Superclass::ContinuousIndexType ContinuousIndexType
Evaluates a function of an image at specified position.
SmartPointer< Self > Pointer
void operator=(const Self &)
Superclass::PointType PointType