[vtkusers] Banding effect on 3D volume rendering

Sandro Rosi s.rosi at optikon.it
Wed Apr 21 12:57:35 EDT 2004


Hi vtk users,
I have a series of slices (PNG files) obtained from an ultrasound registration and I'm trying to reconstruct a 3D volume rendering. The result is a 3D volume with an huge banding effect that I'm not able to eliminate. Could someone help me? The TCL code I'm using is the following:

package require vtk
package require vtkinteraction

# Create the standard renderer, render window
# and interactor
vtkRenderer ren1
vtkRenderWindow renWin
    renWin AddRenderer ren1
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

vtkPNGReader reader
   reader SetDataExtent 0 0 0 0 0 72
   reader SetDataSpacing 0.3 0.3 0.18
   reader SetFilePrefix "C:/bscansdi/slice"

vtkImageIslandRemoval2D islandRemover
      islandRemover SetAreaThreshold 4
      islandRemover SetIslandValue -1
      islandRemover SetReplaceValue 1.0
      islandRemover SetInput [reader GetOutput];

vtkImageGaussianSmooth  gaussian
     gaussian SetStandardDeviations 1.0 1.0 1.0
     gaussian SetRadiusFactors 1.0 1.0 1.0
     gaussian SetInput [islandRemover GetOutput]


vtkImageThreshold selectTissue
     selectTissue ThresholdBetween 30.0 255.0
     selectTissue ReplaceInOff
     selectTissue SetOutValue 0.0
     selectTissue SetInput [gaussian GetOutput]

# Create transfer mapping scalar value to opacity
vtkPiecewiseFunction opacityTransferFunction
    opacityTransferFunction AddPoint  0   0.0
    opacityTransferFunction AddPoint  10   0.259
    opacityTransferFunction AddPoint  255  1.0

# Create transfer mapping scalar value to color
vtkColorTransferFunction colorTransferFunction
    colorTransferFunction AddRGBPoint      0.0 0.0 0.0 0.0
    colorTransferFunction AddRGBPoint     10.0 0.259 0.259 0.3
    colorTransferFunction AddRGBPoint    255.0 1.0 1.0 0.3

# The property describes how the data will look
vtkVolumeProperty volumeProperty
    volumeProperty SetColor colorTransferFunction
    volumeProperty SetScalarOpacity opacityTransferFunction
    volumeProperty SetInterpolationTypeToLinear
    volumeProperty ShadeOff

# The mapper / ray cast function know how to render the data
vtkVolumeRayCastCompositeFunction  compositeFunction
vtkVolumeRayCastMapper volumeMapper
    volumeMapper SetVolumeRayCastFunction compositeFunction
    volumeMapper SetInput [selectTissue GetOutput]

# The volume holds the mapper and the property and
# can be used to position/orient the volume
vtkVolume volume
    volume SetMapper volumeMapper
    volume SetProperty volumeProperty

ren1 AddVolume volume
ren1 SetBackground 0.1 0.2 0.4
renWin Render

iren Initialize

wm withdraw .

Thank for your help
Sandro Rosi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040421/e5d946a6/attachment.htm>


More information about the vtkusers mailing list