OTB  9.0.0
Orfeo Toolbox
otbLineDetectorImageFilterBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbLineDetectorImageFilterBase_h
22 #define otbLineDetectorImageFilterBase_h
23 
24 #include "itkNearestNeighborInterpolateImageFunction.h"
25 #include "itkLinearInterpolateImageFunction.h"
27 #include "otbImage.h"
28 #include "itkNumericTraits.h"
29 
30 namespace otb
31 {
32 
54 template <class TInputImage, class TOutputImage, class TOutputImageDirection = TOutputImage,
55  class TInterpolator = itk::LinearInterpolateImageFunction<TInputImage>>
56 class ITK_EXPORT LineDetectorImageFilterBase : public ImageToModulusAndDirectionImageFilter<TInputImage, TOutputImage, TOutputImageDirection>
57 {
58 public:
60  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
61  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
63 
67  typedef itk::SmartPointer<Self> Pointer;
68  typedef itk::SmartPointer<const Self> ConstPointer;
69 
71  itkNewMacro(Self);
72 
75 
76  typedef typename Superclass::InputImageType InputImageType;
77  typedef typename Superclass::OutputImageType OutputImageType;
78  typedef typename Superclass::OutputImageDirectionType OutputImageDirectionType;
79  typedef TInterpolator InterpolatorType;
80 
82  typedef typename InterpolatorType::Pointer InterpolatorPointer;
83  typedef typename InterpolatorType::CoordRepType CoordRepType;
84 
85  typedef typename InputImageType::PointType TPoint;
86 
88  typedef typename InputImageType::PixelType InputPixelType;
89  typedef typename OutputImageType::PixelType OutputPixelType;
90  typedef typename OutputImageType::Pointer OutputImagePointerType;
91 
92  typedef typename InputImageType::RegionType InputImageRegionType;
93  typedef typename OutputImageType::RegionType OutputImageRegionType;
94 
96  typedef typename InputImageType::SizeType SizeType;
97 
99  itkSetMacro(LengthLine, unsigned int);
100 
102  itkGetConstReferenceMacro(LengthLine, unsigned int);
103 
105  itkSetMacro(WidthLine, unsigned int);
106 
108  itkGetConstReferenceMacro(WidthLine, unsigned int);
109 
111  itkSetMacro(Radius, SizeType);
112 
114  itkGetConstReferenceMacro(Radius, SizeType);
115 
117  itkSetMacro(Threshold, OutputPixelType);
118 
120  itkGetConstReferenceMacro(Threshold, OutputPixelType);
121 
123  itkSetMacro(NumberOfDirections, unsigned int);
124 
126  itkGetConstReferenceMacro(NumberOfDirections, unsigned int);
127 
128  void GenerateInputRequestedRegion() override;
129 
130 protected:
133  {
134  }
135  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
136 
137  void BeforeThreadedGenerateData() override;
138 
148  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
149 
150  virtual double ComputeMeasure(std::vector<double>* m1, std::vector<double>* m2, std::vector<double>* m3);
151 
153  unsigned int m_LengthLine;
154 
156  unsigned int m_WidthLine;
157 
160 
163 
165 
166  unsigned int m_NumberOfDirections;
167 
168 private:
169  LineDetectorImageFilterBase(const Self&) = delete;
170  void operator=(const Self&) = delete;
171 };
172 } // end namespace otb
173 
174 #ifndef OTB_MANUAL_INSTANTIATION
176 #endif
177 
178 #endif
otb::LineDetectorImageFilterBase::InputImageType
Superclass::InputImageType InputImageType
Definition: otbLineDetectorImageFilterBase.h:74
otb::LineDetectorImageFilterBase::TPoint
InputImageType::PointType TPoint
Definition: otbLineDetectorImageFilterBase.h:85
otb::LineDetectorImageFilterBase::m_Radius
SizeType m_Radius
Definition: otbLineDetectorImageFilterBase.h:159
otb::LineDetectorImageFilterBase::m_WidthLine
unsigned int m_WidthLine
Definition: otbLineDetectorImageFilterBase.h:156
otb::LineDetectorImageFilterBase::InterpolatorType
TInterpolator InterpolatorType
Definition: otbLineDetectorImageFilterBase.h:79
otbImage.h
otb::LineDetectorImageFilterBase::Self
LineDetectorImageFilterBase Self
Definition: otbLineDetectorImageFilterBase.h:65
otbLineDetectorImageFilterBase.hxx
otbImageToModulusAndDirectionImageFilter.h
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::LineDetectorImageFilterBase::SizeType
InputImageType::SizeType SizeType
Definition: otbLineDetectorImageFilterBase.h:96
otb::LineDetectorImageFilterBase::InputImageRegionType
InputImageType::RegionType InputImageRegionType
Definition: otbLineDetectorImageFilterBase.h:92
otb::LineDetectorImageFilterBase::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbLineDetectorImageFilterBase.h:67
otb::LineDetectorImageFilterBase::~LineDetectorImageFilterBase
~LineDetectorImageFilterBase() override
Definition: otbLineDetectorImageFilterBase.h:132
otb::LineDetectorImageFilterBase::OutputImageDirectionType
Superclass::OutputImageDirectionType OutputImageDirectionType
Definition: otbLineDetectorImageFilterBase.h:78
otb::LineDetectorImageFilterBase::InterpolatorPointer
InterpolatorType::Pointer InterpolatorPointer
Definition: otbLineDetectorImageFilterBase.h:82
otb::LineDetectorImageFilterBase::OutputImageType
Superclass::OutputImageType OutputImageType
Definition: otbLineDetectorImageFilterBase.h:77
otb::LineDetectorImageFilterBase::InputPixelType
InputImageType::PixelType InputPixelType
Definition: otbLineDetectorImageFilterBase.h:88
otb::ImageToModulusAndDirectionImageFilter
Base class for modulus and direction image filters.
Definition: otbImageToModulusAndDirectionImageFilter.h:42
otb::LineDetectorImageFilterBase::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbLineDetectorImageFilterBase.h:68
otb::LineDetectorImageFilterBase::Superclass
ImageToModulusAndDirectionImageFilter< TInputImage, TOutputImage, TOutputImageDirection > Superclass
Definition: otbLineDetectorImageFilterBase.h:66
otb::LineDetectorImageFilterBase::m_Threshold
OutputPixelType m_Threshold
Definition: otbLineDetectorImageFilterBase.h:164
otb::LineDetectorImageFilterBase
Base class for line detector filters.
Definition: otbLineDetectorImageFilterBase.h:56
otb::LineDetectorImageFilterBase::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbLineDetectorImageFilterBase.h:93
otb::LineDetectorImageFilterBase::CoordRepType
InterpolatorType::CoordRepType CoordRepType
Definition: otbLineDetectorImageFilterBase.h:83
otb::LineDetectorImageFilterBase::m_NumberOfDirections
unsigned int m_NumberOfDirections
Definition: otbLineDetectorImageFilterBase.h:166
otb::LineDetectorImageFilterBase::OutputPixelType
OutputImageType::PixelType OutputPixelType
Definition: otbLineDetectorImageFilterBase.h:89
otb::LineDetectorImageFilterBase::m_FaceList
SizeType m_FaceList
Definition: otbLineDetectorImageFilterBase.h:162
otb::LineDetectorImageFilterBase::m_LengthLine
unsigned int m_LengthLine
Definition: otbLineDetectorImageFilterBase.h:153
otb::LineDetectorImageFilterBase::OutputImagePointerType
OutputImageType::Pointer OutputImagePointerType
Definition: otbLineDetectorImageFilterBase.h:90