diff --git a/Modules/Core/ImageBase/include/otbImage.h b/Modules/Core/ImageBase/include/otbImage.h index d3943b35190b8080e374cfe1dfa684350bb8d385..caf55c470fb347552c738dad9abb032d6bd19354 100644 --- a/Modules/Core/ImageBase/include/otbImage.h +++ b/Modules/Core/ImageBase/include/otbImage.h @@ -231,8 +231,6 @@ public: /** Set signed spacing */ virtual void SetSignedSpacing( SpacingType spacing ); virtual void SetSignedSpacing( double spacing[ VImageDimension ] ); - virtual void SetSignedSpacing( float spacing[ VImageDimension ] ); - /** Get image corners. */ virtual VectorType GetUpperLeftCorner(void) const; diff --git a/Modules/Core/ImageBase/include/otbImage.txx b/Modules/Core/ImageBase/include/otbImage.txx index e02892ef55687193aaf53d4f75c2eab8ac4ff59c..096a7259605c8dc9adabe7c9c058fdd27490332d 100644 --- a/Modules/Core/ImageBase/include/otbImage.txx +++ b/Modules/Core/ImageBase/include/otbImage.txx @@ -181,48 +181,16 @@ void Image<TPixel, VImageDimension> } } this->SetSpacing(spacing); + this->ComputeIndexToPhysicalPointMatrices(); + this->Modified(); } template <class TPixel, unsigned int VImageDimension> void Image<TPixel, VImageDimension> ::SetSignedSpacing( double spacing[ VImageDimension ]) { - for ( unsigned int i = 0; i < VImageDimension; i++ ) - { - if ( spacing[i] < 0.0 ) - { - if ( this->m_Direction[i][i] > 0 ) - { - for ( unsigned j = 0; j < VImageDimension; ++j ) - { - this->m_Direction[j][i] = - this->m_Direction[j][i]; - } - } - spacing[i] = - spacing[i]; - } - } - this->SetSpacing(spacing); -} - -template <class TPixel, unsigned int VImageDimension> -void Image<TPixel, VImageDimension> -::SetSignedSpacing( float spacing[ VImageDimension ]) -{ - for ( unsigned int i = 0; i < VImageDimension; i++ ) - { - if ( spacing[i] < 0.0 ) - { - if ( this->m_Direction[i][i] > 0 ) - { - for ( unsigned j = 0; j < VImageDimension; ++j ) - { - this->m_Direction[j][i] = - this->m_Direction[j][i]; - } - } - spacing[i] = - spacing[i]; - } - } - this->SetSpacing(spacing); + SpacingType s(spacing); + this->SetSignedSpacing(s); } template <class TPixel, unsigned int VImageDimension> diff --git a/Modules/Core/ImageBase/include/otbVectorImage.h b/Modules/Core/ImageBase/include/otbVectorImage.h index dd4e7760c6747422220f524f92f2df907461e2ad..2fa39e599a1811ef98b7930931c37a5031e19cd9 100644 --- a/Modules/Core/ImageBase/include/otbVectorImage.h +++ b/Modules/Core/ImageBase/include/otbVectorImage.h @@ -150,7 +150,6 @@ public: /** Set signed spacing */ virtual void SetSignedSpacing( SpacingType spacing ); virtual void SetSignedSpacing( double spacing[ VImageDimension ] ); - virtual void SetSignedSpacing( float spacing[ VImageDimension ] ); /** Get image corners. */ virtual VectorType GetUpperLeftCorner(void) const; diff --git a/Modules/Core/ImageBase/include/otbVectorImage.txx b/Modules/Core/ImageBase/include/otbVectorImage.txx index e69a9fd14d44cfe0ef080178a9d8dc0705bcc9c7..f6123af5845fc49c321a84febdd28be828ee21bc 100644 --- a/Modules/Core/ImageBase/include/otbVectorImage.txx +++ b/Modules/Core/ImageBase/include/otbVectorImage.txx @@ -183,48 +183,16 @@ void VectorImage<TPixel, VImageDimension> } } this->SetSpacing(spacing); + this->ComputeIndexToPhysicalPointMatrices(); + this->Modified(); } template <class TPixel, unsigned int VImageDimension> void VectorImage<TPixel, VImageDimension> ::SetSignedSpacing( double spacing[ VImageDimension ]) { - for ( unsigned int i = 0; i < VImageDimension; i++ ) - { - if ( spacing[i] < 0.0 ) - { - if ( this->m_Direction[i][i] > 0 ) - { - for ( unsigned j = 0; j < VImageDimension; ++j ) - { - this->m_Direction[j][i] = - this->m_Direction[j][i]; - } - } - spacing[i] = - spacing[i]; - } - } - this->SetSpacing(spacing); -} - -template <class TPixel, unsigned int VImageDimension> -void VectorImage<TPixel, VImageDimension> -::SetSignedSpacing( float spacing[ VImageDimension ]) -{ - for ( unsigned int i = 0; i < VImageDimension; i++ ) - { - if ( spacing[i] < 0.0 ) - { - if ( this->m_Direction[i][i] > 0 ) - { - for ( unsigned j = 0; j < VImageDimension; ++j ) - { - this->m_Direction[j][i] = - this->m_Direction[j][i]; - } - } - spacing[i] = - spacing[i]; - } - } - this->SetSpacing(spacing); + SpacingType s(spacing); + this->SetSignedSpacing(s); } template <class TPixel, unsigned int VImageDimension>