Skip to content
Snippets Groups Projects
Commit 2df70eaa authored by Cédric Traizet's avatar Cédric Traizet
Browse files

Merge branch '2046-superimpose-crash' into 'develop'

BUG: #2046 Add an epsilon margin to compute the m_ReachableOutputRegion

Closes #2046

See merge request orfeotoolbox/otb!714
parents 5d8e5f7c 823608ae
Branches
Tags
No related merge requests found
...@@ -54,7 +54,7 @@ Julien Malik <julien.malik@c-s.fr> Julien Malik <julien.m ...@@ -54,7 +54,7 @@ Julien Malik <julien.malik@c-s.fr> Julien Malik <julien.m
Julien Michel <julien.michel@cnes.fr> Julien Michel <julien.michel@cnes.fr>
Julien Michel <julien.michel@cnes.fr> Julien Michel <julien.michel@c-s.fr> Julien Michel <julien.michel@cnes.fr> Julien Michel <julien.michel@c-s.fr>
Julien Michel <julien.michel@cnes.fr> Julien Michel <julien.michel@orfeo-toolbox.org> Julien Michel <julien.michel@cnes.fr> Julien Michel <julien.michel@orfeo-toolbox.org>
Julien Osman <julien.osman@c-s.fr> Julien Osman <julien.osman@csgroup.eu> Julien Osman <julien.osman@c-s.fr>
Laurențiu Nicola <lnicola@dend.ro> Laurentiu Nicola <lnicola@dend.ro> Laurențiu Nicola <lnicola@dend.ro> Laurentiu Nicola <lnicola@dend.ro>
Laurențiu Nicola <lnicola@dend.ro> Laurențiu Nicola <grayshade@gmail.com> Laurențiu Nicola <lnicola@dend.ro> Laurențiu Nicola <grayshade@gmail.com>
Luc Hermitte <luc.hermitte@c-s.fr> Luc Hermitte <luc.hermitte@cnes.fr> Luc Hermitte <luc.hermitte@c-s.fr> Luc Hermitte <luc.hermitte@cnes.fr>
......
File added
...@@ -192,6 +192,7 @@ private: ...@@ -192,6 +192,7 @@ private:
NNInterpolatorType::Pointer interpolator = NNInterpolatorType::New(); NNInterpolatorType::Pointer interpolator = NNInterpolatorType::New();
m_Resampler->SetInterpolator(interpolator); m_Resampler->SetInterpolator(interpolator);
m_BasicResampler->SetInterpolator(interpolator); m_BasicResampler->SetInterpolator(interpolator);
m_BasicResampler->SetInterpolationMargin(1e-9);
} }
break; break;
case Interpolator_BCO: case Interpolator_BCO:
......
...@@ -367,3 +367,13 @@ otb_test_application(NAME apTvPrSuperimpose_phr ...@@ -367,3 +367,13 @@ otb_test_application(NAME apTvPrSuperimpose_phr
VALID --compare-image ${EPSILON_7} VALID --compare-image ${EPSILON_7}
${BASELINE}/apTvPrSuperimposePHR.tif ${BASELINE}/apTvPrSuperimposePHR.tif
${TEMP}/apTvPrSuperimposePHR.tif) ${TEMP}/apTvPrSuperimposePHR.tif)
otb_test_application(NAME apTvPrSuperimpose_phr_nn
APP Superimpose
OPTIONS -inr ${INPUTDATA}/phr_pan.tif
-inm ${INPUTDATA}/phr_xs.tif
-interpolator nn
-out ${TEMP}/apTvPrSuperimposePHR_nn.tif int16
VALID --compare-image ${EPSILON_7}
${BASELINE}/apTvPrSuperimposePHR_nn.tif
${TEMP}/apTvPrSuperimposePHR_nn.tif)
...@@ -124,6 +124,9 @@ public: ...@@ -124,6 +124,9 @@ public:
itkGetMacro(CheckOutputBounds, bool); itkGetMacro(CheckOutputBounds, bool);
itkBooleanMacro(CheckOutputBounds); itkBooleanMacro(CheckOutputBounds);
itkSetMacro(InterpolationMargin, double);
itkGetMacro(InterpolationMargin, double);
itkSetObjectMacro(Interpolator, InterpolatorType); itkSetObjectMacro(Interpolator, InterpolatorType);
itkGetObjectMacro(Interpolator, InterpolatorType); itkGetObjectMacro(Interpolator, InterpolatorType);
...@@ -190,6 +193,8 @@ private: ...@@ -190,6 +193,8 @@ private:
OutputPixelType m_EdgePaddingValue; // Default pixel value OutputPixelType m_EdgePaddingValue; // Default pixel value
double m_InterpolationMargin;
bool m_CheckOutputBounds; // Shall we check bool m_CheckOutputBounds; // Shall we check
// output bounds when // output bounds when
// casting? // casting?
......
...@@ -42,6 +42,7 @@ GridResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecision>::Grid ...@@ -42,6 +42,7 @@ GridResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecision>::Grid
m_OutputSpacing(), m_OutputSpacing(),
m_EdgePaddingValue(), m_EdgePaddingValue(),
m_CheckOutputBounds(true), m_CheckOutputBounds(true),
m_InterpolationMargin(0.0),
m_Interpolator(), m_Interpolator(),
m_ReachableOutputRegion() m_ReachableOutputRegion()
{ {
...@@ -227,7 +228,6 @@ void GridResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecision>: ...@@ -227,7 +228,6 @@ void GridResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecision>:
// Compute the padding due to the interpolator // Compute the padding due to the interpolator
IndexType inUL = this->GetInput()->GetBufferedRegion().GetIndex(); IndexType inUL = this->GetInput()->GetBufferedRegion().GetIndex();
IndexType inLR = this->GetInput()->GetBufferedRegion().GetIndex() + this->GetInput()->GetBufferedRegion().GetSize(); IndexType inLR = this->GetInput()->GetBufferedRegion().GetIndex() + this->GetInput()->GetBufferedRegion().GetSize();
inLR[0] -= 1; inLR[0] -= 1;
...@@ -246,9 +246,9 @@ void GridResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecision>: ...@@ -246,9 +246,9 @@ void GridResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecision>:
this->GetInput()->TransformIndexToPhysicalPoint(inUL, inULp); this->GetInput()->TransformIndexToPhysicalPoint(inUL, inULp);
this->GetInput()->TransformIndexToPhysicalPoint(inLR, inLRp); this->GetInput()->TransformIndexToPhysicalPoint(inLR, inLRp);
inULp -= 0.5 * this->GetInput()->GetSignedSpacing(); inULp -= (0.5 - m_InterpolationMargin) * this->GetInput()->GetSignedSpacing();
inLRp += 0.5 * this->GetInput()->GetSignedSpacing(); inLRp += (0.5 - m_InterpolationMargin) * this->GetInput()->GetSignedSpacing();
ContinuousInputIndexType outUL; ContinuousInputIndexType outUL;
ContinuousInputIndexType outLR; ContinuousInputIndexType outLR;
this->GetOutput()->TransformPhysicalPointToContinuousIndex(inULp, outUL); this->GetOutput()->TransformPhysicalPointToContinuousIndex(inULp, outUL);
...@@ -265,6 +265,8 @@ void GridResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecision>: ...@@ -265,6 +265,8 @@ void GridResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecision>:
m_ReachableOutputRegion.SetIndex(outputIndex); m_ReachableOutputRegion.SetIndex(outputIndex);
m_ReachableOutputRegion.SetSize(outputSize); m_ReachableOutputRegion.SetSize(outputSize);
otbMsgDevMacro(<< "ReachableOutputRegion: " << m_ReachableOutputRegion);
} }
template <typename TInputImage, typename TOutputImage, typename TInterpolatorPrecision> template <typename TInputImage, typename TOutputImage, typename TInterpolatorPrecision>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment