OTB  10.0.0
Orfeo Toolbox
otbStreamingInnerProductVectorImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 #ifndef otbStreamingInnerProductVectorImageFilter_h
23 #define otbStreamingInnerProductVectorImageFilter_h
24 
27 #include "itkSimpleDataObjectDecorator.h"
28 #include "itkImageRegionSplitter.h"
29 #include "itkVariableSizeMatrix.h"
30 #include "itkVariableLengthVector.h"
31 #include "vnl/vnl_matrix.h"
32 
33 namespace otb
34 {
35 
54 template <class TInputImage>
55 class ITK_EXPORT PersistentInnerProductVectorImageFilter : public PersistentImageFilter<TInputImage, TInputImage>
56 {
57 public:
61  typedef itk::SmartPointer<Self> Pointer;
62  typedef itk::SmartPointer<const Self> ConstPointer;
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  typedef itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
84 
86  typedef vnl_matrix<double> MatrixType;
87  typedef typename std::vector<MatrixType> ArrayMatrixType;
88 
90  typedef itk::SimpleDataObjectDecorator<MatrixType> MatrixObjectType;
91 
95  {
96  return this->GetInnerProductOutput()->Get();
97  }
98  MatrixObjectType* GetInnerProductOutput();
99  const MatrixObjectType* GetInnerProductOutput() const;
100 
104  DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override;
105  using Superclass::MakeOutput;
106 
110  void AllocateOutputs() override;
111  void GenerateOutputInformation() override;
112  void Synthetize(void) override;
113  void Reset(void) override;
115 
117  itkSetMacro(CenterData, bool);
118  itkGetMacro(CenterData, bool);
119  itkBooleanMacro(CenterData);
121 
122 protected:
125  {
126  }
127  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
129  void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
130 
131 private:
133  void operator=(const Self&) = delete;
134 
136 
139 
140 }; // end of class PersistentStatisticsVectorImageFilter
141 
164 template <class TInputImage>
165 class ITK_EXPORT StreamingInnerProductVectorImageFilter : public PersistentFilterStreamingDecorator<PersistentInnerProductVectorImageFilter<TInputImage>>
166 {
167 public:
171  typedef itk::SmartPointer<Self> Pointer;
172  typedef itk::SmartPointer<const Self> ConstPointer;
173 
175  itkNewMacro(Self);
176 
179 
180  typedef TInputImage InputImageType;
183 
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  }
226 
227 private:
229  void operator=(const Self&) = delete;
230 };
231 
232 } // end namespace otb
233 
234 #ifndef OTB_MANUAL_INSTANTIATION
236 #endif
237 
238 #endif
This filter link a persistent filter with a StreamingImageVirtualWriter.
This filter is the base class for all filter persisting data through multiple update....
Compute the inner product of a large image using streaming.
itk::SimpleDataObjectDecorator< MatrixType > MatrixObjectType
PersistentInnerProductVectorImageFilter(const Self &)=delete
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
PersistentImageFilter< TInputImage, TInputImage > Superclass
This class streams the whole input image through the PersistentStatisticsImageFilter.
PersistentFilterStreamingDecorator< PersistentInnerProductVectorImageFilter< TInputImage > > Superclass
StreamingInnerProductVectorImageFilter(const Self &)=delete
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.