ITK  5.0.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:
77  ITK_DISALLOW_COPY_AND_ASSIGN(ObjectMorphologyImageFilter);
78 
84 
87 
89  using InputImageType = TInputImage;
90  using OutputImageType = TOutputImage;
92  using SizeType = typename TInputImage::SizeType;
94  using PixelType = typename TInputImage::PixelType;
95 
96  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
97 
101 
103  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
104  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
105  static constexpr unsigned int KernelDimension = TKernel::NeighborhoodDimension;
106 
110 
112  using KernelType = TKernel;
113 
115  using KernelIteratorType = typename KernelType::ConstIterator;
116 
119 
121  itkSetMacro(Kernel, KernelType);
122 
124  itkGetConstReferenceMacro(Kernel, KernelType);
125 
127  itkGetConstMacro(ObjectValue, PixelType);
128 
130  itkSetMacro(ObjectValue, PixelType);
131 
137  void GenerateInputRequestedRegion() override;
138 
146  { m_BoundaryCondition = i; }
147 
150  { m_BoundaryCondition = &m_DefaultBoundaryCondition; }
151 
153  itkGetConstMacro(BoundaryCondition, ImageBoundaryConditionPointerType);
154 
159  itkSetMacro(UseBoundaryCondition, bool);
160 
165  itkGetConstMacro(UseBoundaryCondition, bool);
166 
167 #ifdef ITK_USE_CONCEPT_CHECKING
168  // Begin concept checking
169  itkConceptMacro( SameDimensionCheck1,
171  itkConceptMacro( SameDimensionCheck2,
173  itkConceptMacro( OutputInputEqualityComparableCheck,
174  ( Concept::EqualityComparable< typename TOutputImage::PixelType,
175  PixelType > ) );
176  itkConceptMacro( InputConvertibleToOutputCheck,
178  itkConceptMacro( IntConvertibleToOutputCheck,
180  itkConceptMacro( InputEqualityComparable,
182  itkConceptMacro( InputOStreamWritableCheck,
184  // End concept checking
185 #endif
186 
187 protected:
189  ~ObjectMorphologyImageFilter() override = default;
190  void PrintSelf(std::ostream & os, Indent indent) const override;
191 
193  void DynamicThreadedGenerateData(const OutputImageRegionType &) override;
194 
197  virtual void Evaluate(OutputNeighborhoodIteratorType & nit,
198  const KernelType & kernel) = 0;
199 
203  bool IsObjectPixelOnBoundary(const InputNeighborhoodIteratorType & nit);
204 
208 
211 
214 
217 
220 
221  void BeforeThreadedGenerateData() override;
222 }; // end of class
223 } // end namespace itk
224 
225 #ifndef ITK_MANUAL_INSTANTIATION
226 #include "itkObjectMorphologyImageFilter.hxx"
227 #endif
228 
229 #endif
DefaultBoundaryConditionType m_DefaultBoundaryCondition
typename KernelType::ConstIterator KernelIteratorType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
void OverrideBoundaryCondition(const ImageBoundaryConditionPointerType i)
typename OutputImageType::RegionType OutputImageRegionType
typename TInputImage::PixelType PixelType
TOutputImage OutputImageType
typename TInputImage::IndexType IndexType
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
typename TInputImage::RegionType RegionType
#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.