OTB  9.0.0
Orfeo Toolbox
otbLabelObjectWithClassLabelFieldsFunctor.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 otbLabelObjectWithClassLabelFieldsFunctor_h
22 #define otbLabelObjectWithClassLabelFieldsFunctor_h
23 
24 #include "itkLabelObject.h"
25 #include <map>
26 
27 namespace otb
28 {
29 
30 namespace Functor
31 {
32 
40 template <class TLabelObject>
42 {
43 public:
44  // The Label Object typedef
45  typedef TLabelObject LabelObjectType;
46  typedef std::map<std::string, std::string> FieldsMapType;
47 
49  {
50  typename LabelObjectType::ClassLabelType classLabel = labelObject->GetClassLabel();
51  std::ostringstream oss;
52  oss << classLabel;
53 
54  FieldsMapType fields;
55  fields["Class"] = oss.str();
56  return fields;
57  }
58 };
59 
60 } // end namespace Functor
61 
62 } // end namespace otb
63 #endif
otb::Functor::LabelObjectWithClassLabelFieldsFunctor::operator()
FieldsMapType operator()(LabelObjectType *labelObject) const
Definition: otbLabelObjectWithClassLabelFieldsFunctor.h:48
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Functor::LabelObjectWithClassLabelFieldsFunctor::LabelObjectType
TLabelObject LabelObjectType
Definition: otbLabelObjectWithClassLabelFieldsFunctor.h:45
otb::Functor::LabelObjectWithClassLabelFieldsFunctor::FieldsMapType
std::map< std::string, std::string > FieldsMapType
Definition: otbLabelObjectWithClassLabelFieldsFunctor.h:46
otb::Functor::LabelObjectWithClassLabelFieldsFunctor
Returns additional OGR fields to be saved in VectorData.
Definition: otbLabelObjectWithClassLabelFieldsFunctor.h:41