OTB  10.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-2024 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 #include "otbMacro.h"
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 
100  this->SetRadius(1);
101  }
103  {
104  }
105 
106 private:
107  LabelToBoundaryImageFilter(const Self&); // Not implemented
108  void operator=(const Self&); // Not implemented
109 }; // end of class
110 
111 } // end of otb namespace
112 
113 #endif
Functor to extract segmentation boundaries.
Filter to extract boundaries of a label image.
LabelToBoundaryImageFilter(const Self &)
UnaryFunctorNeighborhoodImageFilter< TInputImage, TOutputImage, Functor::LabelToBoundaryFunctor< typename itk::ConstNeighborhoodIterator< TInputImage >, typename TOutputImage::PixelType > > Superclass
itk::SmartPointer< const Self > ConstPointer
void operator=(const Self &)
Implements neighborhood-wise generic operation on image.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.