diff --git a/Code/Projections/otbGroundSpacingImageFunction.h b/Code/Projections/otbGroundSpacingImageFunction.h index 30e706e252cd9fd4fd82c604c2c77ee3413b9fba..42426b5a1b3b96df864d4a068a27badfe3d685bd 100644 --- a/Code/Projections/otbGroundSpacingImageFunction.h +++ b/Code/Projections/otbGroundSpacingImageFunction.h @@ -86,6 +86,7 @@ public: this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } + virtual FloatType EvaluateAtContinuousIndex( const ContinuousIndexType& cindex) const { @@ -94,11 +95,8 @@ public: return this->EvaluateAtIndex(index); } - /** Get/Set the transformation definition of the input image **/ - itkSetObjectMacro(Transform, TransformType); - itkGetObjectMacro(Transform, TransformType); - PointType GetPixelLocation(const IndexType& index) const; + protected: GroundSpacingImageFunction(); virtual ~GroundSpacingImageFunction(){} @@ -108,7 +106,6 @@ private: GroundSpacingImageFunction(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented - TransformType::Pointer m_Transform; ValueType m_R; ValueType m_deg2radCoef; }; diff --git a/Code/Projections/otbGroundSpacingImageFunction.txx b/Code/Projections/otbGroundSpacingImageFunction.txx index e0311e4710adaa9e8bd3614c98bbe0eb7ef3a547..bbd1aa05ccc32a7abd45e41b1071c80685d5d18f 100644 --- a/Code/Projections/otbGroundSpacingImageFunction.txx +++ b/Code/Projections/otbGroundSpacingImageFunction.txx @@ -39,7 +39,6 @@ GroundSpacingImageFunction<TInputImage, TCoordRep> { m_R = 6371000; m_deg2radCoef = CONST_PI / 180; - m_Transform = TransformType::New(); } /** @@ -120,6 +119,7 @@ GroundSpacingImageFunction<TInputImage, TCoordRep> PointType inputPoint; inputPoint[0] = index[0]; inputPoint[1] = index[1]; + if (!this->GetInputImage()) { itkExceptionMacro(<< "No input image!"); diff --git a/Code/Visualization/otbImageLayer.txx b/Code/Visualization/otbImageLayer.txx index e73b51cfdb294429cd8a1808d4ac0e945f0f3707..00f3af9eba81d28e513dd63db195472626582263 100644 --- a/Code/Visualization/otbImageLayer.txx +++ b/Code/Visualization/otbImageLayer.txx @@ -284,7 +284,7 @@ ImageLayer<TImage, TOutputImage> { if (m_Transform->GetTransformAccuracy() != Projection::UNKNOWN) { - PointType point = m_GroundSpacing->GetPixelLocation (index); + PointType point = this->GetPixelLocation (index); oss << setiosflags(std::ios::fixed) << std::setprecision(2) << "Ground spacing(in m): " << m_ApproxGroundSpacing.first << " " << m_ApproxGroundSpacing.second << std::endl; @@ -343,8 +343,6 @@ ImageLayer<TImage, TOutputImage> //Set parameters of the ground spacing image calculators m_GroundSpacing->SetInputImage(m_Image); - m_GroundSpacing->SetTransform(m_Transform); - } template <class TImage, class TOutputImage>