ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkMorphologyImageFilter.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 __itkMorphologyImageFilter_h
19 #define __itkMorphologyImageFilter_h
20 
21 #include "itkKernelImageFilter.h"
23 #include "itkNeighborhood.h"
24 #include "itkConstSliceIterator.h"
26 #include "itkImageRegionIterator.h"
27 
28 namespace itk
29 {
71 template< class TInputImage, class TOutputImage, class TKernel >
72 class ITK_EXPORT MorphologyImageFilter:
73  public KernelImageFilter< TInputImage, TOutputImage, TKernel >
74 {
75 public:
81 
84 
86  typedef TInputImage InputImageType;
87  typedef TOutputImage OutputImageType;
88  typedef typename TInputImage::RegionType RegionType;
89  typedef typename TInputImage::SizeType SizeType;
90  typedef typename TInputImage::IndexType IndexType;
91  typedef typename TInputImage::PixelType PixelType;
92  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
93 
95  itkStaticConstMacro(ImageDimension, unsigned int,
96  TInputImage::ImageDimension);
97 
102 
105 
107  typedef TKernel KernelType;
108 
110  typedef typename KernelType::ConstIterator KernelIteratorType;
111 
113  typedef typename KernelType::SizeType RadiusType;
114 
120  void OverrideBoundaryCondition(const ImageBoundaryConditionPointerType i)
121  {
122  m_BoundaryCondition = i;
123  }
124 
126  void ResetBoundaryCondition()
127  {
128  m_BoundaryCondition = &m_DefaultBoundaryCondition;
129  }
130 
132  itkGetConstMacro(BoundaryCondition, ImageBoundaryConditionPointerType);
133 protected:
136  void PrintSelf(std::ostream & os, Indent indent) const;
138 
140  void ThreadedGenerateData(const OutputImageRegionType &
141  outputRegionForThread,
142  ThreadIdType threadId);
143 
146  virtual PixelType Evaluate(const NeighborhoodIteratorType & nit,
147  const KernelIteratorType kernelBegin,
148  const KernelIteratorType kernelEnd) = 0;
149 
150 private:
151  MorphologyImageFilter(const Self &); //purposely not implemented
152  void operator=(const Self &); //purposely not implemented
153 
157 
160 }; // end of class
161 } // end namespace itk
162 
163 #ifndef ITK_MANUAL_INSTANTIATION
164 #include "itkMorphologyImageFilter.hxx"
165 #endif
166 
167 #endif
168