[vtk-developers] gradient backgrounds bug?
Dean Inglis
dean.inglis at camris.ca
Tue Apr 15 15:48:05 EDT 2008
thanks for the quick fix!
Dean
Subject: Re: [vtk-developers] gradient backgrounds bug?
I checked in the fix for this. One issue was that I had to ensure textures
were disabled while drawing the gradient. The other is that
Clear() was being called while picking, causing the gradient quad to
register as a "hit". Thanks, Francois!
Jeff
On Mon, Apr 14, 2008 at 9:30 PM, Dean Inglis <dean.inglis at sympatico.ca>
wrote:
>
> Ive been trying out the new gradient backgrounds which are a great
> addition to vtk. However, Ive come across a few pipelines where the
> gradient background does not work and in some cases interferes with
> event processing. Attached is a tcl script to test
> vtkImageOrthoPlanes: it makes use of two renderers. If you
> un-comment one or both lines where the renderers turn on the
> gradient background and try interacting with the orthoplanes you will
> see some odd behaviour.
> See tcl script below and comments. I have no idea how to fix this
> since I never do opengl programming, and this behaviour may happen
> with other pipeline scenarios.
>
> Dean
>
>
>
> package require vtk
> package require vtkinteraction
>
> vtkVolume16Reader v16
> v16 SetDataDimensions 64 64
> v16 SetDataByteOrderToLittleEndian
> v16 SetImageRange 1 93
> v16 SetDataSpacing 3.2 3.2 1.5
> v16 SetFilePrefix "d:/Developer/Sources/VTKData/Data/headsq/quarter"
> v16 ReleaseDataFlagOn
> v16 SetDataMask 0x7fff
> v16 Update
>
> vtkOutlineFilter outline
> outline SetInputConnection [v16 GetOutputPort ]
>
> vtkPolyDataMapper outlineMapper
> outlineMapper SetInputConnection [outline GetOutputPort ]
>
> vtkActor outlineActor
> outlineActor SetMapper outlineMapper
>
> vtkRenderer ren1
> vtkRenderer ren2
>
> vtkRenderWindow renWin
> renWin AddRenderer ren2
> renWin AddRenderer ren1
>
> vtkRenderWindowInteractor iren
> iren SetRenderWindow renWin
>
> vtkPropPicker picker
>
> vtkProperty ipwProp
> # assign default props to the ipw's texture plane actor
>
> vtkImagePlaneWidget planeWidgetX
> planeWidgetX SetInteractor iren
> planeWidgetX SetKeyPressActivationValue 'x'
> planeWidgetX SetPicker picker
> planeWidgetX RestrictPlaneToVolumeOn
> [planeWidgetX GetPlaneProperty ] SetColor 1 0 0
> planeWidgetX SetTexturePlaneProperty ipwProp
> planeWidgetX TextureInterpolateOff
> planeWidgetX SetResliceInterpolateToNearestNeighbour
> planeWidgetX SetInput [v16 GetOutput ]
> planeWidgetX SetPlaneOrientationToXAxes
> planeWidgetX SetSliceIndex 32
> planeWidgetX DisplayTextOn
> planeWidgetX On
> planeWidgetX InteractionOff
> planeWidgetX InteractionOn
>
> vtkImagePlaneWidget planeWidgetY
> planeWidgetY SetInteractor iren
> planeWidgetY SetKeyPressActivationValue 'y'
> planeWidgetY SetPicker picker
> [planeWidgetY GetPlaneProperty] SetColor 1 1 0
> planeWidgetY SetTexturePlaneProperty ipwProp
> planeWidgetY TextureInterpolateOn
> planeWidgetY SetResliceInterpolateToLinear
> planeWidgetY SetInput [v16 GetOutput ]
> planeWidgetY SetPlaneOrientationToYAxes
> planeWidgetY SetSlicePosition 102.4
> planeWidgetY SetLookupTable [planeWidgetX GetLookupTable ]
> planeWidgetY DisplayTextOff
> planeWidgetY UpdatePlacement
> planeWidgetY On
>
> vtkImagePlaneWidget planeWidgetZ
> planeWidgetZ SetInteractor iren
> planeWidgetZ SetKeyPressActivationValue 'z'
> planeWidgetZ SetPicker picker
> [planeWidgetZ GetPlaneProperty ] SetColor 0 0 1
> planeWidgetZ SetTexturePlaneProperty ipwProp
> planeWidgetZ TextureInterpolateOn
> planeWidgetZ SetResliceInterpolateToCubic
> planeWidgetZ SetInput [v16 GetOutput ]
> planeWidgetZ SetPlaneOrientationToZAxes
> planeWidgetZ SetSliceIndex 25
> planeWidgetZ SetLookupTable [ planeWidgetX GetLookupTable ]
> planeWidgetZ DisplayTextOn
> planeWidgetZ On
>
> vtkImageOrthoPlanes orthoPlanes
> orthoPlanes SetPlane 0 planeWidgetX
> orthoPlanes SetPlane 1 planeWidgetY
> orthoPlanes SetPlane 2 planeWidgetZ
> orthoPlanes ResetPlanes
>
> #set wl [planeWidgetZ GetWindowLevel ]
>
> # Add a 2D image to test the GetReslice method
> #
> vtkImageMapToColors colorMap
> colorMap PassAlphaToOutputOff
> colorMap SetActiveComponent 0
> colorMap SetOutputFormatToLuminance
> colorMap SetInput [planeWidgetZ GetResliceOutput ]
> colorMap SetLookupTable [planeWidgetX GetLookupTable ]
>
> vtkImageActor imageActor
> imageActor PickableOff
> imageActor SetInput [colorMap GetOutput ]
>
> # Add the actors
> #
> ren1 AddActor outlineActor
> ren2 AddActor imageActor
>
> ren1 SetBackground 0.1 0.1 0.2
> ren1 SetBackground2 1 0.1 0.2
>
> #----------------------------------------------------------
> # if the renderer has its gradientbackground # turn on, interaction
> with the image plane widgets # is not possible #
> #ren1 GradientBackgroundOn
>
> # if left off, interaction is possible, but clicking # one of the
> widgets will toggle the gradient background # in the second renderer
> #
> ren2 SetBackground 0.2 0.1 0.2
> ren2 SetBackground2 1 0.1 0.2
> ren2 GradientBackgroundOn
>
> renWin SetSize 600 350
>
> ren1 SetViewport 0 0 0.58333 1
> ren2 SetViewport 0.58333 0 1 1
>
> # render the image
> #
> iren AddObserver UserEvent {wm deiconify .vtkInteract} iren
> Initialize
>
> # prevent the tk window from showing up then start the event loop wm
> withdraw .
>
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
--
Jeff Baumes, Ph.D.
R&D Engineer, Kitware Inc.
(518) 371-3971 x132
jeff.baumes at kitware.com
_______________________________________________
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