X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FImage%2FPolyLineParametricPath.hxx;fp=lib%2Ffpa%2FImage%2FPolyLineParametricPath.hxx;h=0000000000000000000000000000000000000000;hb=3c639e5da479c7216a0a302ffa156ac6762caeed;hp=3093a997c60a8fc8fe7873c9416b4e39dd51d95c;hpb=5bf766068f54d061d3816f4950a076c3cf3a4d8b;p=FrontAlgorithms.git diff --git a/lib/fpa/Image/PolyLineParametricPath.hxx b/lib/fpa/Image/PolyLineParametricPath.hxx deleted file mode 100644 index 3093a99..0000000 --- a/lib/fpa/Image/PolyLineParametricPath.hxx +++ /dev/null @@ -1,217 +0,0 @@ -// ========================================================================= -// @author Leonardo Florez Valencia -// @email florez-l@javeriana.edu.co -// ========================================================================= - -#ifndef __fpa__Image__PolyLineParametricPath__hxx__ -#define __fpa__Image__PolyLineParametricPath__hxx__ - -#include -#include - -// ------------------------------------------------------------------------- -template< unsigned int _VDim > -unsigned long fpa::Image::PolyLineParametricPath< _VDim >:: -GetSize( ) const -{ - return( this->GetVertexList( )->Size( ) ); -} - -// ------------------------------------------------------------------------- -template< unsigned int _VDim > -typename fpa::Image::PolyLineParametricPath< _VDim >:: -TContinuousIndex -fpa::Image::PolyLineParametricPath< _VDim >:: -GetContinuousVertex( unsigned long i ) const -{ - return( this->GetVertexList( )->GetElement( i ) ); -} - -// ------------------------------------------------------------------------- -template< unsigned int _VDim > -typename fpa::Image::PolyLineParametricPath< _VDim >:: -TIndex fpa::Image::PolyLineParametricPath< _VDim >:: -GetVertex( unsigned long i ) const -{ - TContinuousIndex cidx = this->GetContinuousVertex( i ); - TIndex idx; - for( unsigned int d = 0; d < _VDim; ++d ) - idx[ d ] = cidx[ d ]; - return( idx ); -} - -// ------------------------------------------------------------------------- -template< unsigned int _VDim > -typename fpa::Image::PolyLineParametricPath< _VDim >:: -TPoint fpa::Image::PolyLineParametricPath< _VDim >:: -GetPoint( unsigned long i ) const -{ - typedef typename TPoint::CoordRepType _TCoordRep; - TPoint pnt; - TContinuousIndex idx = this->GetVertex( i ); - for( unsigned int r = 0; r < _VDim; ++r ) - { - _TCoordRep sum = itk::NumericTraits< _TCoordRep >::ZeroValue( ); - for( unsigned int c = 0; c < _VDim; ++c ) - sum += this->m_IndexToPhysicalPoint( r, c ) * idx[ c ]; - pnt[ r ] = sum + this->m_Origin[ r ]; - - } // rof - return( pnt ); -} - -// ------------------------------------------------------------------------- -template< unsigned int _VDim > -void fpa::Image::PolyLineParametricPath< _VDim >:: -SetSpacing( const TSpacing& spac ) -{ - if( this->m_Spacing != spac ) - { - this->m_Spacing = spac; - this->_ComputeIndexToPhysicalPointMatrices( ); - this->Modified( ); - - } // fi -} - -// ------------------------------------------------------------------------- -template< unsigned int _VDim > -void fpa::Image::PolyLineParametricPath< _VDim >:: -SetSpacing( const double spac[ _VDim ] ) -{ - this->SetSpacing( TSpacing( spac ) ); -} - -// ------------------------------------------------------------------------- -template< unsigned int _VDim > -void fpa::Image::PolyLineParametricPath< _VDim >:: -SetSpacing( const float spac[ _VDim ] ) -{ - TSpacing s; - for( unsigned int d = 0; d < _VDim; ++d ) - s[ d ] = spac[ d ]; - this->SetSpacing( s ); -} - -// ------------------------------------------------------------------------- -template< unsigned int _VDim > -void fpa::Image::PolyLineParametricPath< _VDim >:: -SetOrigin( const double ori[ _VDim ] ) -{ - this->SetOrigin( TPoint( ori ) ); -} - -// ------------------------------------------------------------------------- -template< unsigned int _VDim > -void fpa::Image::PolyLineParametricPath< _VDim >:: -SetOrigin( const float ori[ _VDim ] ) -{ - this->SetOrigin( TPoint( ori ) ); -} - -// ------------------------------------------------------------------------- -template< unsigned int _VDim > -void fpa::Image::PolyLineParametricPath< _VDim >:: -SetDirection( const TDirection& dir ) -{ - bool modified = false; - for( unsigned int r = 0; r < _VDim; r++ ) - { - for( unsigned int c = 0; c < _VDim; c++ ) - { - if( - itk::Math::NotExactlyEquals( - this->m_Direction[ r ][ c ], dir[ r ][ c ] - ) - ) - { - this->m_Direction[ r ][ c ] = dir[ r ][ c ]; - modified = true; - } // fi - - } // rof - - } // rof - if( modified ) - { - this->_ComputeIndexToPhysicalPointMatrices( ); - this->m_InverseDirection = this->m_Direction.GetInverse( ); - this->Modified( ); - - } // fi -} - -// ------------------------------------------------------------------------- -template< unsigned int _VDim > -void fpa::Image::PolyLineParametricPath< _VDim >:: -Graft( itk::DataObject* o ) -{ - this->Superclass::Graft( o ); - Self* other = dynamic_cast< Self* >( o ); - if( other != NULL ) - { - this->m_DefaultInputStepSize = other->m_DefaultInputStepSize; - this->Initialize( ); - for( unsigned long i = 0; i < other->GetSize( ); ++i ) - this->AddVertex( other->GetContinuousVertex( i ) ); - this->m_Spacing = other->m_Spacing; - this->m_Origin = other->m_Origin; - this->m_Direction = other->m_Direction; - this->m_InverseDirection = other->m_InverseDirection; - this->m_IndexToPhysicalPoint = other->m_IndexToPhysicalPoint; - this->m_PhysicalPointToIndex = other->m_PhysicalPointToIndex; - - } // fi -} - -// ------------------------------------------------------------------------- -template< unsigned int _VDim > -fpa::Image::PolyLineParametricPath< _VDim >:: -PolyLineParametricPath( ) - : Superclass( ) -{ - this->m_Spacing.Fill( 1.0 ); - this->m_Origin.Fill( 0.0 ); - this->m_Direction.SetIdentity( ); - this->m_InverseDirection.SetIdentity( ); - this->m_IndexToPhysicalPoint.SetIdentity( ); - this->m_PhysicalPointToIndex.SetIdentity( ); -} - -// ------------------------------------------------------------------------- -template< unsigned int _VDim > -fpa::Image::PolyLineParametricPath< _VDim >:: -~PolyLineParametricPath( ) -{ -} - -// ------------------------------------------------------------------------- -template< unsigned int _VDim > -void fpa::Image::PolyLineParametricPath< _VDim >:: -_ComputeIndexToPhysicalPointMatrices( ) -{ - TDirection scale; - scale.Fill( 0.0 ); - for( unsigned int i = 0; i < _VDim; i++ ) - { - if( this->m_Spacing[ i ] == 0.0 ) - itkExceptionMacro( - "A spacing of 0 is not allowed: Spacing is " << this->m_Spacing - ); - scale[ i ][ i ] = this->m_Spacing[ i ]; - - } // rof - - if( vnl_determinant( this->m_Direction.GetVnlMatrix( ) ) == 0.0 ) - itkExceptionMacro( - << "Bad direction, determinant is 0. Direction is " - << this->m_Direction - ); - this->m_IndexToPhysicalPoint = this->m_Direction * scale; - this->m_PhysicalPointToIndex = this->m_IndexToPhysicalPoint.GetInverse( ); - this->Modified( ); -} - -#endif // __fpa__Image__PolyLineParametricPath__hxx__ - -// eof - $RCSfile$