00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSceneSpatialObject.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-04-07 14:34:16 $ 00007 Version: $Revision: 1.12 $ 00008 00009 Copyright (c) Insight Software 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 __itkSceneSpatialObject_h 00019 #define __itkSceneSpatialObject_h 00020 00021 #include "itkSpatialObject.h" 00022 00023 #include <list> 00024 00025 namespace itk 00026 { 00027 00037 template <unsigned int TSpaceDimension = 3> 00038 class ITK_EXPORT SceneSpatialObject 00039 : public Object 00040 { 00041 00042 public: 00043 00044 typedef SceneSpatialObject<TSpaceDimension> Self; 00045 typedef Object Superclass; 00046 typedef Superclass::Pointer SuperclassPointer; 00047 typedef SmartPointer< Self > Pointer; 00048 typedef SmartPointer< const Self > ConstPointer; 00049 00050 typedef SpatialObject<TSpaceDimension> ObjectType; 00051 typedef SpatialObject<TSpaceDimension> SpatialObjectType; 00052 typedef typename SpatialObjectType::Pointer SpatialObjectPointer; 00053 00054 typedef std::list< SpatialObjectPointer > 00055 ObjectListType; 00056 00057 itkStaticConstMacro(MaximumDepth, unsigned int, 9999999); 00058 00060 itkNewMacro(Self); 00061 itkTypeMacro(SceneSpatialObject, Object); 00063 00065 void AddSpatialObject( SpatialObject<TSpaceDimension> * pointer ); 00066 00071 void RemoveSpatialObject( SpatialObject<TSpaceDimension> * object ); 00072 00076 ObjectListType * GetObjects( unsigned int depth=MaximumDepth, 00077 char * name=NULL ); 00078 00081 unsigned int GetNumberOfObjects( unsigned int depth=MaximumDepth, 00082 char * name=NULL ); 00083 00086 void SetObjects( ObjectListType & children ); 00087 00090 unsigned long GetMTime( void ) const; 00091 00093 void SetParentId(int parentid) {m_ParentId=parentid;} 00094 int GetParentId(void) {return m_ParentId;} 00096 00098 SpatialObject<TSpaceDimension> * GetObjectById(int Id); 00099 00100 bool FixHierarchy(void); 00101 bool CheckIdValidity(void); 00102 void FixIdValidity(void); 00103 int GetNextAvailableId(); 00104 00106 void Clear(); 00107 00108 protected: 00109 SceneSpatialObject(const Self&); //purposely not implemented 00110 void operator=(const Self&); //purposely not implemented 00111 00114 ObjectListType m_Objects; 00115 00117 SceneSpatialObject(); 00118 00120 virtual ~SceneSpatialObject(); 00121 00123 virtual void PrintSelf( std::ostream& os, Indent indent ) const; 00124 00126 int m_ParentId; 00127 00128 }; 00129 00130 } // end of namespace itk 00131 00132 00133 #ifndef ITK_MANUAL_INSTANTIATION 00134 #include "itkSceneSpatialObject.txx" 00135 #endif 00136 00137 #endif // __SceneSpatialObject_h 00138