[vtk-developers] Bug in VolumeMappers?
Lisa Avila
lisa.avila at kitware.com
Fri Sep 17 09:33:54 EDT 2004
Hi Prabhu,
Can you send me an image of what you see? I suspect it is an issue with
the gradients in your data since you have shading on. Try turning shading
off and make sure you don't see any black regions.
Lisa
At 08:17 AM 9/17/2004, Prabhu Ramachandran wrote:
>Hi,
>
>Attached is a Python script (v.py) and a gzipped data file that
>demonstrates a funny problem that two MayaVi users encountered with
>VTK's volume mappers.
>
>The data file is a structured points dataset. There is one large
>region of constant color and in this region there are spurious black
>regions. This occurs with both the RayCast and Texture mappers.
>
>If you look at a cut-plane of the data, it looks just fine. Only the
>volume renderer seems to produce wierd artifacts.
>
>The Python script should run with VTK-Python (no dependencies are
>required including Tk).
>
>I've submitted the item in the bug tracker (#1180) also.
>
>I'd appreciate any clarifications. Thanks!
>
>regards,
>prabhu
>
>#!/usr/bin/env python
>
>import vtk
>
>RAYCAST = 1
>
>r = vtk.vtkStructuredPointsReader()
>r.SetFileName('volumeBug.vtk')
>
>vm = None
>if RAYCAST:
> cf = vtk.vtkVolumeRayCastCompositeFunction()
> vm = vtk.vtkVolumeRayCastMapper()
> vm.SetVolumeRayCastFunction(cf)
>else:
> vm = vtk.vtkVolumeTextureMapper2D()
>vm.SetInput(r.GetOutput())
>
>otf = vtk.vtkPiecewiseFunction()
>otf.AddPoint(0, 0.2)
>otf.AddPoint(255, 0.2)
>
>ctf = vtk.vtkColorTransferFunction()
>ctf.AddRGBPoint(0.0, 1.0, 0.0, 0.0)
>ctf.AddRGBPoint(255.0, 1.0, 0.0, 0.0)
>
>vp = vtk.vtkVolumeProperty()
>vp.SetColor(ctf)
>vp.SetScalarOpacity(otf)
>vp.ShadeOn()
>vp.SetInterpolationTypeToLinear()
>
>v = vtk.vtkVolume()
>v.SetMapper(vm)
>v.SetProperty(vp)
>
>ren = vtk.vtkRenderer()
>ren.AddVolume(v)
>ren.SetBackground(0.9, 0.9, 0.9)
>
>rw = vtk.vtkRenderWindow()
>rw.AddRenderer(ren)
>rw.SetSize(600, 600)
>
>rwi = vtk.vtkRenderWindowInteractor()
>rwi.SetRenderWindow(rw)
>rwi.Initialize()
>rw.Render()
>rwi.Start()
>
>_______________________________________________
>vtk-developers mailing list
>vtk-developers at vtk.org
>http://www.vtk.org/mailman/listinfo/vtk-developers
More information about the vtk-developers
mailing list