X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxVtk2DBaseView.cxx;h=393b3f1160bf84c6ea866df1e7bba3c60459cc32;hb=63ee187ed08495d67c09ebb243227175f144615d;hp=fe3b8513deaa5cf49f02c1d594f587ddf77d00b8;hpb=543dfcbe8f5ff78bbed90ef1e20c722bfa0ef248;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx index fe3b851..393b3f1 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx @@ -1,8 +1,34 @@ +/*# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sant�) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ */ + #include "wxVtk2DBaseView.h" #include "vtkInfoTextImage.h" #include "vtkInteractorStyleBaseView2D.h" #include "vtkInfoTextImageInteractor.h" +#include "vtkImageActor.h" wxVtk2DBaseView::wxVtk2DBaseView(wxWindow *parent) @@ -69,7 +95,6 @@ void wxVtk2DBaseView::TransformCoordinate_spacing_ModelToView(double &X,double & X=X*spc[0]; Y=Y*spc[1]; Z=Z*spc[2]; - } //------------------------------------------------------------------- @@ -80,18 +105,22 @@ void wxVtk2DBaseView::ResetView() int x1 = 1,x2 = 1,y1 = 1,y2 = 1,z1 = 1,z2 = 1; wxVtkBaseView::Configure(); - wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor(); + crea::wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor(); vtkImageData *imageData = GetVtkBaseData()->GetImageData(); if(imageData){ +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imageData->UpdateInformation(); imageData->SetUpdateExtent( imageData->GetWholeExtent()); imageData->Update(); _imageViewer2XYZ->GetVtkImageViewer2()->SetInput(imageData ); +#else + _imageViewer2XYZ->GetVtkImageViewer2()->SetInputData(imageData ); +#endif imageData->GetSpacing (spx,spy,spz); imageData->GetExtent (x1,x2,y1,y2,z1,z2); } - _imageViewer2XYZ -> SetExtentDimension(x1,x2,y1,y2,z1,z2); _imageViewer2XYZ -> GetVtkImageViewer2()->SetupInteractor ( iren ); @@ -122,18 +151,20 @@ void wxVtk2DBaseView::ResetView() } - - //------------------------------------------------------------------- void wxVtk2DBaseView::SetImageToVtkViewer(vtkImageData *imageData) { if (_imageViewer2XYZ!=NULL) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _imageViewer2XYZ->GetVtkImageViewer2()->SetInput( imageData ); +#else + _imageViewer2XYZ->GetVtkImageViewer2()->SetInputData( imageData ); +#endif } // if _imageViewer2XYZ } - //------------------------------------------------------------------- void wxVtk2DBaseView::Configure(bool okimage) { @@ -145,7 +176,7 @@ void wxVtk2DBaseView::Configure(bool okimage) if (_imageViewer2XYZ==NULL) { _imageViewer2XYZ = new vtkImageViewer2_XYZ(); - wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor(); + crea::wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor(); _imageViewer2XYZ -> GetVtkImageViewer2()->SetupInteractor ( iren ); ////////////// @@ -169,13 +200,19 @@ void wxVtk2DBaseView::Configure(bool okimage) ////////////// } - vtkImageData *imageData = GetVtkBaseData()->GetMarImageData()->GetImageData(); if (imageData!=NULL) { + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imageData->UpdateInformation(); imageData->SetUpdateExtent( imageData->GetWholeExtent()); imageData->Update(); +#else + //... +#endif + if (okimage==true){ imageData->GetSpacing (spx,spy,spz); imageData->GetExtent (x1,x2,y1,y2,z1,z2); @@ -206,11 +243,9 @@ void wxVtk2DBaseView::Configure(bool okimage) //_collookup->SetTableValue(255 , 0 , 1 , 0 , 1 ); //_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel ()->SetLookupTable(_collookup ); - // EED 17 Oct 2007 // SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() ); - vtkImageViewer2 *IV2 = _imageViewer2XYZ->GetVtkImageViewer2(); vtkCamera *camera = IV2->GetRenderer()->GetActiveCamera(); @@ -249,29 +284,15 @@ void wxVtk2DBaseView::Configure(bool okimage) //------------------------------------------------------------------- -int wxVtk2DBaseView::GetActualSlice() // virtual +int wxVtk2DBaseView::GetActualSlice() // virtual { - return (int)(_vtkbasedata->GetZ()); + return (int)(GetVtkBaseData()->GetZ()); } //------------------------------------------------------------------- void wxVtk2DBaseView::SetActualSlice(int slice) // Virtual { - _vtkbasedata->SetZ(slice); -} - -//------------------------------------------------------------------- - -vtkBaseData *wxVtk2DBaseView::GetVtkBaseData() -{ - return _vtkbasedata; -} - -//------------------------------------------------------------------- - -void wxVtk2DBaseView::SetVtkBaseData(vtkBaseData *vtkbasedata) -{ - _vtkbasedata=vtkbasedata; + GetVtkBaseData()->SetZ(slice); } //------------------------------------------------------------------- @@ -282,14 +303,13 @@ void wxVtk2DBaseView::UpdateColorWindowLevel() // vtkImageViewer2 *vtkimageviewer2 = _imageViewer2XYZ->GetVtkImageViewer2(); - vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel(); - imagemaptowindowlevel->SetWindow( _vtkbasedata->GetColorWindow() ); - imagemaptowindowlevel->SetLevel( _vtkbasedata->GetColorLevel() ); + imagemaptowindowlevel->SetWindow( GetVtkBaseData()->GetColorWindow() ); + imagemaptowindowlevel->SetLevel( GetVtkBaseData()->GetColorLevel() ); // EED Borrame -// vtkimageviewer2->SetColorWindow( _vtkbasedata->GetColorWindow() ); -// vtkimageviewer2->SetColorLevel( _vtkbasedata->GetColorLevel() ); +// vtkimageviewer2->SetColorWindow( GetVtkBaseData()->GetColorWindow() ); +// vtkimageviewer2->SetColorLevel( GetVtkBaseData()->GetColorLevel() ); _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->Modified(); } @@ -298,6 +318,9 @@ void wxVtk2DBaseView::Refresh() { int z = (int)(GetVtkBaseData()->GetZ()); _imageViewer2XYZ->SetZSlice( z ); +//EED 2016/02/19 + vtkImageActor *imageactor = _imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor(); + imageactor->SetInterpolate( GetVtkBaseData()->GetInterpolate() ); //EED 01nov2012 UpdateColorWindowLevel(); wxVtkBaseView::Refresh(); @@ -307,12 +330,10 @@ void wxVtk2DBaseView::Refresh() void wxVtk2DBaseView::SetInteractorStyleImage(vtkInteractorStyleBaseView *interactorstylebaseview) { SetInteractorStyleBaseView(interactorstylebaseview); - - wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor(); + crea::wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor(); interactorstylebaseview->SetInteractor ( iren ); iren->SetInteractorStyle(interactorstylebaseview); interactorstylebaseview->SetwxVtkBaseView(this); - vtkMaracasImageViewer2Callback * cbk = vtkMaracasImageViewer2Callback::New(); cbk->IV = _imageViewer2XYZ->GetVtkImageViewer2(); interactorstylebaseview->AddObserver( vtkCommand::WindowLevelEvent, cbk ); @@ -361,7 +382,7 @@ void wxVtk2DBaseView::setColorTransferFunction(vtkColorTransferFunction* colorta void wxVtk2DBaseView::SetColorWindow(double level) { // _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow(level); - _vtkbasedata->SetColorWindow(level); + GetVtkBaseData()->SetColorWindow(level); this->Refresh(); } @@ -369,7 +390,7 @@ void wxVtk2DBaseView::SetColorWindow(double level) void wxVtk2DBaseView::SetColorLevel(double level) { // _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel(level); - _vtkbasedata->SetColorLevel(level); + GetVtkBaseData()->SetColorLevel(level); this->Refresh(); }