]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbmaracasvisuViewerNV.h
9d3eb7d0cba14bc1b2a3487ecf3a26babf77552e
[creaMaracasVisu.git] / bbtk / src / bbmaracasvisuViewerNV.h
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 #ifdef _USE_WXWIDGETS_
27 #ifndef __bbcreaMaracasVisuViewerNV_h_INCLUDED__
28 #define __bbcreaMaracasVisuViewerNV_h_INCLUDED__
29 #include "bbtkWxBlackBox.h"
30
31 #include "vtkImageData.h"
32 #include "vtkRenderer.h"
33
34 #include "wxVtkBaseView.h"
35
36 //#include "widgets/wxMPRWidget.h"
37 //#include "widgets/wxMaracas_ViewerWidget.h"
38 //#include "widgets/wxMaracas_N_ViewersWidget.h"
39
40 #include "wxMPRWidget.h"
41 #include "wxMaracas_ViewerWidget.h"
42 #include "wxMaracas_N_ViewersWidget.h"
43
44 #include "vtkImagePlaneWidget.h"
45
46 namespace bbcreaMaracasVisu
47 {
48   class ViewerNV;
49   class bbwxMaracas_N_ViewersWidget : public wxMaracas_N_ViewersWidget
50   {
51         public:
52                 bbwxMaracas_N_ViewersWidget(ViewerNV* box,wxWindow *parent, vtkImageData* imagedata=NULL, std::vector<int> *nTypeView=NULL);
53                 ~bbwxMaracas_N_ViewersWidget();
54
55                 //if the MPR had generated the refresh event
56                 void OnRefreshView(wxCommandEvent &event);
57                 void OnDClickLeft(wxCommandEvent &event);
58         private:
59                 ViewerNV                        *mbbViewerNV;
60         DECLARE_EVENT_TABLE( );
61   };
62
63 //-------------------------------------------------------------------
64 //-------------------------------------------------------------------
65 //-------------------------------------------------------------------
66
67 class /*BBTK_EXPORT*/ ViewerNV
68  :
69    public bbtk::WxBlackBox
70 {
71   BBTK_BLACK_BOX_INTERFACE(ViewerNV,bbtk::WxBlackBox);
72   BBTK_DECLARE_INPUT(Title,std::string);
73   BBTK_DECLARE_INPUT(In, vtkImageData *);
74   BBTK_DECLARE_INPUT(nTypeView, std::vector<int> );
75   BBTK_DECLARE_INPUT(ColorFunction, vtkColorTransferFunction* );
76   BBTK_DECLARE_INPUT(WindowLevel, double );
77   BBTK_DECLARE_INPUT(ColorLevel, double );
78   BBTK_DECLARE_INPUT(Obs1, vtkInteractorObserver *);
79   BBTK_DECLARE_INPUT(Obs2, vtkInteractorObserver *);
80   BBTK_DECLARE_INPUT(Obs3, vtkInteractorObserver *);
81   BBTK_DECLARE_INPUT(Obs4, vtkInteractorObserver *);
82   BBTK_DECLARE_INPUT(Obs5, vtkInteractorObserver *);
83
84   BBTK_DECLARE_OUTPUT(wxVtkBaseView1,wxVtkBaseView*);
85   BBTK_DECLARE_OUTPUT(wxVtkBaseView2,wxVtkBaseView*);
86   BBTK_DECLARE_OUTPUT(wxVtkBaseView3,wxVtkBaseView*);
87   BBTK_DECLARE_OUTPUT(wxVtkBaseView4,wxVtkBaseView*);
88   BBTK_DECLARE_OUTPUT(Renderer1,vtkRenderer*);
89   BBTK_DECLARE_OUTPUT(Renderer2,vtkRenderer*);
90   BBTK_DECLARE_OUTPUT(Renderer3,vtkRenderer*);
91   BBTK_DECLARE_OUTPUT(Renderer4,vtkRenderer*);
92   BBTK_DECLARE_OUTPUT(Interactor1,vtkRenderWindowInteractor*);
93   BBTK_DECLARE_OUTPUT(Point,std::vector<int>);
94
95   BBTK_PROCESS(Process);
96   void Process();
97   BBTK_CREATE_WIDGET(CreateWidget);
98   void CreateWidget(wxWindow* parent);
99
100    std::vector<int>                             _point;
101 private:
102
103         vtkImageData                            *_currentimg;
104         std::vector<int>                        _currenttype;
105         wxMaracas_N_ViewersWidget       *_mwxwidget;
106         
107         bool compareVectors(std::vector<int> type,std::vector<int> currenttype);
108         void updateObservers();
109 };
110
111 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ViewerNV,bbtk::WxBlackBox);
112 BBTK_NAME("ViewerNV");
113 BBTK_AUTHOR("eduardo.davila [at] creatis.insa-lyon.fr");
114 BBTK_DESCRIPTION("Viewer : N view configuration 2D and 3D");
115   BBTK_CATEGORY("viewer");
116   BBTK_INPUT(ViewerNV,Title,"Title prepended to the text",std::string,"");
117   BBTK_INPUT(ViewerNV,In,"Input image",vtkImageData*,"");
118   BBTK_INPUT(ViewerNV,nTypeView,"vector of viewer types (default 5 1 2 0): -1=Z_2DwithOutAxis 0=Z_2D 1=X_2D 2=Y_2D 3=Plane 4=Sphere 5=3D 6=3Dplane 7=3D_empty",std::vector<int>,"");
119   BBTK_INPUT(ViewerNV,ColorFunction,"Optional: set a different color for the viewers 2D",vtkColorTransferFunction*,"");
120   BBTK_INPUT(ViewerNV,WindowLevel,"Optional: set a different Window level by using an other widget",double,"");
121   BBTK_INPUT(ViewerNV,ColorLevel,"Optional: set a different Color level by using an other widget",double,"");
122   BBTK_INPUT(ViewerNV,Obs1,"Optional: set a different Color level by using an other widget",vtkInteractorObserver*,"");
123   BBTK_INPUT(ViewerNV,Obs2,"Optional: set a different Color level by using an other widget",vtkInteractorObserver*,"");
124   BBTK_INPUT(ViewerNV,Obs3,"Optional: set a different Color level by using an other widget",vtkInteractorObserver*,"");
125   BBTK_INPUT(ViewerNV,Obs4,"Optional: set a different Color level by using an other widget",vtkInteractorObserver*,"");
126   BBTK_INPUT(ViewerNV,Obs5,"Optional: set a different Color level by using an other widget",vtkInteractorObserver*,"");
127
128   BBTK_OUTPUT(ViewerNV,wxVtkBaseView1,"wxVtkBaseView 1",wxVtkBaseView  *,"");
129   BBTK_OUTPUT(ViewerNV,wxVtkBaseView2,"wxVtkBaseView 2",wxVtkBaseView  *,"");
130   BBTK_OUTPUT(ViewerNV,wxVtkBaseView3,"wxVtkBaseView 3",wxVtkBaseView  *,"");
131   BBTK_OUTPUT(ViewerNV,wxVtkBaseView4,"wxVtkBaseView 4",wxVtkBaseView  *,"");
132   BBTK_OUTPUT(ViewerNV,Renderer1,"Renderer 1",vtkRenderer *,"");
133   BBTK_OUTPUT(ViewerNV,Renderer2,"Renderer 2",vtkRenderer *,"");
134   BBTK_OUTPUT(ViewerNV,Renderer3,"Renderer 3",vtkRenderer *,"");
135   BBTK_OUTPUT(ViewerNV,Renderer4,"Renderer 4",vtkRenderer *,"");
136   BBTK_OUTPUT(ViewerNV,Interactor1,"Interactor1",vtkRenderWindowInteractor *,"");
137   BBTK_OUTPUT(ViewerNV,Point,"Axis point",std::vector<int>,"");
138
139 BBTK_END_DESCRIBE_BLACK_BOX(ViewerNV);
140 }
141 // EO namespace bbcreaMaracasVisu
142
143 #endif // __bbcreaMaracasVisuViewerNV_h_INCLUDED__
144 #endif // _USE_WXWIDGETS_