ITK  6.0.0
Insight Toolkit
itkIsolatedConnectedImageFilter.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  * https://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 itkIsolatedConnectedImageFilter_h
19 #define itkIsolatedConnectedImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 
23 namespace itk
24 {
71 template <typename TInputImage, typename TOutputImage>
72 class ITK_TEMPLATE_EXPORT IsolatedConnectedImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
73 {
74 public:
75  ITK_DISALLOW_COPY_AND_MOVE(IsolatedConnectedImageFilter);
76 
82 
84  itkNewMacro(Self);
85 
87  itkOverrideGetNameOfClassMacro(IsolatedConnectedImageFilter);
88  using InputImageType = TInputImage;
92  using InputImagePixelType = typename InputImageType::PixelType;
97  using OutputImageType = TOutputImage;
100  using OutputImagePixelType = typename OutputImageType::PixelType;
101 
102  using SeedsContainerType = std::vector<IndexType>;
103 
105 
106  void
107  PrintSelf(std::ostream & os, Indent indent) const override;
108 
111  void
112  AddSeed1(const IndexType & seed);
113 
121  void
122  SetSeed1(const IndexType & seed);
123 
125  void
126  ClearSeeds1();
127 
129  void
130  AddSeed2(const IndexType & seed);
131 
138  void
139  SetSeed2(const IndexType & seed);
140 
142  void
143  ClearSeeds2();
144 
146  virtual const SeedsContainerType &
147  GetSeeds1() const;
148  virtual const SeedsContainerType &
149  GetSeeds2() const;
154  itkSetMacro(Lower, InputImagePixelType);
155  itkGetConstReferenceMacro(Lower, InputImagePixelType);
160  itkSetMacro(Upper, InputImagePixelType);
161  itkGetConstReferenceMacro(Upper, InputImagePixelType);
164 #if !defined(ITK_LEGACY_REMOVE)
165 
169  void
170  SetUpperValueLimit(InputImagePixelType upperValue)
171  {
172  this->SetUpper(upperValue);
173  }
174 
175  InputImagePixelType
176  GetUpperValueLimit()
177  {
178  return this->GetUpper();
179  }
180 #endif
181 
184  itkSetMacro(IsolatedValueTolerance, InputImagePixelType);
185  itkGetConstReferenceMacro(IsolatedValueTolerance, InputImagePixelType);
191  itkSetMacro(ReplaceValue, OutputImagePixelType);
192  itkGetConstReferenceMacro(ReplaceValue, OutputImagePixelType);
196  itkGetConstReferenceMacro(IsolatedValue, InputImagePixelType);
197 
200  itkSetMacro(FindUpperThreshold, bool);
201  itkBooleanMacro(FindUpperThreshold);
202  itkGetConstReferenceMacro(FindUpperThreshold, bool);
207  itkGetConstReferenceMacro(ThresholdingFailed, bool);
208 
209 #ifdef ITK_USE_CONCEPT_CHECKING
210  // Begin concept checking
211  itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<InputImagePixelType>));
212  // End concept checking
213 #endif
214 
215 protected:
216  IsolatedConnectedImageFilter();
217  ~IsolatedConnectedImageFilter() override = default;
218  SeedsContainerType m_Seeds1{};
219  SeedsContainerType m_Seeds2{};
220 
223 
224  OutputImagePixelType m_ReplaceValue{};
225 
226  InputImagePixelType m_IsolatedValue{};
227  InputImagePixelType m_IsolatedValueTolerance{};
228 
229  bool m_FindUpperThreshold{};
230  bool m_ThresholdingFailed{};
231 
232  // Override since the filter needs all the data for the algorithm
233  void
234  GenerateInputRequestedRegion() override;
235 
236  // Override since the filter produces the entire dataset
237  void
238  EnlargeOutputRequestedRegion(DataObject * output) override;
239 
240  void
241  GenerateData() override;
242 };
243 } // end namespace itk
244 
245 #ifndef ITK_MANUAL_INSTANTIATION
246 # include "itkIsolatedConnectedImageFilter.hxx"
247 #endif
248 
249 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::IsolatedConnectedImageFilter::IndexType
typename InputImageType::IndexType IndexType
Definition: itkIsolatedConnectedImageFilter.h:93
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::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::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::IsolatedConnectedImageFilter::InputRealType
typename NumericTraits< InputImagePixelType >::RealType InputRealType
Definition: itkIsolatedConnectedImageFilter.h:104
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkImageToImageFilter.h
itk::IsolatedConnectedImageFilter::SeedsContainerType
std::vector< IndexType > SeedsContainerType
Definition: itkIsolatedConnectedImageFilter.h:102
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:60
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk::IsolatedConnectedImageFilter::SizeType
typename InputImageType::SizeType SizeType
Definition: itkIsolatedConnectedImageFilter.h:94
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::IsolatedConnectedImageFilter
Label pixels that are connected to one set of seeds but not another.
Definition: itkIsolatedConnectedImageFilter.h:72
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
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