[vtkusers] vtk window closes unexpectedly in vtkImageAccumulate
    David Gobbi 
    david.gobbi at gmail.com
       
    Mon Dec  1 19:34:25 EST 2014
    
    
  
Hi Lizeth,
Many (most?) of the tests are written to exit as soon as the window
pops up, because that's all the testing system needs.
The easiest way to get the program to stick around is to run python
with the "-i" option:
python -i TestAccumulate.py
To make the program stick around without the "-i" option, you have to
connect a vtkRenderWindowInteractor and then call interactor.Start()
at the end of the code.
 - David
On Mon, Dec 1, 2014 at 5:23 PM, Lizeth Castellanos <
castellanoslizan at gmail.com> wrote:
> Hello vtk-users!
>
>
> I'm using the TestAccumulate.py from
> http://vtk.org/gitweb?p=VTK.git;a=blob;f=Imaging/Core/Testing/Python/TestAccumulate.py;h=40054f0e43dbf7914f911815172d8c02378826ee;hb=HEAD
>
> I don't get see the result. The test ran without  compilation errors, but
> the vtk window closes unexpectedly.
>
> Any idea?
>
> Thanks!
>
> -Lizeth
>
> My Code here:
>
> #!/usr/bin/env python
> import vtk
> from vtk.test import Testing
>
> reader = vtk.vtkPNGReader()
> reader.SetFileName("/home/user/Downloads/fullhead15.png")
>
> smooth = vtk.vtkImageGaussianSmooth()
> smooth.SetDimensionality(2)
> smooth.SetStandardDeviations(1,1)
> smooth.SetInputConnection(reader.GetOutputPort())
>
> imageAppend = vtk.vtkImageAppendComponents()
> imageAppend.AddInputConnection(reader.GetOutputPort())
> imageAppend.AddInputConnection(smooth.GetOutputPort())
>
> clip = vtk.vtkImageClip()
> clip.SetInputConnection(imageAppend.GetOutputPort())
> clip.SetOutputWholeExtent(0,255,0,255,20,22)
>
> accum = vtk.vtkImageAccumulate()
> accum.SetInputConnection(clip.GetOutputPort())
> accum.SetComponentExtent(0,255,0,255,0,0)
> accum.SetComponentSpacing(12,12,0.0)
> accum.Update()
>
> viewer = vtk.vtkImageViewer()
> viewer.SetInputConnection(accum.GetOutputPort())
> viewer.SetColorWindow(4)
> viewer.SetColorLevel(2)
> viewer.Render()
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141201/83659d58/attachment.html>
    
    
More information about the vtkusers
mailing list