]> Creatis software - bbtk.git/commitdiff
no message
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Thu, 17 Mar 2011 15:49:14 +0000 (15:49 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Thu, 17 Mar 2011 15:49:14 +0000 (15:49 +0000)
packages/vtk/src/bbvtkMIPCreator.cxx

index 58ee8ae42ec02c5da30f1e1239a353239079f01f..d45db49bf1ecb040145116bfa8c476cf1c759cdd 100644 (file)
@@ -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 <vtkVolumeProperty.h>
+#include <vtkPiecewiseFunction.h>
+
 #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();