X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxVtk2DBaseView.cxx;h=bd26d120d364e66401ac592ac30059cd5db585ce;hb=4645482ed1eae5aaabdd813b784acafd13c41179;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..bd26d12 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]; - } //------------------------------------------------------------------- @@ -91,7 +116,6 @@ void wxVtk2DBaseView::ResetView() imageData->GetExtent (x1,x2,y1,y2,z1,z2); } - _imageViewer2XYZ -> SetExtentDimension(x1,x2,y1,y2,z1,z2); _imageViewer2XYZ -> GetVtkImageViewer2()->SetupInteractor ( iren ); @@ -122,8 +146,6 @@ void wxVtk2DBaseView::ResetView() } - - //------------------------------------------------------------------- void wxVtk2DBaseView::SetImageToVtkViewer(vtkImageData *imageData) { @@ -133,7 +155,6 @@ void wxVtk2DBaseView::SetImageToVtkViewer(vtkImageData *imageData) } // if _imageViewer2XYZ } - //------------------------------------------------------------------- void wxVtk2DBaseView::Configure(bool okimage) { @@ -169,7 +190,6 @@ void wxVtk2DBaseView::Configure(bool okimage) ////////////// } - vtkImageData *imageData = GetVtkBaseData()->GetMarImageData()->GetImageData(); if (imageData!=NULL) { @@ -206,11 +226,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 +267,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 +286,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 +301,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 +313,10 @@ void wxVtk2DBaseView::Refresh() void wxVtk2DBaseView::SetInteractorStyleImage(vtkInteractorStyleBaseView *interactorstylebaseview) { SetInteractorStyleBaseView(interactorstylebaseview); - 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 +365,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 +373,7 @@ void wxVtk2DBaseView::SetColorWindow(double level) void wxVtk2DBaseView::SetColorLevel(double level) { // _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel(level); - _vtkbasedata->SetColorLevel(level); + GetVtkBaseData()->SetColorLevel(level); this->Refresh(); }