From: Eduardo DAVILA Date: Thu, 10 Aug 2017 13:37:26 +0000 (+0200) Subject: #3109 creaMaracasVisu Bug New Normal - branch vtk7itk4 compilation with vtk7 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=2ce64803a106514923d7e06e578f9b1ae3cfe264;p=creaMaracasVisu.git #3109 creaMaracasVisu Bug New Normal - branch vtk7itk4 compilation with vtk7 --- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx index 68f8c2b..2ecbb5d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx @@ -262,7 +262,6 @@ void vtkClipping3DDataViewer::Configure_Tissue() _tissueClipper[i]->SetInput( _tissueStripper[i]->GetOutput() ); #else _tissueClipper[i]->SetInputData( _tissueStripper[i]->GetOutput() ); - printf("EED vtkClipping3DDataViewer::Configure_Tissue Update\n"); _tissueClipper[i]->Update(); #endif diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkmyPWCallback_3DPointWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkmyPWCallback_3DPointWidget.cxx index c82d0d8..1d20277 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkmyPWCallback_3DPointWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkmyPWCallback_3DPointWidget.cxx @@ -46,6 +46,14 @@ void vtkmyPWCallback_3DPointWidget::Execute(vtkObject *caller, unsigned long, vo _planeWidget->GetCenter(p); _planeWidget->GetNormal(n); _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetNormal(n[0],n[1],n[2]); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + //.. +#else + _planeWidget->GetPolyData(_vtkplane); + _probe->Update(); +#endif + } double spc[3]; @@ -100,3 +108,17 @@ void vtkmyPWCallback_3DPointWidget::SetVtkPlaneWidget( vtkPlaneWidget *planeWidg _planeWidget=planeWidget; } +//------------------------------------------------------------------- + void vtkmyPWCallback_3DPointWidget::SetVtkPolyData( vtkPolyData *vtkplane) +{ + _vtkplane=vtkplane; +} + +//------------------------------------------------------------------- +void vtkmyPWCallback_3DPointWidget::SetVtkProbeFilter( vtkProbeFilter *probe) +{ + _probe=probe; +} + + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkmyPWCallback_3DPointWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkmyPWCallback_3DPointWidget.h index 465e9ca..85de5dc 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkmyPWCallback_3DPointWidget.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkmyPWCallback_3DPointWidget.h @@ -43,13 +43,20 @@ public: void SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview ); void SetVtkPointWidget( vtkPointWidget *pointWidget ); void SetVtkPlaneWidget( vtkPlaneWidget *planeWidget ); + + void SetVtkPolyData( vtkPolyData *vtkplane); + void SetVtkProbeFilter( vtkProbeFilter *probe); + private: double _backNormal[3]; vtkPlaneWidget *_planeWidget; + vtkPointWidget *_pointWidget; - wxVtkMPR3DView *_wxvtkmpr3Dview; + vtkPolyData *_vtkplane; + vtkProbeFilter *_probe; + + wxVtkMPR3DView *_wxvtkmpr3Dview; }; - #endif /*VTKMYPWCALLBACK_3DPOINTWIDGET_H_*/ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx index eae1fb6..87b4fa3 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx @@ -56,14 +56,14 @@ wxVtkMPR2DView::wxVtkMPR2DView( wxWindow *parent, int direction) //------------------------------------------------------------------- wxVtkMPR2DView::~wxVtkMPR2DView() { - if (_ptsA!=NULL) { _ptsA -> Delete(); } - if (_lineAActor!=NULL) { _lineAActor -> Delete(); } - if (_lineAMapper!=NULL) { _lineAMapper -> Delete(); } - if (_pdA!=NULL) { _pdA -> Delete(); } - if (_ptsB!=NULL) { _ptsB -> Delete(); } - if (_lineBActor!=NULL) { _lineBActor -> Delete(); } - if (_lineBMapper!=NULL) { _lineBMapper -> Delete(); } - if (_pdB!=NULL) { _pdB -> Delete(); } + if (_ptsA!=NULL) { _ptsA->Delete(); } + if (_lineAActor!=NULL) { _lineAActor->Delete(); } + if (_lineAMapper!=NULL) { _lineAMapper->Delete(); } + if (_pdA!=NULL) { _pdA->Delete(); } + if (_ptsB!=NULL) { _ptsB->Delete(); } + if (_lineBActor!=NULL) { _lineBActor->Delete(); } + if (_lineBMapper!=NULL) { _lineBMapper->Delete(); } + if (_pdB!=NULL) { _pdB->Delete(); } } //------------------------------------------------------------------- vtkMPRBaseData *wxVtkMPR2DView::GetVtkmprbasedata() @@ -360,6 +360,15 @@ void wxVtkMPR2DView::Refresh() } // if back + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + // .. +#else + _ptsA->Modified(); + _ptsB->Modified(); +#endif + _backX=xx; _backY=yy; _backZ=zz; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.h index 11e0030..7a66d83 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.h @@ -47,7 +47,6 @@ public: vtkMPRBaseData *GetVtkmprbasedata(); virtual int GetActualSlice(); virtual void SetActualSlice(int slice); - bool IfMouseTouchX(double x, double y, double z); bool IfMouseTouchY(double x, double y, double z); bool IfMouseTouchZ(double x, double y, double z); @@ -56,20 +55,14 @@ public: void MoveZ(double x, double y, double z); void ChangeAxisColor(double x, double y, double z); virtual void TransFromCoordScreenToWorld(double &X, double &Y, double &Z, bool keepNormalDirection=false, int type=2); - void SetVisibleAxis(bool ok); virtual int GetDirection(); - - private: - int _backX; int _backY; int _backZ; - bool _visibleAxis; - int _direction; vtkPoints *_ptsA; vtkActor *_lineAActor; @@ -83,5 +76,4 @@ private: vtkInteractorStyleMPRView *_interactorstylemprview; }; - #endif /*WXVTKMPR2DVIEW_H_*/ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index a55a101..d6fb6a5 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -186,36 +186,16 @@ void wxVtkMPR3DView::RemoveActor(vtkActor* actor) void wxVtkMPR3DView::Configure() { vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); - _wxvtk3Dbaseview->Configure(); _wxvtkmpr3DviewCntrlPanel->UpdateControlPanel(); - -//EED 27 Mai 2009 -// _wxvtk3Dbaseview->GetRenderer()->Clear(); - // Actors are added to the renderer. vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor(); - - _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor ); - -// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(0) ); // _saggital -// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(1) ); // _axial -// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(2) ); // _coronal - - - - // vtkPointWidget - //if(_myCallback!=NULL){ - //_myCallback->Delete(); - - //} vtkmyPWCallback_3DPointWidget *_myCallback = vtkmyPWCallback_3DPointWidget::New(); _myCallback->SetWxVtkMPR3DView(this); - - if(imageData){ - if(_pointWidget==NULL){ + if(_pointWidget==NULL) + { _pointWidget = vtkPointWidget::New(); } //EED 2017-01-01 Migration VTK7 @@ -258,18 +238,21 @@ void wxVtkMPR3DView::Configure() _planeWidget->PlaceWidget( px-dd , px+dd , py-dd , py+dd , pz-dd , pz+dd ); if(_vtkplane==NULL){ - _vtkplane = vtkPolyData::New(); - - _probe = vtkProbeFilter::New(); - _contourMapper = vtkPolyDataMapper::New(); - + _vtkplane = vtkPolyData::New(); + _probe = vtkProbeFilter::New(); + _contourMapper = vtkPolyDataMapper::New(); //EED 2017-01-01 Migration VTK7 #if VTK_MAJOR_VERSION <= 5 _probe->SetInput(_vtkplane); _contourMapper->SetInput( _probe->GetPolyDataOutput() ); #else + _myCallback->SetVtkPolyData(_vtkplane); + _myCallback->SetVtkProbeFilter(_probe); + _planeWidget->GetPolyData(_vtkplane); _probe->SetInputData(_vtkplane); + _probe->SetSourceData(imageData); +// _probe->Update(); _contourMapper->SetInputData( _probe->GetPolyDataOutput() ); #endif @@ -611,6 +594,12 @@ void wxVtkMPR3DView::RefreshView() // virtual _planeWidget->SetCenter( x,y,z ); _planeWidget->UpdatePlacement(); _planeWidget->GetPolyData(_vtkplane); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + // .. +#else + _probe->Update(); +#endif } if (_wxvtkmpr3DviewCntrlPanel!=NULL) @@ -690,9 +679,9 @@ void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){ // step 5 Refresh _wxvtk3Dbaseview->GetRenderer()->GetRenderWindow()->Render(); - } + } // if visible _vtkmpr3Ddataviewer->SetVisiblePosition(idPosition,visible); - } + } // if visible } @@ -705,8 +694,8 @@ void wxVtkMPR3DView::VisiblePointWidget( bool visible ) _pointWidget->On(); } else { _pointWidget->Off(); - } - } + } // visible + } // _pointWidget } //------------------------------------------------------------------- @@ -720,9 +709,10 @@ void wxVtkMPR3DView::VisiblePlaneWidget( bool visible ) } else { _planeWidget->Off(); - _contourPlaneActor->VisibilityOff(); - } - } + _contourPlaneActor->VisibilityOff(); + } // if visible + _wxvtk3Dbaseview->GetRenderer()->GetRenderWindow()->Render(); + } // _planeWidget } //CPR: Method added 30 Nov 2009 @@ -733,11 +723,9 @@ void wxVtkMPR3DView::showOutlineActor(bool value) if(value == true) { _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor ); - } - else - { + } else { _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _outlineActor ); - } + } // value } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h index a46afe6..4d42b26 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h @@ -76,7 +76,6 @@ public: void setColorTransferFunction(vtkColorTransferFunction* colortable); - //Free planes //------------------------------------------------------------------- void ConfigureFreePlanes(); @@ -88,7 +87,6 @@ public: void SetColorWindow(double colorWindow); void SetColorLevel(double colorLevel); - private: wxVtk3DBaseView *_wxvtk3Dbaseview; vtkMPR3DDataViewer *_vtkmpr3Ddataviewer; @@ -106,11 +104,10 @@ private: vtkPolyDataMapper *_contourMapper; //Free planes - vtkImagePlaneWidget *_planeWidgetX; - vtkImagePlaneWidget *_planeWidgetY; - vtkImagePlaneWidget *_planeWidgetZ; + vtkImagePlaneWidget *_planeWidgetX; + vtkImagePlaneWidget *_planeWidgetY; + vtkImagePlaneWidget *_planeWidgetZ; - protected: }; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx index 790d3bc..b07233c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx @@ -568,7 +568,6 @@ void wxVtkMPR3DViewCntrlPanel::OnVisibleAxisXYZ(wxCommandEvent& event) void wxVtkMPR3DViewCntrlPanel::OnVisiblePlane(wxCommandEvent& event) { _wxvtkmpr3Dview->VisiblePlaneWidget(event.IsChecked()); - } //-------------------------------------------------------------------