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 if (wxwidgetvoi!=NULL){
98 ContourVOIWidget* contourvoiwidget = wxwidgetvoi->GetContourVOIWidget();
101 contourvoiwidget->GetVOI(voi);
103 sprintf(buffer,"%d %d %d ", voi[0], voi[2], voi[4] );
104 std::string Index(buffer);
105 sprintf(buffer,"%d %d %d ", voi[1]-voi[0]+1, voi[3]-voi[2]+1, voi[5]-voi[4]+1 );
106 std::string Size(buffer);
108 bbSetOutputIndex( Index );
109 bbSetOutputSize( Size );
113 //------------------------------------------------------
114 void ContourVOI::CreateWidget(wxWindow* parent)
116 bbtkDebugMessageInc("Core",9,"ContourVOI::CreateWidget()"<<std::endl);
118 if (bbGetInputwxVtkBaseView()==NULL)
120 wxMessageDialog(NULL, bbtk::std2wx("(ContourVOI) Input 'wxVtkBaseView' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
122 if (bbGetInputIn()==NULL)
124 wxMessageDialog(NULL, bbtk::std2wx("(ContourVOI) Input 'In' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
127 wxWidgetVOI *mwxwidget = new wxWidgetVOI( parent, bbGetInputwxVtkBaseView(), bbGetInputIn() );
129 bbSetOutputWidget(mwxwidget);
130 bbtkDebugDecTab("Core",9);
133 //------------------------------------------------------
134 void ContourVOI::bbUserConstructor()
138 //------------------------------------------------------
139 void ContourVOI::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
143 //------------------------------------------------------
144 void ContourVOI::bbUserDestructor()
150 // EO namespace bbcreaMaracasVisu