]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Extensions/IO/WaveFrontOBJReader.h
"Extesions" code reorganized
[cpPlugins.git] / lib / cpPlugins / Extensions / IO / WaveFrontOBJReader.h
1 #ifndef __CPPLUGINS__EXTENSIONS__IO__WAVEFRONTOBJREADER__H__
2 #define __CPPLUGINS__EXTENSIONS__IO__WAVEFRONTOBJREADER__H__
3
4 #include <string>
5 #include <itkIntTypes.h>
6 #include <itkMesh.h>
7 #include <itkMeshSource.h>
8 #include <itkPolygonCell.h>
9
10 namespace cpPlugins
11 {
12   namespace Extensions
13   {
14     namespace IO
15     {
16       /**
17        * \class WaveFrontOBJReader
18        * \brief
19        * Reads a wavefront OBJ file and create an itkMesh.
20        *
21        * Caveat1: itkWaveFrontOBJReader will read only vertices and faces.
22        *          Normal, parameters and textures vectors are ignored.
23        *
24        */
25       template< typename M >
26       class WaveFrontOBJReader
27         : public itk::MeshSource< M >
28       {
29       public:
30         typedef WaveFrontOBJReader              Self;
31         typedef itk::MeshSource< M >            Superclass;
32         typedef itk::SmartPointer< Self >       Pointer;
33         typedef itk::SmartPointer< const Self > ConstPointer;
34
35         typedef M                                    MeshType;
36         typedef typename M::MeshTraits               MeshTraits;
37         typedef typename M::PointType                PointType;
38         typedef typename MeshTraits::PixelType       PixelType;
39         typedef typename M::Pointer                  MeshPointer;
40         typedef typename M::CellTraits               CellTraits;
41         typedef typename M::CellIdentifier           CellIdentifier;
42         typedef typename M::CellType                 CellType;
43         typedef typename M::CellAutoPointer          CellAutoPointer;
44         typedef typename M::PointIdentifier          PointIdentifier;
45         typedef typename CellTraits::PointIdIterator PointIdIterator;
46         typedef typename M::PointsContainerPointer   PointsContainerPointer;
47         typedef typename M::PointsContainer          PointsContainer;
48
49         typedef itk::PolygonCell< CellType > TPolygonCell;
50
51       public:
52         itkNewMacro( Self );
53         itkTypeMacro( WaveFrontOBJReader, itkMeshSource );
54
55         itkSetStringMacro( FileName );
56         itkGetStringMacro( FileName );
57
58       protected:
59         WaveFrontOBJReader( );
60         virtual ~WaveFrontOBJReader( );
61
62         virtual void GenerateData( );
63
64       private:
65         // Purposely not implemented
66         WaveFrontOBJReader( const Self& );
67         Self& operator=( const Self & );
68
69       protected:
70         std::string m_FileName;
71       };
72
73     } // ecapseman
74
75   } // ecapseman
76
77 } // ecapseman
78
79 #include <cpPlugins/Extensions/IO/WaveFrontOBJReader.hxx>
80
81 #endif // __CPPLUGINS__EXTENSIONS__IO__WAVEFRONTOBJREADER__H__
82
83 // eof - $RCSfile$