Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkSpatialObject.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSpatialObject.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/10/18 19:20:51 $
00007   Version:   $Revision: 1.12 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017  
00018 #ifndef __itkSpatialObject_h 
00019 #define __itkSpatialObject_h 
00020  
00021 #include "itkNDimensionalSpatialObject.h"
00022 #include "itkBoundingBox.h"
00023 #include "itkPoint.h"
00024 #include "itkAffineTransform.h"
00025 #include "itkSmartPointer.h" 
00026 #include "itkVector.h"
00027 #include "itkCovariantVector.h"
00028 #include "itkExceptionObject.h" 
00029 #include <list> 
00030 
00031 namespace itk  
00032 { 
00033 
00051 template< unsigned int NDimensions = 3, 
00052           typename TTransform = AffineTransform< double, 
00053                                                  NDimensions
00054           > ,
00055           unsigned int PipelineDimension = 3 
00056         > 
00057 class SpatialObject 
00058 :public NDimensionalSpatialObject<PipelineDimension>
00059 { 
00060 
00061 public: 
00062 
00063   typedef double ScalarType;
00064 
00065   typedef SpatialObject<NDimensions,TTransform,PipelineDimension> Self;
00066   typedef NDimensionalSpatialObject<PipelineDimension> Superclass; 
00067   
00068   typedef SmartPointer< Self > Pointer;
00069   typedef SmartPointer< const Self > ConstPointer;
00070   
00071   typedef Point < ScalarType, NDimensions > PointType; 
00072   typedef PointType * PointPointer; 
00073   
00074   typedef Vector< ScalarType, NDimensions > VectorType; 
00075   typedef VectorType * VectorPointer;
00076 
00077   typedef CovariantVector< double, NDimensions > OutputVectorType; 
00078   typedef OutputVectorType * OutputVectorPointer;
00079 
00080   typedef TTransform            TransformType;
00081   typedef typename TransformType::Pointer  TransformPointer;
00082   typedef const TransformType*             TransformConstPointer;
00083   
00084   typedef std::list< TransformType * > TransformListType;
00085   
00086   typedef VectorContainer< unsigned long int, PointType > VectorContainerType;
00087   
00088   typedef BoundingBox< unsigned long int, NDimensions, ScalarType, VectorContainerType > BoundingBoxType; 
00089   typedef typename BoundingBoxType::Pointer BoundingBoxPointer; 
00090 
00091   typedef std::list< Self * > ChildrenListType; 
00092 
00096   itkStaticConstMacro(ObjectDimension, unsigned int, NDimensions);
00097 
00099   itkNewMacro( Self );
00100  
00102   itkTypeMacro( Self, Superclass );
00103 
00105   void SetBounds( BoundingBoxPointer bounds ); 
00106 
00108   BoundingBoxType * GetBounds( void ) const; 
00109 
00110   void SetLocalToGlobalTransform( TransformType * transform ); 
00111   const TransformType * GetLocalToGlobalTransform( void ); 
00112   
00113   void SetGlobalToLocalTransform( TransformType * transform ); 
00114   const TransformType * GetGlobalToLocalTransform( void );
00115 
00118   virtual void ValueAt( const PointType & point, double & value ); //purposely not implemented
00119      
00122   virtual bool IsEvaluableAt( const PointType & point ); // purposely not implemented
00123 
00125   virtual bool IsInside( const PointType & point ); // purposely not implemented
00126 
00129   void SetParent( const Superclass * parent );
00130 
00132   virtual void DerivativeAt( const PointType & point, short unsigned int order, OutputVectorType & value );
00133 
00136   void TransformPointToLocalCoordinate( PointType & p ) const;
00137 
00140   void TransformPointToGlobalCoordinate( PointType & p ) const; 
00141 
00144   void BuildLocalToGlobalTransformList( TransformListType & list, bool init ) const;
00145 
00148   void BuildGlobalToLocalTransformList( TransformListType & list, bool init ) const;
00149 
00151   TransformListType & GetLocalToGlobalTransformList( void );
00152 
00154   TransformListType & GetGlobalToLocalTransformList( void );
00155 
00160   virtual void ComputeBounds( void ); // purposely not implemented 
00161 
00163   void SetSpacing( const double spacing[ObjectDimension] );
00164 
00166   const double* GetSpacing() const {return m_Spacing;}
00167 
00170   unsigned long GetMTime( void ) const;
00171 
00174   virtual void RebuildLocalToGlobalTransformList( void ) ;
00175 
00178   virtual void RebuildGlobalToLocalTransformList( void ) ;
00179 
00182   virtual void RebuildAllTransformLists( void ) ;
00183 
00185   void AddSpatialObject( Self * pointer ); 
00186      
00191   void RemoveSpatialObject( Self * object ); 
00192 
00194   ChildrenListType & GetChildren( void );
00195 
00197   unsigned int GetNumberOfChildren( void ); 
00198 
00200   void SetChildren( ChildrenListType & children ); 
00201 
00202 protected: 
00203 
00204   BoundingBoxPointer  m_Bounds; 
00205   TimeStamp           m_BoundsMTime;
00206   double              m_Spacing[ObjectDimension]; 
00207 
00208   TransformListType   m_LocalToGlobalTransformList;
00209   TransformListType   m_GlobalToLocalTransformList;
00210 
00211   TransformPointer    m_LocalToGlobalTransform; 
00212   TransformPointer    m_GlobalToLocalTransform; 
00213 
00215   SpatialObject(); 
00216 
00218   virtual ~SpatialObject(); 
00219 
00220   virtual void PrintSelf( std::ostream& os, Indent indent ) const; 
00221 
00224   ChildrenListType m_Children; 
00225 
00226 }; 
00227 
00228 } // end of namespace itk
00229  
00230 #ifndef ITK_MANUAL_INSTANTIATION 
00231   #include "itkSpatialObject.txx" 
00232 #endif 
00233  
00234 #endif // __itkSpatialObject_h

Generated at Wed Mar 12 01:13:10 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000