OTB  9.0.0
Orfeo Toolbox
otbStreamingMinMaxVectorImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2022 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 otbStreamingMinMaxVectorImageFilter_h
23 #define otbStreamingMinMaxVectorImageFilter_h
24 
27 #include "itkSimpleDataObjectDecorator.h"
28 #include "itkImageRegionSplitter.h"
29 #include "itkVariableSizeMatrix.h"
30 #include "itkVariableLengthVector.h"
31 
32 namespace otb
33 {
34 
53 template <class TInputImage>
54 class ITK_EXPORT PersistentMinMaxVectorImageFilter : public PersistentImageFilter<TInputImage, TInputImage>
55 {
56 public:
60  typedef itk::SmartPointer<Self> Pointer;
61  typedef itk::SmartPointer<const Self> ConstPointer;
62 
64  itkNewMacro(Self);
65 
68 
70  typedef TInputImage ImageType;
71  typedef typename TInputImage::Pointer InputImagePointer;
72  typedef typename TInputImage::RegionType RegionType;
73  typedef typename TInputImage::SizeType SizeType;
74  typedef typename TInputImage::IndexType IndexType;
75  typedef typename TInputImage::PixelType PixelType;
76  typedef typename TInputImage::InternalPixelType InternalPixelType;
77 
78  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
79 
81  itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
82 
84  typedef typename itk::NumericTraits<InternalPixelType>::RealType RealType;
85  typedef itk::VariableLengthVector<RealType> RealPixelType;
86 
88  typedef typename itk::DataObject::Pointer DataObjectPointer;
89  typedef itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
90 
92  typedef typename itk::VariableSizeMatrix<RealType> MatrixType;
93  typedef typename std::vector<MatrixType> ArrayMatrixType;
94  typedef typename itk::Array<long> ArrayLongPixelType;
95  typedef typename std::vector<RealPixelType> ArrayRealPixelType;
96  typedef typename std::vector<PixelType> ArrayPixelType;
97  typedef itk::SimpleDataObjectDecorator<RealPixelType> RealPixelObjectType;
98  typedef itk::SimpleDataObjectDecorator<PixelType> PixelObjectType;
99  typedef itk::SimpleDataObjectDecorator<MatrixType> MatrixObjectType;
100 
104  itkSetMacro(NoDataValue, InternalPixelType);
105 
109  itkGetConstReferenceMacro(NoDataValue, InternalPixelType);
110 
114  itkSetMacro(NoDataFlag, bool);
115 
119  itkGetMacro(NoDataFlag, bool);
120 
124  itkBooleanMacro(NoDataFlag);
125 
126 
129  {
130  return this->GetMinimumOutput()->Get();
131  }
132  PixelObjectType* GetMinimumOutput();
133  const PixelObjectType* GetMinimumOutput() const;
135 
138  {
139  return this->GetMaximumOutput()->Get();
140  }
141  PixelObjectType* GetMaximumOutput();
142  const PixelObjectType* GetMaximumOutput() const;
144 
148  DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override;
149  using Superclass::MakeOutput;
150 
154  void AllocateOutputs() override;
155  void GenerateOutputInformation() override;
156  void Synthetize(void) override;
157  void Reset(void) override;
159 
160 protected:
163  {
164  }
165  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
167  void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
168 
169 private:
170  PersistentMinMaxVectorImageFilter(const Self&) = delete;
171  void operator=(const Self&) = delete;
172 
177 
178 }; // end of class PersistentStatisticsVectorImageFilter
179 
202 template <class TInputImage>
203 class ITK_EXPORT StreamingMinMaxVectorImageFilter : public PersistentFilterStreamingDecorator<PersistentMinMaxVectorImageFilter<TInputImage>>
204 {
205 public:
209  typedef itk::SmartPointer<Self> Pointer;
210  typedef itk::SmartPointer<const Self> ConstPointer;
211 
213  itkNewMacro(Self);
214 
217 
218  typedef TInputImage InputImageType;
228 
233 
234  using Superclass::SetInput;
236  {
237  this->GetFilter()->SetInput(input);
238  }
240  {
241  return this->GetFilter()->GetInput();
242  }
243 
246  {
247  return this->GetFilter()->GetMinimumOutput()->Get();
248  }
250  {
251  return this->GetFilter()->GetMinimumOutput();
252  }
254  {
255  return this->GetFilter()->GetMinimumOutput();
256  }
258 
261  {
262  return this->GetFilter()->GetMaximumOutput()->Get();
263  }
265  {
266  return this->GetFilter()->GetMaximumOutput();
267  }
269  {
270  return this->GetFilter()->GetMaximumOutput();
271  }
273 
274 protected:
277 
280  {
281  }
282 
283 private:
284  StreamingMinMaxVectorImageFilter(const Self&) = delete;
285  void operator=(const Self&) = delete;
286 };
287 
288 } // end namespace otb
289 
290 #ifndef OTB_MANUAL_INSTANTIATION
292 #endif
293 
294 #endif
otb::StreamingMinMaxVectorImageFilter::StreamingMinMaxVectorImageFilter
StreamingMinMaxVectorImageFilter()
Definition: otbStreamingMinMaxVectorImageFilter.h:276
otb::StreamingMinMaxVectorImageFilter::RealPixelType
StatFilterType::RealPixelType RealPixelType
Definition: otbStreamingMinMaxVectorImageFilter.h:222
otb::PersistentMinMaxVectorImageFilter::GetMaximum
PixelType GetMaximum() const
Definition: otbStreamingMinMaxVectorImageFilter.h:137
otb::PersistentMinMaxVectorImageFilter::RealPixelType
itk::VariableLengthVector< RealType > RealPixelType
Definition: otbStreamingMinMaxVectorImageFilter.h:85
otb::StreamingMinMaxVectorImageFilter::ArrayLongPixelType
StatFilterType::ArrayLongPixelType ArrayLongPixelType
Definition: otbStreamingMinMaxVectorImageFilter.h:225
otb::StreamingMinMaxVectorImageFilter::Self
StreamingMinMaxVectorImageFilter Self
Definition: otbStreamingMinMaxVectorImageFilter.h:207
otbPersistentImageFilter.h
otb::StreamingMinMaxVectorImageFilter
This class streams the whole input image through the PersistentMinMaxVectorImageFilter.
Definition: otbStreamingMinMaxVectorImageFilter.h:203
otb::StreamingMinMaxVectorImageFilter::StatFilterType
Superclass::FilterType StatFilterType
Definition: otbStreamingMinMaxVectorImageFilter.h:219
otb::StreamingMinMaxVectorImageFilter::MatrixObjectType
StatFilterType::MatrixObjectType MatrixObjectType
Definition: otbStreamingMinMaxVectorImageFilter.h:232
otb::PersistentImageFilter
This filter is the base class for all filter persisting data through multiple update....
Definition: otbPersistentImageFilter.h:47
otb::PersistentMinMaxVectorImageFilter
Compute min. max of a large image using streaming.
Definition: otbStreamingMinMaxVectorImageFilter.h:54
otb::PersistentMinMaxVectorImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbStreamingMinMaxVectorImageFilter.h:61
otb::PersistentMinMaxVectorImageFilter::RegionType
TInputImage::RegionType RegionType
Definition: otbStreamingMinMaxVectorImageFilter.h:72
otb::StreamingMinMaxVectorImageFilter::GetInput
const InputImageType * GetInput()
Definition: otbStreamingMinMaxVectorImageFilter.h:239
otb::PersistentMinMaxVectorImageFilter::DataObjectPointerArraySizeType
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Definition: otbStreamingMinMaxVectorImageFilter.h:89
otbPersistentFilterStreamingDecorator.h
otb::StreamingMinMaxVectorImageFilter::ArrayMatrixType
StatFilterType::ArrayMatrixType ArrayMatrixType
Definition: otbStreamingMinMaxVectorImageFilter.h:224
otb::PersistentMinMaxVectorImageFilter::ImageType
TInputImage ImageType
Definition: otbStreamingMinMaxVectorImageFilter.h:67
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::StreamingMinMaxVectorImageFilter::PixelType
StatFilterType::PixelType PixelType
Definition: otbStreamingMinMaxVectorImageFilter.h:220
otb::StreamingMinMaxVectorImageFilter::InputImageType
TInputImage InputImageType
Definition: otbStreamingMinMaxVectorImageFilter.h:216
otb::StreamingMinMaxVectorImageFilter::GetMinimumOutput
const PixelObjectType * GetMinimumOutput() const
Definition: otbStreamingMinMaxVectorImageFilter.h:253
otb::PersistentMinMaxVectorImageFilter::SizeType
TInputImage::SizeType SizeType
Definition: otbStreamingMinMaxVectorImageFilter.h:73
otb::StreamingMinMaxVectorImageFilter::GetMaximumOutput
const PixelObjectType * GetMaximumOutput() const
Definition: otbStreamingMinMaxVectorImageFilter.h:268
otb::PersistentMinMaxVectorImageFilter::PixelObjectType
itk::SimpleDataObjectDecorator< PixelType > PixelObjectType
Definition: otbStreamingMinMaxVectorImageFilter.h:98
otb::PersistentMinMaxVectorImageFilter::m_ThreadMax
ArrayPixelType m_ThreadMax
Definition: otbStreamingMinMaxVectorImageFilter.h:174
otb::PersistentMinMaxVectorImageFilter::InternalPixelType
TInputImage::InternalPixelType InternalPixelType
Definition: otbStreamingMinMaxVectorImageFilter.h:76
otb::PersistentMinMaxVectorImageFilter::ArrayRealPixelType
std::vector< RealPixelType > ArrayRealPixelType
Definition: otbStreamingMinMaxVectorImageFilter.h:95
otb::PersistentMinMaxVectorImageFilter::InputImagePointer
TInputImage::Pointer InputImagePointer
Definition: otbStreamingMinMaxVectorImageFilter.h:71
otb::StreamingMinMaxVectorImageFilter::GetMinimumOutput
PixelObjectType * GetMinimumOutput()
Definition: otbStreamingMinMaxVectorImageFilter.h:249
otb::StreamingMinMaxVectorImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbStreamingMinMaxVectorImageFilter.h:210
otb::StreamingMinMaxVectorImageFilter::GetMinimum
PixelType GetMinimum() const
Definition: otbStreamingMinMaxVectorImageFilter.h:245
otb::PersistentMinMaxVectorImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbStreamingMinMaxVectorImageFilter.h:60
otb::StreamingMinMaxVectorImageFilter::~StreamingMinMaxVectorImageFilter
~StreamingMinMaxVectorImageFilter() override
Definition: otbStreamingMinMaxVectorImageFilter.h:279
otb::StreamingMinMaxVectorImageFilter::ArrayPixelType
StatFilterType::ArrayPixelType ArrayPixelType
Definition: otbStreamingMinMaxVectorImageFilter.h:227
otb::StreamingMinMaxVectorImageFilter::RealType
StatFilterType::RealType RealType
Definition: otbStreamingMinMaxVectorImageFilter.h:221
otb::StreamingMinMaxVectorImageFilter::PixelObjectType
StatFilterType::PixelObjectType PixelObjectType
Definition: otbStreamingMinMaxVectorImageFilter.h:231
otb::PersistentMinMaxVectorImageFilter::m_ThreadMin
ArrayPixelType m_ThreadMin
Definition: otbStreamingMinMaxVectorImageFilter.h:173
otb::MetaDataKey::NoDataValue
OTBMetadata_EXPORT char const * NoDataValue
otb::PersistentMinMaxVectorImageFilter::RealType
itk::NumericTraits< InternalPixelType >::RealType RealType
Definition: otbStreamingMinMaxVectorImageFilter.h:84
otb::StreamingMinMaxVectorImageFilter::RealPixelObjectType
StatFilterType::RealPixelObjectType RealPixelObjectType
Definition: otbStreamingMinMaxVectorImageFilter.h:230
otb::PersistentMinMaxVectorImageFilter::Self
PersistentMinMaxVectorImageFilter Self
Definition: otbStreamingMinMaxVectorImageFilter.h:58
otb::PersistentFilterStreamingDecorator
This filter link a persistent filter with a StreamingImageVirtualWriter.
Definition: otbPersistentFilterStreamingDecorator.h:47
otb::PersistentMinMaxVectorImageFilter::m_NoDataValue
InternalPixelType m_NoDataValue
Definition: otbStreamingMinMaxVectorImageFilter.h:176
otbStreamingMinMaxVectorImageFilter.hxx
otb::StreamingMinMaxVectorImageFilter::GetMaximum
PixelType GetMaximum() const
Definition: otbStreamingMinMaxVectorImageFilter.h:260
otb::PersistentMinMaxVectorImageFilter::Superclass
PersistentImageFilter< TInputImage, TInputImage > Superclass
Definition: otbStreamingMinMaxVectorImageFilter.h:59
otb::PersistentMinMaxVectorImageFilter::RealPixelObjectType
itk::SimpleDataObjectDecorator< RealPixelType > RealPixelObjectType
Definition: otbStreamingMinMaxVectorImageFilter.h:97
otb::PersistentMinMaxVectorImageFilter::ArrayLongPixelType
itk::Array< long > ArrayLongPixelType
Definition: otbStreamingMinMaxVectorImageFilter.h:94
otb::StreamingMinMaxVectorImageFilter::GetMaximumOutput
PixelObjectType * GetMaximumOutput()
Definition: otbStreamingMinMaxVectorImageFilter.h:264
otb::PersistentMinMaxVectorImageFilter::DataObjectPointer
itk::DataObject::Pointer DataObjectPointer
Definition: otbStreamingMinMaxVectorImageFilter.h:88
otb::StreamingMinMaxVectorImageFilter::ArrayRealPixelType
StatFilterType::ArrayRealPixelType ArrayRealPixelType
Definition: otbStreamingMinMaxVectorImageFilter.h:226
otb::StreamingMinMaxVectorImageFilter::SetInput
void SetInput(InputImageType *input)
Definition: otbStreamingMinMaxVectorImageFilter.h:235
otb::StreamingMinMaxVectorImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbStreamingMinMaxVectorImageFilter.h:209
otb::PersistentMinMaxVectorImageFilter::ArrayPixelType
std::vector< PixelType > ArrayPixelType
Definition: otbStreamingMinMaxVectorImageFilter.h:96
otb::PersistentMinMaxVectorImageFilter::MatrixObjectType
itk::SimpleDataObjectDecorator< MatrixType > MatrixObjectType
Definition: otbStreamingMinMaxVectorImageFilter.h:99
otb::PersistentMinMaxVectorImageFilter::MatrixType
itk::VariableSizeMatrix< RealType > MatrixType
Definition: otbStreamingMinMaxVectorImageFilter.h:92
otb::PersistentMinMaxVectorImageFilter::PixelType
TInputImage::PixelType PixelType
Definition: otbStreamingMinMaxVectorImageFilter.h:75
otb::StreamingMinMaxVectorImageFilter::Superclass
PersistentFilterStreamingDecorator< PersistentMinMaxVectorImageFilter< TInputImage > > Superclass
Definition: otbStreamingMinMaxVectorImageFilter.h:208
otb::PersistentMinMaxVectorImageFilter::GetMinimum
PixelType GetMinimum() const
Definition: otbStreamingMinMaxVectorImageFilter.h:128
otb::PersistentMinMaxVectorImageFilter::m_NoDataFlag
bool m_NoDataFlag
Definition: otbStreamingMinMaxVectorImageFilter.h:175
otb::PersistentMinMaxVectorImageFilter::ArrayMatrixType
std::vector< MatrixType > ArrayMatrixType
Definition: otbStreamingMinMaxVectorImageFilter.h:93
otb::PersistentMinMaxVectorImageFilter::~PersistentMinMaxVectorImageFilter
~PersistentMinMaxVectorImageFilter() override
Definition: otbStreamingMinMaxVectorImageFilter.h:162
otb::PersistentMinMaxVectorImageFilter::IndexType
TInputImage::IndexType IndexType
Definition: otbStreamingMinMaxVectorImageFilter.h:74
otb::StreamingMinMaxVectorImageFilter::MatrixType
StatFilterType::MatrixType MatrixType
Definition: otbStreamingMinMaxVectorImageFilter.h:223