OTB  9.0.0
Orfeo Toolbox
otbMeanShiftConnectedComponentSegmentationFilter.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 otbMeanShiftConnectedComponentSegmentationFilter_h
22 #define otbMeanShiftConnectedComponentSegmentationFilter_h
23 
24 #include "itkMacro.h"
25 
27 #include "itkConnectedComponentFunctorImageFilter.h"
28 #include "otbMaskMuParserFilter.h"
29 #include "itkRelabelComponentImageFilter.h"
30 
32 #include <string>
33 
34 namespace otb
35 {
36 
58 template <class TVInputImage, class TMaskImage, class TLabelImage>
59 class MeanShiftConnectedComponentSegmentationFilter : public itk::ImageToImageFilter<TVInputImage, TLabelImage>
60 {
61 public:
65  typedef itk::ImageToImageFilter<TVInputImage, TLabelImage> Superclass;
66 
67  typedef itk::SmartPointer<Self> Pointer;
68  typedef itk::SmartPointer<const Self> ConstPointer;
69 
70  typedef unsigned int ObjectSizeType;
71 
73  typedef TVInputImage VectorImageType;
74  typedef TMaskImage MaskImageType;
75  typedef TLabelImage LabelImageType;
76 
77  typedef typename VectorImageType::Pointer VectorImagePointerType;
78  typedef typename VectorImageType::PixelType VectorImagePixelType;
79 
81  itkNewMacro(Self);
82 
84  itkTypeMacro(MeanShiftConnectedComponentSegmentationFilter, ImageToImageFilter);
85 
87  itkStaticConstMacro(InputImageDimension, unsigned int, TVInputImage::ImageDimension);
88 
89  // Mask generation
91  typedef itk::ConnectedComponentFunctorImageFilter<VectorImageType, LabelImageType, FunctorType, MaskImageType> ConnectedComponentFilterType;
92 
93  // mask typedef
95 
96  // Labelization
97  typedef itk::RelabelComponentImageFilter<LabelImageType, LabelImageType> RelabelComponentFilterType;
98 
99  typedef double KernelType;
101 
103 
104  // ** // meanshift filter
105  /* Set/Get mean shift filter */
106  itkSetObjectMacro(MeanShiftFilter, MeanShiftFilterType);
107  itkGetObjectMacro(MeanShiftFilter, MeanShiftFilterType);
108 
109  /* Set the mathematical expression used for the mask */
110  itkSetStringMacro(MaskExpression);
111 
112  /* Get the mathematical expression used for the mask */
113  itkGetStringMacro(MaskExpression);
114 
115  /* Set the mathematical expression used during connected component segmentation */
116  itkSetStringMacro(ConnectedComponentExpression);
117 
118  /* Get the mathematical expression used during connected component segmentation */
119  itkGetStringMacro(ConnectedComponentExpression);
120 
121  /* Set the minimum object size */
122  itkSetMacro(MinimumObjectSize, ObjectSizeType);
123 
124  /* Get the minimum object size */
125  itkGetMacro(MinimumObjectSize, ObjectSizeType);
126 
127 protected:
129 
131 
132  void GenerateInputRequestedRegion() override;
133  void GenerateData() override;
134 
135 private:
137 
138  /* CC parameters */
140  std::string m_MaskExpression;
142  /* */
143 };
144 
145 
146 } // end namespace itk
147 
148 #ifndef OTB_MANUAL_INSTANTIATION
150 #endif
151 
152 #endif
otb::MeanShiftConnectedComponentSegmentationFilter::VectorImagePointerType
VectorImageType::Pointer VectorImagePointerType
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:77
otb::MeanShiftConnectedComponentSegmentationFilter::VectorImagePixelType
VectorImageType::PixelType VectorImagePixelType
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:78
otb::MeanShiftConnectedComponentSegmentationFilter::InputImageDimension
static const unsigned int InputImageDimension
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:87
otb::MeanShiftConnectedComponentSegmentationFilter::GenerateInputRequestedRegion
void GenerateInputRequestedRegion() override
Definition: otbMeanShiftConnectedComponentSegmentationFilter.hxx:43
otb::MeanShiftConnectedComponentSegmentationFilter::VectorImageType
TVInputImage VectorImageType
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:73
otb::MeanShiftConnectedComponentSegmentationFilter::m_MaskExpression
std::string m_MaskExpression
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:140
otb::MeanShiftConnectedComponentSegmentationFilter::ConnectedComponentFilterType
itk::ConnectedComponentFunctorImageFilter< VectorImageType, LabelImageType, FunctorType, MaskImageType > ConnectedComponentFilterType
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:91
otb::MeanShiftConnectedComponentSegmentationFilter::FunctorType
Functor::ConnectedComponentMuParserFunctor< VectorImagePixelType > FunctorType
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:90
otbMeanShiftConnectedComponentSegmentationFilter.hxx
otb::MeanShiftConnectedComponentSegmentationFilter::itkGetObjectMacro
itkGetObjectMacro(MeanShiftFilter, MeanShiftFilterType)
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::MeanShiftConnectedComponentSegmentationFilter::RelabelComponentFilterType
itk::RelabelComponentImageFilter< LabelImageType, LabelImageType > RelabelComponentFilterType
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:97
otb::Functor::ConnectedComponentMuParserFunctor
Definition: otbConnectedComponentMuParserFunctor.h:74
otb::MeanShiftConnectedComponentSegmentationFilter::m_MeanShiftFilter
MeanShiftFilterPointerType m_MeanShiftFilter
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:136
otb::MeanShiftConnectedComponentSegmentationFilter::Self
MeanShiftConnectedComponentSegmentationFilter Self
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:64
otb::MeanShiftConnectedComponentSegmentationFilter::MeanShiftFilterPointerType
MeanShiftFilterType::Pointer MeanShiftFilterPointerType
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:102
otb::MeanShiftConnectedComponentSegmentationFilter::KernelType
double KernelType
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:99
otb::MeanShiftConnectedComponentSegmentationFilter::MeanShiftConnectedComponentSegmentationFilter
MeanShiftConnectedComponentSegmentationFilter()
Definition: otbMeanShiftConnectedComponentSegmentationFilter.hxx:31
otb::MeanShiftConnectedComponentSegmentationFilter::~MeanShiftConnectedComponentSegmentationFilter
~MeanShiftConnectedComponentSegmentationFilter() override
Definition: otbMeanShiftConnectedComponentSegmentationFilter.hxx:38
otb::MeanShiftConnectedComponentSegmentationFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:67
otb::MeanShiftConnectedComponentSegmentationFilter::GenerateData
void GenerateData() override
Definition: otbMeanShiftConnectedComponentSegmentationFilter.hxx:49
otb::MeanShiftConnectedComponentSegmentationFilter::LabelImageType
TLabelImage LabelImageType
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:75
otb::MeanShiftConnectedComponentSegmentationFilter::MaskImageType
TMaskImage MaskImageType
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:74
otb::MeanShiftConnectedComponentSegmentationFilter::ObjectSizeType
unsigned int ObjectSizeType
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:70
otb::MeanShiftConnectedComponentSegmentationFilter::Superclass
itk::ImageToImageFilter< TVInputImage, TLabelImage > Superclass
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:65
otbConnectedComponentMuParserFunctor.h
otb::MeanShiftConnectedComponentSegmentationFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:68
otb::MaskMuParserFilter
Definition: otbMaskMuParserFilter.h:73
otb::MeanShiftSmoothingImageFilter
Definition: otbMeanShiftSmoothingImageFilter.h:467
otb::MeanShiftConnectedComponentSegmentationFilter::m_MinimumObjectSize
ObjectSizeType m_MinimumObjectSize
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:139
otbMeanShiftSmoothingImageFilter.h
otb::MeanShiftConnectedComponentSegmentationFilter::MeanShiftFilterType
otb::MeanShiftSmoothingImageFilter< VectorImageType, VectorImageType > MeanShiftFilterType
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:100
otb::MeanShiftConnectedComponentSegmentationFilter
[internal] Helper class to perform connected component segmentation on an input image,
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:59
otb::MeanShiftConnectedComponentSegmentationFilter::MaskMuParserFilterType
otb::MaskMuParserFilter< VectorImageType, MaskImageType > MaskMuParserFilterType
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:94
otbMaskMuParserFilter.h
otb::MeanShiftConnectedComponentSegmentationFilter::m_ConnectedComponentExpression
std::string m_ConnectedComponentExpression
Definition: otbMeanShiftConnectedComponentSegmentationFilter.h:141
otb::MeanShiftSmoothingImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbMeanShiftSmoothingImageFilter.h:473