[vtkusers] wxVTKRenderWindowInteractor + vtkImageViewer2

Mathieu Malaterre Mathieu.Malaterre at creatis.insa-lyon.fr
Thu Sep 4 04:41:03 EDT 2003


Charl P. Botha wrote:
> On Thu, 2003-09-04 at 10:21, Mathieu Malaterre wrote:
> 
>>Ok then, it makes sense. So please find again a patch :
>>
>>http://www.creatis.insa-lyon.fr/~malaterre/vtk/iv2.patch
>>
>>I moved the line into SetupInteractor, thus it won't affet the first render.
> 
> 
> Good idea, I'll test this today (hopefully).
> 
> 
>>Also please note that I also add in my patch to fix James' remark:
>>
>>http://public.kitware.com/pipermail/vtkusers/2003-April/017063.html
> 
> 
> That shouldn't be necessary if ParallelProjection is on.  Are you 100%
> sure that what James reported also happens with ParallelProjection?

110 % sure :))
Please try this python script (*)

Just press 'u' until the head desappear (5 times should be sufficient). 
Then do the test again by removing the '#' in front of 
ResetCameraClippingRange (or just apply my patch iv2.patch). You can 
also check that ParallelProjection is on at each slice iteration.

Thanks,
Mathieu

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

reader = vtk.vtkVolume16Reader()
reader.SetDataDimensions(64, 64)
reader.SetDataByteOrderToLittleEndian()
reader.SetFilePrefix(VTK_DATA_ROOT + "/Data/headsq/quarter")
reader.SetImageRange(1, 93)
reader.SetDataSpacing(3.2, 3.2, 1.5)

slice = 0
def foo(obj, evt):
   global slice
   slice += 1
   viewer.SetZSlice( slice )
   #viewer.GetRenderer().ResetCameraClippingRange()
   #print viewer.GetRenderer().GetActiveCamera().GetParallelProjection()
   viewer.Render()

iren = vtk.vtkRenderWindowInteractor()
#iren.AddObserver("MouseWheelForwardEvent", foo)
iren.AddObserver("UserEvent", foo)

viewer = vtk.vtkImageViewer2()
viewer.SetInput ( reader.GetOutput() )
viewer.SetupInteractor (iren)

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




More information about the vtkusers mailing list