IGSTK
igstkSpatialObjectReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkSpatialObjectReader.h,v $
5  Language: C++
6  Date: $Date: 2008-11-17 20:12:26 $
7  Version: $Revision: 1.17 $
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 
18 #ifndef __igstkSpatialObjectReader_h
19 #define __igstkSpatialObjectReader_h
20 
21 #include "igstkMacros.h"
22 
23 #include "itkSpatialObjectReader.h"
24 #include "igstkObject.h"
25 #include "igstkStateMachine.h"
26 #include "igstkEvents.h"
27 #include "itkDefaultDynamicMeshTraits.h"
28 
29 namespace igstk
30 {
31 
49 template <unsigned int TDimension = 3,
50  typename TPixelType = unsigned char>
52 {
53 
54 public:
55 
58 
59 public:
60 
61  itkStaticConstMacro(ObjectDimension, unsigned int, TDimension);
62 
64  typedef TPixelType PixelType;
65  typedef ::itk::DefaultDynamicMeshTraits< TPixelType ,
66  TDimension,
67  TDimension> MeshTraitsType;
68 
69  typedef ::itk::SpatialObjectReader< TDimension,
70  TPixelType,
72 
73  typedef ::itk::SpatialObject<TDimension> SpatialObjectType;
74  typedef ::itk::GroupSpatialObject<TDimension> GroupSpatialObjectType;
75 
77  typedef std::string FileNameType;
78 
80  void RequestSetFileName( const FileNameType & filename );
81 
83  void RequestReadObject();
84 
89  void RequestGetOutput();
90 
91  igstkEventMacro( ObjectReaderEvent, IGSTKEvent );
92  igstkEventMacro( ObjectReadingErrorEvent, IGSTKErrorEvent );
93  igstkEventMacro( ObjectReadingSuccessEvent, ObjectReaderEvent );
94  igstkEventMacro( ObjectInvalidRequestErrorEvent, ObjectReadingErrorEvent );
95 
96 protected:
97 
98  SpatialObjectReader( void );
99  virtual ~SpatialObjectReader( void );
100 
102  void PrintSelf( std::ostream& os, ::itk::Indent indent ) const;
103 
104  /* Internal itkObjectFileReader */
105  typename SpatialObjectReaderType::Pointer m_SpatialObjectReader;
106  std::string m_FileNameToBeSet;
107  std::string m_FileName;
108 
109  virtual void AttemptReadObjectProcessing();
110 
111  virtual void ReportObjectProcessing();
112 
113 private:
114 
115  SpatialObjectReader(const Self&); //purposely not implemented
116  void operator=(const Self&); //purposely not implemented
117 
119  igstkDeclareStateMacro( Idle );
120  igstkDeclareStateMacro( ObjectFileNameRead );
121  igstkDeclareStateMacro( ObjectRead );
122  igstkDeclareStateMacro( ObjectAttemptingRead );
123 
125  igstkDeclareInputMacro( ReadObjectRequest );
126  igstkDeclareInputMacro( ObjectFileNameValid );
127  igstkDeclareInputMacro( ObjectFileNameIsEmpty );
128  igstkDeclareInputMacro( ObjectFileNameIsDirectory );
129  igstkDeclareInputMacro( ObjectFileNameDoesNotExist );
130  igstkDeclareInputMacro( GetOutput );
131 
133  igstkDeclareInputMacro( ObjectReadingError );
134  igstkDeclareInputMacro( ObjectReadingSuccess );
135 
137  void SetFileNameProcessing();
138 
142  void ReportInvalidRequestProcessing();
143 
146  void ReportObjectReadingErrorProcessing();
147 
150  void ReportObjectReadingSuccessProcessing();
151 
152 
153 };
154 
155 } // end namespace igstk
156 
157 #ifndef IGSTK_MANUAL_INSTANTIATION
158 #include "igstkSpatialObjectReader.txx"
159 #endif
160 
161 #endif // __igstkSpatialObjectReader_h
void RequestGetOutput()
This method will invoke a event from derived reader class, such as: MeshModifiedEvent for igstkMeshRe...
::itk::SpatialObject< TDimension > SpatialObjectType
::itk::SpatialObjectReader< TDimension, TPixelType, MeshTraitsType > SpatialObjectReaderType
#define igstkStandardTemplatedClassTraitsMacro(classname, superclassname)
Convenience macro for the traits of a templated class.
Definition: igstkMacros.h:286
virtual void AttemptReadObjectProcessing()
This class reads spatial object data stored in files.
Base class for all the IGSTK classes.
Definition: igstkObject.h:40
SpatialObjectReaderType::Pointer m_SpatialObjectReader
void RequestSetFileName(const FileNameType &filename)
Method to pass the directory name containing the spatial object data.
defines standard system-wide macros, constants, and other common parameters in the IGSTK Library...
std::string FileNameType
Type for representing the string of the filename.
virtual ~SpatialObjectReader(void)
TPixelType PixelType
Some convenient typedefs for input Object.
::itk::DefaultDynamicMeshTraits< TPixelType, TDimension, TDimension > MeshTraitsType
virtual void ReportObjectProcessing()
igstkEventMacro(ObjectReaderEvent, IGSTKEvent)
void RequestReadObject()
This method request Object read.
void PrintSelf(std::ostream &os,::itk::Indent indent) const
Print the object information in a stream.
itkStaticConstMacro(ObjectDimension, unsigned int, TDimension)
Macro with standard traits declarations.
::itk::GroupSpatialObject< TDimension > GroupSpatialObjectType