ITK  5.2.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  * 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 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 
88  using InputImageType = TInputImage;
89  using InputImagePointer = typename InputImageType::Pointer;
90  using InputImageConstPointer = typename InputImageType::ConstPointer;
92  using InputImagePixelType = typename InputImageType::PixelType;
96 
97  using OutputImageType = TOutputImage;
98  using OutputImagePointer = typename OutputImageType::Pointer;
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 
119  void
120  SetSeed1(const IndexType & seed);
121 
123  void
124  ClearSeeds1();
125 
127  void
128  AddSeed2(const IndexType & seed);
129 
134  void
135  SetSeed2(const IndexType & seed);
136 
138  void
139  ClearSeeds2();
140 
142  virtual const SeedsContainerType &
143  GetSeeds1() const;
144  virtual const SeedsContainerType &
145  GetSeeds2() const;
147 
150  itkSetMacro(Lower, InputImagePixelType);
151  itkGetConstReferenceMacro(Lower, InputImagePixelType);
153 
156  itkSetMacro(Upper, InputImagePixelType);
157  itkGetConstReferenceMacro(Upper, InputImagePixelType);
159 
160 #if !defined(ITK_LEGACY_REMOVE)
161 
165  void
166  SetUpperValueLimit(InputImagePixelType upperValue)
167  {
168  this->SetUpper(upperValue);
169  }
170 
171  InputImagePixelType
172  GetUpperValueLimit()
173  {
174  return this->GetUpper();
175  }
176 #endif
177 
180  itkSetMacro(IsolatedValueTolerance, InputImagePixelType);
181  itkGetConstReferenceMacro(IsolatedValueTolerance, InputImagePixelType);
183 
187  itkSetMacro(ReplaceValue, OutputImagePixelType);
188  itkGetConstReferenceMacro(ReplaceValue, OutputImagePixelType);
190 
192  itkGetConstReferenceMacro(IsolatedValue, InputImagePixelType);
193 
196  itkSetMacro(FindUpperThreshold, bool);
197  itkBooleanMacro(FindUpperThreshold);
198  itkGetConstReferenceMacro(FindUpperThreshold, bool);
200 
203  itkGetConstReferenceMacro(ThresholdingFailed, bool);
204 
205 #ifdef ITK_USE_CONCEPT_CHECKING
206  // Begin concept checking
207  itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<InputImagePixelType>));
208  // End concept checking
209 #endif
210 
211 protected:
212  IsolatedConnectedImageFilter();
213  ~IsolatedConnectedImageFilter() override = default;
216 
219 
221 
224 
227 
228  // Override since the filter needs all the data for the algorithm
229  void
230  GenerateInputRequestedRegion() override;
231 
232  // Override since the filter produces the entire dataset
233  void
234  EnlargeOutputRequestedRegion(DataObject * output) override;
235 
236  void
237  GenerateData() override;
238 };
239 } // end namespace itk
240 
241 #ifndef ITK_MANUAL_INSTANTIATION
242 # include "itkIsolatedConnectedImageFilter.hxx"
243 #endif
244 
245 #endif
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::IsolatedConnectedImageFilter::IndexType
typename InputImageType::IndexType IndexType
Definition: itkIsolatedConnectedImageFilter.h:93
itk::IsolatedConnectedImageFilter::m_Upper
InputImagePixelType m_Upper
Definition: itkIsolatedConnectedImageFilter.h:218
itk::IsolatedConnectedImageFilter::m_IsolatedValue
InputImagePixelType m_IsolatedValue
Definition: itkIsolatedConnectedImageFilter.h:222
itk::IsolatedConnectedImageFilter::m_FindUpperThreshold
bool m_FindUpperThreshold
Definition: itkIsolatedConnectedImageFilter.h:225
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::IsolatedConnectedImageFilter::m_Seeds2
SeedsContainerType m_Seeds2
Definition: itkIsolatedConnectedImageFilter.h:215
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::IsolatedConnectedImageFilter::m_IsolatedValueTolerance
InputImagePixelType m_IsolatedValueTolerance
Definition: itkIsolatedConnectedImageFilter.h:223
itk::IsolatedConnectedImageFilter::m_ReplaceValue
OutputImagePixelType m_ReplaceValue
Definition: itkIsolatedConnectedImageFilter.h:220
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:58
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk::IsolatedConnectedImageFilter::SizeType
typename InputImageType::SizeType SizeType
Definition: itkIsolatedConnectedImageFilter.h:94
itk::IsolatedConnectedImageFilter::m_Lower
InputImagePixelType m_Lower
Definition: itkIsolatedConnectedImageFilter.h:217
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk::IsolatedConnectedImageFilter::m_Seeds1
SeedsContainerType m_Seeds1
Definition: itkIsolatedConnectedImageFilter.h:214
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::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::IsolatedConnectedImageFilter::m_ThresholdingFailed
bool m_ThresholdingFailed
Definition: itkIsolatedConnectedImageFilter.h:226
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