X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FThresholdImageView%2FLayerImageBase.cxx;h=f63a57ae9f68f0aef62277d9b1eed7a3e9957e0d;hb=e263b7ace0f53d647a731553a3f67700838ad146;hp=51409832683b8cddf47972ce4209b37fec09ba04;hpb=75d79aeb1ea13f86ff23da48432f3c142420670f;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx index 5140983..f63a57a 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx @@ -32,7 +32,7 @@ #include "wxMPRBaseData.h" #include "wxVtk2DBaseView.h" -#include "wxVTKRenderWindowInteractor.h" +#include "creawxVTKRenderWindowInteractor.h" #include "vtkTextProperty.h" @@ -192,8 +192,15 @@ void LayerImageBase::SetImage(vtkImageData* image) spcBase[5]=0; _image = image; + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _image->Update(); _image->GetWholeExtent(ext); +#else + _image->GetExtent(ext); +#endif + dimensionOriginalLayer[0] = ext[1]-ext[0]+1; dimensionOriginalLayer[1] = ext[3]-ext[2]+1; dimensionOriginalLayer[2] = ext[5]-ext[4]+1; @@ -206,7 +213,14 @@ void LayerImageBase::SetImage(vtkImageData* image) vtkImageData *imagebase = GetwxVtkBaseView()->GetVtkBaseData()->GetImageData(); if (imagebase!=NULL) { + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imagebase->GetWholeExtent(ext); +#else + imagebase->GetExtent(ext); +#endif + dimBase[0]=ext[1]-ext[0]+1; dimBase[1]=ext[3]-ext[2]+1; dimBase[2]=ext[5]-ext[4]+1; @@ -222,9 +236,17 @@ void LayerImageBase::SetImage(vtkImageData* image) } // if imagebase } // if wxvtkbaseview _image->GetScalarRange( _range ); - _thresholdTable = vtkLookupTable::New(); +// _thresholdTable = vtkLookupTable::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _imageChangeInformation->SetInput(_image); +#else + _imageChangeInformation->SetInputData(_image); + _imageChangeInformation->Update(); +#endif + } //------------------------------------------------------------------------------ @@ -238,9 +260,9 @@ void LayerImageBase::SetSpcOriginalLayer(double spc[3]) //------------------------------------------------------------------------------ void LayerImageBase::SetNewSpacingLayer(double spc[3]) { - _newSpcLayer[0]=spc[0]; - _newSpcLayer[1]=spc[1]; - _newSpcLayer[2]=spc[2]; + _newSpcLayer[0] = spc[0]; + _newSpcLayer[1] = spc[1]; + _newSpcLayer[2] = spc[2]; _imageChangeInformation->SetOutputSpacing( _newSpcLayer ); } @@ -364,6 +386,7 @@ void LayerImageBase::Refresh() //---------------------------------------------------------------------------- vtkLookupTable* LayerImageBase::GetThresholdTable() { +printf("EED LayerImageBase::GetThresholdTable\n"); return _thresholdTable; } @@ -475,7 +498,14 @@ void LayerImageBase::onThreshold() } // !GetActorPresent() ConfigLookupTable(); // virtual method + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _imageReslicer->SetInput( GetImage() ); +#else + _imageReslicer->SetInputData( GetImage() ); +#endif + _imageReslicer->SetInformationInput( GetImage() ); if (directionViewer==0) @@ -501,27 +531,43 @@ void LayerImageBase::onThreshold() _imageReslicer->SetInterpolationModeToNearestNeighbor(); _imageReslicer->Modified(); - +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + // .. +#else + _imageReslicer->Update(); +#endif vtkImageData *img = _imageReslicer->GetOutput(); // img->Update(); // img->UpdateInformation(); - // _thresholdTable->Update(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _thresholdMapper->SetInput( img ); +#else + _thresholdMapper->SetInputData( img ); +#endif + _thresholdMapper->SetLookupTable( _thresholdTable ); + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _thresholdActor->SetInput( _thresholdMapper->GetOutput() ); +#else + _thresholdMapper->Update(); + _thresholdActor->SetInputData( _thresholdMapper->GetOutput() ); +#endif + _thresholdActor->SetOpacity(_opacity); - _scalarbarActor->SetLookupTable( _thresholdTable ); // _scalarbarActor->SetLookupTable( _thresholdMapper->GetLookupTable() ); _scalarbarActor->SetTitle("Value"); _scalarbarActor->SetNumberOfLabels(4); int fontsize = _scalarbarActor->GetLabelTextProperty()->GetFontSize(); _scalarbarActor->GetLabelTextProperty()->SetFontSize(fontsize/2); - // _scalarbarActor->SetTextPad(4); ?? - - } // _image } @@ -571,15 +617,8 @@ void LayerImageBase::onThresholdRemove() wxVtkBaseView * baseView = _baseView; baseView->GetRenderer()->RemoveActor( _thresholdActor ); baseView->GetRenderer()->RemoveActor( _scalarbarActor ); - _actorPresent = false; - } -} - -//---------------------------------------------------------------------------- -vtkLookupTable *LayerImageBase::GetvtkLookupTable() -{ - return _thresholdTable; + } // if _actorPresent } //---------------------------------------------------------------------------- @@ -598,7 +637,10 @@ void LayerImageBase::GetImageScalarRange() _range[1]=max; } - +vtkScalarsToColors* LayerImageBase::GetLookupTable() +{ + return _thresholdTable; +} // EOF