ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkNeighborhoodConnectedImageFilter.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 itkNeighborhoodConnectedImageFilter_h
19 #define itkNeighborhoodConnectedImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 
23 namespace itk
24 {
35 template< typename TInputImage, typename TOutputImage >
36 class ITK_TEMPLATE_EXPORT NeighborhoodConnectedImageFilter:
37  public ImageToImageFilter< TInputImage, TOutputImage >
38 {
39 public:
40  ITK_DISALLOW_COPY_AND_ASSIGN(NeighborhoodConnectedImageFilter);
41 
47 
49  itkNewMacro(Self);
50 
54 
55  using InputImageType = TInputImage;
56  using InputImagePointer = typename InputImageType::Pointer;
58  using InputImagePixelType = typename InputImageType::PixelType;
61 
62  using OutputImageType = TOutputImage;
63  using OutputImagePointer = typename OutputImageType::Pointer;
65  using OutputImagePixelType = typename OutputImageType::PixelType;
66 
67  void PrintSelf(std::ostream & os, Indent indent) const override;
68 
70  void ClearSeeds();
71 
73  void SetSeed(const IndexType & seed);
74 
76  void AddSeed(const IndexType & seed);
77 
79  itkSetMacro(Lower, InputImagePixelType);
80  itkGetConstMacro(Lower, InputImagePixelType);
82 
85  itkSetMacro(Upper, InputImagePixelType);
86  itkGetConstMacro(Upper, InputImagePixelType);
88 
92  itkSetMacro(ReplaceValue, OutputImagePixelType);
93  itkGetConstMacro(ReplaceValue, OutputImagePixelType);
95 
97  itkSetMacro(Radius, InputImageSizeType);
98 
100  itkGetConstReferenceMacro(Radius, InputImageSizeType);
101 
103  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
104  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
105 
106 #ifdef ITK_USE_CONCEPT_CHECKING
107  // Begin concept checking
108  itkConceptMacro( InputEqualityComparableCheck,
110  itkConceptMacro( OutputEqualityComparableCheck,
112  itkConceptMacro( SameDimensionCheck,
114  itkConceptMacro( InputOStreamWritableCheck,
116  itkConceptMacro( OutputOStreamWritableCheck,
118  // End concept checking
119 #endif
120 
121 protected:
123  ~NeighborhoodConnectedImageFilter() override = default;
124  std::vector< IndexType > m_Seeds;
125 
128 
130 
132 
133  // Override since the filter needs all the data for the algorithm
134  void GenerateInputRequestedRegion() override;
135 
136  // Override since the filter produces the entire dataset
137  void EnlargeOutputRequestedRegion(DataObject *output) override;
138 
139  void GenerateData() override;
140 };
141 } // end namespace itk
142 
143 #ifndef ITK_MANUAL_INSTANTIATION
144 #include "itkNeighborhoodConnectedImageFilter.hxx"
145 #endif
146 
147 #endif
typename OutputImageType::Pointer OutputImagePointer
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.
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
typename InputImageType::RegionType InputImageRegionType
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)
Label pixels that are connected to a seed and lie within a neighborhood.
Base class for all data objects in ITK.