X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fvtk%2Fsrc%2FbbvtkMIPCreator.cxx;h=d45db49bf1ecb040145116bfa8c476cf1c759cdd;hb=00045104d4fbcd4f71774a9634739bf954259e4e;hp=58ee8ae42ec02c5da30f1e1239a353239079f01f;hpb=9fb35da25e90c6bc2e91ddafe3dde9c7a33b346a;p=bbtk.git 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();