[vtk-developers] shift error in vtkVolumeTextureMapper2D

Lisa S. Avila lisa.avila at kitware.com
Thu Jul 18 23:46:17 EDT 2002


Hi David,

I think the "-1" values on lines 200 through 203 are the problem. My build 
at home does not include tcl - if it builds before I fall asleep I will try 
it out tonight otherwise I will fix it tomorrow.

Thanks for finding this - this once again points out the need to 
consolidate this type of code (problems with texture coordinates have been 
fixed in the past in vtkOpenGLImageActor, vtkOpenGLVolumeRayCastMapper, 
vtkOpenGLVolumePro500Mapper, and vtkOpenGLTexture).

Lisa



At 03:00 PM 7/18/2002, David Gobbi wrote:
>Hi Lisa,
>
>The vtkVolumeTextureMapper2D seems to have a half-pixel
>offset error in either the generation of the textures or
>in the mapping of the textures to display.
>
>I've attached a tcl script that demonstrates the problem.
>It volume-renders a sphere along with a wireframe sphere
>of the same dimensions.  The ray-cast volume rendering
>matches the wireframe surface perfectly, but the
>texture-map volume rendering (when you interact with
>the window) is definitely off.
>
>  - David
>
>--
>   David Gobbi, MSc                dgobbi at imaging.robarts.ca
>   Advanced Imaging Research Group
>   Robarts Research Institute, University of Western Ontario
>
>=======================================================
>package require vtk
>
>vtkImageEllipsoidSource reader
>     reader SetOutputScalarTypeToUnsignedChar
>     reader SetWholeExtent 0 31 0 31 0 31
>     reader SetCenter 15.5 15.5 15.5
>     reader SetRadius 14 14 14
>     reader SetInValue 200
>     reader SetOutValue 0
>
>     reader UpdateWholeExtent
>     [reader GetOutput] SetOrigin -15.5 -15.5 -15.5
>     [reader GetOutput] SetSpacing 1 1 1
>
>vtkImageGaussianSmooth blur
>     blur SetInput [reader GetOutput]
>     blur SetStandardDeviation 1.5
>     blur SetRadiusFactor 3
>     blur UpdateWholeExtent
>
># Create transfer functions for opacity and color
>vtkPiecewiseFunction opacityTransferFunction
>     opacityTransferFunction AddPoint    0   0.0
>     opacityTransferFunction AddPoint   95   0.0
>     opacityTransferFunction AddPoint  105   1.0
>     opacityTransferFunction AddPoint  255   1.0
>
>vtkColorTransferFunction colorTransferFunction
>     colorTransferFunction SetColorSpaceToRGB
>     colorTransferFunction AddHSVPoint      0.0 0.01 1.0 1.0
>     colorTransferFunction AddHSVPoint    127.5 0.50 1.0 1.0
>     colorTransferFunction AddHSVPoint    255.0 0.99 1.0 1.0
>     colorTransferFunction SetColorSpaceToHSV
>
># Create properties, mappers, volume actors, and ray cast function
>vtkVolumeProperty volumeProperty
>     volumeProperty SetColor colorTransferFunction
>     volumeProperty SetScalarOpacity opacityTransferFunction
>     volumeProperty SetInterpolationTypeToLinear
>
>vtkVolumeRayCastCompositeFunction  compositeFunction
>
>vtkVolumeRayCastMapper volumeMapper
>     volumeMapper SetInput [blur GetOutput]
>     volumeMapper SetVolumeRayCastFunction compositeFunction
>
>vtkVolumeTextureMapper2D volumeTexMapper
>     volumeTexMapper SetInput [blur GetOutput]
>     volumeTexMapper SetTargetTextureSize 32 32
>     volumeTexMapper SetMaximumNumberOfPlanes 32
>
>vtkLODProp3D volume
>     volume AddLOD volumeMapper volumeProperty 0.2
>     volume AddLOD volumeTexMapper volumeProperty 0.05
>
># Create geometric sphere
>vtkSphereSource sphereSource
>     sphereSource SetCenter  0 0 0
>     sphereSource SetRadius  14
>     sphereSource SetThetaResolution 15
>     sphereSource SetPhiResolution 15
>
>vtkPolyDataMapper sphereMapper
>     sphereMapper SetInput [sphereSource GetOutput]
>
>vtkActor sphereActor
>     sphereActor SetMapper sphereMapper
>     [sphereActor GetProperty] SetRepresentationToWireframe
>
># Okay now the graphics stuff
>vtkRenderer ren1
>vtkRenderWindow renWin
>     renWin AddRenderer ren1
>     renWin SetSize 256 256
>vtkRenderWindowInteractor iren
>     iren SetRenderWindow renWin
>
>[ren1 GetCullers] InitTraversal
>set culler [[ren1 GetCullers] GetNextItem]
>$culler SetSortingStyleToBackToFront
>
>ren1 AddProp sphereActor
>ren1 AddProp volume
>ren1 SetBackground 0.1 0.2 0.4
>renWin Render
>
>wm withdraw .
>
>iren Initialize





More information about the vtk-developers mailing list