ITK  6.0.0
Insight Toolkit
itkHoughTransform2DLinesImageFilter.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 itkHoughTransform2DLinesImageFilter_h
19 #define itkHoughTransform2DLinesImageFilter_h
20 
21 
22 #include "itkImageToImageFilter.h"
23 #include "itkLineSpatialObject.h"
24 
25 namespace itk
26 {
61 template <typename TInputPixelType, typename TOutputPixelType>
62 class ITK_TEMPLATE_EXPORT HoughTransform2DLinesImageFilter
63  : public ImageToImageFilter<Image<TInputPixelType, 2>, Image<TOutputPixelType, 2>>
64 {
65 public:
66  ITK_DISALLOW_COPY_AND_MOVE(HoughTransform2DLinesImageFilter);
67 
70 
75 
79 
83 
86  using LinePointer = typename LineType::Pointer;
87  using LinesListType = std::list<LinePointer>;
89 
90  using LinesListSizeType = typename LinesListType::size_type;
91 
94 
97 
100 
103 
105  itkOverrideGetNameOfClassMacro(HoughTransform2DLinesImageFilter);
106 
108  itkNewMacro(Self);
109 
111  void
112  GenerateData() override;
113 
116  itkSetMacro(Threshold, double);
117  itkGetConstMacro(Threshold, double);
123  itkSetMacro(AngleResolution, double);
124  itkGetConstMacro(AngleResolution, double);
130  void
131  Simplify();
132 
134  itkGetModifiableObjectMacro(SimplifyAccumulator, OutputImageType);
135 
137  LinesListType &
138  GetLines();
139 
141  itkSetMacro(NumberOfLines, LinesListSizeType);
142  itkGetConstMacro(NumberOfLines, LinesListSizeType);
147  itkSetMacro(DiscRadius, double);
148  itkGetConstMacro(DiscRadius, double);
152  itkSetMacro(Variance, double);
153  itkGetConstMacro(Variance, double);
156 #ifdef ITK_USE_CONCEPT_CHECKING
157  // Begin concept checking
158  itkConceptMacro(IntConvertibleToOutputCheck, (Concept::Convertible<int, TOutputPixelType>));
161  // End concept checking
162 #endif
163 
164 protected:
166  ~HoughTransform2DLinesImageFilter() override = default;
167 
168  void
169  PrintSelf(std::ostream & os, Indent indent) const override;
170 
174  void
175  GenerateInputRequestedRegion() override;
176 
183  void
184  GenerateOutputInformation() override;
185 
187  void
188  EnlargeOutputRequestedRegion(DataObject * output) override;
189 
190 private:
191  double m_AngleResolution{ 500 };
192  double m_Threshold{ 0 };
193 
194  OutputImagePointer m_SimplifyAccumulator{};
195  LinesListType m_LinesList{};
196  LinesListSizeType m_NumberOfLines{ 1 };
197  double m_DiscRadius{ 10 };
198  double m_Variance{ 5 };
199  ModifiedTimeType m_OldModifiedTime{ 0 };
200 };
201 } // end namespace itk
202 
203 #ifndef ITK_MANUAL_INSTANTIATION
204 # include "itkHoughTransform2DLinesImageFilter.hxx"
205 #endif
206 
207 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::HoughTransform2DLinesImageFilter::LinePointer
typename LineType::Pointer LinePointer
Definition: itkHoughTransform2DLinesImageFilter.h:86
itk::LineSpatialObject
Representation of a Line based on the spatial object classes.
Definition: itkLineSpatialObject.h:43
itk::ModifiedTimeType
SizeValueType ModifiedTimeType
Definition: itkIntTypes.h:105
itk::Concept::GreaterThanComparable
Definition: itkConceptChecking.h:284
itk::HoughTransform2DLinesImageFilter::PixelType
typename InputImageType::PixelType PixelType
Definition: itkHoughTransform2DLinesImageFilter.h:99
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::HoughTransform2DLinesImageFilter::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkHoughTransform2DLinesImageFilter.h:78
itk::HoughTransform2DLinesImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkHoughTransform2DLinesImageFilter.h:74
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::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::HoughTransform2DLinesImageFilter::IndexType
typename InputImageType::IndexType IndexType
Definition: itkHoughTransform2DLinesImageFilter.h:96
itk::HoughTransform2DLinesImageFilter
Performs the Hough Transform to find 2D straight lines in a 2D image.
Definition: itkHoughTransform2DLinesImageFilter.h:62
itkImageToImageFilter.h
itk::Image::PixelType
TPixel PixelType
Definition: itkImage.h:108
itk::HoughTransform2DLinesImageFilter::OutputImageRegionType
typename InputImageType::RegionType OutputImageRegionType
Definition: itkHoughTransform2DLinesImageFilter.h:102
itk::Concept::AdditiveOperators
Definition: itkConceptChecking.h:360
itk::HoughTransform2DLinesImageFilter::LinesListType
std::list< LinePointer > LinesListType
Definition: itkHoughTransform2DLinesImageFilter.h:87
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::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::LineSpatialObjectPoint
Point used for a line definition.
Definition: itkLineSpatialObjectPoint.h:43
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::HoughTransform2DLinesImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkHoughTransform2DLinesImageFilter.h:73
itkLineSpatialObject.h
itk::HoughTransform2DLinesImageFilter::LinesListSizeType
typename LinesListType::size_type LinesListSizeType
Definition: itkHoughTransform2DLinesImageFilter.h:90
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293