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();
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{
323 vtkInteractorStyleBaseView();
324 ~vtkInteractorStyleBaseView();
325 static vtkInteractorStyleBaseView *New();
326 virtual void OnChar();
327 virtual void OnMouseMove();
328 virtual void OnLeftButtonDown();
329 virtual void OnLeftButtonUp();
330 virtual void OnMiddleButtonDown();
331 virtual void OnMiddleButtonUp();
332 virtual void OnRightButtonDown();
333 virtual void OnRightButtonUp();
335 virtual void OnLeftDClick();
336 virtual void OnRightDClick();
337 virtual void OnMiddleDClick();
338 virtual void OnMouseWheel();
340 virtual void TransformCoordinate(double &X, double &Y, double &Z);
341 void AddInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas);
342 void RemoveInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas);
343 void InsertInteractorStyleMaracas(int pos, InteractorStyleMaracas* interactorStyleMaracas);
344 void CallLstInteractorStyleMaracas(int type);
346 wxVtk2DBaseView *GetWxVtk2DBaseView();
347 wxVtk3DBaseView *GetWxVtk3DBaseView();
348 void SetwxVtkBaseView(wxVtkBaseView *wxvtkbaseview);
349 void SetActiveAllInteractors(bool ok);
351 void SetRefresh_waiting();
352 void SetParent_refresh_waiting();
354 bool GetRefresh_waiting();
355 bool GetParent_refresh_waiting();
358 void EvaluateToRefresh();
360 void UnBlockRefresh();
363 std::vector< InteractorStyleMaracas* > _lstInteractorStyleMaracas;
367 bool _refresh_waiting;
368 bool _parent_refresh_waiting;
369 wxVtkBaseView *_wxvtkbaseview;
372 //------------------------------------------------------------------
373 //------------------------------------------------------------------
374 //------------------------------------------------------------------
376 class creaMaracasVisu_EXPORT vtkInteractorStyleBaseView2D : public vtkInteractorStyleBaseView{
378 vtkInteractorStyleBaseView2D();
379 ~vtkInteractorStyleBaseView2D();
380 static vtkInteractorStyleBaseView2D *New();
381 virtual void OnMouseMove();
382 virtual void OnLeftButtonDown();
383 virtual void OnLeftButtonUp();
384 virtual void OnMiddleButtonDown();
385 virtual void OnMiddleButtonUp();
386 virtual void OnRightButtonDown();
387 virtual void OnRightButtonUp();
393 manualInteractorWindowLevel *_manualinteractorwindowlevel;
394 vtkInteractorScrollZ *_vtkInteractorScrollZ;
398 //------------------------------------------------------------------
399 //------------------------------------------------------------------
400 //------------------------------------------------------------------
402 class creaMaracasVisu_EXPORT vtkInteractorStyleBaseView3D : public vtkInteractorStyleBaseView {
404 vtkInteractorStyleBaseView3D();
405 ~vtkInteractorStyleBaseView3D();
406 static vtkInteractorStyleBaseView3D *New();
408 virtual void OnMouseMove () ;
409 virtual void OnLeftButtonDown ();
410 virtual void OnLeftButtonUp () ;
411 virtual void OnMiddleButtonDown ();
412 virtual void OnMiddleButtonUp () ;
413 virtual void OnRightButtonDown () ;
414 virtual void OnRightButtonUp () ;
420 //------------------------------------------------------------------
421 //------------------------------------------------------------------
422 //------------------------------------------------------------------
424 class creaMaracasVisu_EXPORT wxVtk3DBaseView: public wxVtkBaseView{
426 wxVtk3DBaseView( wxWindow *parent );
427 virtual ~wxVtk3DBaseView();
428 vtkCamera* GetCamera();
429 virtual vtkRenderer* GetRenderer();
430 virtual vtkRenderWindow* GetRenWin();
433 virtual void GetSpacing(double spc[3]);
437 vtkRenderer *_aRenderer;
438 vtkRenderWindow *_renWin;
445 #endif // __WX_VTK__BASE__VIEW__H