22 #ifndef __StreamingStatisticsMosaicFilter_H
23 #define __StreamingStatisticsMosaicFilter_H
29 #include "itkSimpleDataObjectDecorator.h"
30 #include "itkImageRegionConstIteratorWithOnlyIndex.h"
53 template <
class TInputImage,
class TOutputImage = TInputImage,
class TInternalValueType =
double>
85 typedef itk::ImageRegionConstIteratorWithOnlyIndex<OutputImageType>
IteratorType;
99 void AllocateOutputs()
override;
100 void ThreadedGenerateData(
const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId)
override;
101 void Reset()
override;
102 void Synthetize()
override;
107 using Superclass::MakeOutput;
112 return this->GetMeansOutput()->Get();
114 RealMatrixListObjectType* GetMeansOutput();
115 const RealMatrixListObjectType* GetMeansOutput()
const;
121 return this->GetStdsOutput()->Get();
123 RealMatrixListObjectType* GetStdsOutput();
124 const RealMatrixListObjectType* GetStdsOutput()
const;
130 return this->GetMinsOutput()->Get();
132 RealMatrixListObjectType* GetMinsOutput();
133 const RealMatrixListObjectType* GetMinsOutput()
const;
139 return this->GetMaxsOutput()->Get();
141 RealMatrixListObjectType* GetMaxsOutput();
142 const RealMatrixListObjectType* GetMaxsOutput()
const;
148 return this->GetMeansOfProductsOutput()->Get();
150 RealMatrixListObjectType* GetMeansOfProductsOutput();
151 const RealMatrixListObjectType* GetMeansOfProductsOutput()
const;
157 return this->GetAreasOutput()->Get();
159 RealMatrixObjectType* GetAreasOutput();
160 const RealMatrixObjectType* GetAreasOutput()
const;
188 Clear(nbOfBands, nbOfSamples);
203 void Clear(
unsigned int nbOfBands,
unsigned int nbOfSamples)
207 const InternalValueType infValue = itk::NumericTraits<InternalValueType>::NonpositiveMin();
220 unsigned int nbOfBands = pixel.Size();
223 for (
unsigned int band = 0; band < nbOfBands; band++)
229 if (pixelValue < m_min[band][sampleId])
230 m_min[band][sampleId] = pixelValue;
231 if (pixelValue > m_max[band][sampleId])
232 m_max[band][sampleId] = pixelValue;
235 m_sum[band][sampleId] += pixelValue;
236 m_sqSum[band][sampleId] += pixelValue * pixelValue;
243 Update(pixel_i, sampleId);
244 unsigned int nbOfBands = pixel_i.Size();
245 for (
unsigned int band = 0; band < nbOfBands; band++)
251 m_cosum[band][sampleId] += pixelValue_i * pixelValue_j;
258 unsigned int nbOfBands = other.
m_sum.rows();
259 unsigned int nbOfSamples = other.
m_sum.cols();
261 for (
unsigned int sampleId = 0; sampleId < nbOfSamples; sampleId++)
263 m_count[sampleId] += other.
m_count[sampleId];
264 for (
unsigned int band = 0; band < nbOfBands; band++)
266 m_sum[band][sampleId] += other.
m_sum[band][sampleId];
267 m_cosum[band][sampleId] += other.
m_cosum[band][sampleId];
268 m_sqSum[band][sampleId] += other.
m_sqSum[band][sampleId];
269 if (other.
m_min[band][sampleId] < m_min[band][sampleId])
270 m_min[band][sampleId] = other.
m_min[band][sampleId];
271 if (other.
m_max[band][sampleId] > m_max[band][sampleId])
272 m_max[band][sampleId] = other.
m_max[band][sampleId];
298 void operator=(
const Self&);
323 template <
class TInputImage,
class TOutputImage,
class TInternalValueType>
341 typedef typename Superclass::FilterType::RealMatrixType
RealMatrixType;
349 using Superclass::PushBackInput;
352 this->GetFilter()->PushBackInput(input);
358 return this->GetFilter()->GetMeansOutput()->Get();
362 return this->GetFilter()->GetMeansOutput();
366 return this->GetFilter()->GetMeansOutput();
373 return this->GetFilter()->GetStdsOutput()->Get();
377 return this->GetFilter()->GetStdsOutput();
381 return this->GetFilter()->GetStdsOutput();
388 return this->GetFilter()->GetMeansOfProductsOutput()->Get();
392 return this->GetFilter()->GetMeansOfProductsOutput();
396 return this->GetFilter()->GetMeansOfProductsOutput();
403 return this->GetFilter()->GetMinsOutput()->Get();
407 return this->GetFilter()->GetMinsOutput();
411 return this->GetFilter()->GetMinsOutput();
418 return this->GetFilter()->GetMaxsOutput()->Get();
422 return this->GetFilter()->GetMaxsOutput();
426 return this->GetFilter()->GetMaxsOutput();
433 return this->GetFilter()->GetAreasOutput()->Get();
437 return this->GetFilter()->GetAreasOutput();
441 return this->GetFilter()->GetAreasOutput();
456 void operator=(
const Self&);
461 #ifndef OTB_MANUAL_INSTANTIATION