OTB  9.0.0
Orfeo Toolbox
otbEdgeDetectorImageFilter.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 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);
77  itkGetObjectMacro(Detector, DetectionType);
78  itkGetConstObjectMacro(Detector, DetectionType);
79 
81  itkSetObjectMacro(BinaryFilter, BinaryFilterType);
82  itkGetObjectMacro(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:
117  ~EdgeDetectorImageFilter() override;
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
otb::EdgeDetectorImageFilter::SetInsideValue
void SetInsideValue(InputImagePixelType val)
Definition: otbEdgeDetectorImageFilter.h:101
otb::EdgeDetectorImageFilter::InputImagePixelType
InputImageType::PixelType InputImagePixelType
Definition: otbEdgeDetectorImageFilter.h:61
otb::EdgeDetectorImageFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbEdgeDetectorImageFilter.h:59
otb::EdgeDetectorImageFilter::BinaryFilterPointerType
BinaryFilterType::Pointer BinaryFilterPointerType
Definition: otbEdgeDetectorImageFilter.h:73
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::EdgeDetectorImageFilter::Superclass
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: otbEdgeDetectorImageFilter.h:47
otb::EdgeDetectorImageFilter::OutputImagePointerType
OutputImageType::Pointer OutputImagePointerType
Definition: otbEdgeDetectorImageFilter.h:64
otb::EdgeDetectorImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbEdgeDetectorImageFilter.h:48
otb::EdgeDetectorImageFilter::SetLowerThreshold
void SetLowerThreshold(InputImagePixelType val)
Definition: otbEdgeDetectorImageFilter.h:87
otb::EdgeDetectorImageFilter::InputImageSizeType
InputImageType::SizeType InputImageSizeType
Definition: otbEdgeDetectorImageFilter.h:62
otb::EdgeDetectorImageFilter::SetOutsideValue
void SetOutsideValue(InputImagePixelType val)
Definition: otbEdgeDetectorImageFilter.h:108
otb::EdgeDetectorImageFilter::BinaryFilterType
itk::BinaryThresholdImageFilter< InputImageType, InputImageType > BinaryFilterType
Definition: otbEdgeDetectorImageFilter.h:72
otb::EdgeDetectorImageFilter::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbEdgeDetectorImageFilter.h:63
otb::EdgeDetectorImageFilter::DetectionPointerType
DetectionType::Pointer DetectionPointerType
Definition: otbEdgeDetectorImageFilter.h:69
otb::EdgeDetectorImageFilter::Self
EdgeDetectorImageFilter Self
Definition: otbEdgeDetectorImageFilter.h:46
otb::EdgeDetectorImageFilter::SetUpperThreshold
void SetUpperThreshold(InputImagePixelType val)
Definition: otbEdgeDetectorImageFilter.h:94
otb::EdgeDetectorImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbEdgeDetectorImageFilter.h:49
otb::EdgeDetectorImageFilter::m_Detector
DetectionPointerType m_Detector
Definition: otbEdgeDetectorImageFilter.h:125
otb::EdgeDetectorImageFilter::InputImageType
TInputImage InputImageType
Definition: otbEdgeDetectorImageFilter.h:55
otb::EdgeDetectorImageFilter::InputImagePointerType
InputImageType::Pointer InputImagePointerType
Definition: otbEdgeDetectorImageFilter.h:60
otbEdgeDetectorImageFilter.hxx
otb::EdgeDetectorImageFilter::DetectionType
TEdgeDetection DetectionType
Definition: otbEdgeDetectorImageFilter.h:68
otb::EdgeDetectorImageFilter
This composite filter binaries a edge detection image output. The used edge detection filter is given...
Definition: otbEdgeDetectorImageFilter.h:41
otb::EdgeDetectorImageFilter::m_BinaryFilter
BinaryFilterPointerType m_BinaryFilter
Definition: otbEdgeDetectorImageFilter.h:126
otb::EdgeDetectorImageFilter::OutputImagePixelType
OutputImageType::PixelType OutputImagePixelType
Definition: otbEdgeDetectorImageFilter.h:65