+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
#ifndef __WX_VTK__BASE__VIEW__H
#include <vtkImageViewer2.h>
#include <vtkInteractorStyleImage.h>
-#include "wxMPRBaseData.h"
+#include "vtkBaseData.h"
#include "wxVTKRenderWindowInteractorEditContour.h"
#include <wx/wx.h>
#include <vector>
#include "marTypes.h"
+#include "wxVTKRenderWindowInteractor.h"
+//#include "include/vtkImageViewer2_XYZ.h"
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-
-class MARACASVISULIB_EXPORTS vtkImageViewer2_XYZ{
-public:
- vtkImageViewer2_XYZ();
- ~vtkImageViewer2_XYZ();
-
- void SetExtentDimension(int x1,int x2, int y1,int y2, int z1,int z2);
- void SetXSlice(int slice);
- void SetYSlice(int slice);
- void SetZSlice(int slice);
- int GetXSlice();
- int GetYSlice();
- int GetZSlice();
- vtkImageViewer2 *GetVtkImageViewer2();
-
-private:
- int _x1,_x2,_y1,_y2,_z1,_z2;
- vtkImageViewer2 *_vtkimageviewer2;
-protected:
-};
-
-
+/* JCP 14/05/09
+//#include "vtkInteractorStyleBaseView.h"
+//class vtkInteractorStyleBaseView;
+ */
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-class wxVtkBaseView;
+#include "vtkInteractorStyleImage.h"
-class MARACASVISULIB_EXPORTS wxVTKRenderWindowInteractorPlus : public wxVTKRenderWindowInteractor
-{
-public:
- wxVTKRenderWindowInteractorPlus(wxWindow *parent ,wxVtkBaseView *_wxvtkbaseview);
- ~wxVTKRenderWindowInteractorPlus();
-
- wxVTKRenderWindowInteractorPlus();
- void OnLeftDClick( wxMouseEvent& event );
- void OnRightDClick( wxMouseEvent& event );
- void OnMiddleDClick( wxMouseEvent& event );
- void OnMouseWheel( wxMouseEvent& event );
-
-
- // VTK
- static wxVTKRenderWindowInteractorPlus * New();
-
-protected:
-private:
- wxVtkBaseView *_wxvtkbaseview;
- DECLARE_EVENT_TABLE( );
-
-
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-
-class vtkInteractorStyleBaseView;
-
-
-class MARACASVISULIB_EXPORTS wxVtkBaseView{
+class creaMaracasVisu_EXPORT wxVtkBaseView{
public:
wxVtkBaseView( );
wxVtkBaseView( wxWindow *parent );
- ~wxVtkBaseView();
- wxVTKRenderWindowInteractor *GetWxVTKRenderWindowInteractor();
- virtual void Configure();
- virtual void Refresh();
- virtual void RefreshView();
- virtual vtkRenderer* GetRenderer();
- virtual vtkRenderWindow* GetRenWin();
- virtual void TransfromeCoordScreenToWorld(double &X, double &Y, double &Z, int type=2);
- void SetInteractorStyleBaseView( vtkInteractorStyleBaseView* interactorStyle);
- vtkInteractorStyleBaseView* GetInteractorStyleBaseView();
- virtual void GetSpacing(double spc[3]);
-
-private:
- wxWindow *_parent;
- wxVTKRenderWindowInteractor *_iren;
- vtkInteractorStyleBaseView *_interactorStyle;
-protected:
-
-};
-
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class vtkInteractorStyleBaseView;
-class manualInteractorWindowLevel;
-class vtkInfoTextImage;
-class vtkInfoTextImageInteractor;
-
-//------------------------------------------------------------------
-
-
-class MARACASVISULIB_EXPORTS wxVtk2DBaseView: public wxVtkBaseView{
-public:
- wxVtk2DBaseView(wxWindow *parent);
- ~wxVtk2DBaseView();
- virtual void Configure(bool okimage=true);
- vtkImageViewer2_XYZ* _imageViewer2XYZ;
- vtkBaseData* GetVtkBaseData();
- void SetVtkBaseData(vtkBaseData *vtkbasedata);
- virtual void Refresh();
- virtual void ResetView();
- virtual int GetActualSlice();
- virtual void SetActualSlice(int slice);
- void SetInteractorStyleImage(vtkInteractorStyleBaseView *interactorstylebaseview);
-
+ virtual ~wxVtkBaseView();
+ wxVTKRenderWindowInteractor *GetWxVTKRenderWindowInteractor() throw (char*);
+ virtual void Configure();
+ virtual void Refresh();
+ virtual void RefreshView();
virtual vtkRenderer* GetRenderer();
virtual vtkRenderWindow* GetRenWin();
- virtual void TransformCoordinate_spacing_ViewToModel(double &X,double &Y, double &Z);
- virtual void TransformCoordinate_spacing_ModelToView(double &X,double &Y, double &Z);
- virtual void GetSpacing(double spc[3]);
-
-
-private:
- vtkBaseData *_vtkbasedata;
-
- vtkInfoTextImage *_vtkIinfoTextImage;
- vtkInfoTextImageInteractor *_vtkIinfoTextImageInteractor;
-
-protected:
-
-};
-
-
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-
-//------------------------------------------------------------------
-
-class MARACASVISULIB_EXPORTS InteractorStyleMaracas
-{
-public:
- InteractorStyleMaracas();
- ~InteractorStyleMaracas();
-
- virtual InteractorStyleMaracas * Clone();
- void CopyAttributesTo( InteractorStyleMaracas *cloneObject );
-
-
- virtual bool OnChar();
- virtual bool OnMouseMove();
- virtual bool OnLeftButtonDown();
- virtual bool OnLeftButtonUp();
- virtual bool OnMiddleButtonDown();
- virtual bool OnMiddleButtonUp();
- virtual bool OnRightButtonDown();
- virtual bool OnRightButtonUp();
-
- virtual bool OnLeftDClick();
- virtual bool OnRightDClick();
- virtual bool OnMiddleDClick();
- virtual bool OnMouseWheel();
-
-
- void SetVtkInteractorStyleBaseView(vtkInteractorStyleBaseView* _vtkInteractorStyleBaseView);
- void RemoveVtkInteractorStyleBaseView();
- void SetActive(bool active);
- bool GetActive();
-
-protected:
- vtkInteractorStyleBaseView* _vtkInteractorStyleBaseView;
-private:
- bool _active;
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-
-
-class MARACASVISULIB_EXPORTS manualInteractorWindowLevel : public InteractorStyleMaracas {
-public:
- manualInteractorWindowLevel();
- ~manualInteractorWindowLevel();
-protected:
-
- bool _stateWindowLevel;
- int _backPx;
- int _backPy;
- int _backWindow;
- int _backLevel;
-
- virtual bool OnMouseMove();
- virtual bool OnMiddleButtonDown();
- virtual bool OnMiddleButtonUp();
-};
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class vtkInfoTextImage{
-public:
- vtkInfoTextImage();
- ~vtkInfoTextImage();
- void SetWxVtk2DBaseView(wxVtk2DBaseView *wxvtk2Dbaseview);
- void SetMarImageData(marImageData *marimagedata);
- void Configure();
- void PutPixelIntensity(int x, int y, int z);
- void PutPosition(int x, int y, int z);
- void PutColorLevel();
- void PutWindowLevel();
-
-
-protected:
-private:
-
- marImageData *_marimagedata;
- wxVtk2DBaseView *_wxvtk2Dbaseview;
- vtkTextActor *_vtkText_WindowLevel;
- vtkTextActor *_vtkText_ColorLevel;
- vtkTextActor *_vtkText_position;
- vtkTextActor *_vtkText_pixelIntensity;
-
- vtkTextActor *Create_Text_Label(int px, int py);
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class vtkInfoTextImageInteractor : public InteractorStyleMaracas{
-public:
- vtkInfoTextImageInteractor();
- ~vtkInfoTextImageInteractor();
- void SetModelVtkInfoTextImage(vtkInfoTextImage *vtkinfotextimage);
- vtkInfoTextImage *GetVtkInfoTextImage();
-
-protected:
-
- virtual bool OnMouseMove();
-
-private:
- vtkInfoTextImage *_vtkinfotextimage;
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class vtkInteractorScrollZ : public InteractorStyleMaracas {
-public:
- vtkInteractorScrollZ();
- ~vtkInteractorScrollZ();
-
- virtual bool OnMouseMove();
- virtual bool OnRightButtonDown();
- virtual bool OnRightButtonUp();
-
-
-
-protected:
- bool _stateFordware;
- int _fordwareX;
- int _fordwareY;
- int _sliceZ;
-
-private:
-
-};
-
-
-
-
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class wxVtk3DBaseView;
-
-class MARACASVISULIB_EXPORTS vtkInteractorStyleBaseView : public vtkInteractorStyleImage{
-public:
- vtkInteractorStyleBaseView();
- ~vtkInteractorStyleBaseView();
- static vtkInteractorStyleBaseView *New();
- virtual void OnChar();
- virtual void OnMouseMove();
- virtual void OnLeftButtonDown();
- virtual void OnLeftButtonUp();
- virtual void OnMiddleButtonDown();
- virtual void OnMiddleButtonUp();
- virtual void OnRightButtonDown();
- virtual void OnRightButtonUp();
-
- virtual void OnLeftDClick();
- virtual void OnRightDClick();
- virtual void OnMiddleDClick();
- virtual void OnMouseWheel();
-
- virtual void TransformCoordinate(double &X, double &Y, double &Z);
- void AddInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas);
- void RemoveInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas);
- void InsertInteractorStyleMaracas(int pos, InteractorStyleMaracas* interactorStyleMaracas);
- void CallLstInteractorStyleMaracas(int type);
-
- wxVtk2DBaseView *GetWxVtk2DBaseView();
- wxVtk3DBaseView *GetWxVtk3DBaseView();
- void SetwxVtkBaseView(wxVtkBaseView *wxvtkbaseview);
- void SetActiveAllInteractors(bool ok);
-
- void SetRefresh_waiting();
- void SetParent_refresh_waiting();
-
- bool GetRefresh_waiting();
- bool GetParent_refresh_waiting();
-
-
- void EvaluateToRefresh();
- void BlockRefresh();
- void UnBlockRefresh();
-
-protected:
- std::vector< InteractorStyleMaracas* > _lstInteractorStyleMaracas;
+ virtual void TransFromCoordScreenToWorld(double &X, double &Y, double &Z, bool keepNormalDirection=false,int type=2);
+
+ //RaC 03-2010 Method used by TransFromCoordScreenToWorld
+ void TransCoordScreenToWorld(double &X, double &Y, double &Z,int type=2);
+
+ /* JCP 04/05/09
+ void SetInteractorStyleBaseView( vtkInteractorStyleBaseView* interactorStyle);
+ */
+ void SetInteractorStyleBaseView( vtkInteractorStyleImage* interactorStyle);
+ /* JCP 04/05/09
+ *
+ vtkInteractorStyleBaseView* GetInteractorStyleBaseView();
+ */
+ vtkInteractorStyleImage* GetInteractorStyleBaseView();
+ virtual void GetSpacing(double spc[3]);
+ virtual int GetDirection();
+ vtkBaseData* GetVtkBaseData();
+ void SetVtkBaseData(vtkBaseData *vtkbasedata);
private:
- bool _blockRefresh;
- bool _refresh_waiting;
- bool _parent_refresh_waiting;
- wxVtkBaseView *_wxvtkbaseview;
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class MARACASVISULIB_EXPORTS vtkInteractorStyleBaseView2D : public vtkInteractorStyleBaseView{
-public:
- vtkInteractorStyleBaseView2D();
- ~vtkInteractorStyleBaseView2D();
- static vtkInteractorStyleBaseView2D *New();
- virtual void OnMouseMove();
- virtual void OnLeftButtonDown();
- virtual void OnLeftButtonUp();
- virtual void OnMiddleButtonDown();
- virtual void OnMiddleButtonUp();
- virtual void OnRightButtonDown();
- virtual void OnRightButtonUp();
+ wxWindow *_parent;
+ wxVTKRenderWindowInteractor *_iren;
+ /**
+ * JCP 04/05/09
+ * vtkInteractorStyleImage *_interactorStyle;
+ */
+ vtkInteractorStyleImage *_interactorStyle;
+// EED Nov 15 2014
+ vtkBaseData *_vtkbasedata;
protected:
-private:
- manualInteractorWindowLevel *_manualinteractorwindowlevel;
- vtkInteractorScrollZ *_vtkInteractorScrollZ;
-
};
//------------------------------------------------------------------
//------------------------------------------------------------------
//------------------------------------------------------------------
-class MARACASVISULIB_EXPORTS vtkInteractorStyleBaseView3D : public vtkInteractorStyleBaseView {
-public:
- vtkInteractorStyleBaseView3D();
- ~vtkInteractorStyleBaseView3D();
- static vtkInteractorStyleBaseView3D *New();
-
- virtual void OnMouseMove () ;
- virtual void OnLeftButtonDown ();
- virtual void OnLeftButtonUp () ;
- virtual void OnMiddleButtonDown ();
- virtual void OnMiddleButtonUp () ;
- virtual void OnRightButtonDown () ;
- virtual void OnRightButtonUp () ;
-
-private:
-
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class MARACASVISULIB_EXPORTS wxVtk3DBaseView: public wxVtkBaseView{
-public:
- wxVtk3DBaseView( wxWindow *parent );
- ~wxVtk3DBaseView();
- vtkCamera* GetCamera();
- virtual vtkRenderer* GetRenderer();
- virtual vtkRenderWindow* GetRenWin();
- void Refresh();
- void Configure();
- virtual void GetSpacing(double spc[3]);
-
-private:
- bool _configure;
- vtkRenderer *_aRenderer;
- vtkRenderWindow *_renWin;
- vtkCamera *_aCamera;
-protected:
-};
-
-
#endif // __WX_VTK__BASE__VIEW__H
-
-
-