[vtkusers] updating vtkImageData ?
Anders Wallin
anders.e.e.wallin at gmail.com
Fri Feb 10 13:27:28 EST 2012
Hi All,
Id like to have 2D bitmap that I update as an algorithm runs, and
produce an animation with VTK that shows the changing bitmap.
In python I am doing it roughly like this:
vol = vtk.vtkImageData()
# .. set dimension,spacing,origin, allocate scalars
scalars = vtk.vtkCharArray()
# .. populate scalars with InsertTuple1(id,color)
vol.GetPointData().SetScalars(scalars)
vol.Update()
ia = vtk.vtkImageActor()
ia.SetInput(vol)
ren.addActor(ia)
renWin.render()
This shows an initial image. Now I want to call functions that modify
the bitmap, and then get an updated rendered scene.
I am trying with:
scalars.SetValue( id , new_color )
vol.Update()
But this does not seem to update my image. If I move these two lines
to before the "ren.addActor(ia)" then I do see that my image-updating
function works, and I get the second frame of my animation. However it
seems after "ren.addActor(ia)" the image data is locked, and
scalars.SetValue( id , new_color ) has no effect?
any ideas?
thanks,
Anders
More information about the vtkusers
mailing list