X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxPanelCuttingImageData.cxx;h=d16cff956e6c4ebb0a5305d4b9078f1ab1150aa0;hb=ca35b13e046343c8b50cbd6b833828b06c9d1608;hp=e3b24b20c8effcaa9fd864cb007fe964f317ca58;hpb=a4ee3758aa0477f677fb981e2c4d6e29995e8db8;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxPanelCuttingImageData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxPanelCuttingImageData.cxx index e3b24b2..d16cff9 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxPanelCuttingImageData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxPanelCuttingImageData.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 "wxPanelCuttingImageData.h" @@ -12,11 +37,11 @@ wxPanelCuttingImageData::wxPanelCuttingImageData (wxWindow *parent) : wxPanel( parent, -1) { - _imageData=NULL; - _histogrammeVector=NULL; - _wxvtk3Dbaseview=NULL; - _wxvtkbaseView=NULL; - CreateInterface(); + _imageData = NULL; + _histogrammeVector = NULL; + _wxvtk3Dbaseview = NULL; + _wxvtkbaseView = NULL; + CreateInterface() ; CreateModel(); Create3DViewObjects(); } @@ -81,7 +106,12 @@ void wxPanelCuttingImageData::Create3DViewObjects() _vtksphere->SetThetaResolution (20); _vtksphere->SetPhiResolution (20); _sphereMapper = vtkPolyDataMapper::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _sphereMapper->SetInput( _vtksphere->GetOutput() ); +#else + _sphereMapper->SetInputData( _vtksphere->GetOutput() ); +#endif _sphereActor = vtkActor::New(); _sphereActor->SetMapper(_sphereMapper); _sphereActor->SetOrigin(0, 0, 0); @@ -95,7 +125,12 @@ void wxPanelCuttingImageData::Create3DViewObjects() _vtkcube->SetYLength (1); _vtkcube->SetZLength (1); _cubeMapper = vtkPolyDataMapper::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _cubeMapper->SetInput( _vtkcube->GetOutput() ); +#else + _cubeMapper->SetInputData( _vtkcube->GetOutput() ); +#endif _cubeActor = vtkActor::New(); _cubeActor->SetMapper(_cubeMapper); _cubeActor->SetOrigin(0, 0, 0); @@ -107,7 +142,14 @@ void wxPanelCuttingImageData::Create3DViewObjects() _vtkcylinder = vtkCylinderSource::New(); _vtkcylinder->SetResolution(20); _cylinderMapper = vtkPolyDataMapper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _cylinderMapper->SetInput( _vtkcylinder->GetOutput() ); +#else + _cylinderMapper->SetInputData( _vtkcylinder->GetOutput() ); +#endif + _cylinderActor = vtkActor::New(); _cylinderActor->SetMapper(_cylinderMapper); _cylinderActor->SetOrigin(0, 0, 0); @@ -141,7 +183,12 @@ void wxPanelCuttingImageData::InitHistogramme() } else { _imageData->GetScalarRange(rangeA); } +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _xyplot->RemoveAllInputs(); +#else + _xyplot->RemoveAllDataSetInputConnections(); +#endif /* if ( _histogrammeVector!=NULL ) { @@ -150,9 +197,14 @@ void wxPanelCuttingImageData::InitHistogramme() */ _histogrammeVector = vtkImageData::New(); _histogrammeVector -> SetDimensions ( (int)(rangeA[1]),1,1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _histogrammeVector -> SetScalarTypeToUnsignedShort(); _histogrammeVector -> AllocateScalars(); _histogrammeVector -> Update(); +#else + _histogrammeVector -> AllocateScalars(VTK_UNSIGNED_SHORT,1); +#endif unsigned short *p_vol = (unsigned short*)_histogrammeVector->GetScalarPointer(0,0,0); int i,size = (int) (rangeA[1]); @@ -163,7 +215,15 @@ void wxPanelCuttingImageData::InitHistogramme() } _xyplot->SetXRange(0, rangeA[1]); _xyplot->SetYRange(0, 10); + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _xyplot->AddInput( _histogrammeVector ); +#else + _xyplot->AddDataSetInput( _histogrammeVector ); +#endif + } //------------------------------------------------------------------- @@ -217,24 +277,24 @@ void wxPanelCuttingImageData::CreateInterface() _typeFig = new wxChoice(this,-1); - _opacityFig = new wxSlider(this,-1,100,0,100, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS); + _opacityFig = new wxSlider(this,-1,100,0,100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS); - _scaleX = new wxSlider(this,-1,6,0,500 , wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS); - _scaleY = new wxSlider(this,-1,20,0,500 , wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS); - _scaleZ = new wxSlider(this,-1,7,0,500 , wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS); + _scaleX = new wxSlider(this,-1,6,0,500 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS); + _scaleY = new wxSlider(this,-1,20,0,500 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS); + _scaleZ = new wxSlider(this,-1,7,0,500 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS); - _rotationX = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS); - _rotationY = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS); - _rotationZ = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS); + _rotationX = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS); + _rotationY = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS); + _rotationZ = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS); _volIntern = new wxRadioButton(this,-1, _T("Volume intern " )); _volExtern = new wxRadioButton(this,-1, _T("Volume extern " )); _histogrammeAccumulated = new wxCheckBox(this,-1,_T("Histogramme accumulated")); - _isoValue = new wxSlider(this,-1, 200, 0,2000, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS); - _valueBeforeIsoValue = new wxSlider(this,-1,-1,-1,2000, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS); - _valueAfterIsoValue = new wxSlider(this,-1,-1,-1,2000, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS); + _isoValue = new wxSlider(this,-1, 200, 0,2000, wxDefaultPosition,wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS); + _valueBeforeIsoValue = new wxSlider(this,-1,-1,-1,2000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS); + _valueAfterIsoValue = new wxSlider(this,-1,-1,-1,2000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS); wxButton *btnExtract = new wxButton(this, -1,_T("Extract")); @@ -453,7 +513,14 @@ void wxPanelCuttingImageData::OnExtract(wxCommandEvent& event) } } double range[2]; + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _histogrammeVector->Update(); +#else + _histogrammeVector->Modified(); +#endif + _histogrammeVector->GetScalarRange(range); _xyplot->SetYRange( 0 , range[1] ); _xyplot->SetXRange( min , max ); @@ -463,7 +530,12 @@ void wxPanelCuttingImageData::OnExtract(wxCommandEvent& event) // _wxvtkbaseView->RefreshView(); wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 _wxvtkbaseView->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); +#else + _wxvtkbaseView->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessWindowEvent(newevent1); +#endif }