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 if(wxvtkbaseview!=NULL&&imagedata!=NULL){
27 setBaseView(wxvtkbaseview);
28 setImageData(imagedata);
29 initializeVOIWidget();
36 void wxWidgetVOI::setBaseView(wxVtkBaseView * wxvtkbaseview){
37 this->wxvtkbaseview = wxvtkbaseview;
39 void wxWidgetVOI::setImageData(vtkImageData * imagedata){
40 this->imagedata = imagedata;
43 void wxWidgetVOI::initializeVOIWidget(){
44 mcontourvoiwidget = new ContourVOIWidget( this, wxvtkbaseview, imagedata );
45 mcontourvoiwidget->ConfigureVTK();
47 // wxwidget = new wxMPRWidget2( panel, marimagedata , 1 );
48 // wxwidget->ConfigureVTK();
49 wxFlexGridSizer *sizer=new wxFlexGridSizer(1);
50 sizer -> Add( mcontourvoiwidget,1,wxGROW );
51 sizer -> AddGrowableCol(0);
52 this -> SetSizer(sizer);
53 this -> SetAutoLayout(true);
57 //--------------------------------------------------------------------------
58 wxWidgetVOI::~wxWidgetVOI()
62 //--------------------------------------------------------------------------
63 void wxWidgetVOI::Refresh()
65 printf("EED wxWidgetVOI::Refresh \n");
66 // wxwidget->RefreshView();
69 //--------------------------------------------------------------------------
73 void wxWidgetVOI::OnRefreshView(wxCommandEvent &event)
75 printf("EED wxWidgetVOI::OnRefreshView \n");
77 if((wxwidget!=NULL) && (mbbViewerMPR!=NULL))
80 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetX());
81 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetY());
82 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetZ());
83 mbbViewerMPR->bbSetOutputPoint(point);
84 mbbViewerMPR->bbSetModifiedStatus();
85 wxwidget->RefreshView();
90 //--------------------------------------------------------------------------
91 void wxWidgetVOI::OnDClickLeft(wxCommandEvent & event)
93 printf("EED wxWidgetVOI::OnDClickLeft \n");
94 // wxwidget->RefreshView();
97 //------------------------------------------------------
98 ContourVOIWidget* wxWidgetVOI::GetContourVOIWidget()
100 return mcontourvoiwidget;
103 //--------------------------------------------------------------------------------------------------------------------------------
105 //------------------------------------------------------
106 //------------------------------------------------------
107 //------------------------------------------------------
110 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ContourVOI)
111 BBTK_BLACK_BOX_IMPLEMENTATION(ContourVOI,bbtk::WxBlackBox);
113 //------------------------------------------------------
114 void ContourVOI::Process()
117 /*if (bbGetInputwxVtkBaseView()==NULL)
119 wxMessageDialog(NULL, bbtk::std2wx("(ContourVOI) Input 'wxVtkBaseView' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
121 if (bbGetInputIn()==NULL)
123 wxMessageDialog(NULL, bbtk::std2wx("(ContourVOI) Input 'In' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
127 vtkImageData* img = bbGetInputIn();
128 wxVtkBaseView* base = bbGetInputwxVtkBaseView();
130 wxWidgetVOI* wxwidgetvoi = (wxWidgetVOI*)bbGetOutputWidget();
132 if(base !=NULL && img != NULL && _img != img && _base != base){
137 wxwidgetvoi->setBaseView(base);
138 wxwidgetvoi->setImageData(img);
139 wxwidgetvoi->initializeVOIWidget();
143 if (wxwidgetvoi!=NULL){
144 ContourVOIWidget* contourvoiwidget = wxwidgetvoi->GetContourVOIWidget();
147 contourvoiwidget->GetVOI(voi);
149 sprintf(buffer,"%d %d %d ", voi[0], voi[2], voi[4] );
150 std::string Index(buffer);
151 sprintf(buffer,"%d %d %d ", voi[1]-voi[0]+1, voi[3]-voi[2]+1, voi[5]-voi[4]+1 );
152 std::string Size(buffer);
154 std::cout<<"ContourVOI index "<<Index<<" size "<<Size<<std::endl;
156 bbSetOutputIndex( Index );
157 bbSetOutputSize( Size );
162 //------------------------------------------------------
163 void ContourVOI::CreateWidget(wxWindow* parent)
165 bbtkDebugMessageInc("Core",9,"ContourVOI::CreateWidget()"<<std::endl);
166 wxWidgetVOI *mwxwidget = new wxWidgetVOI( parent );
167 bbSetOutputWidget(mwxwidget);
168 bbtkDebugDecTab("Core",9);
169 this->bbSignalOutputModification();
174 //------------------------------------------------------
175 void ContourVOI::bbUserConstructor()
180 bbSetInputwxVtkBaseView(NULL);
182 bbSetOutputWidget(NULL);
186 //------------------------------------------------------
187 void ContourVOI::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
194 //------------------------------------------------------
195 void ContourVOI::bbUserDestructor()
201 // EO namespace bbcreaMaracasVisu