[vtkusers] updating vtkImageData ?

Anders Wallin anders.e.e.wallin at gmail.com
Sat Feb 11 04:07:19 EST 2012


Here is a more realistic example of what I want to do:
http://pastebin.com/3Wz8C8yC

Now I see different behavior between:

myim = MyImage(ren)  # create vtkImageActor, add it to ren
renWin.Render()         # when Render() is called here, we don't see
the results of modify()
myim.modify()            # this modifies the vtkCharArray of the image
renWin.Render()

and

myim = MyImage(ren)  # create vtkImageActor, add it to ren
# without Render() here , the results of modify() are visible
myim.modify()            # this modifies the vtkCharArray of the image
renWin.Render()   # now we see a modified image!


Confused.
Anders

On Fri, Feb 10, 2012 at 11:01 PM, David Doria <daviddoria at gmail.com> wrote:
>>
>> It turns out there is some subtle difference between
>> vtkRenderer.Render() and vtkRenderWindow.Render()
>>
>> This example shows the behavior:
>> http://pastebin.com/KPFpkCKU
>> On my machine I see an unmodified image with "renWin.Render()" and a
>> modified image with "ren.Render()"
>> I had previously used renWin.Render() in all my vtk code, but I have
>> always worked with polydata only.
>
>
> Quoting David Gobbi from an old mailing list post that I've used ever since:
>
> "You should never, ever call renderer->Render().  That method is only
> meant to be called by the vtkRenderWindow.  The documentation says
> so quite clearly.  By calling it you are probably causing some timestamps
> to be set (indicating that all actors in the renderer have rendered), but
> you
> aren't actually doing any rendering.  Then, when you call
> renderWindow->Render() it sees that those timestamps have been updated
> and thinks that there is nothing to be done."
>
> I'm not sure why renderWindow->Render() is not working for you in this case.
> Any Python VTK experts out there?



More information about the vtkusers mailing list