00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSpatialObjectFactory.h,v $ 00005 Language: C++ 00006 Date: $Date: 2007-01-28 19:24:57 $ 00007 Version: $Revision: 1.2 $ 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 Portions of this code are covered under the VTK copyright. 00013 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details. 00014 00015 This software is distributed WITHOUT ANY WARRANTY; without even 00016 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00017 PURPOSE. See the above copyright notices for more information. 00018 00019 =========================================================================*/ 00020 #ifndef __itkSpatialObjectFactory_h 00021 #define __itkSpatialObjectFactory_h 00022 00023 #include "itkSpatialObjectFactoryBase.h" 00024 00025 namespace itk 00026 { 00031 template <class T> 00032 class SpatialObjectFactory : public SpatialObjectFactoryBase 00033 { 00034 public: 00035 00036 static void RegisterSpatialObject() 00037 { 00038 typename T::Pointer t = T::New(); 00039 SpatialObjectFactoryBase::Pointer f = 00040 SpatialObjectFactoryBase::GetFactory(); 00041 f->RegisterSpatialObject ( t->GetSpatialObjectTypeAsString().c_str(), 00042 t->GetSpatialObjectTypeAsString().c_str(), 00043 t->GetSpatialObjectTypeAsString().c_str(), 00044 1, 00045 CreateObjectFunction<T>::New() ); 00046 } 00047 }; 00048 } // end namespace itk 00049 00050 #endif 00051