ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkSceneSpatialObject.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkSceneSpatialObject_h
00019 #define __itkSceneSpatialObject_h
00020 
00021 #include "itkSpatialObject.h"
00022 
00023 #include <list>
00024 
00025 namespace itk
00026 {
00037 template< unsigned int TSpaceDimension = 3 >
00038 class ITK_EXPORT SceneSpatialObject:
00039   public Object
00040 {
00041 public:
00042 
00043   typedef SceneSpatialObject< TSpaceDimension > Self;
00044   typedef Object                                Superclass;
00045   typedef Superclass::Pointer                   SuperclassPointer;
00046   typedef SmartPointer< Self >                  Pointer;
00047   typedef SmartPointer< const Self >            ConstPointer;
00048 
00049   typedef SpatialObject< TSpaceDimension >    ObjectType;
00050   typedef SpatialObject< TSpaceDimension >    SpatialObjectType;
00051   typedef typename SpatialObjectType::Pointer SpatialObjectPointer;
00052 
00053   typedef std::list< SpatialObjectPointer >   ObjectListType;
00054 
00055   itkStaticConstMacro(MaximumDepth, unsigned int, 9999999);
00056 
00058   itkNewMacro(Self);
00059   itkTypeMacro(SceneSpatialObject, Object);
00061 
00063   void AddSpatialObject(SpatialObject< TSpaceDimension > *pointer);
00064 
00069   void RemoveSpatialObject(SpatialObject< TSpaceDimension > *object);
00070 
00074   ObjectListType * GetObjects(unsigned int depth = MaximumDepth,
00075                               char *name = NULL);
00076 
00079   unsigned int GetNumberOfObjects(unsigned int depth = MaximumDepth,
00080                                   char *name = NULL);
00081 
00084   void SetObjects(ObjectListType & children);
00085 
00088   unsigned long GetMTime(void) const;
00089 
00091   void SetParentId(int parentid) { m_ParentId = parentid; }
00092   int  GetParentId(void) { return m_ParentId; }
00094 
00096   SpatialObject< TSpaceDimension > * GetObjectById(int Id);
00097 
00098   bool FixHierarchy(void);
00099 
00100   bool CheckIdValidity(void);
00101 
00102   void FixIdValidity(void);
00103 
00104   int GetNextAvailableId();
00105 
00107   void Clear();
00108 
00109 protected:
00110   SceneSpatialObject(const Self &); //purposely not implemented
00111   void operator=(const Self &);     //purposely not implemented
00112 
00115   ObjectListType m_Objects;
00116 
00118   SceneSpatialObject();
00119 
00121   virtual ~SceneSpatialObject();
00122 
00124   virtual void PrintSelf(std::ostream & os, Indent indent) const;
00125 
00127   int m_ParentId;
00128 };
00129 } // end of namespace itk
00130 
00131 #ifndef ITK_MANUAL_INSTANTIATION
00132 #include "itkSceneSpatialObject.hxx"
00133 #endif
00134 
00135 #endif // __SceneSpatialObject_h
00136