]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbmaracasvisuContourVOI.cxx
Changed bbtk package name to comply to coding style
[creaMaracasVisu.git] / bbtk / src / bbmaracasvisuContourVOI.cxx
1 //HOLA!!!
2 //HOLA!!!
3
4 #include "bbmaracasvisuContourVOI.h"
5 #include "bbcreaMaracasVisuPackage.h"
6 namespace bbcreaMaracasVisu
7 {
8
9   //--------------------------------------------------------------------------
10   // wxWidgetMPR
11   //--------------------------------------------------------------------------
12 BEGIN_EVENT_TABLE( wxWidgetVOI, wxPanel )
13         EVT_MENU( 12121, wxWidgetVOI::OnRefreshView )
14         EVT_MENU( 12122, wxWidgetVOI::OnDClickLeft  )
15 END_EVENT_TABLE( );
16
17   //-----------
18   //Constructor
19   //-----------
20   wxWidgetVOI::wxWidgetVOI(wxWindow* parent,  wxVtkBaseView *wxvtkbaseview, vtkImageData *imagedata)
21           : wxPanel( parent, -1 )
22   {
23                 wxPanel *panel  = this;
24
25                 mcontourvoiwidget = new ContourVOIWidget( panel, wxvtkbaseview, imagedata );
26                 mcontourvoiwidget->ConfigureVTK();
27
28 //              wxwidget = new wxMPRWidget2( panel, marimagedata , 1 ); 
29 //              wxwidget->ConfigureVTK();
30                 wxFlexGridSizer *sizer=new wxFlexGridSizer(1);
31                 sizer   -> Add( mcontourvoiwidget,1,wxGROW ); 
32                 sizer   -> AddGrowableCol(0);
33                 panel   -> SetSizer(sizer);
34                 panel   -> SetAutoLayout(true);
35                 panel   -> Layout();            
36   }
37 //--------------------------------------------------------------------------
38   wxWidgetVOI::~wxWidgetVOI()
39   {
40   }
41         
42 //--------------------------------------------------------------------------
43   void wxWidgetVOI::Refresh()
44   { 
45           printf("EED wxWidgetVOI::Refresh \n");
46 //        wxwidget->RefreshView();
47   }
48
49 //--------------------------------------------------------------------------
50   //---------------
51   //Handling events
52   //---------------
53   void wxWidgetVOI::OnRefreshView(wxCommandEvent &event)
54   {
55           printf("EED wxWidgetVOI::OnRefreshView \n");
56 /*
57           if((wxwidget!=NULL) && (mbbViewerMPR!=NULL))
58           {
59             point.clear();
60                 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetX());
61                 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetY());
62                 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetZ());
63                 mbbViewerMPR->bbSetOutputPoint(point);
64                 mbbViewerMPR->bbSetModifiedStatus();
65                 wxwidget->RefreshView();
66           }
67 */
68   }
69
70 //--------------------------------------------------------------------------
71   void wxWidgetVOI::OnDClickLeft(wxCommandEvent & event) 
72   {
73           printf("EED wxWidgetVOI::OnDClickLeft \n");
74 //      wxwidget->RefreshView();
75   }
76
77 //------------------------------------------------------
78 ContourVOIWidget* wxWidgetVOI::GetContourVOIWidget()
79 {
80         return mcontourvoiwidget;
81 }
82
83 //--------------------------------------------------------------------------------------------------------------------------------
84
85 //------------------------------------------------------
86 //------------------------------------------------------
87 //------------------------------------------------------
88
89
90 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ContourVOI)
91 BBTK_BLACK_BOX_IMPLEMENTATION(ContourVOI,bbtk::WxBlackBox);
92
93 //------------------------------------------------------
94 void ContourVOI::Process()
95 {  
96         wxWidgetVOI* wxwidgetvoi = (wxWidgetVOI*)bbGetOutputWidget();
97         ContourVOIWidget* contourvoiwidget = wxwidgetvoi->GetContourVOIWidget();
98     
99         int voi[6];
100         contourvoiwidget->GetVOI(voi);
101         char buffer[40];
102         sprintf(buffer,"%d %d %d ", voi[0], voi[2], voi[4] );
103         std::string Index(buffer);
104         sprintf(buffer,"%d %d %d ", voi[1]-voi[0]+1, voi[3]-voi[2]+1, voi[5]-voi[4]+1 );
105         std::string Size(buffer);
106
107         bbSetOutputIndex( Index );
108         bbSetOutputSize( Size );
109 }
110
111 //------------------------------------------------------
112 void ContourVOI::CreateWidget()
113 {  
114         bbtkDebugMessageInc("Core",9,"ContourVOI::CreateWidget()"<<std::endl);
115   
116         if (bbGetInputwxVtkBaseView()==NULL) 
117     {
118       wxMessageDialog(NULL,  bbtk::std2wx("(ContourVOI) Input 'wxVtkBaseView' is not set"),  bbtk::std2wx(bbGetFullName()) ).ShowModal();
119     }
120         if (bbGetInputIn()==NULL) 
121     {
122       wxMessageDialog(NULL,  bbtk::std2wx("(ContourVOI) Input 'In' is not set"),  bbtk::std2wx(bbGetFullName()) ).ShowModal();
123     }
124
125         wxWidgetVOI *mwxwidget = new wxWidgetVOI( bbGetWxParent(), bbGetInputwxVtkBaseView(), bbGetInputIn() );
126
127         bbSetOutputWidget(mwxwidget);
128         bbtkDebugDecTab("Core",9);
129 }
130
131 //------------------------------------------------------
132 void ContourVOI::bbUserConstructor()
133 {
134 }
135
136 //------------------------------------------------------
137 void ContourVOI::bbUserCopyConstructor()
138 {
139 }
140
141 //------------------------------------------------------
142 void ContourVOI::bbUserDestructor()
143 {
144 }
145
146
147 }
148 // EO namespace bbcreaMaracasVisu
149
150