OTB  5.0.0
Orfeo Toolbox
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 
27 #include "itkImageRegionSplitter.h"
28 #include "itkVariableSizeMatrix.h"
30 #include "vnl/vnl_matrix.h"
31 
32 namespace otb
33 {
34 
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 
84 
86  typedef vnl_matrix<double> MatrixType;
87  typedef typename std::vector<MatrixType> ArrayMatrixType;
88 
91 
95  {
96  return this->GetInnerProductOutput()->Get();
97  }
98  MatrixObjectType* GetInnerProductOutput();
99  const MatrixObjectType* GetInnerProductOutput() const;
100 
104  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
105  using Superclass::MakeOutput;
106 
110  virtual void AllocateOutputs();
111  virtual void GenerateOutputInformation();
112  virtual void Synthetize(void);
113  virtual void Reset(void);
115 
117  itkSetMacro(CenterData, bool);
118  itkGetMacro(CenterData, bool);
119  itkBooleanMacro(CenterData);
121 
122 protected:
125  virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
127  void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId);
128 
129 private:
130  PersistentInnerProductVectorImageFilter(const Self &); //purposely not implemented
131  void operator =(const Self&); //purposely not implemented
132 
134 
137 
138 }; // end of class PersistentStatisticsVectorImageFilter
139 
162 template<class TInputImage>
164  public PersistentFilterStreamingDecorator<PersistentInnerProductVectorImageFilter<TInputImage> >
165 {
166 public:
173 
175  itkNewMacro(Self);
176 
179 
180  typedef TInputImage InputImageType;
182  typedef typename StatFilterType::MatrixType MatrixType;
183 
185  typedef typename StatFilterType::MatrixObjectType MatrixObjectType;
186 
187  using Superclass::SetInput;
188  void SetInput(TInputImage * input)
189  {
190  this->GetFilter()->SetInput(input);
191  }
192  TInputImage * GetInput()
193  {
194  return this->GetFilter()->GetInput();
195  }
196 
199  {
200  return this->GetFilter()->GetInnerProductOutput()->Get();
201  }
203  {
204  return this->GetFilter()->GetInnerProductOutput();
205  }
207  {
208  return this->GetFilter()->GetInnerProductOutput();
209  }
211 
213  void SetCenterData(bool centerdata)
214  {
215  this->GetFilter()->SetCenterData(centerdata);
216  }
217 
218 protected:
221 
224 
225 private:
226  StreamingInnerProductVectorImageFilter(const Self &); //purposely not implemented
227  void operator =(const Self&); //purposely not implemented
228 
229 };
230 
231 } // end namespace otb
232 
233 #ifndef OTB_MANUAL_INSTANTIATION
235 #endif
236 
237 #endif
PersistentFilterStreamingDecorator< PersistentInnerProductVectorImageFilter< TInputImage > > Superclass
This class streams the whole input image through the PersistentStatisticsImageFilter.
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Compute the inner product of a large image using streaming.
itk::SimpleDataObjectDecorator< MatrixType > MatrixObjectType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
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.