OTB  10.0.0
Orfeo Toolbox
otbChangeLabelImageFilter.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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
ChangeLabelImageFilter()
Number of components per pixel.
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Number of components per pixel.
TOutputImage::PixelType OutputPixelType
void SetChangeMap(const ChangeMapType &changeMap)
void SetChange(const InputPixelType &original, const OutputPixelType &result)
std::map< InputPixelType, OutputPixelType > ChangeMapType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.