OTB  6.7.0
Orfeo Toolbox
otbStreamingManager.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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 otbStreamingManager_h
22 #define otbStreamingManager_h
23 
24 #include "otbMacro.h"
25 
26 #include "itkDataObject.h"
29 
30 namespace otb
31 {
32 
52 template<class TImage>
53 class ITK_EXPORT StreamingManager : public itk::Object
54 {
55 public:
61 
62  typedef TImage ImageType;
63  typedef typename ImageType::Pointer ImagePointerType;
64  typedef typename ImageType::RegionType RegionType;
65  typedef typename RegionType::IndexType IndexType;
66  typedef typename RegionType::SizeType SizeType;
67  typedef typename ImageType::InternalPixelType PixelType;
68 
71 
73  itkTypeMacro(StreamingManager, itk::LightObject);
74 
76  itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
77 
78  const AbstractSplitterType * GetSplitter() const;
79 
82  virtual void PrepareStreaming(itk::DataObject * input, const RegionType &region) = 0;
83 
87  virtual unsigned int GetNumberOfSplits();
88 
92  virtual RegionType GetSplit(unsigned int i);
93 
94  itkSetMacro(DefaultRAM, MemoryPrintType);
95  itkGetMacro(DefaultRAM, MemoryPrintType);
96 
97 protected:
99  ~StreamingManager() override;
100 
101  virtual unsigned int EstimateOptimalNumberOfDivisions(itk::DataObject * input, const RegionType &region,
102  MemoryPrintType availableRAMInMB,
103  double bias = 1.0);
104 
107 
110 
114 
115 private:
116  StreamingManager(const StreamingManager &) = delete;
117  void operator =(const StreamingManager&) = delete;
118 
122  MemoryPrintType GetActualAvailableRAMInBytes(MemoryPrintType availableRAMInMB);
123 
126 };
127 
128 } // End namespace otb
129 
130 #ifndef OTB_MANUAL_INSTANTIATION
131 #include "otbStreamingManager.hxx"
132 #endif
133 
134 #endif
135 
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
unsigned int m_ComputedNumberOfSplits
AbstractSplitterPointerType m_Splitter
itk::SmartPointer< const Self > ConstPointer
ImageType::Pointer ImagePointerType
RegionType::IndexType IndexType
ImageType::InternalPixelType PixelType
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
AbstractSplitterType::Pointer AbstractSplitterPointerType
RegionType::SizeType SizeType
itk::LightObject Superclass
This class handles the streaming process used in the writers implementation.
itk::SmartPointer< Self > Pointer
otb::PipelineMemoryPrintCalculator::MemoryPrintType MemoryPrintType
ImageType::RegionType RegionType
itk::ImageRegionSplitterBase AbstractSplitterType
MemoryPrintType m_DefaultRAM