From 2d46fb3f145430129318a9d5e0384d95ffce4608 Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Tue, 14 Jan 2025 14:14:33 +0100 Subject: [PATCH] Test code --- .../bbcreaMaracasVisuwxVtkBaseView_Info.cxx | 2 +- bbtk/src/bbmaracasvisuViewerNV.cxx | 177 +++++++++--------- bbtk/src/bbmaracasvisuViewerNV.h | 1 - 3 files changed, 88 insertions(+), 92 deletions(-) diff --git a/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx b/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx index 78aa909..3e3ba0d 100644 --- a/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx +++ b/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx @@ -159,7 +159,7 @@ bool InteractorwxVtkBaseView::OnMouseMove() { //EED 2023-08-05 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview ); -// _box->bbSignalOutputModification(); + _box->bbSignalOutputModification(); //ED2024-11-01 // return _box->bbGetInputWithEventPropagation(); return true; diff --git a/bbtk/src/bbmaracasvisuViewerNV.cxx b/bbtk/src/bbmaracasvisuViewerNV.cxx index 56a1586..83df745 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.cxx +++ b/bbtk/src/bbmaracasvisuViewerNV.cxx @@ -61,31 +61,28 @@ bbwxMaracas_N_ViewersWidget::~bbwxMaracas_N_ViewersWidget() //------------------------------------------------------------- void bbwxMaracas_N_ViewersWidget::OnRefreshView(wxCommandEvent & event) { - if (mbbViewerNV->_onshowwidget==true) + //EED2024-12-23 Refresh syncronisation (maracasvisu and bbtk) + wxMaracas_N_ViewersWidget::OnRefreshView(event); + if ( (backX!=(int)GetX()) || (backY!=(int)GetY()) || (backZ!=(int)GetZ()) ) { - //EED2024-12-23 Refresh syncronisation (maracasvisu and bbtk) - wxMaracas_N_ViewersWidget::OnRefreshView(event); - if ( (backX!=(int)GetX()) || (backY!=(int)GetY()) || (backZ!=(int)GetZ()) ) - { - backX = GetX(); - backY = GetY(); - backZ = GetZ(); - mbbViewerNV->_point.clear(); - mbbViewerNV->_point.push_back( (int)GetX() ); - mbbViewerNV->_point.push_back( (int)GetY() ); - mbbViewerNV->_point.push_back( (int)GetZ() ); - mbbViewerNV->bbSetOutputPoint( mbbViewerNV->_point ); - - //ED2024-11-01 - bool ok=true; - if (mbbViewerNV->bbGetInputReactivityType()==0) { ok=false; } - mbbViewerNV->bbSignalOutputModification(std::string("Point"),ok); - // if (mbbViewerNV->bbGetInputReactivityType()==1) - // { - // mbbViewerNV->bbSignalOutputModification(std::string("Point"),true); - // } // if type - } // if X Y Z - } // if _onshowwidget + backX = GetX(); + backY = GetY(); + backZ = GetZ(); + mbbViewerNV->_point.clear(); + mbbViewerNV->_point.push_back( (int)GetX() ); + mbbViewerNV->_point.push_back( (int)GetY() ); + mbbViewerNV->_point.push_back( (int)GetZ() ); + mbbViewerNV->bbSetOutputPoint( mbbViewerNV->_point ); + + //ED2024-11-01 + bool ok=true; + if (mbbViewerNV->bbGetInputReactivityType()==0) { ok=false; } + mbbViewerNV->bbSignalOutputModification(std::string("Point"),ok); + // if (mbbViewerNV->bbGetInputReactivityType()==1) + // { + // mbbViewerNV->bbSignalOutputModification(std::string("Point"),true); + // } // if type + } // if X Y Z } //------------------------------------------------------------- @@ -114,72 +111,72 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ViewerNV,bbtk::WxBlackBox); //------------------------------------------------------------- void ViewerNV::Process() { - vtkImageData* img = bbGetInputIn(); - std::vector type = bbGetInputnTypeView(); - if(img != NULL && _mwxwidget != NULL) - { - if(!compareVectors(type, _currenttype)) - { - _mwxwidget->SetType(&type); + vtkImageData* img = bbGetInputIn(); + std::vector type = bbGetInputnTypeView(); + if(img != NULL && _mwxwidget != NULL) + { + if(!compareVectors(type, _currenttype)) + { + _mwxwidget->SetType(&type); _mwxwidget->SetTDxWindow( bbGetInputTDxWindow() ); - _mwxwidget->UpdateLayout(img); - }else if (img != _currentimg){ - _mwxwidget->SetImage(img); - } -// _mwxwidget->RefreshView(); - _currenttype = type; - _currentimg = img; - _point.clear(); - _point.push_back( (int)_mwxwidget->GetX() ); - _point.push_back( (int)_mwxwidget->GetY() ); - _point.push_back( (int)_mwxwidget->GetZ() ); - bbSetOutputPoint( _point ); - - wxVtkBaseView *wvbv1 = _mwxwidget->GetwxVtkBaseView( 1 ); - wxVtkBaseView *wvbv2 = _mwxwidget->GetwxVtkBaseView( 2 ); - wxVtkBaseView *wvbv3 = _mwxwidget->GetwxVtkBaseView( 3 ); - wxVtkBaseView *wvbv4 = _mwxwidget->GetwxVtkBaseView( 4 ); - //wxwidget->RefreshView(); - bbSetOutputwxVtkBaseView1( wvbv1 ); - bbSetOutputwxVtkBaseView2( wvbv2 ); - bbSetOutputwxVtkBaseView3( wvbv3 ); - bbSetOutputwxVtkBaseView4( wvbv4 ); - if (wvbv1!=NULL) { bbSetOutputRenderer1( wvbv1->GetRenderer() ); } - if (wvbv2!=NULL) { bbSetOutputRenderer2( wvbv2->GetRenderer() ); } - if (wvbv3!=NULL) { bbSetOutputRenderer3( wvbv3->GetRenderer() ); } - if (wvbv4!=NULL) { bbSetOutputRenderer4( wvbv4->GetRenderer() ); } - if (wvbv1!=NULL) - { - bbSetOutputInteractor1( wvbv1->GetWxVTKRenderWindowInteractor() ); - updateObservers(); - } - if(bbGetInputColorFunction()!=NULL) - { - _mwxwidget->setColorTransferFunction(bbGetInputColorFunction()); - } - if( (bbGetInputColorLevel()!=-1) && (bbGetInputWindowLevel()!=-1)) - { - if(bbGetInputColorLevel() == 0) - { - _mwxwidget->SetColorWindowLevel( bbGetInputWindowLevel() , 0.1 ); - }else{ - _mwxwidget->SetColorWindowLevel( bbGetInputWindowLevel() , bbGetInputColorLevel() ); - } - } - _mwxwidget->SetInterpolate( bbGetInputInterpolate() ); -/* Borrame - if (wvbv1!=NULL) - { - wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh - //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 - #if wxMAJOR_VERSION <= 2 - wvbv1->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessEvent( newevent ); - #else - wvbv1->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessWindowEvent( newevent ); - #endif - } -*/ - }// mwxwidget != NULL + _mwxwidget->UpdateLayout(img); + }else if (img != _currentimg){ + _mwxwidget->SetImage(img); + } + // _mwxwidget->RefreshView(); + _currenttype = type; + _currentimg = img; + _point.clear(); + _point.push_back( (int)_mwxwidget->GetX() ); + _point.push_back( (int)_mwxwidget->GetY() ); + _point.push_back( (int)_mwxwidget->GetZ() ); + bbSetOutputPoint( _point ); + + wxVtkBaseView *wvbv1 = _mwxwidget->GetwxVtkBaseView( 1 ); + wxVtkBaseView *wvbv2 = _mwxwidget->GetwxVtkBaseView( 2 ); + wxVtkBaseView *wvbv3 = _mwxwidget->GetwxVtkBaseView( 3 ); + wxVtkBaseView *wvbv4 = _mwxwidget->GetwxVtkBaseView( 4 ); + //wxwidget->RefreshView(); + bbSetOutputwxVtkBaseView1( wvbv1 ); + bbSetOutputwxVtkBaseView2( wvbv2 ); + bbSetOutputwxVtkBaseView3( wvbv3 ); + bbSetOutputwxVtkBaseView4( wvbv4 ); + if (wvbv1!=NULL) { bbSetOutputRenderer1( wvbv1->GetRenderer() ); } + if (wvbv2!=NULL) { bbSetOutputRenderer2( wvbv2->GetRenderer() ); } + if (wvbv3!=NULL) { bbSetOutputRenderer3( wvbv3->GetRenderer() ); } + if (wvbv4!=NULL) { bbSetOutputRenderer4( wvbv4->GetRenderer() ); } + if (wvbv1!=NULL) + { + bbSetOutputInteractor1( wvbv1->GetWxVTKRenderWindowInteractor() ); + updateObservers(); + } + if(bbGetInputColorFunction()!=NULL) + { + _mwxwidget->setColorTransferFunction(bbGetInputColorFunction()); + } + if( (bbGetInputColorLevel()!=-1) && (bbGetInputWindowLevel()!=-1)) + { + if(bbGetInputColorLevel() == 0) + { + _mwxwidget->SetColorWindowLevel( bbGetInputWindowLevel() , 0.1 ); + }else{ + _mwxwidget->SetColorWindowLevel( bbGetInputWindowLevel() , bbGetInputColorLevel() ); + } + } + _mwxwidget->SetInterpolate( bbGetInputInterpolate() ); + /* Borrame + if (wvbv1!=NULL) + { + wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh + //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 + #if wxMAJOR_VERSION <= 2 + wvbv1->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessEvent( newevent ); + #else + wvbv1->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessWindowEvent( newevent ); + #endif + } + */ + }// mwxwidget != NULL } //------------------------------------------------------------- @@ -201,7 +198,6 @@ void ViewerNV::OnShowWidget() { if (_mwxwidget!=NULL) { - _onshowwidget = true; _mwxwidget->Layout(); } // if bbGetOutputWidget } @@ -210,6 +206,7 @@ void ViewerNV::OnShowWidget() void ViewerNV::bbUserSetDefaultValues() { _onshowwidget = false; + _onshowwidget2 = false; _currentimg = NULL; _mwxwidget = NULL; bbSetInputIn(NULL); diff --git a/bbtk/src/bbmaracasvisuViewerNV.h b/bbtk/src/bbmaracasvisuViewerNV.h index ac9f6a1..4a444c4 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.h +++ b/bbtk/src/bbmaracasvisuViewerNV.h @@ -106,7 +106,6 @@ class /*BBTK_EXPORT*/ ViewerNV BBTK_ON_SHOW_WIDGET(OnShowWidget); void OnShowWidget(); - bool _onshowwidget; std::vector _point; private: -- 2.49.0