1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
31 #include "vtkRenderWindow.h"
32 #include <vtkVolumeRayCastMapper.h>
33 #include "vtkImageActor.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>
51 #include "wxMPRBaseData.h"
52 #include "wxVtkBaseView.h"
54 //----------------------------------------------------------------------------
57 #define VTKMPRDATA_MAXTISSUE 4
60 //------------------------------------------------------------------
61 //------------------------------------------------------------------
62 //------------------------------------------------------------------
64 // Callback for the interaction
65 class boxVolumeObserver : public vtkCommand{
67 vtkRenderWindow *_renWin;
68 vtkVolumeRayCastMapper *_volumeMapper;
70 boxVolumeObserver() { }
72 virtual char const *GetClassName() const { return "boxVolumeObserver";}
74 static boxVolumeObserver *New(){
75 boxVolumeObserver * result;
76 result = new boxVolumeObserver();
80 virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
81 void SetRenWin( vtkRenderWindow *renWin );
82 void SetVolumeMapper(vtkVolumeRayCastMapper *volumeMapper);
85 //------------------------------------------------------------------
86 //------------------------------------------------------------------
87 //------------------------------------------------------------------
89 // Callback for the interaction
90 class boxSurfaceObserver : public vtkCommand{
95 boxSurfaceObserver() { }
97 virtual char const *GetClassName() const { return "boxSurfaceObserver";}
99 static boxSurfaceObserver *New(){
100 boxSurfaceObserver * result;
101 result = new boxSurfaceObserver();
105 virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
106 void SetPlanes(vtkPlanes *planes);
107 void SetActor(vtkActor *actor);
112 //------------------------------------------------------------------
113 //------------------------------------------------------------------
114 //------------------------------------------------------------------
116 class vtkMPR3DData : public vtkMPRBaseData{
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);
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();
138 bool _visiblePosition[3];
139 wxColour *_colour[ VTKMPRDATA_MAXTISSUE ];
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 ];
150 vtkOutlineFilter *_outlineData;
151 vtkPolyDataMapper *_mapOutline;
155 vtkPiecewiseFunction *_tfun;
156 vtkColorTransferFunction *_ctfun;
157 vtkVolumeRayCastCompositeFunction *_compositeFunction;
158 vtkVolumeRayCastMapper *_volumeMapper;
159 vtkVolumeProperty *_volumeProperty;
164 //------------------------------------------------------------------
165 //------------------------------------------------------------------
166 //------------------------------------------------------------------
169 class wxVtkMPR3DView: public wxVtk3DBaseView, public vtkMPRBaseView{
171 wxVtkMPR3DView( wxWindow *parent );
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();
183 bool _visibleTissue[VTKMPRDATA_MAXTISSUE];
185 vtkActor *_tissue[VTKMPRDATA_MAXTISSUE];
187 boxVolumeObserver *_observerV;
188 vtkBoxWidget *_boxWidget;
189 boxSurfaceObserver *_observerS1;
190 vtkBoxWidget *_boxWidgetS1;
195 //------------------------------------------------------------------
196 //------------------------------------------------------------------
197 //------------------------------------------------------------------
199 class wxSurfaceMPR: public wxFrame{
202 wxSurfaceMPR(wxWindow *parent, vtkImageData *imagedata, const wxString& title);
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);
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);
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);
245 wxCheckBox *_chk1_box1;
246 wxCheckBox *_chk2_box1;
247 wxCheckBox *_chk3_box1;
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;
278 wxStaticText *_text_A;
279 wxStaticText *_text_B;
280 wxStaticText *_text_C;
281 wxStaticText *_text_D;
286 wxCheckBox *_chk_box3;
287 wxCheckBox *_chk_box33;
297 wxCheckBox *_chk_box4;
300 vtkMPR3DData *_vtkmpr3Ddata;
301 wxVtkMPR3DView *_vtkmprview[4];
303 wxPanel* CreateControlPanel(wxWindow *parent);
304 wxPanel* CreateMPRPanel(wxWindow *parent,vtkMPR3DData *vtkmpr3Ddata);
308 #endif // SURFACE_MPR_H