OTB  9.0.0
Orfeo Toolbox
otbChangeLabelImageFilter.hxx
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 otbChangeLabelImageFilter_hxx
22 #define otbChangeLabelImageFilter_hxx
23 
25 
26 namespace otb
27 {
28 
32 template <class TInputImage, class TOutputImage>
34 {
35 }
36 
40 template <class TInputImage, class TOutputImage>
42 {
43  OutputPixelType current = this->GetFunctor().GetChange(original);
44  if (current != result)
45  {
46  this->GetFunctor().SetChange(original, result);
47  this->Modified();
48  }
49 }
51 
55 template <class TInputImage, class TOutputImage>
57 {
58  // If the whole map is being set then we assume that a real change is made
59  this->GetFunctor().SetChangeMap(changeMap);
60  this->Modified();
61 }
63 
67 template <class TInputImage, class TOutputImage>
69 {
70  // If the whole map is being set then we assume that a real change is made
71  this->GetFunctor().ClearChangeMap();
72  this->Modified();
73 }
75 
79 template <class TInputImage, class TOutputImage>
81 {
82  Superclass::GenerateOutputInformation();
83 
84  this->GetOutput()->SetNumberOfComponentsPerPixel(m_NumberOfComponentsPerPixel);
85 }
86 
90 template <class TInputImage, class TOutputImage>
91 void ChangeLabelImageFilter<TInputImage, TOutputImage>::PrintSelf(std::ostream& os, itk::Indent indent) const
92 {
93  Superclass::PrintSelf(os, indent);
94  os << indent << "Number of components per pixel: " << m_NumberOfComponentsPerPixel;
95 }
97 
98 } // end namespace
99 
100 #endif
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ChangeLabelImageFilter::SetChange
void SetChange(const InputPixelType &original, const OutputPixelType &result)
Definition: otbChangeLabelImageFilter.hxx:41
otbChangeLabelImageFilter.h
otb::ChangeLabelImageFilter::InputPixelType
TInputImage::PixelType InputPixelType
Definition: otbChangeLabelImageFilter.h:140
otb::ChangeLabelImageFilter::OutputPixelType
TOutputImage::PixelType OutputPixelType
Definition: otbChangeLabelImageFilter.h:144
otb::ChangeLabelImageFilter::ClearChangeMap
void ClearChangeMap()
Definition: otbChangeLabelImageFilter.hxx:68
otb::ChangeLabelImageFilter::GenerateOutputInformation
void GenerateOutputInformation() override
Definition: otbChangeLabelImageFilter.hxx:80
otb::ChangeLabelImageFilter::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Number of components per pixel.
Definition: otbChangeLabelImageFilter.hxx:91
otb::ChangeLabelImageFilter::SetChangeMap
void SetChangeMap(const ChangeMapType &changeMap)
Definition: otbChangeLabelImageFilter.hxx:56
otb::ChangeLabelImageFilter::ChangeMapType
std::map< InputPixelType, OutputPixelType > ChangeMapType
Definition: otbChangeLabelImageFilter.h:147
otb::ChangeLabelImageFilter::ChangeLabelImageFilter
ChangeLabelImageFilter()
Number of components per pixel.
Definition: otbChangeLabelImageFilter.hxx:33