//HOLA!!! //HOLA!!! #include "bbmaracasvisuContourVOI.h" #include "bbcreaMaracasVisuPackage.h" namespace bbcreaMaracasVisu { //-------------------------------------------------------------------------- // wxWidgetMPR //-------------------------------------------------------------------------- BEGIN_EVENT_TABLE( wxWidgetVOI, wxPanel ) EVT_MENU( 12121, wxWidgetVOI::OnRefreshView ) EVT_MENU( 12122, wxWidgetVOI::OnDClickLeft ) END_EVENT_TABLE( ); //----------- //Constructor //----------- wxWidgetVOI::wxWidgetVOI(wxWindow* parent, wxVtkBaseView *wxvtkbaseview, vtkImageData *imagedata) : wxPanel( parent, -1 ) { wxPanel *panel = this; if(wxvtkbaseview!=NULL&&imagedata!=NULL){ setBaseView(wxvtkbaseview); setImageData(imagedata); initializeVOIWidget(); } } void wxWidgetVOI::setBaseView(wxVtkBaseView * wxvtkbaseview){ this->wxvtkbaseview = wxvtkbaseview; } void wxWidgetVOI::setImageData(vtkImageData * imagedata){ this->imagedata = imagedata; } void wxWidgetVOI::initializeVOIWidget(){ mcontourvoiwidget = new ContourVOIWidget( this, wxvtkbaseview, imagedata ); mcontourvoiwidget->ConfigureVTK(); // wxwidget = new wxMPRWidget2( panel, marimagedata , 1 ); // wxwidget->ConfigureVTK(); wxFlexGridSizer *sizer=new wxFlexGridSizer(1); sizer -> Add( mcontourvoiwidget,1,wxGROW ); sizer -> AddGrowableCol(0); this -> SetSizer(sizer); this -> SetAutoLayout(true); this -> Layout(); this->Refresh(); } //-------------------------------------------------------------------------- wxWidgetVOI::~wxWidgetVOI() { } //-------------------------------------------------------------------------- void wxWidgetVOI::Refresh() { printf("EED wxWidgetVOI::Refresh \n"); // wxwidget->RefreshView(); } //-------------------------------------------------------------------------- //--------------- //Handling events //--------------- void wxWidgetVOI::OnRefreshView(wxCommandEvent &event) { printf("EED wxWidgetVOI::OnRefreshView \n"); /* if((wxwidget!=NULL) && (mbbViewerMPR!=NULL)) { point.clear(); point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetX()); point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetY()); point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetZ()); mbbViewerMPR->bbSetOutputPoint(point); mbbViewerMPR->bbSetModifiedStatus(); wxwidget->RefreshView(); } */ } //-------------------------------------------------------------------------- void wxWidgetVOI::OnDClickLeft(wxCommandEvent & event) { printf("EED wxWidgetVOI::OnDClickLeft \n"); // wxwidget->RefreshView(); } //------------------------------------------------------ ContourVOIWidget* wxWidgetVOI::GetContourVOIWidget() { return mcontourvoiwidget; } //-------------------------------------------------------------------------------------------------------------------------------- //------------------------------------------------------ //------------------------------------------------------ //------------------------------------------------------ BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ContourVOI) BBTK_BLACK_BOX_IMPLEMENTATION(ContourVOI,bbtk::WxBlackBox); //------------------------------------------------------ void ContourVOI::Process() { /*if (bbGetInputwxVtkBaseView()==NULL) { wxMessageDialog(NULL, bbtk::std2wx("(ContourVOI) Input 'wxVtkBaseView' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal(); } if (bbGetInputIn()==NULL) { wxMessageDialog(NULL, bbtk::std2wx("(ContourVOI) Input 'In' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal(); }*/ vtkImageData* img = bbGetInputIn(); wxVtkBaseView* base = bbGetInputwxVtkBaseView(); wxWidgetVOI* wxwidgetvoi = (wxWidgetVOI*)bbGetOutputWidget(); if(base !=NULL && img != NULL && _img != img && _base != base){ _img = img; _base = base; wxwidgetvoi->setBaseView(base); wxwidgetvoi->setImageData(img); wxwidgetvoi->initializeVOIWidget(); } if (wxwidgetvoi!=NULL){ ContourVOIWidget* contourvoiwidget = wxwidgetvoi->GetContourVOIWidget(); int voi[6]; contourvoiwidget->GetVOI(voi); char buffer[40]; sprintf(buffer,"%d %d %d ", voi[0], voi[2], voi[4] ); std::string Index(buffer); sprintf(buffer,"%d %d %d ", voi[1]-voi[0]+1, voi[3]-voi[2]+1, voi[5]-voi[4]+1 ); std::string Size(buffer); std::cout<<"ContourVOI index "<bbSignalOutputModification(); //Process(); } //------------------------------------------------------ void ContourVOI::bbUserConstructor() { _img = NULL; _base = NULL; bbSetInputwxVtkBaseView(NULL); bbSetInputIn(NULL); bbSetOutputWidget(NULL); } //------------------------------------------------------ void ContourVOI::bbUserCopyConstructor(bbtk::BlackBox::Pointer) { _img = NULL; _base = NULL; } //------------------------------------------------------ void ContourVOI::bbUserDestructor() { } } // EO namespace bbcreaMaracasVisu