[vtkusers] 2D scattered points

Mathieu Malaterre Mathieu.Malaterre at creatis.insa-lyon.fr
Tue Aug 26 13:09:45 EDT 2003


Xianjin Yang wrote:
> Hi vtkusers,
> 
> I have a data set with (x, y) coordinates and it is associated with a 
> scalar array that is used to color the points. I can render these points 
> on a plane in 3D by setting z=0 for all points. But I really want to get 
> a static 2D image with Rotate, Traslate and Zoom DISABLED (similar to 
> VTK\Examples\Annotation\Tcl\xyPlot.tcl). Will someone please give me 
> some tips or code snippets? Thank you.
> 
> Yang
> 
> 
> 
Yang,

	You can play with AddObserver and RemoveObserver to disable any 
behavior you don't like. (have a look in particular to 
vtkInteractorStyleImage )
	You might also have a look at vtkImageViewer

	or if you prefer, here is a sample code:

#############################
package require vtk

# Image pipeline
vtkPNGReader reader
reader SetDataSpacing 0.8 0.8 1.5
reader SetFileName $VTK_DATA_ROOT/Data/fullhead15.png

vtkImageShiftScale shiftScale
shiftScale SetInput [reader GetOutput]
shiftScale SetShift 0
shiftScale SetScale 0.07
shiftScale SetOutputScalarTypeToUnsignedChar

vtkImageActor ia
ia SetInput [shiftScale GetOutput]

vtkImageMapper bboxMapper
bboxMapper SetInput [shiftScale GetOutput]

vtkActor2D bboxActor
bboxActor SetMapper bboxMapper

vtkRenderer ren
vtkRenderWindow renWin
renWin AddRenderer ren

ren AddActor ia
ren SetBackground 0.1 0.2 0.4
renWin SetSize 400 400

renWin Render
#############################

HTH
mathieu




More information about the vtkusers mailing list