Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Cresson Remi
NDVITimeSeries
Commits
343dcabc
Commit
343dcabc
authored
Feb 05, 2018
by
remi cresson
Browse files
ENH: rainfall time series interpolator (spatial) can be nn/lin
parent
62196f0f
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/otbTimeSeriesIndexTrend.cxx
View file @
343dcabc
...
...
@@ -40,6 +40,7 @@
// Resample
#include "otbStreamingResampleImageFilter.h"
#include "itkLinearInterpolateImageFunction.h"
#include "itkNearestNeighborInterpolateImageFunction.h"
// Dates
#include "otbDates.h"
...
...
@@ -103,6 +104,7 @@ public:
typedef
otb
::
StreamingResampleImageFilter
<
FloatVectorImageType
,
FloatVectorImageType
>
ResampleImageFilterType
;
typedef
itk
::
LinearInterpolateImageFunction
<
FloatVectorImageType
>
LinearInterpolatorType
;
typedef
itk
::
NearestNeighborInterpolateImageFunction
<
FloatVectorImageType
>
NNInterpolatorType
;
/* typedefs for residues processing */
typedef
otb
::
functor
::
RainfallEstimatedNDVIResiduesFunctor
<
FloatVectorImageType
::
PixelType
,
...
...
@@ -232,6 +234,12 @@ private:
SetDefaultParameterInt
(
"rain.reduce.cumul.nbdays"
,
150
);
// 150 days ~ 5 months
MandatoryOff
(
"rain.reduce.cumul.nbdays"
);
// Method to resample rainfall time series
AddParameter
(
ParameterType_Choice
,
"rain.interpolator"
,
"Interpolation"
);
MandatoryOff
(
"rain.interpolator"
);
AddChoice
(
"rain.interpolator.linear"
,
"Linear interpolation"
);
AddChoice
(
"rain.interpolator.nn"
,
"Nearest Neighbor interpolation"
);
// Output residues
AddParameter
(
ParameterType_OutputImage
,
"residues"
,
"Output image for NDVI residues"
);
SetDefaultOutputPixelType
(
"residues"
,
ImagePixelType_float
);
...
...
@@ -474,12 +482,24 @@ private:
// Resample rainfall
LinearInterpolatorType
::
Pointer
linInterpolator
=
LinearInterpolatorType
::
New
();
NNInterpolatorType
::
Pointer
nnInterpolator
=
NNInterpolatorType
::
New
();
m_ResampleFilter
=
ResampleImageFilterType
::
New
();
m_ResampleFilter
->
SetInput
(
m_RFCumulReduceFilter
->
GetOutput
());
m_ResampleFilter
->
SetOutputOrigin
(
m_NDVIConcatener
->
GetOutput
()
->
GetOrigin
());
m_ResampleFilter
->
SetOutputSpacing
(
m_NDVIConcatener
->
GetOutput
()
->
GetSignedSpacing
());
m_ResampleFilter
->
SetOutputSize
(
m_NDVIConcatener
->
GetOutput
()
->
GetLargestPossibleRegion
().
GetSize
());
m_ResampleFilter
->
SetInterpolator
(
linInterpolator
);
if
(
HasValue
(
"rain.interpolator"
)
==
0
)
{
m_ResampleFilter
->
SetInterpolator
(
linInterpolator
);
}
else
if
(
HasValue
(
"rain.interpolator"
)
==
1
)
{
m_ResampleFilter
->
SetInterpolator
(
nnInterpolator
);
}
else
{
otbAppLogFATAL
(
"Unknown interpolator type!"
);
}
// Write reduced rainfall
if
(
HasValue
(
"rainfcumul"
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment