]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/include/wxSurfaceMPR.h
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / include / wxSurfaceMPR.h
1
2 /*
3 #ifndef SURFACE_MPR_H
4 #define SURFACE_MPR_H
5
6 #include "vtkRenderWindow.h"
7 #include <vtkVolumeRayCastMapper.h>
8 #include "vtkImageActor.h"
9 #include "vtkActor.h"
10 #include "vtkPolyDataMapper.h"
11 #include "vtkStripper.h"
12 #include <vtkGlyph3D.h>
13 #include "vtkLODActor.h"
14 #include "vtkContourFilter.h"
15 #include "vtkPolyDataNormals.h"
16 #include <vtkClipPolyData.h>
17 #include "vtkOutlineFilter.h"
18 #include <vtkPiecewiseFunction.h>
19 #include <vtkColorTransferFunction.h>
20 #include <vtkVolume.h>
21 #include <vtkVolumeProperty.h>
22 #include <vtkVolumeRayCastMapper.h>
23 #include <vtkVolumeRayCastCompositeFunction.h>
24 #include <vtkBoxWidget.h>
25
26 #include "wxMPRBaseData.h"
27 #include "wxVtkBaseView.h"
28
29 //----------------------------------------------------------------------------
30
31
32 #define VTKMPRDATA_MAXTISSUE 4
33
34
35 //------------------------------------------------------------------
36 //------------------------------------------------------------------
37 //------------------------------------------------------------------
38
39 // Callback for the interaction
40 class boxVolumeObserver : public vtkCommand{
41         public:
42                 vtkRenderWindow                 *_renWin;
43                 vtkVolumeRayCastMapper  *_volumeMapper;
44
45                 boxVolumeObserver() {  }
46
47                 virtual char const *GetClassName() const { return "boxVolumeObserver";}
48
49                 static boxVolumeObserver *New(){
50                                 boxVolumeObserver * result;
51                                 result = new boxVolumeObserver();
52                         return result;
53                 }
54
55                 virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
56                 void SetRenWin( vtkRenderWindow *renWin );
57                 void SetVolumeMapper(vtkVolumeRayCastMapper *volumeMapper);
58 };
59
60 //------------------------------------------------------------------
61 //------------------------------------------------------------------
62 //------------------------------------------------------------------
63
64 // Callback for the interaction
65 class boxSurfaceObserver : public vtkCommand{
66         public:
67                 vtkPlanes                       *_planes;
68                 vtkActor                        *_actor;
69
70                 boxSurfaceObserver() {  }
71
72                 virtual char const *GetClassName() const { return "boxSurfaceObserver";}
73
74                 static boxSurfaceObserver *New(){
75                                 boxSurfaceObserver * result;
76                                 result = new boxSurfaceObserver();
77                         return result;
78                 }
79
80                 virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
81                 void SetPlanes(vtkPlanes *planes);
82                 void SetActor(vtkActor *actor);
83 };
84
85
86
87 //------------------------------------------------------------------
88 //------------------------------------------------------------------
89 //------------------------------------------------------------------
90
91 class vtkMPR3DData : public vtkMPRBaseData{
92 public:
93         vtkMPR3DData();
94         ~vtkMPR3DData();
95         vtkImageActor*                  GetImageActor(int id);
96         vtkActor*                               GetOutlineActor();
97         vtkPolyDataMapper*              GetTissueMapper(int id);
98         vtkPlanes*                              GetTissuePlanes(int id);
99         vtkStripper*                    GetTissueStripper(int id);
100         vtkGlyph3D*                             GetGlyph(int id);
101         vtkLODActor*                    GetMaceActor(int id);
102
103         virtual void                    Configure();
104         void                                    SetIsovalue(int idTissue, int isoValue);
105         wxColour*                               GetColour(int idColour);
106         void                                    SetVisiblePosition(int idPosition, bool visible);
107         bool                                    GetVisiblePosition(int idPosition);
108         vtkVolume*                              GetVolumeActor();
109         vtkVolumeRayCastMapper  *GetVolumeMapper();
110
111 private:
112         
113         bool                                                            _visiblePosition[3];
114         wxColour                                                        *_colour[ VTKMPRDATA_MAXTISSUE ];
115
116     // tissue
117         vtkContourFilter                                        *_tissueExtractor[ VTKMPRDATA_MAXTISSUE ];
118         vtkPolyDataNormals                                      *_tissueNormals[ VTKMPRDATA_MAXTISSUE ];
119         vtkStripper                                                     *_tissueStripper[ VTKMPRDATA_MAXTISSUE ];
120         vtkPolyDataMapper                                       *_tissueMapper[ VTKMPRDATA_MAXTISSUE ];
121         vtkPlanes                                                       *_tissuePlanes[ VTKMPRDATA_MAXTISSUE ];
122         vtkClipPolyData                                         *_tissueClipper[ VTKMPRDATA_MAXTISSUE ];
123
124         // outline
125         vtkOutlineFilter                                        *_outlineData;
126         vtkPolyDataMapper                                       *_mapOutline;
127         vtkActor                                                        *_outline;
128
129         /// Volume
130         vtkPiecewiseFunction                            *_tfun;
131         vtkColorTransferFunction                        *_ctfun;
132         vtkVolumeRayCastCompositeFunction       *_compositeFunction;
133         vtkVolumeRayCastMapper                          *_volumeMapper;
134         vtkVolumeProperty                                       *_volumeProperty;
135         vtkVolume                                                       *_newvol;
136 };
137
138
139 //------------------------------------------------------------------
140 //------------------------------------------------------------------
141 //------------------------------------------------------------------
142
143
144 class wxVtkMPR3DView: public wxVtk3DBaseView, public vtkMPRBaseView{
145 public:
146         wxVtkMPR3DView( wxWindow *parent );
147         ~wxVtkMPR3DView();
148         void            SetVtkMPRData(vtkMPR3DData *tmp_vtkmpr3Ddata);
149         vtkActor*       GetTissueActor(int id);
150         void            VisibleActor(int idTissue, bool visTissue, bool visGuide);
151         void            VisibleImageActor(int idPosition, bool visible);
152         void            VisibleVolumeActor( bool visVolume,bool visGuide);
153         void            SetVisibleTissue(int idTissue, bool visible);
154         bool            GetVisibleTissue(int idTissue);
155         virtual void Configure();
156
157 private:
158         bool                            _visibleTissue[VTKMPRDATA_MAXTISSUE];
159         bool                            _visibleVolume;
160         vtkActor                        *_tissue[VTKMPRDATA_MAXTISSUE];
161         //volume
162         boxVolumeObserver       *_observerV;
163         vtkBoxWidget            *_boxWidget;
164         boxSurfaceObserver      *_observerS1;
165         vtkBoxWidget            *_boxWidgetS1;
166
167 protected:
168 };
169
170 //------------------------------------------------------------------
171 //------------------------------------------------------------------
172 //------------------------------------------------------------------
173
174 class wxSurfaceMPR: public wxFrame{
175         public:
176
177         wxSurfaceMPR(wxWindow *parent,  vtkImageData *imagedata, const wxString& title);
178         void ConfigureVTK();
179         void OnPositionX(wxScrollEvent& event);
180         void OnPositionY(wxScrollEvent& event);
181         void OnPositionZ(wxScrollEvent& event);
182         void VisibleActor(int idView, int idTissue, bool visTissue, bool visGuide);
183         void VisibleImageActor(int idView, int idTissue, bool visible);
184         void VisibleVolumeActor(int idView, bool visVolume, bool visGuide);
185
186         void OnVisibleX(wxCommandEvent& event);
187         void OnVisibleY(wxCommandEvent& event);
188         void OnVisibleZ(wxCommandEvent& event);
189         void OnVisibleTissueA(wxCommandEvent& event);
190         void OnVisibleTissueB(wxCommandEvent& event);
191         void OnVisibleTissueC(wxCommandEvent& event);
192         void OnVisibleTissueD(wxCommandEvent& event);
193         void OnVisibleVolume(wxCommandEvent& event);
194
195         void OpacityTissue(int idView, int idTissue, int opacity);
196         void OnOpacity0(wxScrollEvent& event);
197         void OnOpacity1(wxScrollEvent& event);
198         void OnOpacity2(wxScrollEvent& event);
199         void OnOpacity3(wxScrollEvent& event);
200         void OnIsoValue0(wxScrollEvent& event);
201         void OnIsoValue1(wxScrollEvent& event);
202         void OnIsoValue2(wxScrollEvent& event);
203         void OnIsoValue3(wxScrollEvent& event);
204         void OnIsoValue_0(wxScrollEvent& event);
205         void OnIsoValue_1(wxScrollEvent& event);
206         void OnIsoValue_2(wxScrollEvent& event);
207         void OnIsoValue_3(wxScrollEvent& event);
208         void OnBtnColourA(wxCommandEvent& event);
209         void OnBtnColourB(wxCommandEvent& event);
210         void OnBtnColourC(wxCommandEvent& event);
211         void OnBtnColourD(wxCommandEvent& event);
212
213         void Refresh();
214
215         private:
216
217         wxSlider        *_sl1_box1;
218         wxSlider        *_sl2_box1;
219         wxSlider        *_sl3_box1;
220         wxCheckBox      *_chk1_box1;
221         wxCheckBox      *_chk2_box1;
222         wxCheckBox      *_chk3_box1;
223
224         wxButton        *_btnA;
225         wxButton        *_btnB;
226         wxButton        *_btnC;
227         wxButton        *_btnD;
228         wxSlider        *_slA1_box2;
229         wxSlider        *_slA2_box2;
230         wxSlider        *_slA3_box2;
231         wxSlider        *_slB1_box2;
232         wxSlider        *_slB2_box2;
233         wxSlider        *_slB3_box2;
234         wxSlider        *_slC1_box2;
235         wxSlider        *_slC2_box2;
236         wxSlider        *_slC3_box2;
237         wxSlider        *_slD1_box2;
238         wxSlider        *_slD2_box2;
239         wxSlider        *_slD3_box2;
240         wxCheckBox      *_chkA_box2;
241         wxCheckBox      *_chkB_box2;
242         wxCheckBox      *_chkC_box2;
243         wxCheckBox      *_chkD_box2;
244         wxCheckBox      *_chkAA_box2;
245         wxCheckBox      *_chkBB_box2;
246         wxCheckBox      *_chkCC_box2;
247         wxCheckBox      *_chkDD_box2;
248         wxCheckBox      *_chkViewA_box2;
249         wxCheckBox      *_chkViewB_box2;
250         wxCheckBox      *_chkViewC_box2;
251         wxCheckBox      *_chkViewD_box2;
252         
253         wxStaticText *_text_A;
254         wxStaticText *_text_B;
255         wxStaticText *_text_C;
256         wxStaticText *_text_D;
257
258         wxSlider        *_sl1_box3;
259         wxSlider        *_sl2_box3;
260         wxSlider        *_sl3_box3;
261         wxCheckBox      *_chk_box3;
262         wxCheckBox      *_chk_box33;
263
264         wxSlider        *_slA_box4;
265         wxSlider        *_slB_box4;
266         wxSlider        *_sl1_box4;
267         wxSlider        *_sl2_box4;
268         wxSlider        *_sl3_box4;
269         wxSlider        *_sl4_box4;
270         wxSlider        *_sl5_box4;
271         wxSlider        *_sl6_box4;
272         wxCheckBox      *_chk_box4;
273
274
275         vtkMPR3DData    *_vtkmpr3Ddata;
276         wxVtkMPR3DView  *_vtkmprview[4];
277
278         wxPanel* CreateControlPanel(wxWindow *parent);
279         wxPanel* CreateMPRPanel(wxWindow *parent,vtkMPR3DData *vtkmpr3Ddata);
280
281 };
282
283 #endif // SURFACE_MPR_H
284
285
286
287 */