X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxVtkMPR3DView.cxx;h=c32af32beebcf1a55bbb18e809e228ad4918f6f7;hb=80b04dc9e3b981e24fe9ae0d81cdeb8af6e6f8c1;hp=69ffc56b9d505a6dc4c80d0dd9f9cf6df2dbe4ea;hpb=69c806e632999e11e12e8626609f4192d3aec364;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index 69ffc56..c32af32 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -142,14 +142,17 @@ wxVtkMPR3DView::wxVtkMPR3DView( wxVtk3DBaseView *wxvtk3Dbaseview ) wxVtkMPR3DView::~wxVtkMPR3DView() { VisiblePointWidget( false ); - VisiblePlaneWidget( false ); - if(_pointWidget!=NULL){ +// VisiblePlaneWidget( false ); + if(_pointWidget!=NULL) + { _pointWidget->Delete(); } - if(_planeWidget!=NULL){ + if(_planeWidget!=NULL) + { _planeWidget->Delete(); } - if(_vtkplane!=NULL){ + if(_vtkplane!=NULL) + { _vtkplane->Delete(); _probe->Delete(); _contourMapper->Delete(); @@ -168,18 +171,10 @@ 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){ @@ -187,7 +182,12 @@ void wxVtkMPR3DView::Configure() { _pointWidget = vtkPointWidget::New(); } +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _pointWidget->SetInput( imageData ); +#else + _pointWidget->SetInputData( imageData ); +#endif _myCallback->SetVtkPointWidget(_pointWidget); _pointWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() ); _pointWidget->AllOff(); @@ -197,7 +197,13 @@ void wxVtkMPR3DView::Configure() { _planeWidget = vtkPlaneWidget::New(); } +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _planeWidget->SetInput( imageData ); +#else + _planeWidget->SetInputData( imageData ); +#endif + _myCallback->SetVtkPlaneWidget(_planeWidget); _planeWidget->NormalToXAxisOn(); _planeWidget->SetResolution(50); @@ -209,12 +215,26 @@ void wxVtkMPR3DView::Configure() int pz=(dim[2]/2); int dd=20; _planeWidget->PlaceWidget( px-dd , px+dd , py-dd , py+dd , pz-dd , pz+dd ); - if(_vtkplane==NULL){ - _vtkplane = vtkPolyData::New(); - _probe = vtkProbeFilter::New(); + if(_vtkplane==NULL) + { + _vtkplane = vtkPolyData::New(); + _probe = vtkProbeFilter::New(); + _contourMapper = vtkPolyDataMapper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _probe->SetInput(_vtkplane); - _contourMapper = vtkPolyDataMapper::New(); _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 + _contourPlaneActor = vtkActor::New(); _contourPlaneActor->SetMapper(_contourMapper); _contourPlaneActor->VisibilityOff(); @@ -224,7 +244,13 @@ void wxVtkMPR3DView::Configure() _wxvtk3Dbaseview->GetRenderer()->AddActor( _contourPlaneActor ); } _planeWidget->GetPolyData(_vtkplane); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _probe->SetSource( imageData ); +#else + _probe->SetSourceData( imageData ); +#endif _contourMapper->SetScalarRange( imageData->GetScalarRange() ); ConfigureFreePlanes(); } @@ -296,11 +322,20 @@ void wxVtkMPR3DView::SetImage() { vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); // Orthogonal planes B&W +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _planeWidgetX->SetInput( imageData ); _planeWidgetY->SetInput( imageData ); _planeWidgetZ->SetInput( imageData ); // -- Plane widget _probe->SetSource( imageData ); +#else + _planeWidgetX->SetInputData( imageData ); + _planeWidgetY->SetInputData( imageData ); + _planeWidgetZ->SetInputData( imageData ); + // -- Plane widget + _probe->SetSourceData( imageData ); +#endif _vtkmpr3Ddataviewer->SetImage(); } @@ -317,7 +352,13 @@ vtkImagePlaneWidget* wxVtkMPR3DView::GetPlaneWidget(unsigned char activationkey, double xSpacing = 0, ySpacing = 0, zSpacing = 0; if(image) { + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 planeWidget->SetInput( image ); +#else + planeWidget->SetInputData( image ); +#endif image->GetExtent(xMin, xMax, yMin, yMax, zMin, zMax); image->GetSpacing(xSpacing, ySpacing, zSpacing); } @@ -419,7 +460,7 @@ void wxVtkMPR3DView::FreePlaneInteraction(bool ok) _planeWidgetY->InteractionOff(); _planeWidgetZ->InteractionOff(); } - } // if _planeWidgetX + } // if _planeWidgetXVisiblePointWidget } @@ -502,7 +543,12 @@ void wxVtkMPR3DView::RefreshView() // virtual if(_pointWidget) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _pointWidget->SetInput( image ); +#else + _pointWidget->SetInputData( image ); +#endif _pointWidget->PlaceWidget(); _pointWidget->SetPosition( x,y,z ); @@ -515,6 +561,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) @@ -594,9 +646,9 @@ void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){ // step 5 Refresh _wxvtk3Dbaseview->GetRenderer()->GetRenderWindow()->Render(); - } + } // if visible _vtkmpr3Ddataviewer->SetVisiblePosition(idPosition,visible); - } + } // if visible } @@ -609,8 +661,8 @@ void wxVtkMPR3DView::VisiblePointWidget( bool visible ) _pointWidget->On(); } else { _pointWidget->Off(); - } - } + } // visible + } // _pointWidget } //------------------------------------------------------------------- @@ -624,9 +676,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 @@ -638,7 +691,7 @@ void wxVtkMPR3DView::showOutlineActor(bool value) _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor ); } else { _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _outlineActor ); - } + } // value } //------------------------------------------------------------------- @@ -680,7 +733,12 @@ void wxVtkMPR3DView::TestLoic1() double spc[3]; vtkimagedata->GetSpacing(spc); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 vtkimagedata->Update(); +#else + // .. +#endif double p[3], n[3]; @@ -700,20 +758,41 @@ void wxVtkMPR3DView::TestLoic1() pSource->Update( ); vtkProbeFilter* slices = vtkProbeFilter::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 slices->SetInput( ( vtkDataSet* )pSource->GetOutput( ) ); slices->SetSource( vtkimagedata ); slices->Update( ); pSource->Delete( ); +#else + slices->SetInputData( ( vtkDataSet* )pSource->GetOutput( ) ); + slices->SetSourceData( vtkimagedata ); +#endif vtkStructuredPoints *stPoints = vtkStructuredPoints::New(); stPoints -> GetPointData( )->SetScalars( slices->GetOutput()->GetPointData()->GetScalars() ); stPoints -> SetDimensions( sizeIma, sizeIma, 1 ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 stPoints -> SetScalarType( vtkimagedata->GetScalarType() ); stPoints -> SetScalarTypeToShort(); stPoints -> Update(); +#else + vtkInformation* info=stPoints->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(info, VTK_SHORT, 1); +#endif + + vtkImageChangeInformation *change = vtkImageChangeInformation ::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 change -> SetInput( stPoints ); +#else + change -> SetInputData( stPoints ); +#endif change -> Update(); //important double _range[2]; @@ -737,7 +816,12 @@ void wxVtkMPR3DView::TestLoic1() vtkMetaImageWriter *writer = vtkMetaImageWriter::New( ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 writer->SetInput( stPoints ); +#else + writer->SetInputData( stPoints ); +#endif writer->SetFileName( "C:/Users/Images/temp_EED/image.mhd" ); writer->SetFileDimensionality( 2 ); writer->Write( ); @@ -745,7 +829,14 @@ void wxVtkMPR3DView::TestLoic1() vtkDataSetMapper *_3DSliceMapper = vtkDataSetMapper::New( ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _3DSliceMapper->SetInput(change->GetOutput( ) ); +#else + _3DSliceMapper->SetInputData(change->GetOutput( ) ); +#endif + _3DSliceMapper->SetLookupTable( _bwlookup ); _3DSliceMapper->SetScalarRange( _range ); _3DSliceMapper->ImmediateModeRenderingOn( ); @@ -798,14 +889,24 @@ void wxVtkMPR3DView::TestLoic2() vtkCutter* sliceCutter = vtkCutter::New(); vtkImageData *vtkimagedata = this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 sliceCutter->SetInput( vtkimagedata ); +#else + sliceCutter->SetInputData( vtkimagedata ); +#endif sliceCutter->SetCutFunction( slicePlane ); //EED // vtkLookupTable *lut = BuildHueWeightBaseMap(); vtkPolyDataMapper *slice = vtkPolyDataMapper::New(); - slice->SetInput( sliceCutter->GetOutput() ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + slice->SetInput( sliceCutter->GetOutput() ); +#else + slice->SetInputData( sliceCutter->GetOutput() ); +#endif double range[2]; // EED // slice->Update(); @@ -819,7 +920,14 @@ void wxVtkMPR3DView::TestLoic2() // sliceActor->SetMapper( slice ); vtkPolyDataMapper *contourMapper = vtkPolyDataMapper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 contourMapper->SetInput( sliceCutter->GetOutput() ); +#else + contourMapper->SetInputData( sliceCutter->GetOutput() ); +#endif + contourMapper->SetScalarRange( range ); // contourMapper->SetLookupTable( lut );