Orfeo ToolBox  4.2
Orfeo ToolBox is not a black box
otbStreamingInnerProductVectorImageFilter.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  Some parts of this code are derived from ITK. See ITKCopyright.txt
13  for details.
14 
15 
16  This software is distributed WITHOUT ANY WARRANTY; without even
17  the implied warranty of MERCHANT2ABILITY or FITNESS FOR A PARTICULAR
18  PURPOSE. See the above copyright notices for more information.
19 
20 =========================================================================*/
21 #ifndef __otbStreamingInnerProductVectorImageFilter_h
22 #define __otbStreamingInnerProductVectorImageFilter_h
23 
26 #include "itkNumericTraits.h"
27 #include "itkArray.h"
29 #include "itkImageRegionSplitter.h"
30 #include "itkVariableSizeMatrix.h"
32 #include "vnl/vnl_matrix.h"
33 
34 namespace otb
35 {
36 
53 template<class TInputImage>
55  public PersistentImageFilter<TInputImage, TInputImage>
56 {
57 public:
63 
65  itkNewMacro(Self);
66 
69 
71  typedef TInputImage ImageType;
72  typedef typename TInputImage::Pointer InputImagePointer;
73  typedef typename TInputImage::RegionType RegionType;
74  typedef typename TInputImage::PixelType PixelType;
75 
76  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
77 
79  itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
80 
82  typedef typename itk::DataObject::Pointer DataObjectPointer;
83 
85  typedef vnl_matrix<double> MatrixType;
86  typedef typename std::vector<MatrixType> ArrayMatrixType;
87 
90 
94  {
95  return this->GetInnerProductOutput()->Get();
96  }
97  MatrixObjectType* GetInnerProductOutput();
98  const MatrixObjectType* GetInnerProductOutput() const;
99 
103  virtual DataObjectPointer MakeOutput(unsigned int idx);
104 
108  virtual void AllocateOutputs();
109  virtual void GenerateOutputInformation();
110  virtual void Synthetize(void);
111  virtual void Reset(void);
112 
114  itkSetMacro(CenterData, bool);
115  itkGetMacro(CenterData, bool);
116  itkBooleanMacro(CenterData);
117 
118 protected:
121  virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
123  void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId);
124 
125 private:
126  PersistentInnerProductVectorImageFilter(const Self &); //purposely not implemented
127  void operator =(const Self&); //purposely not implemented
128 
130 
133 
134 }; // end of class PersistentStatisticsVectorImageFilter
135 
156 template<class TInputImage>
158  public PersistentFilterStreamingDecorator<PersistentInnerProductVectorImageFilter<TInputImage> >
159 {
160 public:
167 
169  itkNewMacro(Self);
170 
173 
174  typedef TInputImage InputImageType;
176  typedef typename StatFilterType::MatrixType MatrixType;
177 
180 
181  void SetInput(TInputImage * input)
182  {
183  this->GetFilter()->SetInput(input);
184  }
185  TInputImage * GetInput()
186  {
187  return this->GetFilter()->GetInput();
188  }
189 
192  {
193  return this->GetFilter()->GetInnerProductOutput()->Get();
194  }
196  {
197  return this->GetFilter()->GetInnerProductOutput();
198  }
200  {
201  return this->GetFilter()->GetInnerProductOutput();
202  }
203 
205  void SetCenterData(bool centerdata)
206  {
207  this->GetFilter()->SetCenterData(centerdata);
208  }
209 
210 protected:
215 
216 private:
217  StreamingInnerProductVectorImageFilter(const Self &); //purposely not implemented
218  void operator =(const Self&); //purposely not implemented
219 
220 };
221 
222 } // end namespace otb
223 
224 #ifndef OTB_MANUAL_INSTANTIATION
226 #endif
227 
228 #endif
PersistentFilterStreamingDecorator< PersistentInnerProductVectorImageFilter< TInputImage > > Superclass
This class streams the whole input image through the PersistentStatisticsImageFilter.
Compute the inner product of a large image using streaming.
itk::SimpleDataObjectDecorator< MatrixType > MatrixObjectType
PersistentImageFilter< TInputImage, TInputImage > Superclass
This filter is the base class for all filter persisting data through multiple update. For instance, a filter computing global statistics on an image with streaming capabilities will have to keep the temporary results for each streamed piece of the image in order to synthesize the global statistics at the end. This filter is an itk::ImageToImageFilter, providing two additional methods. The first one, Synthetize(), allows the user to synthesize temporary data produced by the multiple updates on different pieces of the image to the global result. The second one, Reset(), allows the user to reset the temporary data for a new input image for instance.
unsigned int ThreadIdType
This filter link a persistent filter with a StreamingImageVirtualWriter.