ITK  4.13.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< typename TInputImage, typename TOutputImage, typename TKernel >
73 class ITK_TEMPLATE_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;
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 
126 
128  itkSetMacro(Kernel, KernelType);
129 
131  itkGetConstReferenceMacro(Kernel, KernelType);
132 
134  itkGetConstMacro(ObjectValue, PixelType);
135 
137  itkSetMacro(ObjectValue, PixelType);
138 
144  void GenerateInputRequestedRegion() ITK_OVERRIDE;
145 
152  void OverrideBoundaryCondition(const ImageBoundaryConditionPointerType i)
153  { m_BoundaryCondition = i; }
154 
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  // Begin concept checking
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  // End concept checking
192 #endif
193 
194 protected:
197  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
198 
200  void ThreadedGenerateData(const OutputImageRegionType &
201  outputRegionForThread,
202  ThreadIdType threadId) ITK_OVERRIDE;
203 
206  virtual void Evaluate(OutputNeighborhoodIteratorType & nit,
207  const KernelType & kernel) = 0;
208 
212  bool IsObjectPixelOnBoundary(const InputNeighborhoodIteratorType & nit);
213 
217 
220 
223 
226 
229 
230  void BeforeThreadedGenerateData() ITK_OVERRIDE;
231 
232 private:
233  ITK_DISALLOW_COPY_AND_ASSIGN(ObjectMorphologyImageFilter);
234 }; // end of class
235 } // end namespace itk
236 
237 #ifndef ITK_MANUAL_INSTANTIATION
238 #include "itkObjectMorphologyImageFilter.hxx"
239 #endif
240 
241 #endif
Superclass::OutputImageRegionType OutputImageRegionType
ConstantBoundaryCondition< InputImageType > DefaultBoundaryConditionType
ImageBoundaryCondition< InputImageType > const * ImageBoundaryConditionConstPointerType
DefaultBoundaryConditionType m_DefaultBoundaryCondition
NeighborhoodIterator< TOutputImage > OutputNeighborhoodIteratorType
ImageToImageFilter< TInputImage, TOutputImage > Superclass
ImageBoundaryCondition< InputImageType > * ImageBoundaryConditionPointerType
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
ConstNeighborhoodIterator< TInputImage > InputNeighborhoodIteratorType
ImageBoundaryConditionPointerType m_BoundaryCondition
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
#define itkConceptMacro(name, concept)
Base class for the morphological operations being applied to isolated objects in an image...
Defines iteration of a local N-dimensional neighborhood of pixels across an itk::Image.