Re: [wxVTK] vtkImageViewer2
Brought to you by:
malat
From: Mathieu M. <mat...@gm...> - 2009-10-23 10:42:19
|
You need to use the same RenderWindow, this is the trick. On Fri, Oct 16, 2009 at 5:57 PM, Suyang Mei <suy...@ya...> wrote: > > Hi, all - > > I am new to wxVTK even VTK world. > > I need to implement a 2D slicer to display 2D slices from a 3D volume by using wxWidget, python & VTK. By searching the web, I am planning to use vtkImageViewer2 to implement it, is this a good choice? any suggestion? > > Here is the sample codes I am working on (I use a 2D slice to start with, the Forest4.png with the size of 192 & 256) - > > #################################### > import vtk > from vtk.util.misc import vtkGetDataRoot > from vtk.wx.wxVTKRenderWindowInteractor import * > from wxPython.wx import * > > app = wxPySimpleApp() > > frame = wxFrame(None, -1, "wxRenderWindow", size=wxSize(400,400)) > frame.Show(1) > > reader = vtk.vtkPNGReader () > reader.SetDataSpacing (1.0, 1.0, 1.0) > reader.SetFileName ( "Forest4.png") > > iren = wxVTKRenderWindowInteractor(frame, -1) > iren.AddObserver("ExitEvent", lambda o,e,f=frame: f.Close()) > > viewer = vtk.vtkImageViewer2() > viewer.SetInput ( reader.GetOutput() ) > viewer.SetupInteractor (iren) > #viewer.GetRenderer().ResetCameraClippingRange() > > app.MainLoop() > #################################### > > When I run this *.py file, I got the image displayed at the upper left corner of the view port, only occupied a small portion. How do I correctly set the zoom factor? > > I googled vtkImageViewer2, back to 2003, there were many posts about bugs inside vtkImageViewer2 when using wxWidget - > > http://public.kitware.com/pipermail/vtkusers/2003-September/069419.html > > Is this problem fixed? I am using VTK version 5.2, wxPython 2.8.9.1, and I am in linux. > > Any suggestions will be helpful, thanks. > > Suyang > > > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Wxvtk-users mailing list > Wxv...@li... > https://lists.sourceforge.net/lists/listinfo/wxvtk-users > -- Mathieu |