4 #include "bbmaracasvisuContourVOI.h"
5 #include "bbcreaMaracasVisuPackage.h"
6 namespace bbcreaMaracasVisu
9 //--------------------------------------------------------------------------
11 //--------------------------------------------------------------------------
12 BEGIN_EVENT_TABLE( wxWidgetVOI, wxPanel )
13 EVT_MENU( 12121, wxWidgetVOI::OnRefreshView )
14 EVT_MENU( 12122, wxWidgetVOI::OnDClickLeft )
20 wxWidgetVOI::wxWidgetVOI(wxWindow* parent, wxVtkBaseView *wxvtkbaseview, vtkImageData *imagedata)
21 : wxPanel( parent, -1 )
23 wxPanel *panel = this;
25 mcontourvoiwidget = new ContourVOIWidget( panel, wxvtkbaseview, imagedata );
26 mcontourvoiwidget->ConfigureVTK();
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);
37 //--------------------------------------------------------------------------
38 wxWidgetVOI::~wxWidgetVOI()
42 //--------------------------------------------------------------------------
43 void wxWidgetVOI::Refresh()
45 printf("EED wxWidgetVOI::Refresh \n");
46 // wxwidget->RefreshView();
49 //--------------------------------------------------------------------------
53 void wxWidgetVOI::OnRefreshView(wxCommandEvent &event)
55 printf("EED wxWidgetVOI::OnRefreshView \n");
57 if((wxwidget!=NULL) && (mbbViewerMPR!=NULL))
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();
70 //--------------------------------------------------------------------------
71 void wxWidgetVOI::OnDClickLeft(wxCommandEvent & event)
73 printf("EED wxWidgetVOI::OnDClickLeft \n");
74 // wxwidget->RefreshView();
77 //------------------------------------------------------
78 ContourVOIWidget* wxWidgetVOI::GetContourVOIWidget()
80 return mcontourvoiwidget;
83 //--------------------------------------------------------------------------------------------------------------------------------
85 //------------------------------------------------------
86 //------------------------------------------------------
87 //------------------------------------------------------
90 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ContourVOI)
91 BBTK_BLACK_BOX_IMPLEMENTATION(ContourVOI,bbtk::WxBlackBox);
93 //------------------------------------------------------
94 void ContourVOI::Process()
96 wxWidgetVOI* wxwidgetvoi = (wxWidgetVOI*)bbGetOutputWidget();
97 ContourVOIWidget* contourvoiwidget = wxwidgetvoi->GetContourVOIWidget();
100 contourvoiwidget->GetVOI(voi);
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);
107 bbSetOutputIndex( Index );
108 bbSetOutputSize( Size );
111 //------------------------------------------------------
112 void ContourVOI::CreateWidget()
114 bbtkDebugMessageInc("Core",9,"ContourVOI::CreateWidget()"<<std::endl);
116 if (bbGetInputwxVtkBaseView()==NULL)
118 wxMessageDialog(NULL, bbtk::std2wx("(ContourVOI) Input 'wxVtkBaseView' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
120 if (bbGetInputIn()==NULL)
122 wxMessageDialog(NULL, bbtk::std2wx("(ContourVOI) Input 'In' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
125 wxWidgetVOI *mwxwidget = new wxWidgetVOI( bbGetWxParent(), bbGetInputwxVtkBaseView(), bbGetInputIn() );
127 bbSetOutputWidget(mwxwidget);
128 bbtkDebugDecTab("Core",9);
131 //------------------------------------------------------
132 void ContourVOI::bbUserConstructor()
136 //------------------------------------------------------
137 void ContourVOI::bbUserCopyConstructor()
141 //------------------------------------------------------
142 void ContourVOI::bbUserDestructor()
148 // EO namespace bbcreaMaracasVisu