From: Eduardo DAVILA Date: Thu, 10 Aug 2017 15:59:45 +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=2e5f20e24f05f896066629e489d825558cdc3cd5;p=creaMaracasVisu.git #3109 creaMaracasVisu Bug New Normal - branch vtk7itk4 compilation with vtk7 --- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/boxSurfaceObserver.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/boxSurfaceObserver.cxx index 9c3760a..36e9c9b 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/boxSurfaceObserver.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/boxSurfaceObserver.cxx @@ -31,6 +31,14 @@ void boxSurfaceObserver::Execute(vtkObject *wdg, unsigned long eventId, void* ca vtkBoxWidget *boxwidget = reinterpret_cast(wdg); boxwidget->GetPlanes(_planes); + if ((_mCubes!=NULL)&&(_tissueStripper!=NULL)&&(_tissueClipper!=NULL)) + { + _mCubes->Update(); + _tissueStripper->Update(); + _tissueClipper->Update(); + } // if surface + + if ( _vtkVolumeRayCastMapper != NULL ) { _vtkVolumeRayCastMapper->RemoveAllClippingPlanes(); @@ -38,7 +46,8 @@ void boxSurfaceObserver::Execute(vtkObject *wdg, unsigned long eventId, void* ca // boxwidget->GetPlanes(planes); // _vtkVolumeRayCastMapper->SetClippingPlanes(planes); _vtkVolumeRayCastMapper->SetClippingPlanes(_planes); - } + } // if volume + // _actor->VisibilityOn(); @@ -57,3 +66,14 @@ void boxSurfaceObserver::SetvtkVolumeRayCastMapper(vtkVolumeRayCastMapper *vtkvo { _vtkVolumeRayCastMapper = vtkvolumeraycastmapper; } + +//------------------------------------------------------------------- +void boxSurfaceObserver::SetFilters(vtkAlgorithm *mCubes , vtkAlgorithm *tissueStripper , vtkAlgorithm *tissueClipper) +{ + _mCubes = mCubes; + _tissueStripper = tissueStripper; + _tissueClipper = tissueClipper; + + +} + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/boxSurfaceObserver.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/boxSurfaceObserver.h index 11e4d59..92892da 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/boxSurfaceObserver.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/boxSurfaceObserver.h @@ -39,10 +39,17 @@ class boxSurfaceObserver : public vtkCommand public: vtkPlanes *_planes; vtkProp *_actor; + + vtkAlgorithm *_mCubes; + vtkAlgorithm *_tissueStripper; + vtkAlgorithm *_tissueClipper; vtkVolumeRayCastMapper *_vtkVolumeRayCastMapper; boxSurfaceObserver() { + _mCubes = NULL; + _tissueStripper = NULL; + _tissueClipper = NULL; _vtkVolumeRayCastMapper = NULL; } @@ -58,8 +65,8 @@ class boxSurfaceObserver : public vtkCommand void SetPlanes(vtkPlanes *planes); void SetActor(vtkProp *actor); void SetvtkVolumeRayCastMapper(vtkVolumeRayCastMapper *vtkvolumeraycastmapper); + void SetFilters(vtkAlgorithm *_mCubes , vtkAlgorithm *_tissueStripper , vtkAlgorithm *_tissueClipper); }; - #endif /*BOXSURFACEOBSERVER_H_*/ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx index 2ecbb5d..646baf2 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx @@ -252,7 +252,7 @@ void vtkClipping3DDataViewer::Configure_Tissue() _tissuePlanes[i] = vtkPlanes::New(); int x1,x2,y1,y2,z1,z2; imagedata->GetExtent(x1,x2,y1,y2,z1,z2); - _tissuePlanes[i]->SetBounds (x1,x2,y1,y2,z1,z2); + _tissuePlanes[i]->SetBounds(x1,x2,y1,y2,z1,z2); _tissueClipper[i] = vtkClipPolyData::New(); _tissueClipper[i]->SetClipFunction( _tissuePlanes[i] ); _tissueClipper[i]->InsideOutOn( ); @@ -262,7 +262,6 @@ void vtkClipping3DDataViewer::Configure_Tissue() _tissueClipper[i]->SetInput( _tissueStripper[i]->GetOutput() ); #else _tissueClipper[i]->SetInputData( _tissueStripper[i]->GetOutput() ); - _tissueClipper[i]->Update(); #endif _tissueMapper[i] = vtkPolyDataMapper::New( ); @@ -271,6 +270,9 @@ void vtkClipping3DDataViewer::Configure_Tissue() #if VTK_MAJOR_VERSION <= 5 _tissueMapper[i]->SetInput( _tissueClipper[i]->GetOutput() ); #else + _mCubes[i]->Update(); + _tissueStripper[i]->Update(); + _tissueClipper[i]->Update(); _tissueMapper[i]->SetInputData( _tissueClipper[i]->GetOutput() ); _tissueMapper[i]->Update(); #endif @@ -290,19 +292,19 @@ void vtkClipping3DDataViewer::Configure_Tissue() _tissue[i]->GetProperty()->SetSpecular(.3); _tissue[i]->GetProperty()->SetSpecularPower(20); _tissue[i]->GetProperty()->SetOpacity(0.5); - if (i==0) _tissue[i]->GetProperty()->SetColor(0.85, 0.85 , 0.85 ); - if (i==1) _tissue[i]->GetProperty()->SetColor(0, 0 , 1 ); - if (i==2) _tissue[i]->GetProperty()->SetColor(0.85, 0.20 , 0.20 ); - if (i==3) _tissue[i]->GetProperty()->SetColor(0, 1 , 0 ); - } + if (i==0) { _tissue[i]->GetProperty()->SetColor(0.85, 0.85 , 0.85 ); } + if (i==1) { _tissue[i]->GetProperty()->SetColor(0, 0 , 1 ); } + if (i==2) { _tissue[i]->GetProperty()->SetColor(0.85, 0.20 , 0.20 ); } + if (i==3) { _tissue[i]->GetProperty()->SetColor(0, 1 , 0 ); } + } // for for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++) { _observerS[i] = boxSurfaceObserver::New(); _observerS[i]->SetPlanes( GetTissuePlanes(i) ); _observerS[i]->SetActor( _tissue[i] ); - } - + _observerS[i]->SetFilters( _mCubes[i], _tissueStripper[i] ,_tissueClipper[i] ); + } // for } //----------------------------------------------------------------------------- @@ -532,6 +534,14 @@ void vtkClipping3DDataViewer::Configure() void vtkClipping3DDataViewer::SetIsovalue(int idTissue, int isoValue) { _mCubes[idTissue]->SetValue(0, isoValue); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + // .. +#else + _mCubes[idTissue]->Update(); + _tissueStripper[idTissue]->Update(); + _tissueClipper[idTissue]->Update(); +#endif } //------------------------------------------------------------------- double vtkClipping3DDataViewer::GetIsovalue(int idTissue) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx index 4fd2218..b41609e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx @@ -173,8 +173,6 @@ void wxVtkClipping3DView::Configure() _boxWidgetS1->SetInteractor( _wxvtk3Dbaseview->GetWxVTKRenderWindowInteractor() ); _boxWidgetS1->SetPlaceFactor(1.25); - - vtkStripper *stripper=_vtkclipping3Ddataviewer->GetTissueStripper(0); vtkPolyData *polydata= stripper->GetOutput(); @@ -182,6 +180,7 @@ void wxVtkClipping3DView::Configure() #if VTK_MAJOR_VERSION <= 5 _boxWidgetS1->SetInput( polydata ); #else + stripper->Update(); _boxWidgetS1->SetInputData( polydata ); #endif @@ -265,6 +264,7 @@ void wxVtkClipping3DView::Configure() _vtkclipping3Ddataviewer->SetRenderer(this->GetWxvtk3Dbaseview()->GetRenderer()); _vtkclipping3Ddataviewer->SetInteractor(this->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()); } + //------------------------------------------------------------------- void wxVtkClipping3DView::SetVtkClipping3DDataViewer(vtkClipping3DDataViewer *vtkclipping3Ddataviewer) {