ITK  5.4.0
Insight Toolkit
itkBinaryContourImageFilter.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 itkBinaryContourImageFilter_h
19 #define itkBinaryContourImageFilter_h
20 
21 #include "itkInPlaceImageFilter.h"
23 #include <vector>
24 
25 namespace itk
26 {
52 template <typename TInputImage, typename TOutputImage>
53 class ITK_TEMPLATE_EXPORT BinaryContourImageFilter
54  : public InPlaceImageFilter<TInputImage, TOutputImage>
55  , protected ScanlineFilterCommon<TInputImage, TOutputImage>
56 {
57 public:
58  ITK_DISALLOW_COPY_AND_MOVE(BinaryContourImageFilter);
59 
67  using Superclass::Register;
68  using Superclass::UnRegister;
69 
73  itkOverrideGetNameOfClassMacro(BinaryContourImageFilter);
74 
78  itkNewMacro(Self);
79 
83  using InputImageType = TInputImage;
88  using OffsetType = typename InputImageType::OffsetType;
89  using InputImagePixelType = typename InputImageType::PixelType;
90  using InputInternalPixelType = typename InputImageType::InternalPixelType;
91 
92  using OutputImageType = TOutputImage;
97  using OutputOffsetType = typename OutputImageType::OffsetType;
98  using OutputImagePixelType = typename OutputImageType::PixelType;
99  using OutputInternalPixelType = typename OutputImageType::InternalPixelType;
100 
101  static constexpr unsigned int ImageDimension = OutputImageType::ImageDimension;
108  itkSetMacro(FullyConnected, bool);
109  itkGetConstReferenceMacro(FullyConnected, bool);
110  itkBooleanMacro(FullyConnected);
117  itkSetMacro(BackgroundValue, OutputImagePixelType);
118  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
125  itkSetMacro(ForegroundValue, InputImagePixelType);
126  itkGetConstMacro(ForegroundValue, InputImagePixelType);
129 protected:
131  ~BinaryContourImageFilter() override = default;
132 
133  void
134  PrintSelf(std::ostream & os, Indent indent) const override;
135 
136  void
137  GenerateData() override;
138 
139  void
140  BeforeThreadedGenerateData() override;
141 
142  void
143  AfterThreadedGenerateData() override;
144 
145  void
146  DynamicThreadedGenerateData(const RegionType & outputRegionForThread) override;
147 
148  void
149  ThreadedIntegrateData(const RegionType & outputRegionForThread);
150 
154  void
155  GenerateInputRequestedRegion() override;
156 
161  void
162  EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
163 
165 
177 
178 private:
179  LineMapType m_ForegroundLineMap{};
180  LineMapType m_BackgroundLineMap{};
181 
182  InputImagePixelType m_ForegroundValue{};
183  OutputImagePixelType m_BackgroundValue{};
184 };
185 } // end namespace itk
186 
187 #ifndef ITK_MANUAL_INSTANTIATION
188 # include "itkBinaryContourImageFilter.hxx"
189 #endif
190 
191 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::ScanlineFilterCommon::LineEncodingIterator
typename LineEncodingType::iterator LineEncodingIterator
Definition: itkScanlineFilterCommon.h:128
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::ScanlineFilterCommon::LineMapType
std::vector< LineEncodingType > LineMapType
Definition: itkScanlineFilterCommon.h:134
itk::ScanlineFilterCommon::LineEncodingType
std::vector< RunLength > LineEncodingType
Definition: itkScanlineFilterCommon.h:127
itk::BinaryContourImageFilter::RunLength
typename ScanlineFunctions::RunLength RunLength
Definition: itkBinaryContourImageFilter.h:168
itk::BinaryContourImageFilter::OutputIndexType
typename OutputImageType::IndexType OutputIndexType
Definition: itkBinaryContourImageFilter.h:95
itk::InPlaceImageFilter
Base class for filters that take an image as input and overwrite that image as the output.
Definition: itkInPlaceImageFilter.h:77
itk::BinaryContourImageFilter::UnionFindType
typename ScanlineFunctions::UnionFindType UnionFindType
Definition: itkBinaryContourImageFilter.h:175
itk::BinaryContourImageFilter::ConsecutiveVectorType
typename ScanlineFunctions::ConsecutiveVectorType ConsecutiveVectorType
Definition: itkBinaryContourImageFilter.h:176
itk::BinaryContourImageFilter::OutSizeType
typename ScanlineFunctions::OutSizeType OutSizeType
Definition: itkBinaryContourImageFilter.h:167
itk::BinaryContourImageFilter::OffsetType
typename InputImageType::OffsetType OffsetType
Definition: itkBinaryContourImageFilter.h:88
itk::ScanlineFilterCommon::RunLength
Definition: itkScanlineFilterCommon.h:114
itk::ScanlineFilterCommon::OffsetVectorType
std::vector< OffsetValueType > OffsetVectorType
Definition: itkScanlineFilterCommon.h:131
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::BinaryContourImageFilter::LineMapType
typename ScanlineFunctions::LineMapType LineMapType
Definition: itkBinaryContourImageFilter.h:174
itk::BinaryContourImageFilter::SizeType
typename InputImageType::SizeType SizeType
Definition: itkBinaryContourImageFilter.h:87
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkScanlineFilterCommon.h
itk::ScanlineFilterCommon::UnionFindType
std::vector< InternalLabelType > UnionFindType
Definition: itkScanlineFilterCommon.h:136
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
itk::BinaryContourImageFilter::OutputInternalPixelType
typename OutputImageType::InternalPixelType OutputInternalPixelType
Definition: itkBinaryContourImageFilter.h:99
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::BinaryContourImageFilter::OutputSizeType
typename OutputImageType::SizeType OutputSizeType
Definition: itkBinaryContourImageFilter.h:96
itk::ScanlineFilterCommon::InternalLabelType
SizeValueType InternalLabelType
Definition: itkScanlineFilterCommon.h:111
itk::ScanlineFilterCommon::OutSizeType
typename TOutputImage::RegionType::SizeType OutSizeType
Definition: itkScanlineFilterCommon.h:112
itk::BinaryContourImageFilter::InternalLabelType
typename ScanlineFunctions::InternalLabelType InternalLabelType
Definition: itkBinaryContourImageFilter.h:166
itk::BinaryContourImageFilter::OffsetVectorConstIterator
typename ScanlineFunctions::OffsetVectorConstIterator OffsetVectorConstIterator
Definition: itkBinaryContourImageFilter.h:173
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::BinaryContourImageFilter::IndexType
typename InputImageType::IndexType IndexType
Definition: itkBinaryContourImageFilter.h:86
itk::ScanlineFilterCommon::OffsetVectorConstIterator
typename OffsetVectorType::const_iterator OffsetVectorConstIterator
Definition: itkScanlineFilterCommon.h:132
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::ScanlineFilterCommon::ConsecutiveVectorType
std::vector< OutputPixelType > ConsecutiveVectorType
Definition: itkScanlineFilterCommon.h:137
itk::BinaryContourImageFilter::OutputOffsetType
typename OutputImageType::OffsetType OutputOffsetType
Definition: itkBinaryContourImageFilter.h:97
itk::BinaryContourImageFilter::LineEncodingType
typename ScanlineFunctions::LineEncodingType LineEncodingType
Definition: itkBinaryContourImageFilter.h:169
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::BinaryContourImageFilter
Labels the pixels on the border of the objects in a binary image.
Definition: itkBinaryContourImageFilter.h:53
itk::ScanlineFilterCommon
Helper class for a group of filters which operate on scan-lines.
Definition: itkScanlineFilterCommon.h:41
itkInPlaceImageFilter.h
itk::BinaryContourImageFilter::RegionType
typename OutputImageType::RegionType RegionType
Definition: itkBinaryContourImageFilter.h:94
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::BinaryContourImageFilter::LineEncodingIterator
typename ScanlineFunctions::LineEncodingIterator LineEncodingIterator
Definition: itkBinaryContourImageFilter.h:170
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::ScanlineFilterCommon::LineEncodingConstIterator
typename LineEncodingType::const_iterator LineEncodingConstIterator
Definition: itkScanlineFilterCommon.h:129
itk::BinaryContourImageFilter::OffsetVectorType
typename ScanlineFunctions::OffsetVectorType OffsetVectorType
Definition: itkBinaryContourImageFilter.h:172
itk::BinaryContourImageFilter::LineEncodingConstIterator
typename ScanlineFunctions::LineEncodingConstIterator LineEncodingConstIterator
Definition: itkBinaryContourImageFilter.h:171
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
itk::BinaryContourImageFilter::InputInternalPixelType
typename InputImageType::InternalPixelType InputInternalPixelType
Definition: itkBinaryContourImageFilter.h:90