diff --git a/Code/Projections/otbGenericRSResampleImageFilter.h b/Code/Projections/otbGenericRSResampleImageFilter.h index a127f733ef71ddd14e9c6a0c7e73cd7e8a9470b0..2fa232c19818e4fd93e2c25057f11e7781c9b9bc 100644 --- a/Code/Projections/otbGenericRSResampleImageFilter.h +++ b/Code/Projections/otbGenericRSResampleImageFilter.h @@ -20,7 +20,6 @@ #include "itkImageToImageFilter.h" #include "otbOptResampleImageFilter.h" -#include "itkLinearInterpolateImageFunction.h" #include "otbGenericRSTransform.h" @@ -56,7 +55,6 @@ public: /** Typedef parameters*/ typedef TInputImage InputImageType; - typedef typename InputImageType::PointType PointType; typedef TOutputImage OutputImageType; typedef TDeormationField DeformationFieldType; @@ -70,9 +68,7 @@ public: typedef typename ResamplerType::IndexType IndexType; typedef typename ResamplerType::RegionType RegionType; typedef typename ResamplerType::InterpolatorType InterpolatorType; - typedef typename ResamplerType::DefaultInterpolatorType DefaultInterpolatorType; - /** Specialisation of OptResampleFilter with a remote * sensing transform */ @@ -121,12 +117,20 @@ public: otbGetObjectMemberConstMacro(Resampler, Interpolator, const InterpolatorType *); /** Set/Get for input and output projections. */ - itkSetStringMacro(InputProjectionRef); - itkGetStringMacro(InputProjectionRef); + void SetInputProjectionRef(const std::string& ref) + { + m_Transform->SetOutputProjectionRef(ref); + this->Modified(); + } + otbGetObjectMemberMacro(Transform,InputProjectionRef,std::string); + + void SetOutputProjectionRef(const std::string& ref) + { + m_Transform->SetInputProjectionRef(ref); + this->Modified(); + } + otbGetObjectMemberMacro(Transform,OutputProjectionRef,std::string); - itkSetStringMacro(OutputProjectionRef); - itkGetStringMacro(OutputProjectionRef); - /** Set/Get Input Keywordlist*/ void SetInputKeywordList(const ImageKeywordlist& kwl) { @@ -161,18 +165,11 @@ protected: virtual void GenerateOutputInformation(); virtual void GenerateInputRequestedRegion(); - - // Method to instanciate the Generic RS transform - void UpdateTransform(); - + private: GenericRSResampleImageFilter(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented - - // GenericRSTransform Parameters - std::string m_InputProjectionRef; - std::string m_OutputProjectionRef; - + // Filters pointers ResamplerPointerType m_Resampler; GenericRSTransformPointerType m_Transform; diff --git a/Code/Projections/otbGenericRSResampleImageFilter.txx b/Code/Projections/otbGenericRSResampleImageFilter.txx index 693f9bd1e18f71cfde3a6c84bd06e44886dfa704..61fa622c24e69968dfbadbaa26e1863c7af5430e 100644 --- a/Code/Projections/otbGenericRSResampleImageFilter.txx +++ b/Code/Projections/otbGenericRSResampleImageFilter.txx @@ -81,26 +81,10 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField> // Expose the input metadata to the output itk::MetaDataDictionary& dict = this->GetOutput()->GetMetaDataDictionary(); - itk::EncapsulateMetaData<std::string>(dict, MetaDataKey::ProjectionRefKey, m_OutputProjectionRef); + itk::EncapsulateMetaData<std::string>(dict, MetaDataKey::ProjectionRefKey, this->GetInputProjectionRef()); outputPtr->SetMetaDataDictionary(dict); } -template <class TInputImage, class TOutputImage, class TDeformationField> -void -GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField> -::UpdateTransform() -{ - // Get the input image - const InputImageType* input = this->GetInput(); - - // Instanciate the RS Transform - m_Transform->SetOutputProjectionRef(input->GetProjectionRef()); - m_Transform->SetInputProjectionRef(m_OutputProjectionRef); - m_Transform->SetOutputKeywordList(input->GetImageKeywordlist()); - m_Transform->SetInputKeywordList(this->GetOutputKeywordList()); - m_Transform->InstanciateTransform(); -} - template <class TInputImage, class TOutputImage, class TDeformationField> void GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField> @@ -116,7 +100,7 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField> RegionType requestedRegion = outputPtr->GetRequestedRegion(); // Instanciate the RS transform - this->UpdateTransform(); + m_Transform->InstanciateTransform(); // Generate input requested region m_Resampler->SetInput(inputPtr);