ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkObjectMorphologyImageFilter.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 __itkObjectMorphologyImageFilter_h
19 #define __itkObjectMorphologyImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
23 #include "itkConstSliceIterator.h"
25 #include "itkImageRegionIterator.h"
26 
27 namespace itk
28 {
72 template< class TInputImage, class TOutputImage, class TKernel >
73 class ITK_EXPORT ObjectMorphologyImageFilter:
74  public ImageToImageFilter< TInputImage, TOutputImage >
75 {
76 public:
82 
85 
87  typedef TInputImage InputImageType;
88  typedef TOutputImage OutputImageType;
89  typedef typename TInputImage::RegionType RegionType;
90  typedef typename TInputImage::SizeType SizeType;
91  typedef typename TInputImage::IndexType IndexType;
92  typedef typename TInputImage::PixelType PixelType;
93 
94  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
95 
102 
104  itkStaticConstMacro(ImageDimension, unsigned int,
105  TInputImage::ImageDimension);
106  itkStaticConstMacro(OutputImageDimension, unsigned int,
107  TOutputImage::ImageDimension);
108  itkStaticConstMacro(KernelDimension, unsigned int,
109  TKernel::NeighborhoodDimension);
111 
117 
119  typedef TKernel KernelType;
120 
122  typedef typename KernelType::ConstIterator KernelIteratorType;
123 
125  typedef typename KernelType::SizeType RadiusType;
126 
128  itkSetMacro(Kernel, KernelType);
129 
131  itkGetConstReferenceMacro(Kernel, KernelType);
132 
134  itkGetConstMacro(ObjectValue, PixelType);
135 
137  itkSetMacro(ObjectValue, PixelType);
138 
144  void GenerateInputRequestedRegion();
145 
152  void OverrideBoundaryCondition(const ImageBoundaryConditionPointerType i)
153  { m_BoundaryCondition = i; }
154 
156  void ResetBoundaryCondition()
157  { m_BoundaryCondition = &m_DefaultBoundaryCondition; }
158 
160  itkGetConstMacro(BoundaryCondition, ImageBoundaryConditionPointerType);
161 
166  itkSetMacro(UseBoundaryCondition, bool);
167 
172  itkGetConstMacro(UseBoundaryCondition, bool);
173 
174 #ifdef ITK_USE_CONCEPT_CHECKING
175 
176  itkConceptMacro( SameDimensionCheck1,
178  itkConceptMacro( SameDimensionCheck2,
180  itkConceptMacro( OutputInputEqualityComparableCheck,
181  ( Concept::EqualityComparable< typename TOutputImage::PixelType,
182  PixelType > ) );
183  itkConceptMacro( InputConvertibleToOutputCheck,
185  itkConceptMacro( IntConvertibleToOutputCheck,
187  itkConceptMacro( InputEqualityComparable,
189  itkConceptMacro( InputOStreamWritableCheck,
191 
193 #endif
194 
195 protected:
198  void PrintSelf(std::ostream & os, Indent indent) const;
199 
201  void ThreadedGenerateData(const OutputImageRegionType &
202  outputRegionForThread,
203  ThreadIdType threadId);
204 
207  virtual void Evaluate(OutputNeighborhoodIteratorType & nit,
208  const KernelType & kernel) = 0;
209 
213  bool IsObjectPixelOnBoundary(const InputNeighborhoodIteratorType & nit);
214 
218 
221 
224 
227 
230 
231  void BeforeThreadedGenerateData();
232 
233 private:
234  ObjectMorphologyImageFilter(const Self &); //purposely not implemented
235  void operator=(const Self &); //purposely not implemented
236 }; // end of class
237 } // end namespace itk
238 
239 #ifndef ITK_MANUAL_INSTANTIATION
240 #include "itkObjectMorphologyImageFilter.hxx"
241 #endif
242 
243 #endif
244