OTB  9.0.0
Orfeo Toolbox
otbTemporalGapFilling.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: gapfilling
4  Language: C++
5 
6  Copyright (c) Jordi Inglada. All rights reserved.
7 
8  See LICENSE for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notices for more information.
13 
14 =========================================================================*/
15 #ifndef _TEMPORALGAPFILLING_H_
16 #define _TEMPORALGAPFILLING_H_
17 
18 #include "otbVectorImage.h"
19 #include "otbImageFileReader.h"
20 #include "otbImageFileWriter.h"
22 #include "itkBinaryFunctorImageFilter.h"
23 #include <vector>
24 #include <tuple>
25 #include <stdexcept>
26 #include <cmath>
27 #include <gsl/gsl_errno.h>
28 #include <gsl/gsl_spline.h>
29 
30 #include "otbDateUtils.h"
31 
32 namespace GapFilling
33 {
34 
35 template<typename ValueType, typename VectorType>
36 inline
37 itk::VariableLengthVector<ValueType> vectorToPixel(const VectorType& v)
38 {
39  itk::VariableLengthVector<ValueType> p(v.size());
40  for(auto i=0; i<p.Size(); ++i)
41  p[i] = ValueType{v[i]};
42  return p;
43 }
44 
45 template<typename ValueType>
46 inline
47 itk::VariableLengthVector<ValueType> vectorToPixel(const std::vector<ValueType>& v)
48 {
49  itk::VariableLengthVector<ValueType> p(v.size());
50  for(size_t i=0; i<p.Size(); ++i)
51  p[i] = ValueType{v[i]};
52  return p;
53 }
56 template <class TInputImage1, class TInputImage2, class TOutputImage,
57  class TFunctor>
59  public itk::BinaryFunctorImageFilter< TInputImage1, TInputImage2,
60  TOutputImage, TFunctor >
61 {
62 public:
64  typedef itk::BinaryFunctorImageFilter< TInputImage1, TInputImage2,
65  TOutputImage, TFunctor > Superclass;
66  typedef itk::SmartPointer<Self> Pointer;
67  typedef itk::SmartPointer<const Self> ConstPointer;
68 
70  itkNewMacro(Self);
71 
73  itkTypeMacro(BinaryFunctorImageFilterWithNBands, SuperClass);
74 
76  itkSetMacro(NumberOfOutputBands, unsigned int);
77  itkGetConstMacro(NumberOfOutputBands, unsigned int);
79 
80 protected:
82  virtual ~BinaryFunctorImageFilterWithNBands() = default;
83 
84  void GenerateOutputInformation() override
85  {
86  Superclass::GenerateOutputInformation();
87  this->GetOutput()->SetNumberOfComponentsPerPixel( m_NumberOfOutputBands );
88  }
89 private:
90  BinaryFunctorImageFilterWithNBands(const Self &) = delete; //purposely not implemented
91  void operator =(const Self&) = delete; //purposely not implemented
92 
93  unsigned int m_NumberOfOutputBands;
94 
95 
96 };
100 template <typename PixelType>
101 inline
102 std::tuple<std::vector<typename PixelType::ValueType>,
103  std::vector<typename PixelType::ValueType>, bool>
104 find_valid_bounds(const PixelType mask, int nbDates,
105  typename PixelType::ValueType valid_value)
106 {
107  using PValueType = typename PixelType::ValueType;
108  using PVectorType = typename std::vector<PValueType>;
110 
111  PVectorType l_valid(nbDates,0);
112  PVectorType n_valid(nbDates,0);
113  int lv{-1};
114  int nv{nbDates};
115  for(auto i=0; i<nbDates; i++)
116  {
117  if(mask[i]==(valid_value)) lv=i;
118  l_valid[i] = lv;
119  auto j = nbDates-1-i;
120  if(mask[j]==(valid_value)) nv=j;
121  n_valid[j] = nv;
122  }
123  return std::make_tuple(l_valid, n_valid, (lv==-1 && nv==nbDates));
124 }
130 template <typename PixelType>
131 inline
132 std::tuple<PixelType, PixelType, PixelType >
133 create_tmp_data_interlace_dates(const PixelType pix,
134  const PixelType mask,
135  const PixelType idv,
136  const PixelType odv,
137  typename PixelType::ValueType valid_value)
138 {
139  if(idv == odv)
140  return std::make_tuple(pix, mask, odv);
141 
142  unsigned int nbDates = idv.GetSize() + odv.GetSize();
143  PixelType opix{nbDates};
144  PixelType omask{nbDates};
145  PixelType dv{nbDates};
146 
147  unsigned int dcount = 0;
148  unsigned int icount = 0;
149  unsigned int ocount = 0;
150 
151  while(dcount < nbDates)
152  {
153  if(icount < idv.GetSize() &&
154  (ocount == odv.GetSize() || //ouput dates consumed
155  idv[icount] <= odv[ocount]))
156  {
157  opix[dcount] = pix[icount];
158  omask[dcount] = mask[icount];
159  dv[dcount] = idv[icount];
160  icount++;
161  }
162  else
163  {
164  opix[dcount] = typename PixelType::ValueType{0};
165  omask[dcount] = valid_value+1;
166  dv[dcount] = odv[ocount];
167  ocount++;
168  }
169  dcount++;
170  }
171  return std::make_tuple(opix, omask, dv);
172 }
173 /*** Return a pixel with only the output dates. dv contains all dates
174 * and only those contained in odv are kept.
175 */
176 template <typename PixelType>
177 inline
178 PixelType extract_output_dates(const PixelType pix,
179  const PixelType dv,
180  const PixelType odv)
181 {
182  if(dv == odv)
183  return pix;
184 
185  unsigned int nbDates = odv.GetSize();
186  unsigned int nbInDates = dv.GetSize();
187 
188  if(nbDates > nbInDates)
189  throw std::invalid_argument("There are more output dates than input dates\n");
190  PixelType result{nbDates};
191 
192  unsigned int in_count = 0;
193  unsigned int out_count = 0;
194 
195  while(in_count < dv.GetSize() && out_count < nbDates)
196  {
197  if(dv[in_count] == odv[out_count])
198  {
199  result[out_count] = pix[in_count];
200  ++out_count;
201  }
202  ++in_count;
203  }
204 
205  return result;
206 }
207 
208 template <typename PixelType>
210 {
211 public:
212  IdentityGapFillingFunctor() = default;
213  IdentityGapFillingFunctor(const PixelType& d) : dv{d} {}
214 
215  PixelType operator()(PixelType pix, PixelType mask) const
216  {
217  if(pix.GetSize() != mask.GetSize())
218  throw std::invalid_argument("Pixel and mask have different sizes\n");
219  return pix;
220  }
221 
223  {
224  return (this->dates != a.dates) || (this->dv != a.dv) ;
225  }
226 
228  {
229  return !(*this != a);
230  }
231 
232 protected:
233  PixelType dv;
234 
235 };
236 
237 template <typename PixelType>
239 {
240 public:
241  using ValueType = typename PixelType::ValueType;
242  using VectorType = typename std::vector<ValueType>;
245  LinearGapFillingFunctor() = default;
247  LinearGapFillingFunctor(const PixelType& d) : dv{d} {}
249  LinearGapFillingFunctor(const PixelType& d, const PixelType& od)
250  : dv{d}, odv{od} {}
251 
252  // valid pixel has a mask==0
253  PixelType operator()(PixelType pix, PixelType mask) const
254  {
255  auto local_dv(dv);
256  auto local_odv(odv);
257  unsigned int nbDates = local_dv.GetSize();
258  if(nbDates == 0) nbDates = pix.GetSize();
259  if(nbDates != mask.GetSize())
260  throw std::invalid_argument("Pixel and mask have different sizes\n");
261  if(local_dv.GetSize()!=0 && nbDates != local_dv.GetSize())
262  {
263  std::stringstream errmessg;
264  errmessg << "Pixel and date vector have different sizes: "
265  << nbDates << " vs " << local_dv.GetSize() << "\n";
266  throw
267  std::invalid_argument(errmessg.str());
268  }
269  if(local_dv.GetSize()==0)
270  {
271  local_dv = pix;
272  for(unsigned i=0; i<nbDates; i++)
273  local_dv[i] = i;
274  }
275  if(local_odv.GetSize()==0) local_odv = local_dv;
276 
277  unsigned int nbOutputDates = local_odv.GetSize();
278  PixelType validpix{nbDates};
279  validpix.Fill(valid_value);
280  PixelType invalidpix{nbOutputDates};
281  invalidpix.Fill(invalid_pixel_return_value);
282  // If the mask says all dates are valid and the input and output
283  // dates are the same, keep the original value
284  if(mask == validpix && local_dv == local_odv) return pix;
285  // Interlace input and output dates
286  PixelType tmp_pix, tmp_mask, tmp_dates;
287  std::tie(tmp_pix, tmp_mask, tmp_dates) =
288  create_tmp_data_interlace_dates(pix, mask, local_dv, local_odv, valid_value);
289  // For each component, find the position of the last and the next valid
290  // values
291  VectorType last_valid;
292  VectorType next_valid;
293  bool invalid_pixel;
294  std::tie(last_valid, next_valid, invalid_pixel) =
295  find_valid_bounds(tmp_mask, tmp_mask.GetSize(), valid_value);
296  // invalid pixel?
297  if(invalid_pixel)
298  return invalidpix;
299 
300  return extract_output_dates(this->interpolate(tmp_pix, tmp_mask,
301  tmp_dates, last_valid,
302  next_valid),
303  tmp_dates, local_odv);
304  }
305 
307  {
308  return (this->dv != a.dv) ;
309  }
310 
312  {
313  return !(*this != a);
314  }
315 
316 protected:
317  inline
318  PixelType interpolate(const PixelType& p, const PixelType& m, const PixelType& d,
319  const VectorType& lv, const VectorType& nv) const
320  {
321  unsigned int nbDates = p.GetSize();
322  PixelType result(nbDates);
323  for(size_t i=0; i<nbDates; i++)
324  {
325  auto lvp = lv[i];
326  auto nvp = nv[i];
327  if(m[i]==valid_value)
328  result[i] = p[i];
329  else
330  {
331  // If there is no previous valid value, just use the next one
332  if(lvp==-1)
333  result[i] = p[nvp];
334  // If there is no next valid value, just use the last one
335  else if(nvp==nbDates)
336  result[i] = p[lvp];
337  // Otherwise, use linear interpolation
338  else
339  {
340  double x1 = d[lvp];
341  double y1 = p[lvp];
342  double x2 = d[nvp];
343  double y2 = p[nvp];
344  double a = (y2-y1)/(x2-x1);
345  double b = ((y1+y2)*(x2-x1)-(y2-y1)*(x2+x1))/(2*(x2-x1));
346 
347  result[i] = a*d[i]+b;
348  }
349  }
350  }
351  return result;
352  }
353 
355  PixelType dv;
357  PixelType odv;
358 
359 };
360 
361 template <typename PixelType>
363 {
364 public:
365  using ValueType = typename PixelType::ValueType;
366  using VectorType = typename std::vector<ValueType>;
369  SplineGapFillingFunctor() = default;
370 
371  SplineGapFillingFunctor(const PixelType& d) : dv{d} {}
372 
374  SplineGapFillingFunctor(const PixelType& d, const PixelType& od)
375  : dv{d}, odv{od} {}
376 
377 
378  // valid pixel has a mask==0
379  PixelType operator()(PixelType pix, PixelType mask) const
380  {
381  auto local_dv(dv);
382  auto local_odv(odv);
383  unsigned int nbDates = local_dv.GetSize();
384  if(nbDates == 0) nbDates = pix.GetSize();
385  if(nbDates != mask.GetSize())
386  throw std::invalid_argument("Pixel and mask have different sizes\n");
387  if(local_dv.GetSize()!=0 && nbDates != local_dv.GetSize())
388  {
389  std::stringstream errmessg;
390  errmessg << "Pixel and date vector have different sizes: "
391  << nbDates << " vs " << local_dv.GetSize() << "\n";
392  throw
393  std::invalid_argument(errmessg.str());
394  }
395  if(local_dv.GetSize()==0)
396  {
397  local_dv = pix;
398  for(size_t i=0; i<nbDates; i++)
399  local_dv[i] = i;
400  }
401  if(local_odv.GetSize()==0) local_odv = local_dv;
402 
403  unsigned int nbOutputDates = local_odv.GetSize();
404  PixelType validpix{nbDates};
405  validpix.Fill(valid_value);
406  PixelType invalidpix{nbOutputDates};
407  invalidpix.Fill(invalid_pixel_return_value);
408  // If the mask says all dates are valid and the input and output
409  // dates are the same, keep the original value
410  if(mask == validpix && local_dv == local_odv) return pix;
411  // Interlace input and output dates
412  PixelType tmp_pix, tmp_mask, tmp_dates;
413  std::tie(tmp_pix, tmp_mask, tmp_dates) =
414  create_tmp_data_interlace_dates(pix, mask, local_dv, local_odv, valid_value);
415  // For each component, find the position of the last and the next valid
416  // values
417  VectorType last_valid;
418  VectorType next_valid;
419  bool invalid_pixel;
420  std::tie(last_valid, next_valid, invalid_pixel) =
421  find_valid_bounds(tmp_mask, tmp_mask.GetSize(), valid_value);
422  // invalid pixel?
423  if(invalid_pixel)
424  return invalidpix;
425 
426  return extract_output_dates(this->interpolate(tmp_pix, tmp_mask,
427  tmp_dates, last_valid,
428  next_valid),
429  tmp_dates, local_odv);
430  }
431 
433  {
434  return (this->dv != a.dv) ;
435  }
436 
438  {
439  return !(*this != a);
440  }
441 
442 protected:
443  inline
444  PixelType interpolate(const PixelType& p, const PixelType& m,
445  const PixelType& d, const VectorType& lv,
446  const VectorType& nv) const
447  {
448  unsigned int nbDates = p.GetSize();
449  // Prepare the data for gsl
450  double* x = new double[nbDates];
451  double* y = new double[nbDates];
452  std::size_t nbValidDates{0};
453  for(size_t i = 0; i < nbDates; i++)
454  {
455  if(m[i]==valid_value)
456  {
457  x[nbValidDates] = d[i];
458  //Ensure that the dates are strictly increasing
459  if(nbValidDates>0 &&
460  (x[nbValidDates]-x[nbValidDates-1])<std::numeric_limits<double>::epsilon())
461  {
462  //1 epsilon is not enough for gsl
463  x[nbValidDates] = x[nbValidDates-1] + 0.1;
464  }
465  y[nbValidDates] = p[i];
466  nbValidDates++;
467  }
468  }
469  if(nbValidDates < 2)
470  {
471  return p;
472  }
473  gsl_interp_accel* acc = gsl_interp_accel_alloc();
474  gsl_spline* spline = select_spline_type(nbValidDates);
475  if(spline == nullptr) return p;
476  gsl_spline_init(spline, x, y, nbValidDates);
477  // the real interpolation
478  PixelType result(nbDates);
479  for(size_t i=0; i<nbDates; i++)
480  {
481  auto lvp = lv[i];
482  auto nvp = nv[i];
483  if(m[i]==(valid_value))
484  result[i] = p[i];
485  else
486  {
487  // If there is no previous valid value, just use the next one
488  if(lvp==-1)
489  result[i] = p[nvp];
490  // If there is no next valid value, just use the last one
491  else if(nvp==nbDates)
492  result[i] = p[lvp];
493  // Otherwise, use spline interpolation
494  else
495  {
496  result[i] = gsl_spline_eval(spline, d[i], acc);
497  }
498  }
499  }
500  gsl_spline_free(spline);
501  gsl_interp_accel_free(acc);
502  delete [] x;
503  delete [] y;
504  return result;
505  }
506 
507  gsl_spline* select_spline_type(std::size_t nbDates) const
508  {
509  switch(nbDates)
510  {
511  case 0:
512  case 1:
513  return nullptr;
514  case 2:
515  return gsl_spline_alloc(gsl_interp_linear, nbDates);
516  break;
517  case 3:
518  case 4:
519  return gsl_spline_alloc(gsl_interp_cspline, nbDates);
520  break;
521  default:
522  return gsl_spline_alloc(gsl_interp_akima, nbDates);
523  }
524  }
526  PixelType dv;
528  PixelType odv;
529 };
530 
536 template <typename PixelType, typename FunctorType>
540  PixelType operator()(PixelType p1, PixelType p2) const
541  {
542  const auto nbComponents = p1.GetSize();
543  const auto nbDates = nbComponents/m_NumberOfComponentsPerDate;
544  CheckSizes(p1, p2);
545  // Due to date interlacing, we don't know here the size of the
546  // output pixel. This is only known when we receive the result
547  // from the functor. The worst case is all dates are dulicated
548  PixelType result(nbComponents*m_MaxNumberOfOutputDates);
549  unsigned int outNbDates{0};
550  for(size_t band=0; band<m_NumberOfComponentsPerDate; band++)
551  {
552  auto tmp1 = PixelType(nbDates);
553  auto tmp2 = PixelType(nbDates);
554  for(size_t date=0; date<nbDates; date++)
555  tmp1[date] = p1[band+date*m_NumberOfComponentsPerDate];
557 
558  PixelType tmp_res;
559  // If p1 and p2 have the same sizes, demux also p2
560  if(p1.GetSize() == p2.GetSize())
561  {
562  for(size_t date=0; date<nbDates; date++)
563  tmp2[date] = p2[band+date*m_NumberOfComponentsPerDate];
564  tmp_res = m_Functor(tmp1, tmp2);
565  }
566  // Otherwise, use the same p2 for all components of p1
567  else
568  tmp_res = m_Functor(tmp1, p2);
569 
570  outNbDates = tmp_res.GetSize();
571  if(outNbDates > result.GetSize())
572  {
573  std::stringstream errmessg;
574  errmessg << "The result pixel has too many components: "
575  << outNbDates << " instead of expected max of "
576  << result.GetSize() << std::endl;
577  throw
578  std::invalid_argument(errmessg.str());
579  }
580  for(size_t date=0; date<outNbDates; date++)
581  result[band+date*m_NumberOfComponentsPerDate] = tmp_res[date];
582  }
583 
584  auto output_size = outNbDates*m_NumberOfComponentsPerDate;
585  //resize keeping only the front values
586  result.SetSize(output_size);
587  return result;
588  }
589  void CheckSizes(PixelType p1, PixelType p2) const
590  {
591  const auto nbComponents = p1.GetSize();
592  const auto nbDates = nbComponents/m_NumberOfComponentsPerDate;
593  if(nbComponents < m_NumberOfComponentsPerDate)
594  {
595  std::stringstream errmessg;
596  errmessg << "Using " << m_NumberOfComponentsPerDate
597  << " components per date, but pixel has only "
598  << nbComponents << "\n";
599  throw
600  std::invalid_argument(errmessg.str());
601  }
602  if(p1.GetSize()!=p2.GetSize() && p2.GetSize()!=nbDates)
603  {
604  std::stringstream errmessg;
605  errmessg << "p2 has to have either the same size as p1 "
606  << "or one component per date\n"
607  << "p1 is " << p1.GetSize() << "\n"
608  << "p2 is " << p2.GetSize() << "\n"
609  << "nbDates is " << nbDates << "\n";
610  throw
611  std::invalid_argument(errmessg.str());
612  }
613  }
615  {
617  }
619  {
621  }
622  void SetFunctor(FunctorType f)
623  {
624  m_Functor = f;
625  }
626  FunctorType* GetFunctor() const
627  {
628  return &m_Functor;
629  }
630 private:
633  FunctorType m_Functor;
634 };
635 
649 template <typename ImageType, typename FunctorType,
650  typename MultiComponentFunctorType =
651  MultiComponentTimeSeriesFunctorAdaptor<typename ImageType::PixelType,
652  FunctorType>>
653 void gapfill_time_series(typename ImageType::Pointer inIma,
654  typename ImageType::Pointer maskIma,
655  typename BinaryFunctorImageFilterWithNBands<ImageType,
656  ImageType, ImageType, FunctorType>::Pointer filter,
657  typename BinaryFunctorImageFilterWithNBands<ImageType,
658  ImageType, ImageType,
659  MultiComponentFunctorType>::Pointer filter_mc,
660  size_t components_per_date = 1,
661  typename ImageType::PixelType dv= typename ImageType::PixelType{},
662  typename ImageType::PixelType odv= typename ImageType::PixelType{})
663 {
664 
665  inIma->UpdateOutputInformation();
666  maskIma->UpdateOutputInformation();
667 
668  using TPixel = typename ImageType::PixelType;
669 
670  auto number_of_input_components = inIma->GetNumberOfComponentsPerPixel();
671  unsigned int number_of_output_components{number_of_input_components};
672  if(dv != TPixel{})
673  {
674  number_of_output_components = components_per_date*dv.GetSize();
675  }
676  if(odv != TPixel{})
677  {
678  number_of_output_components = components_per_date*odv.GetSize();
679  }
680 
681  filter->SetNumberOfOutputBands(number_of_output_components);
682 
683  filter_mc->SetNumberOfOutputBands(number_of_output_components);
684 
685  if(components_per_date==1)
686  {
687  if(odv != TPixel{})
688  filter->SetFunctor(FunctorType(dv, odv));
689  else if(dv != TPixel{})
690  filter->SetFunctor(FunctorType(dv));
691  filter->SetInput(0, inIma);
692  filter->SetInput(1, maskIma);
693  filter->UpdateOutputInformation();
694  }
695  else
696  {
697  if(odv != TPixel{})
698  {
699  (filter_mc->GetFunctor()).SetFunctor(FunctorType(dv, odv));
700  (filter_mc->GetFunctor()).SetMaxNumberOfOutputDates(odv.GetSize());
701  }
702  else if(dv != TPixel{})
703  (filter_mc->GetFunctor()).SetFunctor(FunctorType(dv));
704  (filter_mc->GetFunctor()).SetNumberOfComponentsPerDate(components_per_date);
705  filter_mc->SetInput(0, inIma);
706  filter_mc->SetInput(1, maskIma);
707  filter_mc->UpdateOutputInformation();
708  }
709 }
710 
711 }//GapFilling namespace
712 
713 #endif
GapFilling::BinaryFunctorImageFilterWithNBands::Superclass
itk::BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, TFunctor > Superclass
Definition: otbTemporalGapFilling.h:65
GapFilling::BinaryFunctorImageFilterWithNBands::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbTemporalGapFilling.h:66
GapFilling
Definition: otbDateUtils.h:28
GapFilling::VectorType
vnl_vector< PrecisionType > VectorType
Definition: otbDateUtils.h:30
GapFilling::SplineGapFillingFunctor::interpolate
PixelType interpolate(const PixelType &p, const PixelType &m, const PixelType &d, const VectorType &lv, const VectorType &nv) const
Definition: otbTemporalGapFilling.h:444
GapFilling::SplineGapFillingFunctor::dv
PixelType dv
Input date vector.
Definition: otbTemporalGapFilling.h:526
GapFilling::SplineGapFillingFunctor::valid_value
ValueType valid_value
Definition: otbTemporalGapFilling.h:367
GapFilling::LinearGapFillingFunctor::invalid_pixel_return_value
ValueType invalid_pixel_return_value
Definition: otbTemporalGapFilling.h:244
otbVectorImage.h
GapFilling::SplineGapFillingFunctor::odv
PixelType odv
Output date vector.
Definition: otbTemporalGapFilling.h:528
GapFilling::IdentityGapFillingFunctor
Definition: otbTemporalGapFilling.h:209
GapFilling::IdentityGapFillingFunctor::dv
PixelType dv
Definition: otbTemporalGapFilling.h:233
GapFilling::LinearGapFillingFunctor::interpolate
PixelType interpolate(const PixelType &p, const PixelType &m, const PixelType &d, const VectorType &lv, const VectorType &nv) const
Definition: otbTemporalGapFilling.h:318
GapFilling::LinearGapFillingFunctor::valid_value
ValueType valid_value
Definition: otbTemporalGapFilling.h:243
GapFilling::BinaryFunctorImageFilterWithNBands
Definition: otbTemporalGapFilling.h:58
GapFilling::SplineGapFillingFunctor::ValueType
typename PixelType::ValueType ValueType
Definition: otbTemporalGapFilling.h:365
GapFilling::LinearGapFillingFunctor::ValueType
typename PixelType::ValueType ValueType
Definition: otbTemporalGapFilling.h:241
GapFilling::LinearGapFillingFunctor::dv
PixelType dv
Input date vector.
Definition: otbTemporalGapFilling.h:355
GapFilling::MultiComponentTimeSeriesFunctorAdaptor::m_Functor
FunctorType m_Functor
Definition: otbTemporalGapFilling.h:633
GapFilling::BinaryFunctorImageFilterWithNBands::Self
BinaryFunctorImageFilterWithNBands Self
Definition: otbTemporalGapFilling.h:63
GapFilling::LinearGapFillingFunctor::LinearGapFillingFunctor
LinearGapFillingFunctor(const PixelType &d, const PixelType &od)
Constructor with vectors of input and output dates.
Definition: otbTemporalGapFilling.h:249
GapFilling::SplineGapFillingFunctor::SplineGapFillingFunctor
SplineGapFillingFunctor(const PixelType &d)
Definition: otbTemporalGapFilling.h:371
GapFilling::MultiComponentTimeSeriesFunctorAdaptor
Definition: otbTemporalGapFilling.h:537
GapFilling::extract_output_dates
PixelType extract_output_dates(const PixelType pix, const PixelType dv, const PixelType odv)
Definition: otbTemporalGapFilling.h:178
GapFilling::LinearGapFillingFunctor::VectorType
typename std::vector< ValueType > VectorType
Definition: otbTemporalGapFilling.h:242
GapFilling::LinearGapFillingFunctor::odv
PixelType odv
Output date vector.
Definition: otbTemporalGapFilling.h:357
GapFilling::SplineGapFillingFunctor::SplineGapFillingFunctor
SplineGapFillingFunctor()=default
GapFilling::MultiComponentTimeSeriesFunctorAdaptor::GetFunctor
FunctorType * GetFunctor() const
Definition: otbTemporalGapFilling.h:626
GapFilling::MultiComponentTimeSeriesFunctorAdaptor::SetNumberOfComponentsPerDate
void SetNumberOfComponentsPerDate(vcl_size_t n)
Definition: otbTemporalGapFilling.h:614
GapFilling::MultiComponentTimeSeriesFunctorAdaptor::m_NumberOfComponentsPerDate
vcl_size_t m_NumberOfComponentsPerDate
Definition: otbTemporalGapFilling.h:631
otbDateUtils.h
GapFilling::vectorToPixel
itk::VariableLengthVector< ValueType > vectorToPixel(const VectorType &v)
Definition: otbTemporalGapFilling.h:37
GapFilling::MultiComponentTimeSeriesFunctorAdaptor::SetMaxNumberOfOutputDates
void SetMaxNumberOfOutputDates(vcl_size_t n)
Definition: otbTemporalGapFilling.h:618
GapFilling::MultiComponentTimeSeriesFunctorAdaptor::SetFunctor
void SetFunctor(FunctorType f)
Definition: otbTemporalGapFilling.h:622
GapFilling::LinearGapFillingFunctor::LinearGapFillingFunctor
LinearGapFillingFunctor(const PixelType &d)
Constructor with a vector of input dates.
Definition: otbTemporalGapFilling.h:247
GapFilling::SplineGapFillingFunctor::SplineGapFillingFunctor
SplineGapFillingFunctor(const PixelType &d, const PixelType &od)
Constructor with vectors of input and output dates.
Definition: otbTemporalGapFilling.h:374
GapFilling::MultiComponentTimeSeriesFunctorAdaptor::operator()
PixelType operator()(PixelType p1, PixelType p2) const
Definition: otbTemporalGapFilling.h:540
GapFilling::create_tmp_data_interlace_dates
std::tuple< PixelType, PixelType, PixelType > create_tmp_data_interlace_dates(const PixelType pix, const PixelType mask, const PixelType idv, const PixelType odv, typename PixelType::ValueType valid_value)
Definition: otbTemporalGapFilling.h:133
GapFilling::BinaryFunctorImageFilterWithNBands::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbTemporalGapFilling.h:67
GapFilling::LinearGapFillingFunctor::LinearGapFillingFunctor
LinearGapFillingFunctor()=default
GapFilling::MultiComponentTimeSeriesFunctorAdaptor::MultiComponentTimeSeriesFunctorAdaptor
MultiComponentTimeSeriesFunctorAdaptor()
Definition: otbTemporalGapFilling.h:538
GapFilling::IdentityGapFillingFunctor::operator()
PixelType operator()(PixelType pix, PixelType mask) const
Definition: otbTemporalGapFilling.h:215
GapFilling::SplineGapFillingFunctor::VectorType
typename std::vector< ValueType > VectorType
Definition: otbTemporalGapFilling.h:366
GapFilling::IdentityGapFillingFunctor::IdentityGapFillingFunctor
IdentityGapFillingFunctor(const PixelType &d)
Definition: otbTemporalGapFilling.h:213
GapFilling::BinaryFunctorImageFilterWithNBands::m_NumberOfOutputBands
unsigned int m_NumberOfOutputBands
Definition: otbTemporalGapFilling.h:93
GapFilling::SplineGapFillingFunctor::operator==
bool operator==(const SplineGapFillingFunctor a) const
Definition: otbTemporalGapFilling.h:437
GapFilling::SplineGapFillingFunctor::operator()
PixelType operator()(PixelType pix, PixelType mask) const
Definition: otbTemporalGapFilling.h:379
GapFilling::SplineGapFillingFunctor
Definition: otbTemporalGapFilling.h:362
GapFilling::IdentityGapFillingFunctor::operator==
bool operator==(const IdentityGapFillingFunctor a) const
Definition: otbTemporalGapFilling.h:227
GapFilling::MultiComponentTimeSeriesFunctorAdaptor::m_MaxNumberOfOutputDates
vcl_size_t m_MaxNumberOfOutputDates
Definition: otbTemporalGapFilling.h:632
otbImageFileWriter.h
GapFilling::find_valid_bounds
std::tuple< std::vector< typename PixelType::ValueType >, std::vector< typename PixelType::ValueType >, bool > find_valid_bounds(const PixelType mask, int nbDates, typename PixelType::ValueType valid_value)
Definition: otbTemporalGapFilling.h:104
GapFilling::SplineGapFillingFunctor::select_spline_type
gsl_spline * select_spline_type(std::vcl_size_t nbDates) const
Definition: otbTemporalGapFilling.h:507
GapFilling::BinaryFunctorImageFilterWithNBands::GenerateOutputInformation
void GenerateOutputInformation() override
Definition: otbTemporalGapFilling.h:84
GapFilling::LinearGapFillingFunctor::operator!=
bool operator!=(const LinearGapFillingFunctor a) const
Definition: otbTemporalGapFilling.h:306
GapFilling::LinearGapFillingFunctor
Definition: otbTemporalGapFilling.h:238
GapFilling::gapfill_time_series
void gapfill_time_series(typename ImageType::Pointer inIma, typename ImageType::Pointer maskIma, typename BinaryFunctorImageFilterWithNBands< ImageType, ImageType, ImageType, FunctorType >::Pointer filter, typename BinaryFunctorImageFilterWithNBands< ImageType, ImageType, ImageType, MultiComponentFunctorType >::Pointer filter_mc, vcl_size_t components_per_date=1, typename ImageType::PixelType dv=typename ImageType::PixelType{}, typename ImageType::PixelType odv=typename ImageType::PixelType{})
Definition: otbTemporalGapFilling.h:653
GapFilling::SplineGapFillingFunctor::invalid_pixel_return_value
ValueType invalid_pixel_return_value
Definition: otbTemporalGapFilling.h:368
otbImageFileReader.h
otbStandardFilterWatcher.h
GapFilling::IdentityGapFillingFunctor::operator!=
bool operator!=(const IdentityGapFillingFunctor a) const
Definition: otbTemporalGapFilling.h:222
GapFilling::SplineGapFillingFunctor::operator!=
bool operator!=(const SplineGapFillingFunctor a) const
Definition: otbTemporalGapFilling.h:432
GapFilling::LinearGapFillingFunctor::operator()
PixelType operator()(PixelType pix, PixelType mask) const
Definition: otbTemporalGapFilling.h:253
GapFilling::MultiComponentTimeSeriesFunctorAdaptor::CheckSizes
void CheckSizes(PixelType p1, PixelType p2) const
Definition: otbTemporalGapFilling.h:589
GapFilling::LinearGapFillingFunctor::operator==
bool operator==(const LinearGapFillingFunctor a) const
Definition: otbTemporalGapFilling.h:311
GapFilling::IdentityGapFillingFunctor::IdentityGapFillingFunctor
IdentityGapFillingFunctor()=default