IGSTK
igstkMeshReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkMeshReader.h,v $
5  Language: C++
6  Date: $Date: 2008-05-05 20:41:09 $
7  Version: $Revision: 1.13 $
8 
9  Copyright (c) ISC Insight Software Consortium. All rights reserved.
10  See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __igstkMeshReader_h
18 #define __igstkMeshReader_h
19 
21 #include "igstkMeshObject.h"
22 
23 namespace igstk
24 {
25 
26 namespace Friends
27 {
28 
39 {
40 public:
41 
42  template < class TReader, class TMeshSpatialObject >
43  static void
44  ConnectMesh( TReader * reader,
45  TMeshSpatialObject * meshSpatialObject )
46  {
47  meshSpatialObject->SetMesh( reader->GetITKMesh() );
48  }
49 
50 }; // end of MeshReaderToMeshSpatialObject class
51 
52 } // end of Friend namespace
53 
54 
70 class MeshReader : public SpatialObjectReader<3,float>
71 {
72 
73 public:
74 
78 
81 
82 public:
83 
87  typedef SpatialObjectType::ConstPointer SpatialObjectTypeConstPointer;
88  typedef igstk::MeshObject MeshObjectType;
89 
91  igstkEventMacro( MeshReaderEvent,ObjectReaderEvent )
92  igstkEventMacro( MeshReadingErrorEvent, ObjectReadingErrorEvent )
93  igstkLoadedObjectEventMacro( MeshModifiedEvent, MeshReaderEvent,
94  MeshObjectType )
95 
96 protected:
97 
98  typedef MeshObjectType::MeshType MeshType;
99 
100 public:
101 
104  igstkFriendClassMacro( igstk::Friends::MeshReaderToMeshSpatialObject );
105 
106 protected:
107 
108  MeshReader( void );
109  ~MeshReader( void );
110 
112  void PrintSelf( std::ostream& os, itk::Indent indent ) const;
113 
117 
119  void ReportObjectProcessing();
120 
122  void ConnectMesh();
123 
124 private:
125 
126  MeshReader(const Self&); //purposely not implemented
127  void operator=(const Self&); //purposely not implemented
128 
129  // FIXME : This must be replaced with StateMachine logic
130  virtual MeshType * GetITKMesh() const;
131 
132  MeshObjectType::Pointer m_MeshObject;
133  MeshType::Pointer m_Mesh;
134 
135 };
136 
137 } // end namespace igstk
138 
139 
140 #endif // __igstkMeshReader_h