[vtk-developers] vtkCamera + SetPixelAspect -> bug ?

Mathieu Malaterre Mathieu.Malaterre at creatis.insa-lyon.fr
Wed Sep 3 13:38:30 EDT 2003


Hi all,

	This mail follows the discussion I had with a vtk user:
http://vtk.org/pipermail/vtkusers/2003-September/019858.html

	This problem has already been reported before:
http://vtk.org/pipermail/vtkusers/2003-July/019258.html


	So I made an attempt(*) to fix it. Even if it produces the awaited 
result for images, it also has some consequences on a vtkPolyDataMapper...

	In VTK 4.0, the aspect would depend only on the pixel aspect and not 
the window size. The version that break it, is:

http://public.kitware.com/cgi-bin/cvsweb.cgi/VTK/Rendering/vtkOpenGLCamera.cxx.diff?r1=1.48&r2=1.49&cvsroot=VTK

	Look for:
matrix->DeepCopy(this->GetPerspectiveTransformMatrix(aspect[0]/aspect[1],-1,1));

	which became:
matrix->DeepCopy(this->GetPerspectiveTransformMatrix(1.0*usize/vsize,-1,1));

	Could someone shed some light on it ? Also please find this python 
script that shows SetPixelAspect is not doing anything:

#######################################
import vtk
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()

reader = vtk.vtkPNGReader ()
reader.SetDataSpacing (0.8, 0.8, 1.5)
reader.SetFileName ( VTK_DATA_ROOT + "/Data/fullhead15.png")

iren = vtk.vtkRenderWindowInteractor()

viewer = vtk.vtkImageViewer2()
viewer.GetRenderer().SetPixelAspect( 1, 1.5)
viewer.SetupInteractor (iren)
viewer.SetInput ( reader.GetOutput() )

iren.Initialize()
iren.Start()
#######################################

Thanks,
Mathieu

(*) you'll find a patch here:

http://www.creatis.insa-lyon.fr/~malaterre/vtk/camera.patch





More information about the vtk-developers mailing list