From d76258da5a63c87235a5dc471fd388fb559719df Mon Sep 17 00:00:00 2001 From: Guillaume Pasero <guillaume.pasero@c-s.fr> Date: Fri, 21 Apr 2017 16:34:06 +0200 Subject: [PATCH] REFAC: use improved itkWarpImageFilter rather than otb clone --- .../Core/Transform/include/otbStreamingWarpImageFilter.h | 8 ++++---- .../Transform/include/otbStreamingWarpImageFilter.txx | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h b/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h index ade6a29676..ee6c50cf54 100644 --- a/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h +++ b/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h @@ -21,14 +21,14 @@ #ifndef otbStreamingWarpImageFilter_h #define otbStreamingWarpImageFilter_h -#include "otbWarpImageFilter.h" +#include "itkWarpImageFilter.h" #include "otbStreamingTraits.h" namespace otb { /** \class StreamingWarpImageFilter - * \brief This class acts like the otb::WarpImageFilter, but it does not request the largest possible region of the image to warp. + * \brief This class acts like the itk::WarpImageFilter, but it does not request the largest possible region of the image to warp. * * Instead, the user should assess the maximum displacement in the displacement field and set it via the SetMaximumDisplacement() method. * @@ -50,12 +50,12 @@ namespace otb template <class TInputImage, class TOutputImage, class TDisplacementField> class ITK_EXPORT StreamingWarpImageFilter - : public otb::WarpImageFilter<TInputImage, TOutputImage, TDisplacementField> + : public itk::WarpImageFilter<TInputImage, TOutputImage, TDisplacementField> { public: /** Standard class typedefs. */ typedef StreamingWarpImageFilter Self; - typedef otb::WarpImageFilter<TInputImage, TOutputImage, TDisplacementField> Superclass; + typedef itk::WarpImageFilter<TInputImage, TOutputImage, TDisplacementField> Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; diff --git a/Modules/Core/Transform/include/otbStreamingWarpImageFilter.txx b/Modules/Core/Transform/include/otbStreamingWarpImageFilter.txx index eca2711fc2..60dc825d3d 100644 --- a/Modules/Core/Transform/include/otbStreamingWarpImageFilter.txx +++ b/Modules/Core/Transform/include/otbStreamingWarpImageFilter.txx @@ -44,6 +44,8 @@ void StreamingWarpImageFilter<TInputImage, TOutputImage, TDisplacementField> ::GenerateInputRequestedRegion() { + Superclass::GenerateInputRequestedRegion(); + // Get the input and displacement field pointers InputImageType * inputPtr = const_cast<InputImageType *>(this->GetInput()); @@ -228,6 +230,11 @@ StreamingWarpImageFilter<TInputImage, TOutputImage, TDisplacementField> noDataValue.resize(this->GetOutput()->GetNumberOfComponentsPerPixel(),0.0); } PixelType edgePadding = this->GetEdgePaddingValue(); + if (itk::NumericTraits<PixelType>::GetLength(edgePadding) != this->GetOutput()->GetNumberOfComponentsPerPixel()) + { + itk::NumericTraits<PixelType>::SetLength(edgePadding,this->GetOutput()->GetNumberOfComponentsPerPixel()); + this->SetEdgePaddingValue(edgePadding); + } for (unsigned int i=0; i<noDataValueAvailable.size() ; ++i) { if (!noDataValueAvailable[i]) -- GitLab