OTB  10.0.0
Orfeo Toolbox
otbObjectListToObjectListFilter.h
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 otbObjectListToObjectListFilter_h
22 #define otbObjectListToObjectListFilter_h
23 
24 #include "otbObjectListSource.h"
25 #include "otbMacro.h" //for ITK_THREAD_RETURN_TYPE in ITK5
26 #include "itkMultiThreaderBase.h"
27 
28 namespace otb
29 {
30 
47 template <class TInputList, class TOutputList>
48 class ITK_EXPORT ObjectListToObjectListFilter : public otb::ObjectListSource<TOutputList>
49 {
50 public:
54  typedef itk::SmartPointer<Self> Pointer;
55  typedef itk::SmartPointer<const Self> ConstPointer;
56 
58  itkNewMacro(Self);
59 
62 
64  typedef TInputList InputListType;
65  typedef TOutputList OutputListType;
66  typedef typename TInputList::ConstPointer InputListPointer;
67  typedef typename TOutputList::Pointer OutputListPointer;
68  typedef typename TInputList::ConstIterator InputListIterator;
69  typedef typename InputListType::ObjectType InputObjectType;
70  typedef typename OutputListType::ObjectType OutputObjectType;
71 
72  typedef itk::DataObject::Pointer DataObjectPointer;
73 
74  using Superclass::SetInput;
75  virtual void SetInput(const InputListType* input);
76  const InputListType* GetInput(void);
77 
78 protected:
81 
84  {
85  }
86 
88  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
89 
90  void GenerateData(void) override;
91 
94  typedef std::vector<OutputListPointer> OutputListForThreadType;
95 
96  virtual void BeforeThreadedGenerateData();
97 
99  {
100  }
101 
102  virtual int SplitRequestedRegion(itk::ThreadIdType threadId, int threadCount, unsigned int requestedElements, unsigned int& startIndex,
103  unsigned int& stopIndex);
104 
107  virtual void ThreadedGenerateData(unsigned int startIndex, unsigned int stopIndex, itk::ThreadIdType threadId);
108 
112  static itk::ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg);
113 
116  {
118  };
119 
121 
124 private:
126  void operator=(const Self&) = delete;
127 };
128 
129 } // end namespace otb
130 
131 #ifndef OTB_MANUAL_INSTANTIATION
133 #endif
134 
135 #endif
Base class for all process objects that output ObjectList data.
itk::SmartPointer< Self > Pointer
Base class for filters that take an ObjectList as input and produce an ObjectList as output.
otb::ObjectListSource< TOutputList > Superclass
void operator=(const Self &)=delete
std::vector< OutputListPointer > OutputListForThreadType
ObjectListToObjectListFilter(const Self &)=delete
itk::SmartPointer< const Self > ConstPointer
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.