OTB  9.0.0
Orfeo Toolbox
otbLabelMapSource.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 
22 #ifndef otbLabelMapSource_hxx
23 #define otbLabelMapSource_hxx
24 
25 #include "otbLabelMapSource.h"
26 
27 namespace otb
28 {
29 
30 template <class TOutputLabelMap>
32 {
33  this->Superclass::SetNumberOfRequiredOutputs(1);
34  this->Superclass::SetNthOutput(0, OutputLabelMapType::New().GetPointer());
35 }
36 
37 template <class TOutputLabelMap>
39 {
40 }
41 
42 template <class TOutputLabelMap>
44 {
45  OutputLabelMapPointer outputPtr;
46 
47  // Allocate the output memory
48  for (unsigned int i = 0; i < this->GetNumberOfOutputs(); ++i)
49  {
50  outputPtr = this->GetOutput(i);
51 
52  // TODO Need to implement the Clear Method in the class itk::LabelMap
53  // outputPtr->Clear();
54  }
55 }
56 
57 template <class TOutputLabelMap>
59 {
60  if (this->GetNumberOfOutputs() < 1)
61  {
62  return nullptr;
63  }
64  return static_cast<OutputLabelMapType*>(this->ProcessObject::GetOutput(0));
65 }
66 
67 template <class TOutputLabelMap>
69 {
70  return static_cast<OutputLabelMapType*>(this->Superclass::GetOutput(idx));
71 }
72 
73 template <class TOutputLabelMap>
74 void LabelMapSource<TOutputLabelMap>::PrintSelf(std::ostream& os, itk::Indent indent) const
75 {
76  Superclass::PrintSelf(os, indent);
77 }
78 
79 } // End namespace otb
80 
81 #endif
otb::LabelMapSource::GetOutput
virtual OutputLabelMapType * GetOutput(void)
Definition: otbLabelMapSource.hxx:58
otb::LabelMapSource::OutputLabelMapType
TOutputLabelMap OutputLabelMapType
Definition: otbLabelMapSource.h:57
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::LabelMapSource< TLabelMap >::DataObjectPointerArraySizeType
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Definition: otbLabelMapSource.h:54
otb::LabelMapSource::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbLabelMapSource.hxx:74
otb::LabelMapSource::AllocateOutputs
virtual void AllocateOutputs()
Definition: otbLabelMapSource.hxx:43
otb::LabelMapSource< TLabelMap >::OutputLabelMapPointer
TLabelMap ::Pointer OutputLabelMapPointer
Definition: otbLabelMapSource.h:58
otb::LabelMapSource::~LabelMapSource
~LabelMapSource() override
Definition: otbLabelMapSource.hxx:38
otbLabelMapSource.h
otb::LabelMapSource::LabelMapSource
LabelMapSource()
Definition: otbLabelMapSource.hxx:31