00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkScene.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/01/22 22:29:53 $ 00007 Version: $Revision: 1.8 $ 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 __Scene_h 00019 #define __Scene_h 00020 00021 #include "itkSpatialObject.h" 00022 00023 #include <list> 00024 00025 namespace itk 00026 { 00027 00037 template <unsigned int SpaceDimension = 3> 00038 class Scene 00039 : public Object 00040 { 00041 00042 public: 00043 00044 typedef Scene<SpaceDimension> 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<SpaceDimension> ObjectType; 00051 typedef SpatialObject<SpaceDimension> SpatialObjectType; 00052 00053 typedef std::list< SpatialObject<SpaceDimension> * > 00054 ObjectListType; 00055 00056 itkStaticConstMacro(MaximumDepth, unsigned int, 9999999); 00057 00059 itkNewMacro(Self); 00060 itkTypeMacro(Self, Superclass); 00061 00063 void AddSpatialObject( SpatialObject<SpaceDimension> * pointer ); 00064 00069 void RemoveSpatialObject( SpatialObject<SpaceDimension> * object ); 00070 00072 ObjectListType * GetObjects( unsigned int depth=MaximumDepth, 00073 char * name=NULL ); 00074 00076 unsigned int GetNumberOfObjects( unsigned int depth=MaximumDepth, 00077 char * name=NULL ); 00078 00080 void SetObjects( ObjectListType & children ); 00081 00084 unsigned long GetMTime( void ) const; 00085 00087 void SetParentId(int parentid) {m_ParentId=parentid;} 00088 int GetParentId(void) {return m_ParentId;} 00089 00091 SpatialObject<SpaceDimension> * GetObjectById(int Id); 00092 00093 bool FixHierarchy(void); 00094 00095 protected: 00096 00098 ObjectListType m_Objects; 00099 00101 Scene(); 00102 00104 virtual ~Scene(); 00105 00107 virtual void PrintSelf( std::ostream& os, Indent indent ) const; 00108 00110 int m_ParentId; 00111 00112 }; 00113 00114 } // end of namespace itk 00115 00116 00117 #ifndef ITK_MANUAL_INSTANTIATION 00118 #include "itkScene.txx" 00119 #endif 00120 00121 #endif // __Scene_h