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

itkPolygonGroupSpatialObjectXMLFile.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkPolygonGroupSpatialObjectXMLFile.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/01/21 20:19:32 $
00007   Version:   $1.0$
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 #ifndef __tkPolygonGroupSpatialObjectXMLFile_h
00018 #define __itkPolygonGroupSpatialObjectXMLFile_h
00019 
00020 #ifdef _MSC_VER
00021 #pragma warning ( disable : 4786 )
00022 #endif
00023 
00024 #include "itkPolygonGroupSpatialObject.h"
00025 #include "itkXMLFile.h"
00026 namespace itk
00027 {
00028 
00029 /* 3D Polygon Groups only ones that make sense for this data type */
00030 typedef PolygonGroupSpatialObject<3> PGroupSpatialObjectType;
00031 
00037 class PolygonGroupSpatialObjectXMLFileReader :
00038 public XMLReader<PGroupSpatialObjectType>
00039 {
00040  public:
00042   typedef PolygonGroupSpatialObjectXMLFileReader Self;
00043   typedef XMLReader<PGroupSpatialObjectType> Superclass;
00044   typedef SmartPointer<Self> Pointer;
00045 
00046   typedef PGroupSpatialObjectType PolygonGroupType;
00047   typedef PolygonSpatialObject<3> PolygonSpatialObjectType;
00048   typedef SpatialObjectPoint<3> PointType;
00049   typedef std::vector<PointType> PointListType;
00050 
00052   itkTypeMacro(PolygonGroupSpatialObjectXMLFileReader, XMLReader);
00053 
00055   itkNewMacro(Self);
00056 public:
00057 
00059   virtual int CanReadFile(const char* name);
00060 protected:
00061   virtual void StartElement(const char * name,const char **atts);
00062   virtual void EndElement(const char *name);
00063   virtual void CharacterDataHandler(const char *inData, int inLength);
00064 private:
00065   PGroupSpatialObjectType::Pointer m_PGroup;
00066   PolygonSpatialObjectType::Pointer m_CurPoly;
00067   PointListType m_CurPointList;
00068   std::string m_CurCharacterData;
00069 };
00071 
00077 class PolygonGroupSpatialObjectXMLFileWriter :
00078     public XMLWriterBase<PGroupSpatialObjectType>
00079 {
00080 public:
00082   typedef XMLWriterBase<PGroupSpatialObjectType> Superclass;
00083   typedef PolygonGroupSpatialObjectXMLFileWriter Self;
00084   typedef SmartPointer<Self> Pointer;
00085 
00087   itkNewMacro(Self);
00088 
00090   itkTypeMacro(PolygonGroupSpatialObjectXMLFileWriter,
00091                XMLWriterBase<PGroupSpatialObjectType>);
00092   typedef PGroupSpatialObjectType PolygonGroupType;
00093   typedef PolygonSpatialObject<3> PolygonSpatialObjectType;
00094 
00096   virtual int CanWriteFile(const char* name);
00097 
00099   virtual int WriteFile();
00100 };
00101 
00102 }
00103 #endif
00104 

Generated at Mon Mar 12 02:16:26 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000