OTB  9.0.0
Orfeo Toolbox
otbWatershedSegmentationFilter.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 otbWatershedSegmentationFilter_h
22 #define otbWatershedSegmentationFilter_h
23 
24 #include "otbMacro.h"
25 #include "itkUnaryFunctorImageFilter.h"
26 #include "itkCastImageFilter.h"
27 #include "itkWatershedImageFilter.h"
28 
29 namespace otb
30 {
31 
48 template <class TInputImage, class TOutputLabelImage>
49 class WatershedSegmentationFilter : public itk::ImageToImageFilter<TInputImage, TOutputLabelImage>
50 {
51 public:
54  typedef itk::ImageToImageFilter<TInputImage, TOutputLabelImage> Superclass;
55  typedef itk::SmartPointer<Self> Pointer;
56  typedef itk::SmartPointer<const Self> ConstPointer;
57 
59  typedef TInputImage InputImageType;
60  typedef TOutputLabelImage OutputLabelImageType;
61 
62  typedef itk::WatershedImageFilter<TInputImage> WatershedFilterType;
63  typedef typename WatershedFilterType::OutputImageType InternalOutputImageType;
64 
65  typedef itk::CastImageFilter<InternalOutputImageType, OutputLabelImageType> CastImageFilterType;
66 
68  itkNewMacro(Self);
69 
71  itkTypeMacro(WatershedSegmentationFilter, ImageToImageFilter);
72 
74  itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
75 
76  otbSetObjectMemberMacro(WatershedFilter, Level, float);
77  otbGetObjectMemberMacro(WatershedFilter, Level, float);
78 
79  otbSetObjectMemberMacro(WatershedFilter, Threshold, float);
80  otbGetObjectMemberMacro(WatershedFilter, Threshold, float);
81 
82 
83 protected:
85 
87 
88  void GenerateData() override;
89 
90 private:
91  typename CastImageFilterType::Pointer m_CastFilter;
92  typename WatershedFilterType::Pointer m_WatershedFilter;
93 };
94 
95 
96 } // end namespace otb
97 
98 #ifndef OTB_MANUAL_INSTANTIATION
100 #endif
101 
102 #endif
otb::WatershedSegmentationFilter::WatershedSegmentationFilter
WatershedSegmentationFilter()
Definition: otbWatershedSegmentationFilter.hxx:30
otb::WatershedSegmentationFilter::otbSetObjectMemberMacro
otbSetObjectMemberMacro(WatershedFilter, Level, float)
otb::WatershedSegmentationFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbWatershedSegmentationFilter.h:55
otb::WatershedSegmentationFilter
Watershed composite filter allowing to set output type.
Definition: otbWatershedSegmentationFilter.h:49
otb::WatershedSegmentationFilter::InputImageType
TInputImage InputImageType
Definition: otbWatershedSegmentationFilter.h:59
otb::WatershedSegmentationFilter::InternalOutputImageType
WatershedFilterType::OutputImageType InternalOutputImageType
Definition: otbWatershedSegmentationFilter.h:63
otb::WatershedSegmentationFilter::OutputLabelImageType
TOutputLabelImage OutputLabelImageType
Definition: otbWatershedSegmentationFilter.h:60
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::WatershedSegmentationFilter::Superclass
itk::ImageToImageFilter< TInputImage, TOutputLabelImage > Superclass
Definition: otbWatershedSegmentationFilter.h:54
otb::WatershedSegmentationFilter::CastImageFilterType
itk::CastImageFilter< InternalOutputImageType, OutputLabelImageType > CastImageFilterType
Definition: otbWatershedSegmentationFilter.h:65
otb::WatershedSegmentationFilter::otbGetObjectMemberMacro
otbGetObjectMemberMacro(WatershedFilter, Level, float)
otbMacro.h
otb::WatershedSegmentationFilter::m_CastFilter
CastImageFilterType::Pointer m_CastFilter
Definition: otbWatershedSegmentationFilter.h:91
otb::WatershedSegmentationFilter::m_WatershedFilter
WatershedFilterType::Pointer m_WatershedFilter
Definition: otbWatershedSegmentationFilter.h:92
otb::WatershedSegmentationFilter::ImageDimension
static const unsigned int ImageDimension
Definition: otbWatershedSegmentationFilter.h:74
otb::WatershedSegmentationFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbWatershedSegmentationFilter.h:56
otb::WatershedSegmentationFilter::GenerateData
void GenerateData() override
Definition: otbWatershedSegmentationFilter.hxx:45
otb::WatershedSegmentationFilter::WatershedFilterType
itk::WatershedImageFilter< TInputImage > WatershedFilterType
Definition: otbWatershedSegmentationFilter.h:62
otb::WatershedSegmentationFilter::Self
WatershedSegmentationFilter Self
Definition: otbWatershedSegmentationFilter.h:53
otbWatershedSegmentationFilter.hxx
otb::WatershedSegmentationFilter::~WatershedSegmentationFilter
~WatershedSegmentationFilter() override
Definition: otbWatershedSegmentationFilter.hxx:39