X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk%2Fsrc%2FbbmaracasvisuContourVOI.cxx;h=dfb620215e184217e8afe8316abda565e10ecfb4;hb=f010d4e7f1754243c513cc659372169c42560d5f;hp=cf35763703d5f6485645762b29fd8ce0447db133;hpb=825aea147234aff270ea97229e7a6c6c4f190f58;p=creaMaracasVisu.git diff --git a/bbtk/src/bbmaracasvisuContourVOI.cxx b/bbtk/src/bbmaracasvisuContourVOI.cxx index cf35763..dfb6202 100644 --- a/bbtk/src/bbmaracasvisuContourVOI.cxx +++ b/bbtk/src/bbmaracasvisuContourVOI.cxx @@ -20,7 +20,15 @@ END_EVENT_TABLE( ); wxWidgetVOI::wxWidgetVOI(wxWindow* parent, wxVtkBaseView *wxvtkbaseview, vtkImageData *imagedata) : wxPanel( parent, -1 ) { - wxPanel *panel = this; +// wxPanel *panel = this; + + wxFlexGridSizer *sizer=new wxFlexGridSizer(1); + sizer -> AddGrowableCol(0); + this -> SetSizer(sizer); + this -> SetAutoLayout(true); + this->wxvtkbaseview = NULL; + mcontourvoiwidget=NULL; + if(wxvtkbaseview!=NULL&&imagedata!=NULL){ @@ -32,28 +40,34 @@ END_EVENT_TABLE( ); } + void wxWidgetVOI::initializeVOIWidget(){ + wxSizer* sizer = this->GetSizer(); - void wxWidgetVOI::setBaseView(wxVtkBaseView * wxvtkbaseview){ - this->wxvtkbaseview = wxvtkbaseview; - } - void wxWidgetVOI::setImageData(vtkImageData * imagedata){ - this->imagedata = imagedata; - } + + if(mcontourvoiwidget!=NULL){ + sizer->Remove( mcontourvoiwidget ); + mcontourvoiwidget->Destroy(); + } - 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(); +// wxwidget = new wxMPRWidget2( panel, marimagedata , 1 ); +// wxwidget->ConfigureVTK(); + this->Refresh(); } + + void wxWidgetVOI::setBaseView(wxVtkBaseView * wxvtkbaseview){ + this->wxvtkbaseview = wxvtkbaseview; + } + void wxWidgetVOI::setImageData(vtkImageData * imagedata){ + this->imagedata = imagedata; + } + + //-------------------------------------------------------------------------- wxWidgetVOI::~wxWidgetVOI() { @@ -62,7 +76,6 @@ END_EVENT_TABLE( ); //-------------------------------------------------------------------------- void wxWidgetVOI::Refresh() { - printf("EED wxWidgetVOI::Refresh \n"); // wxwidget->RefreshView(); } @@ -72,7 +85,6 @@ END_EVENT_TABLE( ); //--------------- void wxWidgetVOI::OnRefreshView(wxCommandEvent &event) { - printf("EED wxWidgetVOI::OnRefreshView \n"); /* if((wxwidget!=NULL) && (mbbViewerMPR!=NULL)) { @@ -90,7 +102,6 @@ END_EVENT_TABLE( ); //-------------------------------------------------------------------------- void wxWidgetVOI::OnDClickLeft(wxCommandEvent & event) { - printf("EED wxWidgetVOI::OnDClickLeft \n"); // wxwidget->RefreshView(); } @@ -129,7 +140,7 @@ void ContourVOI::Process() wxWidgetVOI* wxwidgetvoi = (wxWidgetVOI*)bbGetOutputWidget(); - if(base !=NULL && img != NULL && _img != img && _base != base){ + if(base !=NULL && img != NULL && _img != img){ _img = img; _base = base; @@ -140,7 +151,7 @@ void ContourVOI::Process() } - if (wxwidgetvoi!=NULL){ + if (wxwidgetvoi!=NULL && _img!=NULL && _base != NULL){ ContourVOIWidget* contourvoiwidget = wxwidgetvoi->GetContourVOIWidget(); int voi[6]; @@ -153,6 +164,21 @@ void ContourVOI::Process() std::cout<<"ContourVOI index "<Delete(); + } + _extract = vtkExtractVOI::New(); + _extract->RemoveAllInputs(); + _extract->SetInput(img); + _extract->SetVOI(voi); + _extract->UpdateWholeExtent(); + _extract->Update(); + bbSetOutputVOI(_extract->GetOutput()); + //JCP + + + bbSetOutputIndex( Index ); bbSetOutputSize( Size ); } @@ -172,30 +198,34 @@ void ContourVOI::CreateWidget(wxWindow* parent) } //------------------------------------------------------ -void ContourVOI::bbUserConstructor() +void ContourVOI::bbUserSetDefaultValues() { _img = NULL; _base = NULL; + _extract =NULL; bbSetInputwxVtkBaseView(NULL); bbSetInputIn(NULL); bbSetOutputWidget(NULL); + bbSetOutputVOI(NULL); -} - -//------------------------------------------------------ -void ContourVOI::bbUserCopyConstructor(bbtk::BlackBox::Pointer) -{ - _img = NULL; - _base = NULL; - -} + bbSetInputIn(NULL); + bbSetInputwxVtkBaseView(NULL); -//------------------------------------------------------ -void ContourVOI::bbUserDestructor() -{ } + //----------------------------------------------------------------- + void ContourVOI::bbUserInitializeProcessing() + { + } + + //----------------------------------------------------------------- + void ContourVOI::bbUserFinalizeProcessing() + { + } + + //----------------------------------------------------------------- + } // EO namespace bbcreaMaracasVisu