ITK  5.2.0
Insight Toolkit
itkObjectMorphologyImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 {
73 template <typename TInputImage, typename TOutputImage, typename TKernel>
74 class ITK_TEMPLATE_EXPORT ObjectMorphologyImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
75 {
76 public:
77  ITK_DISALLOW_COPY_AND_MOVE(ObjectMorphologyImageFilter);
79 
85 
88 
90  using InputImageType = TInputImage;
91  using OutputImageType = TOutputImage;
93  using SizeType = typename TInputImage::SizeType;
95  using PixelType = typename TInputImage::PixelType;
96 
97  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
98 
102 
104  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
105  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
106  static constexpr unsigned int KernelDimension = TKernel::NeighborhoodDimension;
107 
111 
113  using KernelType = TKernel;
114 
116  using KernelIteratorType = typename KernelType::ConstIterator;
117 
120 
122  itkSetMacro(Kernel, KernelType);
123 
125  itkGetConstReferenceMacro(Kernel, KernelType);
126 
128  itkGetConstMacro(ObjectValue, PixelType);
129 
131  itkSetMacro(ObjectValue, PixelType);
132 
138  void
139  GenerateInputRequestedRegion() override;
140 
147  void
149  {
150  m_BoundaryCondition = i;
151  }
152 
154  void
156  {
157  m_BoundaryCondition = &m_DefaultBoundaryCondition;
158  }
159 
161  itkGetConstMacro(BoundaryCondition, ImageBoundaryConditionPointerType);
162 
167  itkSetMacro(UseBoundaryCondition, bool);
168 
173  itkGetConstMacro(UseBoundaryCondition, bool);
174 
175 #ifdef ITK_USE_CONCEPT_CHECKING
176  // Begin concept checking
179  itkConceptMacro(OutputInputEqualityComparableCheck,
183  itkConceptMacro(InputEqualityComparable, (Concept::EqualityComparable<PixelType>));
184  itkConceptMacro(InputOStreamWritableCheck, (Concept::OStreamWritable<PixelType>));
185  // End concept checking
186 #endif
187 
188 protected:
190  ~ObjectMorphologyImageFilter() override = default;
191  void
192  PrintSelf(std::ostream & os, Indent indent) const override;
193 
195  void
196  DynamicThreadedGenerateData(const OutputImageRegionType &) override;
197 
200  virtual void
201  Evaluate(OutputNeighborhoodIteratorType & nit, const KernelType & kernel) = 0;
202 
206  bool
207  IsObjectPixelOnBoundary(const InputNeighborhoodIteratorType & nit);
208 
212 
215 
218 
221 
224 
225  void
226  BeforeThreadedGenerateData() override;
227 }; // end of class
228 } // end namespace itk
229 
230 #ifndef ITK_MANUAL_INSTANTIATION
231 # include "itkObjectMorphologyImageFilter.hxx"
232 #endif
233 
234 #endif
itk::ObjectMorphologyImageFilter::OverrideBoundaryCondition
void OverrideBoundaryCondition(const ImageBoundaryConditionPointerType i)
Definition: itkObjectMorphologyImageFilter.h:148
itk::ObjectMorphologyImageFilter::m_DefaultBoundaryCondition
DefaultBoundaryConditionType m_DefaultBoundaryCondition
Definition: itkObjectMorphologyImageFilter.h:214
itk::ObjectMorphologyImageFilter::RegionType
typename TInputImage::RegionType RegionType
Definition: itkObjectMorphologyImageFilter.h:92
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:634
itkNeighborhoodIterator.h
itk::ObjectMorphologyImageFilter::m_Kernel
KernelType m_Kernel
Definition: itkObjectMorphologyImageFilter.h:220
itk::ObjectMorphologyImageFilter::PixelType
typename TInputImage::PixelType PixelType
Definition: itkObjectMorphologyImageFilter.h:95
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::ObjectMorphologyImageFilter::KernelType
TKernel KernelType
Definition: itkObjectMorphologyImageFilter.h:113
itk::SmartPointer< Self >
itkImageRegionIterator.h
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkConstSliceIterator.h
itkConstantBoundaryCondition.h
itk::ObjectMorphologyImageFilter::m_BoundaryCondition
ImageBoundaryConditionPointerType m_BoundaryCondition
Definition: itkObjectMorphologyImageFilter.h:211
itk::Concept::SameDimension
Definition: itkConceptChecking.h:692
itk::ImageBoundaryCondition< InputImageType >
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ConstantBoundaryCondition< InputImageType >
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ObjectMorphologyImageFilter::ResetBoundaryCondition
void ResetBoundaryCondition()
Definition: itkObjectMorphologyImageFilter.h:155
itk::ObjectMorphologyImageFilter::m_UseBoundaryCondition
bool m_UseBoundaryCondition
Definition: itkObjectMorphologyImageFilter.h:217
itk::ObjectMorphologyImageFilter::KernelIteratorType
typename KernelType::ConstIterator KernelIteratorType
Definition: itkObjectMorphologyImageFilter.h:116
itk::ObjectMorphologyImageFilter::m_ObjectValue
PixelType m_ObjectValue
Definition: itkObjectMorphologyImageFilter.h:223
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkImageToImageFilter.h
itk::ObjectMorphologyImageFilter::RadiusType
typename KernelType::SizeType RadiusType
Definition: itkObjectMorphologyImageFilter.h:119
itk::NeighborhoodIterator
Defines iteration of a local N-dimensional neighborhood of pixels across an itk::Image.
Definition: itkNeighborhoodIterator.h:211
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:64
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ConstNeighborhoodIterator< TInputImage >
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::Concept::Convertible
Definition: itkConceptChecking.h:214
itk::ObjectMorphologyImageFilter::SizeType
typename TInputImage::SizeType SizeType
Definition: itkObjectMorphologyImageFilter.h:93
itk::ObjectMorphologyImageFilter::IndexType
typename TInputImage::IndexType IndexType
Definition: itkObjectMorphologyImageFilter.h:94
itk::Concept::EqualityComparable
Definition: itkConceptChecking.h:304
itk::ObjectMorphologyImageFilter
Base class for the morphological operations being applied to isolated objects in an image.
Definition: itkObjectMorphologyImageFilter.h:74
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90