ITK  5.2.0
Insight Toolkit
itkConnectedThresholdImageFilter.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 itkConnectedThresholdImageFilter_h
19 #define itkConnectedThresholdImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
23 #include "ITKRegionGrowingExport.h"
24 
25 namespace itk
26 {
33 {
34 public:
43  enum class Connectivity : uint8_t
44  {
47  };
48 };
49 
50 // Define how to print enumeration
51 extern ITKRegionGrowing_EXPORT std::ostream &
52  operator<<(std::ostream & out, const ConnectedThresholdImageFilterEnums::Connectivity value);
67 template <typename TInputImage, typename TOutputImage>
68 class ITK_TEMPLATE_EXPORT ConnectedThresholdImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
69 {
70 public:
71  ITK_DISALLOW_COPY_AND_MOVE(ConnectedThresholdImageFilter);
72 
78 
80  itkNewMacro(Self);
81 
84 
85  using InputImageType = TInputImage;
86  using InputImagePointer = typename InputImageType::Pointer;
87  using InputImageConstPointer = typename InputImageType::ConstPointer;
89  using InputImagePixelType = typename InputImageType::PixelType;
91  using SeedContainerType = typename std::vector<IndexType>;
93 
94  using OutputImageType = TOutputImage;
95  using OutputImagePointer = typename OutputImageType::Pointer;
97  using OutputImagePixelType = typename OutputImageType::PixelType;
98 
99  void
100  PrintSelf(std::ostream & os, Indent indent) const override;
101 
103  void
104  SetSeed(const IndexType & seed);
105 
106  void
107  AddSeed(const IndexType & seed);
108 
110  void
111  ClearSeeds();
112 
114  virtual const SeedContainerType &
115  GetSeeds() const;
116 
120  itkSetMacro(ReplaceValue, OutputImagePixelType);
121  itkGetConstMacro(ReplaceValue, OutputImagePixelType);
123 
126 
128  virtual void SetUpper(InputImagePixelType);
129  virtual void SetLower(InputImagePixelType);
131 
133  virtual void
134  SetUpperInput(const InputPixelObjectType *);
135  virtual void
136  SetLowerInput(const InputPixelObjectType *);
138 
140  virtual InputImagePixelType
141  GetUpper() const;
142  virtual InputImagePixelType
143  GetLower() const;
145 
147  virtual InputPixelObjectType *
148  GetUpperInput();
149  virtual InputPixelObjectType *
150  GetLowerInput();
152 
154  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
155  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
156 
157 #ifdef ITK_USE_CONCEPT_CHECKING
158  // Begin concept checking
159  itkConceptMacro(OutputEqualityComparableCheck, (Concept::EqualityComparable<OutputImagePixelType>));
160  itkConceptMacro(InputEqualityComparableCheck, (Concept::EqualityComparable<InputImagePixelType>));
165  // End concept checking
166 #endif
167 
169 #if !defined(ITK_LEGACY_REMOVE)
170  using ConnectivityEnumType = ConnectedThresholdImageFilterEnums::Connectivity;
172  static constexpr ConnectedThresholdImageFilterEnums::Connectivity FaceConnectivity =
174  static constexpr ConnectedThresholdImageFilterEnums::Connectivity FullConnectivity =
176 #endif
177 
183 
184 protected:
186  ~ConnectedThresholdImageFilter() override = default;
187 
188  // Override since the filter needs all the data for the algorithm.
189  void
190  GenerateInputRequestedRegion() override;
191 
192  // Override since the filter produces the entire dataset.
193  void
194  EnlargeOutputRequestedRegion(DataObject * output) override;
195 
196  void
197  GenerateData() override;
198 
199 private:
201 
203 
204  ConnectedThresholdImageFilterEnums::Connectivity m_Connectivity{ ConnectivityEnum::FaceConnectivity };
205 };
206 } // end namespace itk
207 
208 #ifndef ITK_MANUAL_INSTANTIATION
209 # include "itkConnectedThresholdImageFilter.hxx"
210 #endif
211 
212 #endif
Connectivity
itk::SimpleDataObjectDecorator
Decorates any "simple" data type (data types without smart pointers) with a DataObject API.
Definition: itkSimpleDataObjectDecorator.h:66
itk::uint8_t
::uint8_t uint8_t
Definition: itkIntTypes.h:29
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:636
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::operator<<
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:218
itk::ConnectedThresholdImageFilter::m_Seeds
SeedContainerType m_Seeds
Definition: itkConnectedThresholdImageFilter.h:200
itk::ConnectedThresholdImageFilterEnums::Connectivity::FaceConnectivity
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Concept::SameDimension
Definition: itkConceptChecking.h:694
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
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::ConnectedThresholdImageFilter::m_ReplaceValue
OutputImagePixelType m_ReplaceValue
Definition: itkConnectedThresholdImageFilter.h:202
itk::ConnectedThresholdImageFilter
Label pixels that are connected to a seed and lie within a range of values.
Definition: itkConnectedThresholdImageFilter.h:68
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ConnectedThresholdImageFilterEnums::Connectivity
Connectivity
Definition: itkConnectedThresholdImageFilter.h:43
itk::ConnectedThresholdImageFilterEnums::Connectivity::FullConnectivity
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkImageToImageFilter.h
itk::ConnectedThresholdImageFilter::SizeType
typename InputImageType::SizeType SizeType
Definition: itkConnectedThresholdImageFilter.h:92
itk::ConnectedThresholdImageFilterEnums
Contains all the enum classes used by the ConnectedThresholdImageFilter class.
Definition: itkConnectedThresholdImageFilter.h:32
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::ConnectedThresholdImageFilter::SeedContainerType
typename std::vector< IndexType > SeedContainerType
Definition: itkConnectedThresholdImageFilter.h:91
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::ConnectedThresholdImageFilter::IndexType
typename InputImageType::IndexType IndexType
Definition: itkConnectedThresholdImageFilter.h:90
itkSimpleDataObjectDecorator.h
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::Concept::EqualityComparable
Definition: itkConceptChecking.h:306
itk::ImageToImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkImageToImageFilter.h:131
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293