From 97dee12beaba08089198ed7bab9544b8b4c4f240 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Mon, 22 Aug 2016 16:23:02 +0200 Subject: [PATCH] #3009 creaMaracasVisu Feature New Normal - Interpolate option in box ViewerNV --- bbtk/bbs/boxes/Measure3DLength_Widget.bbg | 4 +- bbtk/bbs/boxes/Measure3DLength_Widget.bbs | 1 + bbtk/src/bbmaracasvisuViewerNV.cxx | 21 +++------- bbtk/src/bbmaracasvisuViewerNV.h | 3 ++ .../widgets/wxMaracas_N_ViewersWidget.cxx | 9 +++++ .../widgets/wxMaracas_N_ViewersWidget.h | 3 ++ .../widgets/wxMaracas_ViewerWidget.cxx | 39 +++++++++--------- .../wxWindows/widgets/wxVtkClipping3DView.cxx | 40 ++++++++++--------- .../wxWindows/widgets/wxVtkClipping3DView.h | 36 ++++++++--------- 9 files changed, 84 insertions(+), 72 deletions(-) diff --git a/bbtk/bbs/boxes/Measure3DLength_Widget.bbg b/bbtk/bbs/boxes/Measure3DLength_Widget.bbg index dd5cf9a..518189e 100644 --- a/bbtk/bbs/boxes/Measure3DLength_Widget.bbg +++ b/bbtk/bbs/boxes/Measure3DLength_Widget.bbg @@ -49,7 +49,7 @@ BOX creaMaracasVisu:ShowNPoints:Box31 ISEXEC:FALSE -19.500275:46.578993:-900.000000 -28.819725:36.578993:-900.000000 +41.139725:36.578993:-900.000000 FIN_BOX BOX wx:LayoutSplit:Box32 @@ -58,6 +58,8 @@ ISEXEC:FALSE -43.295549:-113.442289:-900.000000 PORT Proportion:"10" +PORT +WinTitle:"Measure" FIN_BOX BOX wx:LayoutTab:Box33 diff --git a/bbtk/bbs/boxes/Measure3DLength_Widget.bbs b/bbtk/bbs/boxes/Measure3DLength_Widget.bbs index 2d9d86a..c73b963 100644 --- a/bbtk/bbs/boxes/Measure3DLength_Widget.bbs +++ b/bbtk/bbs/boxes/Measure3DLength_Widget.bbs @@ -25,6 +25,7 @@ new creaMaracasVisu:ShowNPoints Box31 new wx:LayoutSplit Box32 set Box32.Proportion "10" + set Box32.WinTitle "Measure" new wx:LayoutTab Box33 diff --git a/bbtk/src/bbmaracasvisuViewerNV.cxx b/bbtk/src/bbmaracasvisuViewerNV.cxx index a191017..fd98d87 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.cxx +++ b/bbtk/src/bbmaracasvisuViewerNV.cxx @@ -86,38 +86,31 @@ 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)){ + if(img != NULL && _mwxwidget != NULL) + { + if(!compareVectors(type, _currenttype)) + { _mwxwidget->SetType(&type); _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); - // WxBlackBox::Process(); // mwxwidget->SetImage(img ); 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 ); @@ -126,19 +119,15 @@ void ViewerNV::Process() 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) @@ -148,6 +137,7 @@ void ViewerNV::Process() _mwxwidget->SetColorWindowLevel( bbGetInputWindowLevel() , bbGetInputColorLevel() ); } } + _mwxwidget->SetInterpolate( bbGetInputInterpolate() ); }// mwxwidget != NULL } @@ -174,6 +164,7 @@ void ViewerNV::bbUserSetDefaultValues() bbSetInputObs3(NULL); bbSetInputObs4(NULL); bbSetInputObs5(NULL); + bbSetInputInterpolate(true); std::vector vecNTypeViwer; vecNTypeViwer.push_back(5); diff --git a/bbtk/src/bbmaracasvisuViewerNV.h b/bbtk/src/bbmaracasvisuViewerNV.h index 9d3eb7d..0846f82 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.h +++ b/bbtk/src/bbmaracasvisuViewerNV.h @@ -80,6 +80,8 @@ class /*BBTK_EXPORT*/ ViewerNV BBTK_DECLARE_INPUT(Obs3, vtkInteractorObserver *); BBTK_DECLARE_INPUT(Obs4, vtkInteractorObserver *); BBTK_DECLARE_INPUT(Obs5, vtkInteractorObserver *); + BBTK_DECLARE_INPUT(Interpolate, bool); + BBTK_DECLARE_OUTPUT(wxVtkBaseView1,wxVtkBaseView*); BBTK_DECLARE_OUTPUT(wxVtkBaseView2,wxVtkBaseView*); @@ -124,6 +126,7 @@ BBTK_DESCRIPTION("Viewer : N view configuration 2D and 3D"); BBTK_INPUT(ViewerNV,Obs3,"Optional: set a different Color level by using an other widget",vtkInteractorObserver*,""); BBTK_INPUT(ViewerNV,Obs4,"Optional: set a different Color level by using an other widget",vtkInteractorObserver*,""); BBTK_INPUT(ViewerNV,Obs5,"Optional: set a different Color level by using an other widget",vtkInteractorObserver*,""); + BBTK_INPUT(ViewerNV,Interpolate,"Interpolate true/false (default true)",bool,""); BBTK_OUTPUT(ViewerNV,wxVtkBaseView1,"wxVtkBaseView 1",wxVtkBaseView *,""); BBTK_OUTPUT(ViewerNV,wxVtkBaseView2,"wxVtkBaseView 2",wxVtkBaseView *,""); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx index ed4001b..75fa8c3 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx @@ -438,3 +438,12 @@ void wxMaracas_N_ViewersWidget::SetColorWindowLevel(double colorWindow, double c RefreshView(); } +//----------------------------------------------------------------------------------- +void wxMaracas_N_ViewersWidget::SetInterpolate(bool interpolate) +{ + mvtkmprbasedata->SetInterpolate(interpolate); + RefreshView(); +} + + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h index 1495dc1..4d0223c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h @@ -132,6 +132,9 @@ class creaMaracasVisu_EXPORT wxMaracas_N_ViewersWidget : public wxPanel void setColorTransferFunction(vtkColorTransferFunction* colortable); void SetColorWindowLevel(double colorWindow, double colorLevel); + void SetInterpolate(bool interpolate); + + //------------------------------------------------------------------------------------------------------------ // Attributes //------------------------------------------------------------------------------------------------------------ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx index de0a52f..f5cce00 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx @@ -55,15 +55,16 @@ wxMaracas_ViewerWidget::wxMaracas_ViewerWidget(wxWindow *parent, vtkImageData* imagedata, int type, vtkMPRBaseData *vtkmprbasedata) : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL) { - wxPanel *panel = this; - wxWindow *wxwindow = NULL, *window3D = 0; - wxSplitterWindow *panelClipping3D= 0; -// wxPanel *panelControl = 0; -// wxFlexGridSizer *sizerCtrol = 0; - wxPanel *controlPanelMPR3D = 0; - wxPanel *controlPanelClippingSurf3D = 0; + wxPanel *panel = this; + wxWindow *wxwindow = NULL; + wxWindow *window3D = NULL; + wxSplitterWindow *panelClipping3D = NULL; +// wxPanel *panelControl = NULL; +// wxFlexGridSizer *sizerCtrol = NULL; + wxPanel *controlPanelMPR3D = NULL; + wxPanel *controlPanelClippingSurf3D = NULL; //RaC 03-2010 Adding a tab - wxPanel *controlPanelClippingVol3D = 0; + wxPanel *controlPanelClippingVol3D = NULL; wxBoxSizer *sizer = 0; @@ -80,17 +81,17 @@ mvtkmprbasedata = vtkmprbasedata; } - mvtk2Dbaseview = NULL; - mvtkmpr2Dview_X = NULL; - mvtkmpr2Dview_Y = NULL; - mvtkmpr2Dview_Z = NULL; - mvtkplane2Dview = NULL; - mwidgetMesure = NULL; - mwxsphereview = NULL; - mwxvtkclipping3Dview = NULL; - mwxvtk3Dbaseview_Clipping3D = NULL; - mwxvtkmpr3Dview = NULL; - vtkmpr3Ddataviewer = NULL; + mvtk2Dbaseview = NULL; + mvtkmpr2Dview_X = NULL; + mvtkmpr2Dview_Y = NULL; + mvtkmpr2Dview_Z = NULL; + mvtkplane2Dview = NULL; + mwidgetMesure = NULL; + mwxsphereview = NULL; + mwxvtkclipping3Dview = NULL; + mwxvtk3Dbaseview_Clipping3D = NULL; + mwxvtkmpr3Dview = NULL; + vtkmpr3Ddataviewer = NULL; if (type==-1) { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx index a53f035..84c3c60 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx @@ -42,30 +42,35 @@ wxVtkClipping3DView::wxVtkClipping3DView(wxVtk3DBaseView* wxvtk3Dbaseview) //------------------------------------------------------------------- wxVtkClipping3DView::~wxVtkClipping3DView() { - if (_boxWidgetVolume!=NULL) { _boxWidgetVolume -> Delete(); } - if (_boxWidgetS1!=NULL) { _boxWidgetS1 -> Delete(); } + if (_boxWidgetVolume!=NULL) { _boxWidgetVolume -> Delete(); } + if (_boxWidgetS1!=NULL) { _boxWidgetS1 -> Delete(); } if (_vtkclipping3Ddataviewer!=NULL) { delete _vtkclipping3Ddataviewer; } if (_wxvtkclipping3DviewCntrlPanel!=NULL){ delete _wxvtkclipping3DviewCntrlPanel; } } + //------------------------------------------------------------------- void wxVtkClipping3DView::SetVisibleBoxSurface(bool visible) { - if (visible==true){ + if (visible==true) + { _boxWidgetS1->On(); } else { _boxWidgetS1->Off(); } } + //------------------------------------------------------------------- void wxVtkClipping3DView::VisibleVolumeBoxActor(bool visible) { - if (visible!=_vtkclipping3Ddataviewer->GetVisibleVolumeBox() ){ + if (visible!=_vtkclipping3Ddataviewer->GetVisibleVolumeBox() ) + { VisibleVolumeActor(!visible); _vtkclipping3Ddataviewer->BoxActorChanged(visible); _vtkclipping3Ddataviewer->SetVisibleVolumeBox(visible); _vtkclipping3Ddataviewer->SetVisibleVolume(!visible); } } + //------------------------------------------------------------------- void wxVtkClipping3DView::Refresh() { @@ -75,6 +80,7 @@ void wxVtkClipping3DView::Refresh() _wxvtkclipping3DviewCntrlPanel->Refresh(); } } + //------------------------------------------------------------------- wxPanel* wxVtkClipping3DView::CreateSurfControlPanel(wxWindow *parent) { @@ -90,12 +96,12 @@ wxPanel* wxVtkClipping3DView::CreateVolControlPanel(wxWindow *parent) return _wxvtkclipping3DviewVolCntrlPanel; } - //------------------------------------------------------------------- vtkClipping3DDataViewer* wxVtkClipping3DView::GetVtkClipping3DDataViewer() { return _vtkclipping3Ddataviewer; } + //------------------------------------------------------------------- void wxVtkClipping3DView::VisibleActor(int idTissue, bool visTissue){ if (visTissue!=_vtkclipping3Ddataviewer->GetVisibleTissue(idTissue)){ @@ -109,6 +115,7 @@ void wxVtkClipping3DView::VisibleActor(int idTissue, bool visTissue){ _vtkclipping3Ddataviewer->SetVisibleTissue(idTissue,visTissue); } } + //------------------------------------------------------------------- void wxVtkClipping3DView::SetRepSurfaceWireFrame(int idTissue , bool representationType ) { @@ -145,6 +152,7 @@ void wxVtkClipping3DView::VisibleVolumeActor( bool visVolume){ } } + //------------------------------------------------------------------- wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()throw(char*) { @@ -153,6 +161,7 @@ wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()throw(char*) } return _wxvtk3Dbaseview; } + //------------------------------------------------------------------- void wxVtkClipping3DView::Configure() { @@ -172,7 +181,12 @@ void wxVtkClipping3DView::Configure() _boxWidgetS1->SetInput( polydata ); - _boxWidgetS1->PlaceWidget(); + +//EED 2016-08-19 + //_boxWidgetS1->PlaceWidget(); + int ext[6]; + this->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData()->GetExtent(ext); + _boxWidgetS1->PlaceWidget(ext[0],ext[1],ext[2],ext[3],ext[4],ext[5]); int i; for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++) @@ -180,9 +194,6 @@ void wxVtkClipping3DView::Configure() _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent, _vtkclipping3Ddataviewer->GetObserverS(i) ); } - - - // _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(0) ); // _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(3)); @@ -195,7 +206,6 @@ void wxVtkClipping3DView::Configure() //EED 29Mars2009 // _boxWidgetS1->On(); - _boxWidgetS1->Off(); _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(0) ); @@ -208,24 +218,18 @@ void wxVtkClipping3DView::Configure() _boxWidgetVolume = vtkBoxWidget::New(); _boxWidgetVolume->SetInteractor( _wxvtk3Dbaseview->GetWxVTKRenderWindowInteractor() ); _boxWidgetVolume->SetPlaceFactor(1.25); - _boxWidgetVolume->SetInput( this->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData() ); _boxWidgetVolume->PlaceWidget(); - - _boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent , _vtkclipping3Ddataviewer->GetObserverV() ); - + _boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent, _vtkclipping3Ddataviewer->GetObserverV() ); _boxWidgetVolume->HandlesOn (); //EED 29Mars2009 // _boxWidgetVolume->On(); - _boxWidgetVolume->Off(); - // vtkPlanes *vtkplanes=this->GetVtkClipping3DDataViewer()->GetVolumePlanes(); // _boxWidgetVolume->GetPlanes( vtkplanes ); - //EED 27/05/2013 // _wxvtk3Dbaseview->GetRenderer()->ResetCamera (); // _wxvtk3Dbaseview->GetCamera()->Dolly(1.2); @@ -250,8 +254,6 @@ void wxVtkClipping3DView::Configure() _vtkclipping3Ddataviewer->SetRenderer(this->GetWxvtk3Dbaseview()->GetRenderer()); _vtkclipping3Ddataviewer->SetInteractor(this->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()); - - } //------------------------------------------------------------------- void wxVtkClipping3DView::SetVtkClipping3DDataViewer(vtkClipping3DDataViewer *vtkclipping3Ddataviewer) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.h index 8e7f4bb..c3c2451 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.h @@ -41,39 +41,39 @@ public: virtual ~wxVtkClipping3DView(); virtual void Refresh(); virtual void Configure(); - void SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer ); + void SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer ); - wxPanel* CreateSurfControlPanel(wxWindow *parent); - wxPanel* CreateVolControlPanel(wxWindow *parent); + wxPanel* CreateSurfControlPanel(wxWindow *parent); + wxPanel* CreateVolControlPanel(wxWindow *parent); vtkClipping3DDataViewer* GetVtkClipping3DDataViewer(); - void VisibleActor(int idTissue, bool visTissue); - void VisibleVolumeActor( bool visVolume ); + void VisibleActor(int idTissue, bool visTissue); + void VisibleVolumeActor( bool visVolume ); - void VisibleVolumeBoxActor(bool visible); + void VisibleVolumeBoxActor(bool visible); - void SetVisibleBoxSurface(bool visible); - void SetVisibleBoxVolume(bool visible); - void SetRepSurfaceWireFrame(int idTissue , bool typeRepresentation ); + void SetVisibleBoxSurface(bool visible); + void SetVisibleBoxVolume(bool visible); + void SetRepSurfaceWireFrame(int idTissue , bool typeRepresentation ); wxVtk3DBaseView* GetWxvtk3Dbaseview()throw(char*); - void SetRayCasting(bool active); - void SetMIPActive(bool active); - void SetInterpolation(bool active); - void SetShade(bool active); + void SetRayCasting(bool active); + void SetMIPActive(bool active); + void SetInterpolation(bool active); + void SetShade(bool active); - void UpdateVolumeBox(vector gf, vector vf, vtkColorTransferFunction* ctfun); + void UpdateVolumeBox(vector gf, vector vf, vtkColorTransferFunction* ctfun); private: wxVtk3DBaseView *_wxvtk3Dbaseview; vtkClipping3DDataViewer *_vtkclipping3Ddataviewer; - vtkBoxWidget *_boxWidgetS1; - vtkBoxWidget *_boxWidgetVolume; - wxPanel *_wxvtkclipping3DviewCntrlPanel; - wxPanel *_wxvtkclipping3DviewVolCntrlPanel; + vtkBoxWidget *_boxWidgetS1; + vtkBoxWidget *_boxWidgetVolume; + wxPanel *_wxvtkclipping3DviewCntrlPanel; + wxPanel *_wxvtkclipping3DviewVolCntrlPanel; protected: }; -- 2.47.1