[vtk-developers] vtkBoundedPlanePlacer problem

dean.inglis at camris.ca dean.inglis at camris.ca
Mon Oct 15 18:27:45 EDT 2007


Hi,

there were some changes made to vtkBoundedPointPlacer for the 
new vtkParallelopipedWidget that does not appear to allow
for simple placement on bounded 2D planes and breaks the functionality
of vtkImageActorPointPlacer .  Can anyone verify by 
drawing on an image with vtkContourWidget and then trying to move 
the widget's handles.  See script below...

Dean

#------------------------------------------------------------------------------------
package require vtk
package require vtkinteraction

# Start by loading some data.
#
vtkVolume16Reader v16
  v16 SetDataDimensions 64 64
  v16 SetDataByteOrderToLittleEndian
  v16 SetImageRange 1 93
  v16 SetDataSpacing 3.2 3.2 1.5
  v16 SetFilePrefix "$VTK_DATA_ROOT/Data/headsq/quarter"
  v16 Update

# Display a y-z plane.
#
vtkImageViewer2 viewer
  viewer SetInput [v16 GetOutput]
  viewer SetSliceOrientationToXY

vtkRenderWindowInteractor iren
  viewer SetupInteractor iren

  vtkContourWidget ContourWidget
  ContourWidget KeyPressActivationOn

  vtkOrientedGlyphContourRepresentation ContourRep
  ContourWidget SetRepresentation ContourRep

  ContourWidget   SetInteractor iren


  #vtkImageActorPointPlacer placer
  #placer SetImageActor [ viewer GetImageActor ]

  vtkBoundedPlanePointPlacer placer

  placer DebugOn

  ContourRep SetPointPlacer placer

 set bounds [[viewer GetImageActor] GetBounds]
 set xmin [lindex $bounds 0]
 set xmax [lindex $bounds 1]
 set ymin [lindex $bounds 2]
 set ymax [lindex $bounds 3]
 set zmin [lindex $bounds 4]
 set zmax [lindex $bounds 5]

  placer SetProjectionNormalToZAxis

 set center [[viewer GetImageActor] GetCenter]
 set c [lindex $center 2]
  placer SetProjectionPosition  $c

  vtkPlane p1
  p1 SetOrigin $xmin $ymin $zmin
  p1 SetNormal 1.0 0.0 0.0

  vtkPlane p2
  p2 SetOrigin $xmin $ymin $zmin
  p2 SetNormal 0.0 1.0 0.0

  vtkPlane p3
  p3 SetOrigin $xmax $ymax $zmax
  p3 SetNormal -1.0 0.0 0.0

  vtkPlane p4
  p4 SetOrigin $xmax $ymax $zmax
  p4 SetNormal 0.0 -1.0 0.0


  placer AddBoundingPlane p1
  placer AddBoundingPlane p2
  placer AddBoundingPlane p3
  placer AddBoundingPlane p4



  [ContourRep GetLinesProperty] SetColor 0 0 1
  [ContourRep GetActiveProperty] SetColor 0 1 0
  [ContourRep GetProperty] SetColor 0 1 0

iren AddObserver UserEvent {wm deiconify .vtkInteract}

viewer Render

ContourWidget On


# Prevent the tk window from showing up then start the event loop.
wm withdraw .



More information about the vtk-developers mailing list