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
Implements the 3-dimensional mesh structure.
::itk::SpatialObject< TDimension > SpatialObjectType
This class reads 3D Mesh in the metaIO format.
#define igstkFriendClassMacro(type)
Create a Macro for friend class.
Definition: igstkMacros.h:137
igstkLoadedObjectEventMacro(SpatialObjectModifiedEvent, IGSTKEvent, SpatialObject)
Event to be invoked when the state of the SpatialObject changes.
void PrintSelf(std::ostream &os, itk::Indent indent) const
Print the object information in a stream.
This class reads spatial object data stored in files.
void ReportObjectProcessing()
This method will invoke the MeshModifiedEvent.
Base class for all the IGSTK classes.
Definition: igstkObject.h:40
This class is intended to make the connection between the MeshReader and its output, the MeshSpatialObject.
#define igstkStandardClassTraitsMacro(classname, superclassname)
Convenience macro for traits of a non-templated class.
Definition: igstkMacros.h:275
SpatialObjectType::ConstPointer SpatialObjectTypeConstPointer
SpatialObjectReader< 3, float > SuperclassType
Typedef for the superclass is needed because the StandardClassTraitsMacro would get confused with the...
::itk::SmartPointer< Self > Pointer
Definition: igstkObject.h:50
void ConnectMesh()
Connect the ITK mesh to the output MeshSpatialObject.
::itk::Object Superclass
Definition: igstkObject.h:49
void AttemptReadObjectProcessing()
This method tries to read the Object.
static void ConnectMesh(TReader *reader, TMeshSpatialObject *meshSpatialObject)
::itk::SmartPointer< const Self > ConstPointer
Definition: igstkObject.h:51
igstkEventMacro(MeshReaderEvent, ObjectReaderEvent) igstkEventMacro(MeshReadingErrorEvent
Event type.
::itk::GroupSpatialObject< TDimension > GroupSpatialObjectType