X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxVtkBaseView.h;h=79391aa6dc764f31119b84efdeb433f4d026f047;hb=47d49bceea4f93ff4f57c40596960d042171abb4;hp=bc5d35ffb04697bbc9e7be88743e92cddf957c62;hpb=3e48d6cf83c4d96585d3e825899db643f9a62193;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h index bc5d35f..79391aa 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h @@ -1,3 +1,28 @@ +/*# --------------------------------------------------------------------- +# +# 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 @@ -18,7 +43,7 @@ #include #include -#include "wxMPRBaseData.h" +#include "vtkBaseData.h" #include "wxVTKRenderWindowInteractorEditContour.h" #include @@ -28,422 +53,70 @@ #include #include "marTypes.h" +#include "wxVTKRenderWindowInteractor.h" +//#include "include/vtkImageViewer2_XYZ.h" -//------------------------------------------------------------------ -//------------------------------------------------------------------ -//------------------------------------------------------------------ - - -class creaMaracasVisu_EXPORT 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: -}; - - - -//------------------------------------------------------------------ -//------------------------------------------------------------------ -//------------------------------------------------------------------ - -class wxVtkBaseView; - -class creaMaracasVisu_EXPORT 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(); +/* JCP 14/05/09 +//#include "vtkInteractorStyleBaseView.h" +//class vtkInteractorStyleBaseView; + */ -protected: -private: - wxVtkBaseView *_wxvtkbaseview; - DECLARE_EVENT_TABLE( ); - - -}; - -//------------------------------------------------------------------ -//------------------------------------------------------------------ -//------------------------------------------------------------------ - - -class vtkInteractorStyleBaseView; +#include "vtkInteractorStyleImage.h" class creaMaracasVisu_EXPORT wxVtkBaseView{ public: wxVtkBaseView( ); wxVtkBaseView( wxWindow *parent ); virtual ~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 creaMaracasVisu_EXPORT wxVtk2DBaseView: public wxVtkBaseView{ -public: - wxVtk2DBaseView(wxWindow *parent); - virtual ~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); - + 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 creaMaracasVisu_EXPORT InteractorStyleMaracas -{ -public: - InteractorStyleMaracas(); - virtual ~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; -}; - -//------------------------------------------------------------------ -//------------------------------------------------------------------ -//------------------------------------------------------------------ - - + virtual void TransFromCoordScreenToWorld(double &X, double &Y, double &Z, bool keepNormalDirection=false,int type=2); -class creaMaracasVisu_EXPORT manualInteractorWindowLevel : public InteractorStyleMaracas { -public: - manualInteractorWindowLevel(); - virtual ~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; + //RaC 03-2010 Method used by TransFromCoordScreenToWorld + void TransCoordScreenToWorld(double &X, double &Y, double &Z,int type=2); - vtkTextActor *Create_Text_Label(int px, int py); -}; - -//------------------------------------------------------------------ -//------------------------------------------------------------------ -//------------------------------------------------------------------ + /* 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(); -class vtkInfoTextImageInteractor : public InteractorStyleMaracas{ -public: - vtkInfoTextImageInteractor(); - virtual ~vtkInfoTextImageInteractor(); - void SetModelVtkInfoTextImage(vtkInfoTextImage *vtkinfotextimage); - vtkInfoTextImage *GetVtkInfoTextImage(); -protected: + vtkBaseData* GetVtkBaseData(); + void SetVtkBaseData(vtkBaseData *vtkbasedata); - virtual bool OnMouseMove(); private: - vtkInfoTextImage *_vtkinfotextimage; -}; - -//------------------------------------------------------------------ -//------------------------------------------------------------------ -//------------------------------------------------------------------ - -class vtkInteractorScrollZ : public InteractorStyleMaracas { -public: - vtkInteractorScrollZ(); - virtual ~vtkInteractorScrollZ(); - - virtual bool OnMouseMove(); - virtual bool OnRightButtonDown(); - virtual bool OnRightButtonUp(); - + wxWindow *_parent; + wxVTKRenderWindowInteractor *_iren; + /** + * JCP 04/05/09 + * vtkInteractorStyleImage *_interactorStyle; + */ + vtkInteractorStyleImage *_interactorStyle; +// EED Nov 15 2014 + vtkBaseData *_vtkbasedata; protected: - bool _stateFordware; - int _fordwareX; - int _fordwareY; - int _sliceZ; - -private: }; - - - - - //------------------------------------------------------------------ //------------------------------------------------------------------ //------------------------------------------------------------------ -class wxVtk3DBaseView; - -class creaMaracasVisu_EXPORT 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; - -private: - bool _blockRefresh; - bool _refresh_waiting; - bool _parent_refresh_waiting; - wxVtkBaseView *_wxvtkbaseview; -}; - -//------------------------------------------------------------------ -//------------------------------------------------------------------ -//------------------------------------------------------------------ - -class creaMaracasVisu_EXPORT 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(); - - -protected: - -private: - manualInteractorWindowLevel *_manualinteractorwindowlevel; - vtkInteractorScrollZ *_vtkInteractorScrollZ; - -}; - -//------------------------------------------------------------------ -//------------------------------------------------------------------ -//------------------------------------------------------------------ - -class creaMaracasVisu_EXPORT 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 creaMaracasVisu_EXPORT wxVtk3DBaseView: public wxVtkBaseView{ -public: - wxVtk3DBaseView( wxWindow *parent ); - virtual ~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 - - -