From 00045104d4fbcd4f71774a9634739bf954259e4e Mon Sep 17 00:00:00 2001 From: Eduardo Davila Date: Thu, 17 Mar 2011 15:49:14 +0000 Subject: [PATCH] no message --- packages/vtk/src/bbvtkMIPCreator.cxx | 46 +++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/packages/vtk/src/bbvtkMIPCreator.cxx b/packages/vtk/src/bbvtkMIPCreator.cxx index 58ee8ae..d45db49 100644 --- a/packages/vtk/src/bbvtkMIPCreator.cxx +++ b/packages/vtk/src/bbvtkMIPCreator.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbvtkMIPCreator.cxx,v $ Language: C++ - Date: $Date: 2010/04/08 14:37:59 $ - Version: $Revision: 1.7 $ + Date: $Date: 2011/03/17 15:49:14 $ + Version: $Revision: 1.8 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -35,6 +35,9 @@ #ifdef _USE_VTK_ +#include +#include + #include "bbvtkMIPCreator.h" #include "bbvtkPackage.h" @@ -60,9 +63,43 @@ namespace bbvtk mCast = vtkImageShiftScale::New(); mCast->SetOutputScalarTypeToUnsignedChar(); mCast->ClampOverflowOn(); - + + + + + //define range of values + vtkPiecewiseFunction *opacityTransferFunction = vtkPiecewiseFunction::New(); + opacityTransferFunction->AddPoint( 0 , 0.0/100.0 ); +// opacityTransferFunction->AddPoint( 85 , 2.0/100.0 ); +// opacityTransferFunction->AddPoint( 160 , 25.0/100.0 ); +// opacityTransferFunction->AddPoint( 210 , 50.0/100.0 ); + opacityTransferFunction->AddPoint( 255 , 90.0/100.0 ); + + + //Create a transfer function mapping scalar value to color (grey) + vtkPiecewiseFunction *grayTransferFunction = vtkPiecewiseFunction::New(); + grayTransferFunction->AddSegment( 0 , 0.0 , 255 , 1.0 ); + + // Create a set of properties for mip + vtkVolumeProperty *mipProperty; + mipProperty = vtkVolumeProperty::New(); + mipProperty->SetScalarOpacity( opacityTransferFunction ); + mipProperty->SetColor( grayTransferFunction ); + +// mipProperty->SetInterpolationTypeToLinear(); + mipProperty->SetInterpolationTypeToNearest(); + +// mipProperty->ShadeOff(); + mipProperty->ShadeOn(); + + mipProperty->SetAmbient(0.9); + mipProperty->SetDiffuse(0.9); + mipProperty->SetSpecular(0.9); + + mMIP = vtkVolumeRayCastMIPFunction::New(); mMIP->SetMaximizeMethodToScalarValue(); +// mMIP->SetMaximizeMethodToOpacity(); mMapper = vtkVolumeRayCastMapper::New(); mMapper->SetVolumeRayCastFunction(mMIP); @@ -70,7 +107,8 @@ namespace bbvtk mVolume = vtkVolume::New(); mVolume->SetMapper(mMapper); - + mVolume->SetProperty( mipProperty ); + // mMapper->ScalarVisibilityOff(); // mMapper->ImmediateModeRenderingOn(); -- 2.45.1