]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/VTK/Image/Observer3D.h
ce3c053c8494c3b5724b19652f0391f3dd728dc8
[FrontAlgorithms.git] / lib / fpa / VTK / Image / Observer3D.h
1 #ifndef __FPA__VTK__IMAGE__OBSERVER3D__H__
2 #define __FPA__VTK__IMAGE__OBSERVER3D__H__
3
4 #include <map>
5
6 #include <itkCommand.h>
7
8 #include <vtkActor.h>
9 #include <vtkPolyData.h>
10 #include <vtkPolyDataMapper.h>
11 #include <vtkSmartPointer.h>
12
13 namespace fpa
14 {
15   namespace VTK
16   {
17     namespace Image
18     {
19       /**
20        */
21       template< class F, class R >
22       class Observer3D
23         : public itk::Command
24       {
25       public:
26         typedef Observer3D                      Self;
27         typedef itk::Command                    Superclass;
28         typedef itk::SmartPointer< Self >       Pointer;
29         typedef itk::SmartPointer< const Self > ConstPointer;
30
31         typedef F                                TFilter;
32         typedef R                                TRenderWindow;
33         typedef typename TFilter::TInputImage    TImage;
34         typedef typename TFilter::TVertex        TVertex;
35         typedef typename TFilter::TVertexCompare TVertexCompare;
36
37         typedef std::set< TVertex > TVertices;
38
39       public:
40         itkNewMacro( Self );
41         itkTypeMacro( Observer3D, itkCommand );
42
43         itkGetConstMacro( RenderPercentage, double );
44         itkSetMacro( RenderPercentage, double );
45
46       public:
47         void SetRenderWindow( R* rw );
48         void Render( );
49         void Execute( itk::Object* c, const itk::EventObject& e ) ITK_OVERRIDE
50           { this->Execute( ( const itk::Object* )( c ), e ); }
51         void Execute( const itk::Object* c, const itk::EventObject& e ) ITK_OVERRIDE;
52
53       protected:
54         Observer3D( );
55         virtual ~Observer3D( );
56
57       private:
58         Observer3D( const Self& );     // Not impl.
59         void operator=( const Self& ); // Not impl.
60
61       protected:
62         vtkSmartPointer< vtkPolyData >       m_PolyData;
63         vtkSmartPointer< vtkPolyDataMapper > m_PolyDataMapper;
64         vtkSmartPointer< vtkActor >          m_PolyDataActor;
65         std::map< TVertex, unsigned long, TVertexCompare >   m_PointsToReplace;
66         std::map< TVertex, unsigned long, TVertexCompare >   m_PointsInFront;
67
68         R*            m_RenderWindow;
69         unsigned long m_Count;
70         unsigned long m_RenderCount;
71         double        m_RenderPercentage;
72       };
73
74     } // ecapseman
75
76   } // ecapseman
77
78 } // ecapseman
79
80 #ifndef ITK_MANUAL_INSTANTIATION
81 #include <fpa/VTK/Observer3D.hxx>
82 #endif // ITK_MANUAL_INSTANTIATION
83
84 #endif // __FPA__VTK__IMAGE__OBSERVER3D__H__
85
86 // eof - $RCSfile$