1 #include "bbmaracasvisuTransferFunctionView.h"
2 #include "bbcreaMaracasVisuPackage.h"
3 namespace bbcreaMaracasVisu
6 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,TransferFunctionView)
7 BBTK_BLACK_BOX_IMPLEMENTATION(TransferFunctionView,bbtk::WxBlackBox);
9 //-----------------------------------------------------
10 void TransferFunctionView::Process()
13 std::vector<double> greylevel;
14 std::vector<double> value;
16 std::vector<double> greylevelcolors;
17 std::vector<double> red;
18 std::vector<double> green;
19 std::vector<double> blue;
23 if(bbGetInputIn()!=NULL){
25 if(_currentimg != bbGetInputIn()){
26 _currentimg = bbGetInputIn();
27 //mwxwidget->initializeHistogram(_currentimg);
28 mwxwidget->setImageData(_currentimg);
29 //mwxwidget->Refresh();
32 mwxwidget->GetValuesPointsFunction(greylevel, value);
33 mwxwidget->GetValuesColorPointsFunction(greylevelcolors,red, green,blue);
36 _tfun->RemoveAllPoints();
37 for(int i = 0; i < greylevel.size();i++){
38 _tfun->AddPoint(greylevel[i], value[i]);
39 //std::cout<<"TransferFunctionView::Process()transfer function "<<greylevel[i]<<" "<< value[i]<<std::endl;
41 _ctfun->RemoveAllPoints();
42 for(int i = 0; i < greylevelcolors.size();i++){
43 _ctfun->AddRGBPoint(greylevelcolors[i], red[i],green[i], blue[i]);
44 //std::cout<<"TransferFunctionView::Process()transfer color function "<<greylevelcolors[i]<<" "<<red[i]<<" "<<green[i]<<" "<<blue[i]<<std::endl;
48 bbSetOutputOpacityFunction(_tfun);
49 bbSetOutputColorFunction(_ctfun);
50 /*bbSetOutputGreyLevel(greylevel);
51 bbSetOutputValue(value);
52 bbSetOutputGreyLevelColors(greylevelcolors);
54 bbSetOutputGreen(green);
55 bbSetOutputBlue(blue);*/
65 //-----------------------------------------------------
66 void TransferFunctionView::CreateWidget(wxWindow* parent)
68 bbtkDebugMessageInc("Core",9,"TransferFunctionView::CreateWxWindow()"<<std::endl);
70 //mwxwidget = new HistogramWidget(parent, -1);
71 mwxwidget = new HistogramDialogComboBox(parent);
73 bbtkDebugDecTab("Core",9);
74 bbSetOutputWidget( mwxwidget );
77 //-----------------------------------------------------
78 void TransferFunctionView::bbUserSetDefaultValues()
86 bbSetOutputOpacityFunction(0);
87 bbSetOutputColorFunction(0);
92 //-----------------------------------------------------------------
93 void TransferFunctionView::bbUserInitializeProcessing()
95 _tfun = vtkPiecewiseFunction::New();
96 _ctfun = vtkColorTransferFunction::New();
100 //-----------------------------------------------------------------
101 void TransferFunctionView::bbUserFinalizeProcessing()
105 //-----------------------------------------------------------------
108 // EO namespace bbcreaMaracasVisu