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 $
=========================================================================*/
/* ---------------------------------------------------------------------
#ifdef _USE_VTK_
+#include <vtkVolumeProperty.h>
+#include <vtkPiecewiseFunction.h>
+
#include "bbvtkMIPCreator.h"
#include "bbvtkPackage.h"
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);
mVolume = vtkVolume::New();
mVolume->SetMapper(mMapper);
-
+ mVolume->SetProperty( mipProperty );
+
// mMapper->ScalarVisibilityOff();
// mMapper->ImmediateModeRenderingOn();