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: 2004/01/08 00:39:07 $
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 #include "itkXMLFile.h"
00021 #include "itkPolygonGroupSpatialObject.h"
00022 namespace itk
00023 {
00024 
00025 /* 3D Polygon Groups only ones that make sense for this data type */
00026 typedef PolygonGroupSpatialObject<3> PGroupSpatialObjectType;
00027 
00033 class PolygonGroupSpatialObjectXMLFileReader :
00034 public XMLReader<PGroupSpatialObjectType>
00035 {
00036  public:
00038   typedef PolygonGroupSpatialObjectXMLFileReader Self;
00039   typedef XMLReader<PGroupSpatialObjectType> Superclass;
00040   typedef SmartPointer<Self> Pointer;
00041 
00042   typedef PGroupSpatialObjectType PolygonGroupType;
00043   typedef PolygonSpatialObject<3> PolygonSpatialObjectType;
00044   typedef SpatialObjectPoint<3> PointType;
00045   typedef std::vector<PointType> PointListType;
00046 
00048   itkTypeMacro(Self,Superclass);
00049 
00051   itkNewMacro(Self);
00052 public:
00054   virtual int CanReadFile(const char* name);
00055 protected:
00056   virtual void StartElement(const char * name,const char **atts);
00057   virtual void EndElement(const char *name);
00058   virtual void CharacterDataHandler(const char *inData, int inLength);
00059 private:
00060   PGroupSpatialObjectType::Pointer m_PGroup;
00061   PolygonSpatialObjectType::Pointer m_CurPoly;
00062   PointListType m_CurPointList;
00063   std::string m_CurCharacterData;
00064 };
00065 
00071 class PolygonGroupSpatialObjectXMLFileWriter :
00072     public XMLWriterBase<PGroupSpatialObjectType>
00073 {
00074 public:
00076   typedef XMLWriterBase<PGroupSpatialObjectType> Superclass;
00077   typedef PolygonGroupSpatialObjectXMLFileWriter Self;
00078   typedef SmartPointer<Self> Pointer;
00080   itkNewMacro(Self);
00082   itkTypeMacro(PolygonGroupSpatialObjectXMLFileWriter,
00083                XMLWriterBase<PGroupSpatialObjectType>);
00084   typedef PGroupSpatialObjectType PolygonGroupType;
00085   typedef PolygonSpatialObject<3> PolygonSpatialObjectType;
00087   virtual int CanWriteFile(const char* name);
00089   virtual int WriteFile();
00090 };
00091 
00092 }
00093 #endif

Generated at Sun Jan 25 13:19:43 2004 for ITK by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2000