00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00033 #ifdef _USE_WXWIDGETS_
00034 #ifdef _USE_VTK_
00035
00036
00037 #ifndef __bbwxvtkViewer2D_h__
00038 #define __bbwxvtkViewer2D_h__
00039
00040 #include "vtkImageData.h"
00041 #include "vtkImageViewer2.h"
00042 #include "vtkImplicitPlaneWidget.h"
00043
00044 #include "bbtkWxBlackBox.h"
00045 #include "wxVTKRenderWindowInteractor.h"
00046
00047
00048
00049 namespace bbwxvtk
00050 {
00051 class Viewer2D;
00052
00053
00054
00055 class Viewer2DWidget : public wxPanel
00056 {
00057 public:
00058 Viewer2DWidget(Viewer2D* box, wxWindow *parent);
00059 ~Viewer2DWidget();
00060 void UpdateView();
00061 vtkRenderer *GetRenderer();
00062 private:
00063 Viewer2D *mBox;
00064 vtkImageViewer2 *imageViewer;
00065 vtkImageData *backImageData;
00066 vtkImageData *mDefaultImage;
00067 wxVTKRenderWindowInteractor *wxvtkrenderwindowinteractor;
00068 bool mUpdateCamera;
00069
00070 vtkImplicitPlaneWidget * maPlane1, * maPlane2, * mbPlane1, * mbPlane2;
00071 };
00072
00073
00074
00075
00076
00077 class Viewer2D : public bbtk::WxBlackBox
00078 {
00079 BBTK_BLACK_BOX_INTERFACE(Viewer2D,bbtk::WxBlackBox);
00080 BBTK_DECLARE_INPUT(Slice,int);
00081 BBTK_DECLARE_INPUT(Orientation,int);
00082 BBTK_DECLARE_INPUT(In,vtkImageData *);
00083 BBTK_DECLARE_OUTPUT(Out,int);
00084 BBTK_DECLARE_OUTPUT(Renderer,vtkRenderer*);
00085 BBTK_PROCESS(Process);
00086 void Process();
00087 BBTK_CREATE_WIDGET(CreateWidget);
00088 void CreateWidget();
00089 void bbUserOnShow();
00090 void bbUserConstructor();
00091 };
00092
00093
00094
00095 BBTK_BEGIN_DESCRIBE_BLACK_BOX(Viewer2D,bbtk::WxBlackBox);
00096 BBTK_NAME("Viewer2D");
00097 BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
00098 BBTK_DESCRIPTION("2D Viewer widget (vtk)");
00099 BBTK_CATEGORY("viewer");
00100 BBTK_INPUT(Viewer2D,Slice,"Initial Slice number",int,"");
00101 BBTK_INPUT(Viewer2D,Orientation,"Slicing orientation : 0:yz / 1:xz / 2:xy",int,"");
00102 BBTK_INPUT(Viewer2D,In,"Input Image",vtkImageData *,"");
00103 BBTK_OUTPUT(Viewer2D,Out,"Current Slice number",int,"");
00104 BBTK_OUTPUT(Viewer2D,Renderer,"vtk Renderer",vtkRenderer*,"");
00105 BBTK_END_DESCRIBE_BLACK_BOX(Viewer2D);
00106
00107
00108
00109 }
00110
00111 #endif //__bbwxvtkViewer2D_h__
00112
00113 #endif //_USE_VTK_
00114 #endif //_USE_WXWIDGETS_