]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/include/wxSurfaceMPR.h
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / include / wxSurfaceMPR.h
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26
27 /*
28 #ifndef SURFACE_MPR_H
29 #define SURFACE_MPR_H
30
31 #include "vtkRenderWindow.h"
32 #include <vtkVolumeRayCastMapper.h>
33 #include "vtkImageActor.h"
34 #include "vtkActor.h"
35 #include "vtkPolyDataMapper.h"
36 #include "vtkStripper.h"
37 #include <vtkGlyph3D.h>
38 #include "vtkLODActor.h"
39 #include "vtkContourFilter.h"
40 #include "vtkPolyDataNormals.h"
41 #include <vtkClipPolyData.h>
42 #include "vtkOutlineFilter.h"
43 #include <vtkPiecewiseFunction.h>
44 #include <vtkColorTransferFunction.h>
45 #include <vtkVolume.h>
46 #include <vtkVolumeProperty.h>
47 #include <vtkVolumeRayCastMapper.h>
48 #include <vtkVolumeRayCastCompositeFunction.h>
49 #include <vtkBoxWidget.h>
50
51 #include "wxMPRBaseData.h"
52 #include "wxVtkBaseView.h"
53
54 //----------------------------------------------------------------------------
55
56
57 #define VTKMPRDATA_MAXTISSUE 4
58
59
60 //------------------------------------------------------------------
61 //------------------------------------------------------------------
62 //------------------------------------------------------------------
63
64 // Callback for the interaction
65 class boxVolumeObserver : public vtkCommand{
66         public:
67                 vtkRenderWindow                 *_renWin;
68                 vtkVolumeRayCastMapper  *_volumeMapper;
69
70                 boxVolumeObserver() {  }
71
72                 virtual char const *GetClassName() const { return "boxVolumeObserver";}
73
74                 static boxVolumeObserver *New(){
75                                 boxVolumeObserver * result;
76                                 result = new boxVolumeObserver();
77                         return result;
78                 }
79
80                 virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
81                 void SetRenWin( vtkRenderWindow *renWin );
82                 void SetVolumeMapper(vtkVolumeRayCastMapper *volumeMapper);
83 };
84
85 //------------------------------------------------------------------
86 //------------------------------------------------------------------
87 //------------------------------------------------------------------
88
89 // Callback for the interaction
90 class boxSurfaceObserver : public vtkCommand{
91         public:
92                 vtkPlanes                       *_planes;
93                 vtkActor                        *_actor;
94
95                 boxSurfaceObserver() {  }
96
97                 virtual char const *GetClassName() const { return "boxSurfaceObserver";}
98
99                 static boxSurfaceObserver *New(){
100                                 boxSurfaceObserver * result;
101                                 result = new boxSurfaceObserver();
102                         return result;
103                 }
104
105                 virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
106                 void SetPlanes(vtkPlanes *planes);
107                 void SetActor(vtkActor *actor);
108 };
109
110
111
112 //------------------------------------------------------------------
113 //------------------------------------------------------------------
114 //------------------------------------------------------------------
115
116 class vtkMPR3DData : public vtkMPRBaseData{
117 public:
118         vtkMPR3DData();
119         ~vtkMPR3DData();
120         vtkImageActor*                  GetImageActor(int id);
121         vtkActor*                               GetOutlineActor();
122         vtkPolyDataMapper*              GetTissueMapper(int id);
123         vtkPlanes*                              GetTissuePlanes(int id);
124         vtkStripper*                    GetTissueStripper(int id);
125         vtkGlyph3D*                             GetGlyph(int id);
126         vtkLODActor*                    GetMaceActor(int id);
127
128         virtual void                    Configure();
129         void                                    SetIsovalue(int idTissue, int isoValue);
130         wxColour*                               GetColour(int idColour);
131         void                                    SetVisiblePosition(int idPosition, bool visible);
132         bool                                    GetVisiblePosition(int idPosition);
133         vtkVolume*                              GetVolumeActor();
134         vtkVolumeRayCastMapper  *GetVolumeMapper();
135
136 private:
137         
138         bool                                                            _visiblePosition[3];
139         wxColour                                                        *_colour[ VTKMPRDATA_MAXTISSUE ];
140
141     // tissue
142         vtkContourFilter                                        *_tissueExtractor[ VTKMPRDATA_MAXTISSUE ];
143         vtkPolyDataNormals                                      *_tissueNormals[ VTKMPRDATA_MAXTISSUE ];
144         vtkStripper                                                     *_tissueStripper[ VTKMPRDATA_MAXTISSUE ];
145         vtkPolyDataMapper                                       *_tissueMapper[ VTKMPRDATA_MAXTISSUE ];
146         vtkPlanes                                                       *_tissuePlanes[ VTKMPRDATA_MAXTISSUE ];
147         vtkClipPolyData                                         *_tissueClipper[ VTKMPRDATA_MAXTISSUE ];
148
149         // outline
150         vtkOutlineFilter                                        *_outlineData;
151         vtkPolyDataMapper                                       *_mapOutline;
152         vtkActor                                                        *_outline;
153
154         /// Volume
155         vtkPiecewiseFunction                            *_tfun;
156         vtkColorTransferFunction                        *_ctfun;
157         vtkVolumeRayCastCompositeFunction       *_compositeFunction;
158         vtkVolumeRayCastMapper                          *_volumeMapper;
159         vtkVolumeProperty                                       *_volumeProperty;
160         vtkVolume                                                       *_newvol;
161 };
162
163
164 //------------------------------------------------------------------
165 //------------------------------------------------------------------
166 //------------------------------------------------------------------
167
168
169 class wxVtkMPR3DView: public wxVtk3DBaseView, public vtkMPRBaseView{
170 public:
171         wxVtkMPR3DView( wxWindow *parent );
172         ~wxVtkMPR3DView();
173         void            SetVtkMPRData(vtkMPR3DData *tmp_vtkmpr3Ddata);
174         vtkActor*       GetTissueActor(int id);
175         void            VisibleActor(int idTissue, bool visTissue, bool visGuide);
176         void            VisibleImageActor(int idPosition, bool visible);
177         void            VisibleVolumeActor( bool visVolume,bool visGuide);
178         void            SetVisibleTissue(int idTissue, bool visible);
179         bool            GetVisibleTissue(int idTissue);
180         virtual void Configure();
181
182 private:
183         bool                            _visibleTissue[VTKMPRDATA_MAXTISSUE];
184         bool                            _visibleVolume;
185         vtkActor                        *_tissue[VTKMPRDATA_MAXTISSUE];
186         //volume
187         boxVolumeObserver       *_observerV;
188         vtkBoxWidget            *_boxWidget;
189         boxSurfaceObserver      *_observerS1;
190         vtkBoxWidget            *_boxWidgetS1;
191
192 protected:
193 };
194
195 //------------------------------------------------------------------
196 //------------------------------------------------------------------
197 //------------------------------------------------------------------
198
199 class wxSurfaceMPR: public wxFrame{
200         public:
201
202         wxSurfaceMPR(wxWindow *parent,  vtkImageData *imagedata, const wxString& title);
203         void ConfigureVTK();
204         void OnPositionX(wxScrollEvent& event);
205         void OnPositionY(wxScrollEvent& event);
206         void OnPositionZ(wxScrollEvent& event);
207         void VisibleActor(int idView, int idTissue, bool visTissue, bool visGuide);
208         void VisibleImageActor(int idView, int idTissue, bool visible);
209         void VisibleVolumeActor(int idView, bool visVolume, bool visGuide);
210
211         void OnVisibleX(wxCommandEvent& event);
212         void OnVisibleY(wxCommandEvent& event);
213         void OnVisibleZ(wxCommandEvent& event);
214         void OnVisibleTissueA(wxCommandEvent& event);
215         void OnVisibleTissueB(wxCommandEvent& event);
216         void OnVisibleTissueC(wxCommandEvent& event);
217         void OnVisibleTissueD(wxCommandEvent& event);
218         void OnVisibleVolume(wxCommandEvent& event);
219
220         void OpacityTissue(int idView, int idTissue, int opacity);
221         void OnOpacity0(wxScrollEvent& event);
222         void OnOpacity1(wxScrollEvent& event);
223         void OnOpacity2(wxScrollEvent& event);
224         void OnOpacity3(wxScrollEvent& event);
225         void OnIsoValue0(wxScrollEvent& event);
226         void OnIsoValue1(wxScrollEvent& event);
227         void OnIsoValue2(wxScrollEvent& event);
228         void OnIsoValue3(wxScrollEvent& event);
229         void OnIsoValue_0(wxScrollEvent& event);
230         void OnIsoValue_1(wxScrollEvent& event);
231         void OnIsoValue_2(wxScrollEvent& event);
232         void OnIsoValue_3(wxScrollEvent& event);
233         void OnBtnColourA(wxCommandEvent& event);
234         void OnBtnColourB(wxCommandEvent& event);
235         void OnBtnColourC(wxCommandEvent& event);
236         void OnBtnColourD(wxCommandEvent& event);
237
238         void Refresh();
239
240         private:
241
242         wxSlider        *_sl1_box1;
243         wxSlider        *_sl2_box1;
244         wxSlider        *_sl3_box1;
245         wxCheckBox      *_chk1_box1;
246         wxCheckBox      *_chk2_box1;
247         wxCheckBox      *_chk3_box1;
248
249         wxButton        *_btnA;
250         wxButton        *_btnB;
251         wxButton        *_btnC;
252         wxButton        *_btnD;
253         wxSlider        *_slA1_box2;
254         wxSlider        *_slA2_box2;
255         wxSlider        *_slA3_box2;
256         wxSlider        *_slB1_box2;
257         wxSlider        *_slB2_box2;
258         wxSlider        *_slB3_box2;
259         wxSlider        *_slC1_box2;
260         wxSlider        *_slC2_box2;
261         wxSlider        *_slC3_box2;
262         wxSlider        *_slD1_box2;
263         wxSlider        *_slD2_box2;
264         wxSlider        *_slD3_box2;
265         wxCheckBox      *_chkA_box2;
266         wxCheckBox      *_chkB_box2;
267         wxCheckBox      *_chkC_box2;
268         wxCheckBox      *_chkD_box2;
269         wxCheckBox      *_chkAA_box2;
270         wxCheckBox      *_chkBB_box2;
271         wxCheckBox      *_chkCC_box2;
272         wxCheckBox      *_chkDD_box2;
273         wxCheckBox      *_chkViewA_box2;
274         wxCheckBox      *_chkViewB_box2;
275         wxCheckBox      *_chkViewC_box2;
276         wxCheckBox      *_chkViewD_box2;
277         
278         wxStaticText *_text_A;
279         wxStaticText *_text_B;
280         wxStaticText *_text_C;
281         wxStaticText *_text_D;
282
283         wxSlider        *_sl1_box3;
284         wxSlider        *_sl2_box3;
285         wxSlider        *_sl3_box3;
286         wxCheckBox      *_chk_box3;
287         wxCheckBox      *_chk_box33;
288
289         wxSlider        *_slA_box4;
290         wxSlider        *_slB_box4;
291         wxSlider        *_sl1_box4;
292         wxSlider        *_sl2_box4;
293         wxSlider        *_sl3_box4;
294         wxSlider        *_sl4_box4;
295         wxSlider        *_sl5_box4;
296         wxSlider        *_sl6_box4;
297         wxCheckBox      *_chk_box4;
298
299
300         vtkMPR3DData    *_vtkmpr3Ddata;
301         wxVtkMPR3DView  *_vtkmprview[4];
302
303         wxPanel* CreateControlPanel(wxWindow *parent);
304         wxPanel* CreateMPRPanel(wxWindow *parent,vtkMPR3DData *vtkmpr3Ddata);
305
306 };
307
308 #endif // SURFACE_MPR_H
309
310
311
312 */