]> 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 <vtkImageData.h>
10 #include <vtkPolyData.h>
11 #include <vtkPolyDataMapper.h>
12 #include <vtkSmartPointer.h>
13
14 namespace fpa
15 {
16   namespace VTK
17   {
18     /**
19      */
20     template< class F, class R >
21     class Image3DObserver
22       : public itk::Command
23     {
24     public:
25       typedef Image3DObserver                 Self;
26       typedef itk::Command                    Superclass;
27       typedef itk::SmartPointer< Self >       Pointer;
28       typedef itk::SmartPointer< const Self > ConstPointer;
29
30       typedef F                             TFilter;
31       typedef R                             TRenderWindow;
32       typedef typename TFilter::TInputImage TImage;
33       typedef typename TFilter::TVertex     TVertex;
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 SetPixel(
47         typename TImage::IndexType idx,
48         unsigned char red,
49         unsigned char green,
50         unsigned char blue,
51         unsigned char alpha
52         );
53       void Render( );
54       void Execute( itk::Object* c, const itk::EventObject& e )
55         { this->Execute( ( const itk::Object* )( c ), e ); }
56       void Execute( const itk::Object* c, const itk::EventObject& e );
57
58     protected:
59       Image3DObserver( );
60       virtual ~Image3DObserver( );
61
62     private:
63       Image3DObserver( const Self& ); // Not impl.
64       void operator=( const Self& );  // Not impl.
65
66     protected:
67       vtkSmartPointer< vtkImageData >      m_Stencil;
68       vtkSmartPointer< vtkPolyData >       m_PolyData;
69       vtkSmartPointer< vtkPolyDataMapper > m_PolyDataMapper;
70       vtkSmartPointer< vtkActor >          m_PolyDataActor;
71
72       R*            m_RenderWindow;
73       unsigned long m_Count;
74       unsigned long m_RenderCount;
75       double        m_RenderPercentage;
76     };
77
78     /**
79      */
80     /*
81     template< class F, class R >
82     class Image3DObserver
83       : public itk::Command
84     {
85     public:
86       typedef Image3DObserver                 Self;
87       typedef itk::Command                    Superclass;
88       typedef itk::SmartPointer< Self >       Pointer;
89       typedef itk::SmartPointer< const Self > ConstPointer;
90
91       typedef F TFilter;
92       typedef R TRenderWindow;
93
94     public:
95       itkNewMacro( Self );
96       itkTypeMacro( Image3DObserver, itkCommand );
97
98       itkGetConstMacro( RenderPercentage, double );
99       itkSetMacro( RenderPercentage, double );
100
101     public:
102       void SetRenderWindow( R* rw );
103       void Execute( itk::Object* c, const itk::EventObject& e )
104         { this->Execute( ( const itk::Object* )( c ), e ); }
105       void Execute( const itk::Object* c, const itk::EventObject& e );
106
107     protected:
108       Image3DObserver( );
109       virtual ~Image3DObserver( )
110         { }
111
112     private:
113       Image3DObserver( const Self& ); // Not impl.
114       void operator=( const Self& );  // Not impl.
115
116     protected:
117       R*            m_RenderWindow;
118       unsigned long m_Count;
119       unsigned long m_RenderCount;
120       double        m_RenderPercentage;
121
122       vtkSmartPointer< vtkPolyData >       m_Data;
123       vtkSmartPointer< vtkPolyDataMapper > m_Mapper;
124       vtkSmartPointer< vtkActor >          m_Actor;
125     };
126     */
127
128   } // ecapseman
129
130 } // ecapseman
131
132 #include <fpa/VTK/Image3DObserver.hxx>
133
134 #endif // __FPA__VTK__IMAGE3DOBSERVER__H__
135
136 // eof - $RCSfile$