From 106ae978d134a80f95f5e4a00f4b21e4f50a8495 Mon Sep 17 00:00:00 2001 From: Julien Michel <julien.michel@cnes.fr> Date: Mon, 14 Mar 2016 14:33:51 +0100 Subject: [PATCH] BUG: Ensure that the Superimpose and BundleToPerfectSensor app reports the correcte geometry information (mantis #1153) --- .../AppFusion/app/otbBundleToPerfectSensor.cxx | 12 ++++++++++-- .../AppProjection/app/otbSuperimpose.cxx | 12 +++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx b/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx index 7de9d58d36..51b77af142 100644 --- a/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx +++ b/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx @@ -19,6 +19,7 @@ #include "otbMultiToMonoChannelExtractROI.h" #include "otbGenericRSResampleImageFilter.h" +#include "otbImportGeoInformationImageFilter.h" #include "otbBCOInterpolateImageFunction.h" #include "otbSimpleRcsPanSharpeningFusionImageFilter.h" #include "itkFixedArray.h" @@ -133,6 +134,7 @@ private: typedef otb::BCOInterpolateImageFunction<FloatVectorImageType> InterpolatorType; typedef otb::GenericRSResampleImageFilter<FloatVectorImageType, FloatVectorImageType> ResamplerType; typedef otb::StreamingResampleImageFilter<FloatVectorImageType, FloatVectorImageType> BasicResamplerType; + typedef otb::ImportGeoInformationImageFilter<FloatVectorImageType,InternalImageType> ImportGeoInformationFilterType; typedef otb::SimpleRcsPanSharpeningFusionImageFilter<InternalImageType, FloatVectorImageType, FloatVectorImageType> FusionFilterType; // Resample filter @@ -142,6 +144,9 @@ private: BasicResamplerType::Pointer basicResampler = BasicResamplerType::New(); m_Ref.push_back(basicResampler.GetPointer()); + ImportGeoInformationFilterType::Pointer geoImport = ImportGeoInformationFilterType::New(); + m_Ref.push_back(geoImport.GetPointer()); + InterpolatorType::Pointer interpolator = InterpolatorType::New(); resampler->SetInterpolator(interpolator); basicResampler->SetInterpolator(interpolator); @@ -209,8 +214,11 @@ private: basicResampler->SetOutputSize(size); basicResampler->SetOutputStartIndex(start); basicResampler->SetEdgePaddingValue(defaultValue); - - fusionFilter->SetXsInput(basicResampler->GetOutput()); + + geoImport->SetInput(basicResampler->GetOutput()); + geoImport->SetSource(panchro); + + fusionFilter->SetXsInput(geoImport->GetOutput()); // Set the profRef & Keywordlist from Pan into the resampled XS image basicResampler->UpdateOutputInformation(); diff --git a/Modules/Applications/AppProjection/app/otbSuperimpose.cxx b/Modules/Applications/AppProjection/app/otbSuperimpose.cxx index b44ce6db05..8063257976 100644 --- a/Modules/Applications/AppProjection/app/otbSuperimpose.cxx +++ b/Modules/Applications/AppProjection/app/otbSuperimpose.cxx @@ -18,6 +18,7 @@ #include "otbWrapperApplicationFactory.h" #include "otbGenericRSResampleImageFilter.h" +#include "otbImportGeoInformationImageFilter.h" #include "otbBCOInterpolateImageFunction.h" #include "itkNearestNeighborInterpolateImageFunction.h" @@ -66,6 +67,8 @@ public: typedef otb::GenericRSResampleImageFilter<FloatVectorImageType, FloatVectorImageType> ResamplerType; + typedef otb::ImportGeoInformationImageFilter<FloatVectorImageType, + FloatVectorImageType> ImportGeoInformationFilterType; typedef itk::ScalableAffineTransform<double, 2> TransformType; @@ -165,6 +168,8 @@ private: m_BasicResampler = BasicResamplerType::New(); + m_GeoImport = ImportGeoInformationFilterType::New(); + // Get Interpolator switch ( GetParameterInt("interpolator") ) { @@ -261,8 +266,11 @@ private: m_BasicResampler->SetEdgePaddingValue(defaultValue); + m_GeoImport->SetInput(m_BasicResampler->GetOutput()); + m_GeoImport->SetSource(refImage); + // Set the output image - SetParameterOutputImage("out", m_BasicResampler->GetOutput()); + SetParameterOutputImage("out", m_GeoImport->GetOutput()); } else { @@ -273,6 +281,8 @@ private: ResamplerType::Pointer m_Resampler; BasicResamplerType::Pointer m_BasicResampler; + + ImportGeoInformationFilterType::Pointer m_GeoImport; }; -- GitLab