[vtkusers] Problems with MIP...

Marcelo amati at cenpra.gov.br
Thu Feb 13 03:05:40 EST 2003


        Hi,

        I'm trying to use the volume rendering method MIP (in a medical
volume) and I can't see anything.  I use the following code. What's
wrong? 
Do I need another color transfer function?

 
---------------------------------------------------------------------------
    reader = vtkImageReader()
    .
    .
    . 
    reader.SetDataScalarTypeToUnsignedShort()

   
    opacity = vtkPieceWiseFunction() 
    opacity.AddSegment(0, 1.0, 255, 1.0)

    color = vtkColorTransferFunction() 
    color.SetColorSpaceToRGB()
    color.AddRGBPoint(0, 1, 0, 0)
    color.AddRGBPoint(64, 1, 1, 0)
    color.AddRGBPoint(128, 0, 1, 0)
    color.AddRGBPoint(192, 0, 1, 1)
    color.AddRGBPoint(255, 0, 0, 1) 

    mip_prop = vtkVolumeProperty()
    mip_prop.SetColor(color)
    mip_prop.SetScalarOpacity(opacity)
    mip_prop.SetInterpolationTypeToLinear()
    mip_prop.ShadeOn()

    mip_func = vtkVolumeRayCastMIPFunction()
    mip_func.SetMaximizeMethodToOpacity()  #ScalarValue

    mip_volmap = vtkVolumeRayCastMapper()

    mip_volmap.SetInput(reader.GetOutput()) 
    mip_volmap.SetVolumeRayCastFunction(mip_func)

    mip_volume = vtkVolume()
    mip_volume.SetMapper(mip_volmap)
    mip_volume.SetProperty(mip_prop) 

---------------------------------------------------------------------------

   Thank you.

   Marcelo



More information about the vtkusers mailing list