X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FDataObjects%2FBoundingBox.h;h=11cf8c2738eb465fcf729e77888bf39df4a5504a;hb=49d2d7db538d60008b9a5701ea8f26bb19997a82;hp=2b5c9c872adf17c7928b559bc25b2028dc56b0aa;hpb=65e11480407fe343b2b56098257e0bb837f75df3;p=cpPlugins.git diff --git a/lib/cpPlugins/DataObjects/BoundingBox.h b/lib/cpPlugins/DataObjects/BoundingBox.h index 2b5c9c8..11cf8c2 100644 --- a/lib/cpPlugins/DataObjects/BoundingBox.h +++ b/lib/cpPlugins/DataObjects/BoundingBox.h @@ -36,16 +36,28 @@ namespace cpPlugins void Blend( Self* other ); template< class _TPoint > - inline void SetMinimum( const _TPoint& p ); + inline void SetMinimum( const _TPoint& p ) + { + this->_SetPoint( 0, p ); + } template< class _TPoint > - inline void SetMaximum( const _TPoint& p ); + inline void SetMaximum( const _TPoint& p ) + { + this->_SetPoint( 1, p ); + } template< class _TPoint > - inline _TPoint GetMinimum( ) const; + inline _TPoint GetMinimum( ) const + { + return( this->_GetPoint< _TPoint >( 0 ) ); + } template< class _TPoint > - inline _TPoint GetMaximum( ) const; + inline _TPoint GetMaximum( ) const + { + return( this->_GetPoint< _TPoint >( 1 ) ); + } protected: BoundingBox( ); @@ -54,16 +66,33 @@ namespace cpPlugins void _UpdateVTK( ); template< class _TPoint > - inline void _SetPoint( unsigned int m, const _TPoint& p ); + inline void _SetPoint( unsigned int m, const _TPoint& p ) + { + this->m_Points[ m ].clear( ); + for( unsigned int d = 0; d < _TPoint::PointDimension; ++d ) + this->m_Points[ m ].push_back( double( p[ d ] ) ); + this->_UpdateVTK( ); + this->Modified( ); + } template< class _TPoint > - inline _TPoint _GetPoint( unsigned int m ) const; + inline _TPoint _GetPoint( unsigned int m ) const + { + unsigned int dim = this->m_Points[ m ].size( ); + dim = + ( _TPoint::PointDimension < dim )? _TPoint::PointDimension: dim; + _TPoint p; + p.Fill( 0 ); + for( unsigned int d = 0; d < dim; ++d ) + p[ d ] = this->m_Points[ m ][ d ]; + return( p ); + } template< unsigned int _NDim > - inline bool _ITKImage( itk::LightObject* o ); + inline bool _ITKImage( itk::LightObject* o ); template< class _TScalar, unsigned int _NDim > - inline bool _ITKPointSet( itk::LightObject* o ); + inline bool _ITKPointSet( itk::LightObject* o ); private: // Purposely not implemented