X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FvtkClipping3DDataViewer.cxx;h=d2524bed7c192c2cbb5c9b92c9591903ef09899c;hb=8efe1d6e29dc7ec7436779b9290b86552df7877f;hp=800f8be546d499af73ae2bef0223cb0deb87a55e;hpb=e9163fc688996aa392f7211cf6e49d3962149246;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx index 800f8be..d2524be 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx @@ -16,9 +16,13 @@ vtkClipping3DDataViewer::vtkClipping3DDataViewer() _interpolation=false; _shade=false; + _volumerendererdata = VolumeRendererData::New(); _volumeMapper = vtkVolumeRayCastMapper::New(); _newvol = vtkVolume::New(); _volumeProperty = vtkVolumeProperty::New(); + _compositeFunction = vtkVolumeRayCastCompositeFunction::New(); + _compositeFunctionMIP = vtkVolumeRayCastMIPFunction::New(); + } //------------------------------------------------------------------- vtkClipping3DDataViewer::~vtkClipping3DDataViewer() @@ -162,6 +166,15 @@ void vtkClipping3DDataViewer::SetVisibleVolume(bool visiblevolume) _visibleVolume = visiblevolume; } +bool vtkClipping3DDataViewer::GetVisibleVolumeBox() +{ + return _visibleVolumeBox; +} +//------------------------------------------------------------------- +void vtkClipping3DDataViewer::SetVisibleVolumeBox(bool visibleBox) +{ + _visibleVolumeBox = visibleBox; +} //------------------------------------------------------------------- void vtkClipping3DDataViewer::Configure_Tissue() @@ -313,30 +326,24 @@ void vtkClipping3DDataViewer::Configure_Volume() // EED 13/03/2011 - _compositeFunction = vtkVolumeRayCastCompositeFunction::New(); - vtkVolumeRayCastMIPFunction* _compositeFunctionMIP = vtkVolumeRayCastMIPFunction::New(); // _volumeMapper = vtkVolumeRayCastMapper::New(); _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() ); -if(_isRayCasting) -{ - cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isRayCasting"<SetVolumeRayCastFunction(_compositeFunction); -} -else if(_isMIP) -{ - cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isMIP"<SetVolumeRayCastFunction(_compositeFunctionMIP); -} + + // _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP); // _volumeMapper->SetClippingPlanes( _volumePlanes ); _volumeMapper->AutoAdjustSampleDistancesOn(); + _volumeProperty->SetInterpolationTypeToNearest(); //_volumeProperty = vtkVolumeProperty::New(); _volumeProperty->SetColor(_ctfun); _volumeProperty->SetScalarOpacity( _tfun ); @@ -345,23 +352,7 @@ else if(_isMIP) _volumeProperty->DisableGradientOpacityOn(); -if(_interpolation) -{ - _volumeProperty->SetInterpolationTypeToLinear(); -} -else -{ - _volumeProperty->SetInterpolationTypeToNearest(); -} -if(_shade) -{ - _volumeProperty->ShadeOn(); -} -else -{ - _volumeProperty->ShadeOff(); -} // _ @@ -387,12 +378,96 @@ else } +void vtkClipping3DDataViewer::Configure_VolumeBox() +{ + cout<<"JPRG::vtkClipping3DDataViewer::Configure_VolumeBox()"<SetImageData(_vtkmprbasedata->GetImageData()); + + + vector *gv = this->GetGreyValuesTransferenceFVector(); + vector *op = this->GetIntensityValuesTransferenceFVector(); + + + _volumerendererdata->SetLookUpTable((vtkLookupTable*)(_ctfun)); + _volumerendererdata->OpacityChanged(*gv, *op); + + //_wxvtkclipping3Dview->VisibleVolumeActor( false ); + //_volumerendererdata->ShowVolume(event.IsChecked() ); + //_volumerendererdata->BoundingBoxChanged(event.IsChecked() ); +} + +void vtkClipping3DDataViewer::SetRenderer(vtkRenderer* renderer) +{ + _volumerendererdata->SetRenderer(renderer); + +} + +void vtkClipping3DDataViewer::SetInteractor(vtkRenderWindowInteractor* interactor) +{ + + _volumerendererdata->SetInteractor(interactor); +} + + +void vtkClipping3DDataViewer::BoxActorChanged(bool changed) +{ + vector *gv = this->GetGreyValuesTransferenceFVector(); + vector *op = this->GetIntensityValuesTransferenceFVector(); + + _volumerendererdata->ShowVolume(changed); + _volumerendererdata->OpacityChanged(*gv, *op); + _volumerendererdata->BoundingBoxChanged(changed); + +} + +void vtkClipping3DDataViewer::UpdateVolumeBox(vector gf, vector vf, vtkColorTransferFunction* ctfun) +{ + _volumerendererdata->SetLookUpTable((vtkLookupTable*)(ctfun)); + _volumerendererdata->OpacityChanged(gf, vf); +} + + +void vtkClipping3DDataViewer::updateVolume() +{ + + if(_isRayCasting) + { + _volumeMapper->SetVolumeRayCastFunction(_compositeFunction); + _volumerendererdata->changeCompositeMIPFunction(0); + } + else if(_isMIP) + { + _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP); + _volumerendererdata->changeCompositeMIPFunction(1); + } + + if(_interpolation) + { + _volumeProperty->SetInterpolationTypeToLinear(); + } + else + { + _volumeProperty->SetInterpolationTypeToNearest(); + } + + if(_shade) + { + _volumeProperty->ShadeOn(); + } + else + { + _volumeProperty->ShadeOff(); + } + +} + //------------------------------------------------------------------- void vtkClipping3DDataViewer::Configure() { Configure_Tissue(); Configure_Volume(); - + Configure_VolumeBox(); // An outline provides context around the data. // _outlineData = vtkOutlineFilter::New();