Orfeo Toolbox  4.0
otbStreamingImageVirtualWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbStreamingImageVirtualWriter_h
19 #define __otbStreamingImageVirtualWriter_h
20 
21 #include "itkMacro.h"
22 #include "itkImageToImageFilter.h"
23 #include "otbStreamingManager.h"
24 
25 namespace otb
26 {
27 
53 template <class TInputImage >
54 class ITK_EXPORT StreamingImageVirtualWriter : public itk::ImageToImageFilter<TInputImage, TInputImage>
55 {
56 public:
62 
64  itkNewMacro(Self);
65 
68 
70  typedef TInputImage InputImageType;
71  typedef typename InputImageType::Pointer InputImagePointer;
72  typedef typename InputImageType::RegionType InputImageRegionType;
73  typedef typename InputImageType::PixelType InputImagePixelType;
74 
78 
80  itkStaticConstMacro(InputImageDimension, unsigned int,
81  InputImageType::ImageDimension);
82 
85  StreamingManagerType* GetStreamingManager(void)
86  {
87  return m_StreamingManager;
88  }
89 
92  void SetStreamingManager(StreamingManagerType* streamingManager)
93  {
94  m_StreamingManager = streamingManager;
95  }
96 
99  void SetNumberOfDivisionsStrippedStreaming(unsigned int nbDivisions);
100 
103  void SetNumberOfDivisionsTiledStreaming(unsigned int nbDivisions);
104 
107  void SetNumberOfLinesStrippedStreaming(unsigned int nbLinesPerStrip);
108 
114  void SetAutomaticStrippedStreaming(unsigned int availableRAM = 0, double bias = 1.0);
115 
118  void SetTileDimensionTiledStreaming(unsigned int tileDimension);
119 
126  void SetAutomaticTiledStreaming(unsigned int availableRAM = 0, double bias = 1.0);
127 
134  void SetAutomaticAdaptativeStreaming(unsigned int availableRAM = 0, double bias = 1.0);
135 
138  virtual void Update();
139 
140 protected:
142 
143  virtual ~StreamingImageVirtualWriter();
144 
145  void PrintSelf(std::ostream& os, itk::Indent indent) const;
146 
147  virtual void GenerateData(void);
148 
149  virtual void GenerateInputRequestedRegion(void);
150 
151 private:
152  StreamingImageVirtualWriter(const StreamingImageVirtualWriter &); //purposely not implemented
153  void operator =(const StreamingImageVirtualWriter&); //purposely not implemented
154 
155  void ObserveSourceFilterProgress(itk::Object* object, const itk::EventObject & event )
156  {
157  if (typeid(event) != typeid(itk::ProgressEvent))
158  {
159  return;
160  }
161 
162  itk::ProcessObject* processObject = dynamic_cast<itk::ProcessObject*>(object);
163  if (processObject)
164  {
165  m_DivisionProgress = processObject->GetProgress();
166  }
167 
168  this->UpdateFilterProgress();
169  }
170 
171  void UpdateFilterProgress()
172  {
173  this->UpdateProgress( (m_DivisionProgress + m_CurrentDivision) / m_NumberOfDivisions );
174  }
175 
176  unsigned int m_NumberOfDivisions;
177  unsigned int m_CurrentDivision;
179 
181 
183  unsigned long m_ObserverID;
184 };
185 
186 } // end namespace otb
187 
188 #ifndef OTB_MANUAL_INSTANTIATION
190 #endif
191 
192 #endif

Generated at Sat Mar 8 2014 16:19:54 for Orfeo Toolbox with doxygen 1.8.3.1