3 #ifndef __WX_VTK__BASE__VIEW__H
4 #define __WX_VTK__BASE__VIEW__H
8 #include <vtkRenderer.h>
9 #include <vtkRenderWindow.h>
10 #include <vtkCamera.h>
11 #include <vtkTextActor.h>
14 #include <vtkProperty.h>
18 #include <vtkImageViewer2.h>
19 #include <vtkInteractorStyleImage.h>
21 #include "wxMPRBaseData.h"
22 #include "wxVTKRenderWindowInteractorEditContour.h"
32 //------------------------------------------------------------------
33 //------------------------------------------------------------------
34 //------------------------------------------------------------------
37 class creaMaracasVisu_EXPORT vtkImageViewer2_XYZ{
39 vtkImageViewer2_XYZ();
40 ~vtkImageViewer2_XYZ();
42 void SetExtentDimension(int x1,int x2, int y1,int y2, int z1,int z2);
43 void SetXSlice(int slice);
44 void SetYSlice(int slice);
45 void SetZSlice(int slice);
49 vtkImageViewer2 *GetVtkImageViewer2();
52 int _x1,_x2,_y1,_y2,_z1,_z2;
53 vtkImageViewer2 *_vtkimageviewer2;
59 //------------------------------------------------------------------
60 //------------------------------------------------------------------
61 //------------------------------------------------------------------
65 class creaMaracasVisu_EXPORT wxVTKRenderWindowInteractorPlus : public wxVTKRenderWindowInteractor
68 wxVTKRenderWindowInteractorPlus(wxWindow *parent ,wxVtkBaseView *_wxvtkbaseview);
69 virtual ~wxVTKRenderWindowInteractorPlus();
71 wxVTKRenderWindowInteractorPlus();
72 void OnLeftDClick( wxMouseEvent& event );
73 void OnRightDClick( wxMouseEvent& event );
74 void OnMiddleDClick( wxMouseEvent& event );
75 void OnMouseWheel( wxMouseEvent& event );
79 static wxVTKRenderWindowInteractorPlus * New();
83 wxVtkBaseView *_wxvtkbaseview;
84 DECLARE_EVENT_TABLE( );
89 //------------------------------------------------------------------
90 //------------------------------------------------------------------
91 //------------------------------------------------------------------
94 class vtkInteractorStyleBaseView;
97 class creaMaracasVisu_EXPORT wxVtkBaseView{
100 wxVtkBaseView( wxWindow *parent );
101 virtual ~wxVtkBaseView();
102 wxVTKRenderWindowInteractor *GetWxVTKRenderWindowInteractor() throw (char*);
103 virtual void Configure();
104 virtual void Refresh();
105 virtual void RefreshView();
106 virtual vtkRenderer* GetRenderer();
107 virtual vtkRenderWindow* GetRenWin();
108 virtual void TransfromeCoordScreenToWorld(double &X, double &Y, double &Z, int type=2);
109 void SetInteractorStyleBaseView( vtkInteractorStyleBaseView* interactorStyle);
110 vtkInteractorStyleBaseView* GetInteractorStyleBaseView();
111 virtual void GetSpacing(double spc[3]);
115 wxVTKRenderWindowInteractor *_iren;
116 vtkInteractorStyleBaseView *_interactorStyle;
123 //------------------------------------------------------------------
124 //------------------------------------------------------------------
125 //------------------------------------------------------------------
127 class vtkInteractorStyleBaseView;
128 class manualInteractorWindowLevel;
129 class vtkInfoTextImage;
130 class vtkInfoTextImageInteractor;
132 //------------------------------------------------------------------
135 class creaMaracasVisu_EXPORT wxVtk2DBaseView: public wxVtkBaseView{
137 wxVtk2DBaseView(wxWindow *parent);
138 virtual ~wxVtk2DBaseView();
139 virtual void Configure(bool okimage=true);
140 vtkImageViewer2_XYZ* _imageViewer2XYZ;
141 vtkBaseData* GetVtkBaseData();
142 void SetVtkBaseData(vtkBaseData *vtkbasedata);
143 virtual void Refresh();
144 virtual void ResetView();
145 virtual int GetActualSlice();
146 virtual void SetActualSlice(int slice);
147 void SetInteractorStyleImage(vtkInteractorStyleBaseView *interactorstylebaseview);
149 virtual vtkRenderer* GetRenderer();
150 virtual vtkRenderWindow* GetRenWin();
151 virtual void TransformCoordinate_spacing_ViewToModel(double &X,double &Y, double &Z);
152 virtual void TransformCoordinate_spacing_ModelToView(double &X,double &Y, double &Z);
153 virtual void GetSpacing(double spc[3]);
157 vtkBaseData *_vtkbasedata;
159 vtkInfoTextImage *_vtkIinfoTextImage;
160 vtkInfoTextImageInteractor *_vtkIinfoTextImageInteractor;
169 //------------------------------------------------------------------
170 //------------------------------------------------------------------
171 //------------------------------------------------------------------
174 //------------------------------------------------------------------
176 class creaMaracasVisu_EXPORT InteractorStyleMaracas
179 InteractorStyleMaracas();
180 virtual ~InteractorStyleMaracas();
182 virtual InteractorStyleMaracas * Clone();
183 void CopyAttributesTo( InteractorStyleMaracas *cloneObject );
186 virtual bool OnChar();
187 virtual bool OnMouseMove();
188 virtual bool OnLeftButtonDown();
189 virtual bool OnLeftButtonUp();
190 virtual bool OnMiddleButtonDown();
191 virtual bool OnMiddleButtonUp();
192 virtual bool OnRightButtonDown();
193 virtual bool OnRightButtonUp();
195 virtual bool OnLeftDClick();
196 virtual bool OnRightDClick();
197 virtual bool OnMiddleDClick();
198 virtual bool OnMouseWheel();
201 void SetVtkInteractorStyleBaseView(vtkInteractorStyleBaseView* _vtkInteractorStyleBaseView);
202 void RemoveVtkInteractorStyleBaseView();
203 void SetActive(bool active);
207 vtkInteractorStyleBaseView* _vtkInteractorStyleBaseView;
212 //------------------------------------------------------------------
213 //------------------------------------------------------------------
214 //------------------------------------------------------------------
218 class creaMaracasVisu_EXPORT manualInteractorWindowLevel : public InteractorStyleMaracas {
220 manualInteractorWindowLevel();
221 virtual ~manualInteractorWindowLevel();
224 bool _stateWindowLevel;
230 virtual bool OnMouseMove();
231 virtual bool OnMiddleButtonDown();
232 virtual bool OnMiddleButtonUp();
236 //------------------------------------------------------------------
237 //------------------------------------------------------------------
238 //------------------------------------------------------------------
240 class vtkInfoTextImage{
244 void SetWxVtk2DBaseView(wxVtk2DBaseView *wxvtk2Dbaseview);
245 void SetMarImageData(marImageData *marimagedata);
247 void PutPixelIntensity(int x, int y, int z);
248 void PutPosition(int x, int y, int z);
249 void PutColorLevel();
250 void PutWindowLevel();
256 marImageData *_marimagedata;
257 wxVtk2DBaseView *_wxvtk2Dbaseview;
258 vtkTextActor *_vtkText_WindowLevel;
259 vtkTextActor *_vtkText_ColorLevel;
260 vtkTextActor *_vtkText_position;
261 vtkTextActor *_vtkText_pixelIntensity;
263 vtkTextActor *Create_Text_Label(int px, int py);
266 //------------------------------------------------------------------
267 //------------------------------------------------------------------
268 //------------------------------------------------------------------
270 class vtkInfoTextImageInteractor : public InteractorStyleMaracas{
272 vtkInfoTextImageInteractor();
273 virtual ~vtkInfoTextImageInteractor();
274 void SetModelVtkInfoTextImage(vtkInfoTextImage *vtkinfotextimage);
275 vtkInfoTextImage *GetVtkInfoTextImage();
279 virtual bool OnMouseMove();
282 vtkInfoTextImage *_vtkinfotextimage;
285 //------------------------------------------------------------------
286 //------------------------------------------------------------------
287 //------------------------------------------------------------------
289 class vtkInteractorScrollZ : public InteractorStyleMaracas {
291 vtkInteractorScrollZ();
292 virtual ~vtkInteractorScrollZ();
294 virtual bool OnMouseMove();
295 virtual bool OnRightButtonDown();
296 virtual bool OnRightButtonUp();
315 //------------------------------------------------------------------
316 //------------------------------------------------------------------
317 //------------------------------------------------------------------
319 class wxVtk3DBaseView;
321 class creaMaracasVisu_EXPORT vtkInteractorStyleBaseView : public vtkInteractorStyleImage
324 vtkInteractorStyleBaseView();
325 ~vtkInteractorStyleBaseView();
326 static vtkInteractorStyleBaseView *New();
327 virtual void OnChar();
328 virtual void OnMouseMove();
329 virtual void OnLeftButtonDown();
330 virtual void OnLeftButtonUp();
331 virtual void OnMiddleButtonDown();
332 virtual void OnMiddleButtonUp();
333 virtual void OnRightButtonDown();
334 virtual void OnRightButtonUp();
336 virtual void OnLeftDClick();
337 virtual void OnRightDClick();
338 virtual void OnMiddleDClick();
339 virtual void OnMouseWheel();
341 virtual void TransformCoordinate(double &X, double &Y, double &Z);
342 void AddInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas);
343 void RemoveInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas);
344 void InsertInteractorStyleMaracas(int pos, InteractorStyleMaracas* interactorStyleMaracas);
345 void CallLstInteractorStyleMaracas(int type);
347 wxVtk2DBaseView *GetWxVtk2DBaseView();
348 wxVtk3DBaseView *GetWxVtk3DBaseView();
349 void SetwxVtkBaseView(wxVtkBaseView *wxvtkbaseview);
350 void SetActiveAllInteractors(bool ok);
352 void SetRefresh_waiting();
353 void SetParent_refresh_waiting();
355 bool GetRefresh_waiting();
356 bool GetParent_refresh_waiting();
359 void EvaluateToRefresh();
361 void UnBlockRefresh();
364 std::vector< InteractorStyleMaracas* > _lstInteractorStyleMaracas;
368 bool _refresh_waiting;
369 bool _parent_refresh_waiting;
370 wxVtkBaseView *_wxvtkbaseview;
373 //------------------------------------------------------------------
374 //------------------------------------------------------------------
375 //------------------------------------------------------------------
377 class creaMaracasVisu_EXPORT vtkInteractorStyleBaseView2D : public vtkInteractorStyleBaseView{
379 vtkInteractorStyleBaseView2D();
380 ~vtkInteractorStyleBaseView2D();
381 static vtkInteractorStyleBaseView2D *New();
382 virtual void OnMouseMove();
383 virtual void OnLeftButtonDown();
384 virtual void OnLeftButtonUp();
385 virtual void OnMiddleButtonDown();
386 virtual void OnMiddleButtonUp();
387 virtual void OnRightButtonDown();
388 virtual void OnRightButtonUp();
394 manualInteractorWindowLevel *_manualinteractorwindowlevel;
395 vtkInteractorScrollZ *_vtkInteractorScrollZ;
399 //------------------------------------------------------------------
400 //------------------------------------------------------------------
401 //------------------------------------------------------------------
403 class creaMaracasVisu_EXPORT vtkInteractorStyleBaseView3D : public vtkInteractorStyleBaseView {
405 vtkInteractorStyleBaseView3D();
406 ~vtkInteractorStyleBaseView3D();
407 static vtkInteractorStyleBaseView3D *New();
409 virtual void OnMouseMove () ;
410 virtual void OnLeftButtonDown ();
411 virtual void OnLeftButtonUp () ;
412 virtual void OnMiddleButtonDown ();
413 virtual void OnMiddleButtonUp () ;
414 virtual void OnRightButtonDown () ;
415 virtual void OnRightButtonUp () ;
421 //------------------------------------------------------------------
422 //------------------------------------------------------------------
423 //------------------------------------------------------------------
425 class creaMaracasVisu_EXPORT wxVtk3DBaseView: public wxVtkBaseView{
427 wxVtk3DBaseView( wxWindow *parent );
428 virtual ~wxVtk3DBaseView();
429 vtkCamera* GetCamera();
430 virtual vtkRenderer* GetRenderer();
431 virtual vtkRenderWindow* GetRenWin();
434 virtual void GetSpacing(double spc[3]);
438 vtkRenderer *_aRenderer;
439 vtkRenderWindow *_renWin;
446 #endif // __WX_VTK__BASE__VIEW__H