OTB  10.0.0
Orfeo Toolbox
otbEdgeDetectorImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 otbEdgeDetectorImageFilter_h
22 #define otbEdgeDetectorImageFilter_h
23 
24 #include "itkUnaryFunctorImageFilter.h"
25 #include "itkImageToImageFilter.h"
26 #include "itkBinaryThresholdImageFilter.h"
27 
28 namespace otb
29 {
30 
40 template <class TInputImage, class TOutputImage, class TEdgeDetection>
41 class ITK_EXPORT EdgeDetectorImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
42 {
43 
44 public:
47  typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
48  typedef itk::SmartPointer<Self> Pointer;
49  typedef itk::SmartPointer<const Self> ConstPointer;
50 
52  itkNewMacro(Self);
53 
55  itkTypeMacro(EdgeDetectorImageFilter, itk::ImageToImageFilter);
56 
58  typedef TInputImage InputImageType;
59  typedef TOutputImage OutputImageType;
60  typedef typename InputImageType::Pointer InputImagePointerType;
61  typedef typename InputImageType::PixelType InputImagePixelType;
62  typedef typename InputImageType::SizeType InputImageSizeType;
63  typedef typename OutputImageType::RegionType OutputImageRegionType;
64  typedef typename OutputImageType::Pointer OutputImagePointerType;
65  typedef typename OutputImageType::PixelType OutputImagePixelType;
66 
68  typedef TEdgeDetection DetectionType;
69  typedef typename DetectionType::Pointer DetectionPointerType;
70 
72  typedef itk::BinaryThresholdImageFilter<InputImageType, InputImageType> BinaryFilterType;
73  typedef typename BinaryFilterType::Pointer BinaryFilterPointerType;
74 
76  itkSetObjectMacro(Detector, DetectionType);
78  itkGetConstObjectMacro(Detector, DetectionType);
79 
81  itkSetObjectMacro(BinaryFilter, BinaryFilterType);
83  // itkGetObjectMacro(DetectorImageFilter, DetectorImageType);
85 
88  {
89  m_BinaryFilter->SetLowerThreshold(val);
90  this->Modified();
91  }
92 
95  {
96  m_BinaryFilter->SetUpperThreshold(val);
97  this->Modified();
98  }
99 
102  {
103  m_BinaryFilter->SetInsideValue(val);
104  this->Modified();
105  }
106 
109  {
110  m_BinaryFilter->SetOutsideValue(val);
111  this->Modified();
112  }
114 
115 protected:
118  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
119  void GenerateData() override;
120 
121 private:
122  EdgeDetectorImageFilter(const Self&) = delete;
123  void operator=(const Self&) = delete;
124 
127 };
128 }
129 #ifndef OTB_MANUAL_INSTANTIATION
131 #endif
132 
133 #endif
This composite filter binaries a edge detection image output. The used edge detection filter is given...
OutputImageType::Pointer OutputImagePointerType
OutputImageType::PixelType OutputImagePixelType
void SetUpperThreshold(InputImagePixelType val)
InputImageType::SizeType InputImageSizeType
itkGetObjectMacro(Detector, DetectionType)
DetectionType::Pointer DetectionPointerType
void operator=(const Self &)=delete
itk::BinaryThresholdImageFilter< InputImageType, InputImageType > BinaryFilterType
itk::SmartPointer< const Self > ConstPointer
InputImageType::Pointer InputImagePointerType
void GenerateData() override
EdgeDetectorImageFilter(const Self &)=delete
void SetOutsideValue(InputImagePixelType val)
BinaryFilterType::Pointer BinaryFilterPointerType
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
void PrintSelf(std::ostream &os, itk::Indent indent) const override
OutputImageType::RegionType OutputImageRegionType
itkGetObjectMacro(BinaryFilter, BinaryFilterType)
void SetInsideValue(InputImagePixelType val)
InputImageType::PixelType InputImagePixelType
void SetLowerThreshold(InputImagePixelType val)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.