]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbmaracasvisuTransferFunctionView.h
08e386a69509de2c4a21f7723f6e2ffa2b69c9a3
[creaMaracasVisu.git] / bbtk / src / bbmaracasvisuTransferFunctionView.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 __bbcreaMaracasVisuTransferFunctionView_h_INCLUDED__
28 #define __bbcreaMaracasVisuTransferFunctionView_h_INCLUDED__
29 #include "bbtkWxBlackBox.h"
30
31 #include "vtkImageData.h"
32 //#include "HistogramWidget.h"
33 #include "HistogramDialogComboBox.h"
34
35 #include "vtkPiecewiseFunction.h"
36 #include "vtkColorTransferFunction.h"
37 #include <wx/wx.h>
38
39 namespace bbcreaMaracasVisu
40 {
41
42   
43
44 class /*BBTK_EXPORT*/ TransferFunctionView
45  : 
46    public bbtk::WxBlackBox
47 {
48   BBTK_BLACK_BOX_INTERFACE(TransferFunctionView,bbtk::WxBlackBox);
49         BBTK_DECLARE_INPUT(In, vtkImageData*);
50         BBTK_DECLARE_OUTPUT(OpacityFunction, vtkPiecewiseFunction*);
51         BBTK_DECLARE_OUTPUT(ColorFunction, vtkColorTransferFunction*);
52
53         BBTK_DECLARE_OUTPUT(WindowLevel, double);
54         BBTK_DECLARE_OUTPUT(ColorLevel, double);
55         /*BBTK_DECLARE_OUTPUT(GreyLevel, std::vector<double> );
56         BBTK_DECLARE_OUTPUT(Value, std::vector<double> );
57         BBTK_DECLARE_OUTPUT(GreyLevelColors, std::vector<double>);
58         BBTK_DECLARE_OUTPUT(Red, std::vector<double>);
59         BBTK_DECLARE_OUTPUT(Green, std::vector<double>);
60         BBTK_DECLARE_OUTPUT(Blue, std::vector<double>);*/
61
62   BBTK_PROCESS(Process);
63   void Process();
64   BBTK_CREATE_WIDGET(CreateWidget);
65   void CreateWidget(wxWindow* parent);  
66
67   void onColorChange();
68
69   void onSliderChange();
70
71   private:
72         //HistogramWidget *mwxwidget;
73           HistogramDialogComboBox *mwxwidget;
74         vtkImageData* _currentimg;
75         
76         vtkPiecewiseFunction* _tfun;
77         vtkColorTransferFunction* _ctfun;
78 };
79
80 class HandlerTransferFunctionView : public wxEvtHandler
81 {
82         public:
83                 HandlerTransferFunctionView(TransferFunctionView* box);
84                 ~HandlerTransferFunctionView();    
85                 
86                  void onColorChange(wxCommandEvent& event);
87
88                  void onSliderChange(wxCommandEvent& event);
89                 
90         private:
91                 TransferFunctionView                    *_box;  
92 };
93
94 BBTK_BEGIN_DESCRIBE_BLACK_BOX(TransferFunctionView,bbtk::WxBlackBox);
95 BBTK_NAME("TransferFunctionView");
96 BBTK_AUTHOR("eduardo.davila [at] creatis.insa-lyon.fr");
97 BBTK_DESCRIPTION("Transfer Function Window");
98 //BBTK_CATEGORY("__CategoryBlackBox__");
99   BBTK_INPUT(TransferFunctionView,In,"Input image",vtkImageData*,"");
100         BBTK_OUTPUT(TransferFunctionView,OpacityFunction,"Transfer function for the opacity", vtkPiecewiseFunction*,"");
101         BBTK_OUTPUT(TransferFunctionView,ColorFunction,"Transfer function for the color", vtkColorTransferFunction*,"");  
102         BBTK_OUTPUT(TransferFunctionView,WindowLevel,"WidowLevel for the current window", double,"");  
103         BBTK_OUTPUT(TransferFunctionView,ColorLevel,"ColorLevel for the current window", double,"");  
104   /*BBTK_OUTPUT(TransferFunctionView,GreyLevel,"Greylevel related to the transparency",std::vector<double>,"");
105   BBTK_OUTPUT(TransferFunctionView,Value,"Value of the transparency in the transfer function",std::vector<double>,"");
106   BBTK_OUTPUT(TransferFunctionView,GreyLevelColors,"Grey level of the color in the transfer function",std::vector<double>,"");
107   BBTK_OUTPUT(TransferFunctionView,Red,"Red value according to the GreyLevelColors",std::vector<double>,"");
108   BBTK_OUTPUT(TransferFunctionView,Green,"Green value according to the GreyLevelColors",std::vector<double>,"");
109   BBTK_OUTPUT(TransferFunctionView,Blue,"Blue value according to the GreyLevelColors",std::vector<double>,"");*/
110 BBTK_END_DESCRIBE_BLACK_BOX(TransferFunctionView);
111 }
112
113
114 // EO namespace bbcreaMaracasVisu
115
116 #endif // __bbcreaMaracasVisuTransferFunctionView_h_INCLUDED__
117 #endif // _USE_WXWIDGETS_
118