]> Creatis software - bbtk.git/blob - packages/wxvtk/src/bbwxvtkViewer2D.h
5019b96d54f4d364fa818a3b81c974b66202a797
[bbtk.git] / packages / wxvtk / src / bbwxvtkViewer2D.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbwxvtkViewer2D.h,v $
5   Language:  C++
6   Date:      $Date: 2008/12/08 12:56:17 $
7   Version:   $Revision: 1.12 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*//**
18  * \brief Short description in one line
19  * 
20  * Long description which 
21  * can span multiple lines
22  */
23 /**
24  * \file 
25  * \brief 
26  */
27 /**
28  * \class Viewer2D
29  * \brief 
30  */
31
32
33 #ifdef _USE_WXWIDGETS_
34 #ifdef _USE_VTK_
35
36
37 #ifndef __bbwxvtkViewer2D_h__
38 #define __bbwxvtkViewer2D_h__
39
40 #include "vtkImageData.h"
41 #include "wxvtkImageViewer2.h"
42 #include "vtkImplicitPlaneWidget.h"
43
44 #include "bbtkWxBlackBox.h"
45 #include "wxVTKRenderWindowInteractor.h"
46
47
48
49 namespace bbwxvtk
50 {
51   class Viewer2D; 
52
53
54   //--------------------------------------------------------------------------
55   class Viewer2DWidget : public wxPanel
56   {
57   public:
58     Viewer2DWidget(Viewer2D* box, wxWindow *parent);
59     ~Viewer2DWidget();
60     void UpdateView();
61     vtkRenderer         *GetRenderer();
62   private:
63     Viewer2D                    *mBox;
64     wxvtkImageViewer2           *imageViewer;
65     vtkImageData                *backImageData;
66     vtkImageData                *mDefaultImage;
67     wxVTKRenderWindowInteractor *wxvtkrenderwindowinteractor;
68     bool mUpdateCamera;
69
70     vtkImplicitPlaneWidget * maPlane1, * maPlane2, * mbPlane1, * mbPlane2;
71   };
72   
73   //------------------------------------------------------------------------
74   //------------------------------------------------------------------------
75   //------------------------------------------------------------------------
76   
77   class /*BBTK_EXPORT*/ Viewer2D : public bbtk::WxBlackBox
78   {    
79     BBTK_BLACK_BOX_INTERFACE(Viewer2D,bbtk::WxBlackBox);
80     BBTK_DECLARE_INPUT(Slice,int);
81     BBTK_DECLARE_INPUT(Orientation,int);
82     BBTK_DECLARE_INPUT(In,vtkImageData *);
83     BBTK_DECLARE_OUTPUT(Out,int);
84     BBTK_DECLARE_OUTPUT(Renderer,vtkRenderer*);
85     BBTK_PROCESS(Process);
86     BBTK_CREATE_WIDGET(CreateWidget);
87     BBTK_ON_SHOW_WIDGET(OnShowWidget);
88     
89     void Process();
90     void CreateWidget(wxWindow*);
91     void OnShowWidget();
92     void bbUserConstructor();
93   };
94    
95   //=================================================================
96   // UserBlackBox description
97   BBTK_BEGIN_DESCRIBE_BLACK_BOX(Viewer2D,bbtk::WxBlackBox);
98   BBTK_NAME("Viewer2D");
99   BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
100   BBTK_DESCRIPTION("2D Viewer widget (vtk)");
101   BBTK_CATEGORY("viewer");
102   BBTK_INPUT(Viewer2D,Slice,"Initial Slice number",int,"");
103   BBTK_INPUT(Viewer2D,Orientation,"Slicing orientation : 0:yz / 1:xz / 2:xy",int,"");
104   BBTK_INPUT(Viewer2D,In,"Input Image",vtkImageData *,"");
105   BBTK_OUTPUT(Viewer2D,Out,"Current Slice number",int,"");
106   BBTK_OUTPUT(Viewer2D,Renderer,"vtk Renderer",vtkRenderer*,"");
107   BBTK_END_DESCRIBE_BLACK_BOX(Viewer2D);
108   //=================================================================
109
110
111 }//namespace bbwxvtk
112
113 #endif  //__bbwxvtkViewer2D_h__
114
115 #endif //_USE_VTK_
116 #endif //_USE_WXWIDGETS_