X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FvtkClipping3DDataViewer.cxx;h=1e723a13e09b5973e0d1cbf9aa096a721d2c89ac;hb=ba3bf1e05af2b03d6b013606b9d885d8fb0b2cb4;hp=e5b8804e0550d26b847db84dc98c057a63ad86ec;hpb=1b2153bfefaca680e9680b02a039fb06df0a6fba;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx index e5b8804..1e723a1 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.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 "vtkClipping3DDataViewer.h" #include "vtkDataSetReader.h" @@ -10,18 +35,18 @@ vtkClipping3DDataViewer::vtkClipping3DDataViewer() _visibleTissue[i] = false; _representationType[i] = true; } - _visibleVolume=false; - _isRayCasting=true; - _isMIP=false; - _interpolation=false; - _shade=false; + _visibleVolume = false; + _isRayCasting = true; + _isMIP = false; + _interpolation = false; + _shade = false; - _volumerendererdata = VolumeRendererData::New(); - _volumeMapper = vtkVolumeRayCastMapper::New(); - _newvol = vtkVolume::New(); - _volumeProperty = vtkVolumeProperty::New(); - _compositeFunction = vtkVolumeRayCastCompositeFunction::New(); - _compositeFunctionMIP = vtkVolumeRayCastMIPFunction::New(); + _volumerendererdata = VolumeRendererData::New(); + _volumeMapper = vtkVolumeRayCastMapper::New(); + _newvol = vtkVolume::New(); + _volumeProperty = vtkVolumeProperty::New(); + _compositeFunction = vtkVolumeRayCastCompositeFunction::New(); + _compositeFunctionMIP = vtkVolumeRayCastMIPFunction::New(); } //------------------------------------------------------------------- @@ -176,46 +201,88 @@ void vtkClipping3DDataViewer::SetVisibleVolumeBox(bool visibleBox) _visibleVolumeBox = visibleBox; } + //------------------------------------------------------------------- -void vtkClipping3DDataViewer::Configure_Tissue() +void vtkClipping3DDataViewer::SetImage() { + int i; + vtkImageData *imagedata=_vtkmprbasedata->GetImageData(); + for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++) + { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _mCubes[i]->SetInput( imagedata ); +#else + _mCubes[i]->SetInputData( imagedata ); +#endif + } // for +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _volumeMapper->SetInput( imagedata ); +#else + _volumeMapper->SetInputData( imagedata ); +#endif + _volumerendererdata->SetImageData( imagedata ); +} - double range[2]; +//------------------------------------------------------------------- +void vtkClipping3DDataViewer::Configure_Tissue() +{ int i; - for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){ + double range[2]; + vtkImageData *imagedata=_vtkmprbasedata->GetImageData(); + imagedata->GetScalarRange( range ); + for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++) + { // Visualisation - original volume - vtkImageData *imagedata=_vtkmprbasedata->GetImageData(); - imagedata->GetScalarRange( range ); _mCubes[i] = vtkMarchingCubes::New( ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _mCubes[i]->SetInput( imagedata ); +#else + _mCubes[i]->SetInputData( imagedata ); +#endif _mCubes[i]->SetValue( 0, range[1]*(4+i) / 8 ); // _mCubes[i]->SetValue( 0, 1500 ); - _tissueStripper[i] = vtkStripper::New(); - _tissueStripper[i]->SetInput( _mCubes[i]->GetOutput( ) ); - +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _tissueStripper[i]->SetInput( _mCubes[i]->GetOutput( ) ); +#else + _tissueStripper[i]->SetInputData( _mCubes[i]->GetOutput( ) ); +#endif _tissuePlanes[i] = vtkPlanes::New(); - int x1,x2,y1,y2,z1,z2; imagedata->GetExtent(x1,x2,y1,y2,z1,z2); _tissuePlanes[i]->SetBounds (x1,x2,y1,y2,z1,z2); - _tissueClipper[i] = vtkClipPolyData::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _tissueClipper[i]->SetInput( _tissueStripper[i]->GetOutput() ); +#else + _tissueClipper[i]->SetInputData( _tissueStripper[i]->GetOutput() ); +#endif + _tissueClipper[i]->SetClipFunction( _tissuePlanes[i] ); _tissueClipper[i]->InsideOutOn( ); - _tissueMapper[i] = vtkPolyDataMapper::New( ); - _tissueMapper[i]->SetInput( _tissueClipper[i]->GetOutput() ); - _tissueMapper[i]->ScalarVisibilityOff( ); -// _tissueMapper[i]->Update(); - } +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _tissueMapper[i]->SetInput( _tissueClipper[i]->GetOutput() ); +#else + _tissueMapper[i]->SetInputData( _tissueClipper[i]->GetOutput() ); +#endif + _tissueMapper[i]->ScalarVisibilityOff( ); +// _tissueMapper[i]->Update(); + } // for i // vtkActor tissue for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){ @@ -248,8 +315,6 @@ void vtkClipping3DDataViewer::Configure_Volume() { // Volume - - /** if(_newvol != NULL) { _newvol->Delete(); @@ -257,8 +322,6 @@ void vtkClipping3DDataViewer::Configure_Volume() _volumeProperty->Delete(); }*/ - - _tfun = vtkPiecewiseFunction::New(); _ctfun = vtkColorTransferFunction::New(); @@ -266,8 +329,6 @@ void vtkClipping3DDataViewer::Configure_Volume() this->_vtkmprbasedata->GetImageData()->GetScalarRange(range); double max = range[1]; - printf("EED::vtkClipping3DDataViewer::Configure_Volume max=%f \n",max); - /* adding the poinst of the transference function */ @@ -328,20 +389,22 @@ void vtkClipping3DDataViewer::Configure_Volume() // EED 13/03/2011 + // _volumeMapper = vtkVolumeRayCastMapper::New(); - // _volumeMapper = vtkVolumeRayCastMapper::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() ); - +#else + _volumeMapper->SetInputData( this->GetVtkMPRBaseData()->GetImageData() ); +#endif _volumeMapper->SetVolumeRayCastFunction(_compositeFunction); - // _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP); - + // - _volumeMapper->SetClippingPlanes( _volumePlanes ); _volumeMapper->AutoAdjustSampleDistancesOn(); @@ -351,17 +414,9 @@ void vtkClipping3DDataViewer::Configure_Volume() _volumeProperty->SetScalarOpacity( _tfun ); // EED 31/03/2008 - _volumeProperty->DisableGradientOpacityOn(); - -// _ - - -// _ - - // _volumeProperty->SetInterpolationTypeToNearest(); // _volumeProperty->ShadeOff(); // _volumeProperty->SetAmbient(0.3); @@ -373,42 +428,39 @@ void vtkClipping3DDataViewer::Configure_Volume() _newvol->SetMapper(_volumeMapper ); _newvol->SetProperty(_volumeProperty ); - _observerV = boxSurfaceObserver::New(); + _observerV = boxSurfaceObserver::New(); _observerV->SetPlanes( _volumePlanes ); _observerV->SetActor( _newvol ); _observerV->SetvtkVolumeRayCastMapper( _volumeMapper ); } +//----------------------------------------------------------------------------- void vtkClipping3DDataViewer::Configure_VolumeBox() { - cout<<"EED::JPRG::vtkClipping3DDataViewer::Configure_VolumeBox() start"<SetImageData(_vtkmprbasedata->GetImageData()); vector *gv = this->GetGreyValuesTransferenceFVector(); vector *op = this->GetIntensityValuesTransferenceFVector(); - printf("EED::vtkClipping3DDataViewer::Configure_VolumeBox _ctfun=%p \n",_ctfun); - - _volumerendererdata->SetLookUpTable((vtkLookupTable*)(_ctfun)); _volumerendererdata->OpacityChanged(*gv, *op); //_wxvtkclipping3Dview->VisibleVolumeActor( false ); //_volumerendererdata->ShowVolume(event.IsChecked() ); //_volumerendererdata->BoundingBoxChanged(event.IsChecked() ); - - cout<<"EED::JPRG::vtkClipping3DDataViewer::Configure_VolumeBox() end"<SetRenderer(renderer); } +//----------------------------------------------------------------------------- void vtkClipping3DDataViewer::SetInteractor(vtkRenderWindowInteractor* interactor) { @@ -416,6 +468,7 @@ void vtkClipping3DDataViewer::SetInteractor(vtkRenderWindowInteractor* interacto } +//----------------------------------------------------------------------------- void vtkClipping3DDataViewer::BoxActorChanged(bool changed) { vector *gv = this->GetGreyValuesTransferenceFVector(); @@ -427,6 +480,7 @@ void vtkClipping3DDataViewer::BoxActorChanged(bool changed) } +//----------------------------------------------------------------------------- void vtkClipping3DDataViewer::UpdateVolumeBox(vector gf, vector vf, vtkColorTransferFunction* ctfun) { _volumerendererdata->SetLookUpTable((vtkLookupTable*)(ctfun)); @@ -434,6 +488,7 @@ void vtkClipping3DDataViewer::UpdateVolumeBox(vector gf, vector } +//----------------------------------------------------------------------------- void vtkClipping3DDataViewer::updateVolume() { @@ -476,11 +531,21 @@ void vtkClipping3DDataViewer::Configure() Configure_VolumeBox(); // An outline provides context around the data. // - _outlineData = vtkOutlineFilter::New(); + _outlineData = vtkOutlineFilter::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() ); - _mapOutline = vtkPolyDataMapper::New(); - _mapOutline->SetInput(_outlineData->GetOutput()); - _outline = vtkActor::New(); +#else + _outlineData->SetInputData((vtkDataSet *) _vtkmprbasedata->GetImageData() ); +#endif + + _mapOutline = vtkPolyDataMapper::New(); + +//EED 4 nov 2015 Estelle +// _mapOutline->SetInput(_outlineData->GetOutput()); + + _outline = vtkActor::New(); _outline->SetMapper(_mapOutline); _outline->GetProperty()->SetColor(0,0,0); } @@ -761,7 +826,14 @@ void vtkClipping3DDataViewer::ReadMeshVTK(char *namefile) vtkDataSetReader *reader = vtkDataSetReader::New(); reader->SetFileName(namefile); reader->Update(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _tissueStripper[3]->SetInput( reader->GetPolyDataOutput() ); +#else + _tissueStripper[3]->SetInputData( reader->GetPolyDataOutput() ); +#endif + } void vtkClipping3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){