OTB  9.0.0
Orfeo Toolbox
otbLabelToBoundaryImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 #ifndef otbLabelToBoundaryImageFilter_h
23 #define otbLabelToBoundaryImageFilter_h
24 
26 
27 namespace otb
28 {
29 namespace Functor
30 {
31 
43 template <class TInput, class TOutput>
45 {
46 public:
48  {
49  }
51  {
52  }
54 
55  TOutput operator()(const TInput& input)
56  {
57  unsigned char output = 1;
58  if (input.GetCenterPixel() == input.GetPixel(5) && input.GetCenterPixel() == input.GetPixel(7) && input.GetCenterPixel() == input.GetPixel(8))
59  {
60  output = 0;
61  }
62  return static_cast<TOutput>(output);
63  }
64 }; // end of class
65 
66 } // end of Functor namespace
67 
79 template <class TInputImage, class TOutputImage>
82  TInputImage, TOutputImage, Functor::LabelToBoundaryFunctor<typename itk::ConstNeighborhoodIterator<TInputImage>, typename TOutputImage::PixelType>>
83 {
84 public:
87  TInputImage, TOutputImage, Functor::LabelToBoundaryFunctor<typename itk::ConstNeighborhoodIterator<TInputImage>, typename TOutputImage::PixelType>>
89  typedef itk::SmartPointer<Self> Pointer;
90  typedef itk::SmartPointer<const Self> ConstPointer;
91 
92  itkNewMacro(Self);
93 
95 
96 protected:
98  {
99  this->SetRadius(1);
100  }
102  {
103  }
104 
105 private:
106  LabelToBoundaryImageFilter(const Self&); // Not implemented
107  void operator=(const Self&); // Not implemented
108 }; // end of class
109 
110 } // end of otb namespace
111 
112 #endif
otb::LabelToBoundaryImageFilter
Filter to extract boundaries of a label image.
Definition: otbLabelToBoundaryImageFilter.h:80
otb::Functor::LabelToBoundaryFunctor::LabelToBoundaryFunctor
LabelToBoundaryFunctor()
Definition: otbLabelToBoundaryImageFilter.h:47
otb::LabelToBoundaryImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbLabelToBoundaryImageFilter.h:90
otbUnaryFunctorNeighborhoodImageFilter.h
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::LabelToBoundaryImageFilter::~LabelToBoundaryImageFilter
~LabelToBoundaryImageFilter() override
Definition: otbLabelToBoundaryImageFilter.h:101
otb::LabelToBoundaryImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbLabelToBoundaryImageFilter.h:89
otb::Functor::LabelToBoundaryFunctor
Functor to extract segmentation boundaries.
Definition: otbLabelToBoundaryImageFilter.h:44
otb::UnaryFunctorNeighborhoodImageFilter
Implements neighborhood-wise generic operation on image.
Definition: otbUnaryFunctorNeighborhoodImageFilter.h:43
otb::LabelToBoundaryImageFilter::LabelToBoundaryImageFilter
LabelToBoundaryImageFilter()
Definition: otbLabelToBoundaryImageFilter.h:97
otb::Functor::LabelToBoundaryFunctor::~LabelToBoundaryFunctor
virtual ~LabelToBoundaryFunctor()
Definition: otbLabelToBoundaryImageFilter.h:50
otb::Functor::LabelToBoundaryFunctor::operator()
TOutput operator()(const TInput &input)
Definition: otbLabelToBoundaryImageFilter.h:55
otb::LabelToBoundaryImageFilter::Self
LabelToBoundaryImageFilter Self
Definition: otbLabelToBoundaryImageFilter.h:85
otb::LabelToBoundaryImageFilter::Superclass
UnaryFunctorNeighborhoodImageFilter< TInputImage, TOutputImage, Functor::LabelToBoundaryFunctor< typename itk::ConstNeighborhoodIterator< TInputImage >, typename TOutputImage::PixelType > > Superclass
Definition: otbLabelToBoundaryImageFilter.h:88