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