X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxVtkClipping3DView.cxx;h=b41609ebcb2fb5cc3928edadecd3cf5ef7ab158a;hb=ca35b13e046343c8b50cbd6b833828b06c9d1608;hp=fa6be72c2baab462cdb8654603d5de2e55da790d;hpb=543dfcbe8f5ff78bbed90ef1e20c722bfa0ef248;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx index fa6be72..b41609e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx @@ -1,3 +1,28 @@ +/*# --------------------------------------------------------------------- +# +# 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 "wxVtkClipping3DView.h" #include "wxVtkClipping3DViewCntrlPanel.h" @@ -15,31 +40,37 @@ wxVtkClipping3DView::wxVtkClipping3DView(wxVtk3DBaseView* wxvtk3Dbaseview) } //------------------------------------------------------------------- -wxVtkClipping3DView::~wxVtkClipping3DView(){ - if (_boxWidgetVolume!=NULL) { _boxWidgetVolume -> Delete(); } - if (_boxWidgetS1!=NULL) { _boxWidgetS1 -> Delete(); } +wxVtkClipping3DView::~wxVtkClipping3DView() +{ + if (_boxWidgetVolume!=NULL) { _boxWidgetVolume -> Delete(); } + if (_boxWidgetS1!=NULL) { _boxWidgetS1 -> Delete(); } if (_vtkclipping3Ddataviewer!=NULL) { delete _vtkclipping3Ddataviewer; } if (_wxvtkclipping3DviewCntrlPanel!=NULL){ delete _wxvtkclipping3DviewCntrlPanel; } } + //------------------------------------------------------------------- void wxVtkClipping3DView::SetVisibleBoxSurface(bool visible) { - if (visible==true){ + if (visible==true) + { _boxWidgetS1->On(); } else { _boxWidgetS1->Off(); } } + //------------------------------------------------------------------- void wxVtkClipping3DView::VisibleVolumeBoxActor(bool visible) { - if (visible!=_vtkclipping3Ddataviewer->GetVisibleVolumeBox() ){ + if (visible!=_vtkclipping3Ddataviewer->GetVisibleVolumeBox() ) + { VisibleVolumeActor(!visible); _vtkclipping3Ddataviewer->BoxActorChanged(visible); _vtkclipping3Ddataviewer->SetVisibleVolumeBox(visible); _vtkclipping3Ddataviewer->SetVisibleVolume(!visible); } } + //------------------------------------------------------------------- void wxVtkClipping3DView::Refresh() { @@ -49,6 +80,7 @@ void wxVtkClipping3DView::Refresh() _wxvtkclipping3DviewCntrlPanel->Refresh(); } } + //------------------------------------------------------------------- wxPanel* wxVtkClipping3DView::CreateSurfControlPanel(wxWindow *parent) { @@ -64,12 +96,12 @@ wxPanel* wxVtkClipping3DView::CreateVolControlPanel(wxWindow *parent) return _wxvtkclipping3DviewVolCntrlPanel; } - //------------------------------------------------------------------- vtkClipping3DDataViewer* wxVtkClipping3DView::GetVtkClipping3DDataViewer() { return _vtkclipping3Ddataviewer; } + //------------------------------------------------------------------- void wxVtkClipping3DView::VisibleActor(int idTissue, bool visTissue){ if (visTissue!=_vtkclipping3Ddataviewer->GetVisibleTissue(idTissue)){ @@ -83,6 +115,7 @@ void wxVtkClipping3DView::VisibleActor(int idTissue, bool visTissue){ _vtkclipping3Ddataviewer->SetVisibleTissue(idTissue,visTissue); } } + //------------------------------------------------------------------- void wxVtkClipping3DView::SetRepSurfaceWireFrame(int idTissue , bool representationType ) { @@ -119,6 +152,7 @@ void wxVtkClipping3DView::VisibleVolumeActor( bool visVolume){ } } + //------------------------------------------------------------------- wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()throw(char*) { @@ -127,25 +161,34 @@ wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()throw(char*) } return _wxvtk3Dbaseview; } + //------------------------------------------------------------------- -void wxVtkClipping3DView::Configure(){ +void wxVtkClipping3DView::Configure() +{ _wxvtk3Dbaseview->Configure(); // Actors are added to the renderer. - _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetOutlineActor() ); _boxWidgetS1 = vtkBoxWidget::New(); _boxWidgetS1->SetInteractor( _wxvtk3Dbaseview->GetWxVTKRenderWindowInteractor() ); _boxWidgetS1->SetPlaceFactor(1.25); - - vtkStripper *stripper=_vtkclipping3Ddataviewer->GetTissueStripper(0); vtkPolyData *polydata= stripper->GetOutput(); - +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _boxWidgetS1->SetInput( polydata ); - _boxWidgetS1->PlaceWidget(); +#else + stripper->Update(); + _boxWidgetS1->SetInputData( polydata ); +#endif + +//EED 2016-08-19 + //_boxWidgetS1->PlaceWidget(); + int ext[6]; + this->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData()->GetExtent(ext); + _boxWidgetS1->PlaceWidget(ext[0],ext[1],ext[2],ext[3],ext[4],ext[5]); int i; for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++) @@ -153,9 +196,6 @@ void wxVtkClipping3DView::Configure(){ _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent, _vtkclipping3Ddataviewer->GetObserverS(i) ); } - - - // _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(0) ); // _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(3)); @@ -168,7 +208,6 @@ void wxVtkClipping3DView::Configure(){ //EED 29Mars2009 // _boxWidgetS1->On(); - _boxWidgetS1->Off(); _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(0) ); @@ -182,28 +221,32 @@ void wxVtkClipping3DView::Configure(){ _boxWidgetVolume->SetInteractor( _wxvtk3Dbaseview->GetWxVTKRenderWindowInteractor() ); _boxWidgetVolume->SetPlaceFactor(1.25); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _boxWidgetVolume->SetInput( this->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData() ); - _boxWidgetVolume->PlaceWidget(); - - _boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent , _vtkclipping3Ddataviewer->GetObserverV() ); +#else + _boxWidgetVolume->SetInputData( this->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData() ); +#endif + _boxWidgetVolume->PlaceWidget(); + _boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent, _vtkclipping3Ddataviewer->GetObserverV() ); _boxWidgetVolume->HandlesOn (); //EED 29Mars2009 // _boxWidgetVolume->On(); - _boxWidgetVolume->Off(); - // vtkPlanes *vtkplanes=this->GetVtkClipping3DDataViewer()->GetVolumePlanes(); // _boxWidgetVolume->GetPlanes( vtkplanes ); +//EED 27/05/2013 +// _wxvtk3Dbaseview->GetRenderer()->ResetCamera (); +// _wxvtk3Dbaseview->GetCamera()->Dolly(1.2); // An initial camera view is created. The Dolly() method moves // the camera towards the FocalPoint, thereby enlarging the image. - _wxvtk3Dbaseview->GetRenderer()->SetActiveCamera(_wxvtk3Dbaseview->GetCamera()); - _wxvtk3Dbaseview->GetRenderer()->ResetCamera (); - _wxvtk3Dbaseview->GetCamera()->Dolly(1.5); + _wxvtk3Dbaseview->ResetCamera(); + // Set a background color for the renderer and set the size of the // render window (expressed in pixels). @@ -216,12 +259,12 @@ void wxVtkClipping3DView::Configure(){ // near plane clips out objects in front of the plane; the far plane // clips out objects behind the plane. This way only what is drawn // between the planes is actually rendered. - _wxvtk3Dbaseview->GetRenderer()->ResetCameraClippingRange(); +//EEDUPS _wxvtk3Dbaseview->GetRenderer()->ResetCameraClippingRange(); _vtkclipping3Ddataviewer->SetRenderer(this->GetWxvtk3Dbaseview()->GetRenderer()); _vtkclipping3Ddataviewer->SetInteractor(this->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()); - } + //------------------------------------------------------------------- void wxVtkClipping3DView::SetVtkClipping3DDataViewer(vtkClipping3DDataViewer *vtkclipping3Ddataviewer) {