OTB  7.2.0
Orfeo Toolbox
otbImageToPointSetFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2020 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 otbImageToPointSetFilter_h
22 #define otbImageToPointSetFilter_h
23 
24 #include "otbPointSetSource.h"
26 
27 // TODO: This class needs a refactoring to become a persistent filter
28 
29 namespace otb
30 {
31 
43 template <class TInputImage, class TOutputPointSet>
44 class ITK_EXPORT ImageToPointSetFilter : public PointSetSource<TOutputPointSet>
45 {
46 public:
50  typedef itk::SmartPointer<Self> Pointer;
51  typedef itk::SmartPointer<const Self> ConstPointer;
52 
55 
57  typedef TInputImage InputImageType;
58  typedef typename InputImageType::Pointer InputImagePointer;
59  typedef typename InputImageType::ConstPointer InputImageConstPointer;
60  typedef typename InputImageType::RegionType InputImageRegionType;
61  typedef typename InputImageType::PixelType InputImagePixelType;
62  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
63 
69  typedef itk::ProcessObject ProcessObjectType;
70 
72  using Superclass::SetInput;
73  void SetInput(unsigned int idx, const InputImageType* input);
74  void SetInput(const InputImageType* input);
76 
78  const InputImageType* GetInput(unsigned int idx);
79  const InputImageType* GetInput();
81 
83  void GenerateOutputInformation(void) override;
84 
85 protected:
88  {
89  }
90  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
91 
92  void GenerateData(void) override;
93 
96  typedef std::vector<typename OutputPointSetType::PointsContainer::Pointer> OutputPointsContainerForThreadType;
97  typedef std::vector<typename OutputPointSetType::PointDataContainer::Pointer> OutputPointDataContainerForThreadType;
98 
99  virtual void BeforeThreadedGenerateData();
100 
101  virtual void AfterThreadedGenerateData();
102 
103  virtual int SplitRequestedRegion(int i, int num, InputImageRegionType& splitRegion);
104 
105  virtual void ThreadedGenerateData(const InputImageRegionType& inputRegionForThread, itk::ThreadIdType threadId);
106 
110  static ITK_THREAD_RETURN_TYPE ThreaderCallback(void* arg);
111 
114  {
115  Pointer Filter;
116  };
117 
118  OutputPointsContainerForThreadType m_PointsContainerPerThread;
119  OutputPointDataContainerForThreadType m_PointDataContainerPerThread;
120 
126 
127  StreamingManagerPointer m_StreamingManager;
128 
129 private:
131  void operator=(const ImageToPointSetFilter&) = delete;
132 };
133 
134 } // end namespace otb
135 
136 #ifndef OTB_MANUAL_INSTANTIATION
138 #endif
139 
140 #endif
itk::SmartPointer< Self > Pointer
This class computes the divisions needed to stream an image according to the input image tiling schem...
OutputPointSetType::Pointer OutputPointSetPointer
Base class for all process objects that output point set data.
PointSetSource< TOutputPointSet > Superclass
TOutputPointSet OutputPointSetType
OutputPointSetType::PointDataContainer PointDataContainerType
Superclass::PointsContainerType PointsContainerType
InputImageType::Pointer InputImagePointer
InputImageType::RegionType InputImageRegionType
Base class to output PointSet data with image data as input.
RAMDrivenAdaptativeStreamingManager< InputImageType > StreamingManagerType
Superclass::OutputPointSetType OutputPointSetType
OutputPointSetType::PointsContainer PointsContainerType
itk::SmartPointer< const Self > ConstPointer
InputImageType::ConstPointer InputImageConstPointer
Superclass::OutputPointSetPointer OutputPointSetPointer
OutputPointDataContainerForThreadType m_PointDataContainerPerThread
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
OutputPointsContainerForThreadType m_PointsContainerPerThread
std::vector< typename OutputPointSetType::PointsContainer::Pointer > OutputPointsContainerForThreadType
InputImageType::PixelType InputImagePixelType
StreamingManagerPointer m_StreamingManager
std::vector< typename OutputPointSetType::PointDataContainer::Pointer > OutputPointDataContainerForThreadType
StreamingManagerType::Pointer StreamingManagerPointer
Superclass::PointDataContainerType PointDataContainerType