[vtkusers] updating vtkImageData ?

Jothybasu Selvaraj jothybasu at gmail.com
Mon Feb 13 07:24:16 EST 2012


If you add the actor after myimg.modify(), it shows the updated image.

You are earlier modifying the data, but not adding the updated actor to the
renderer.

myim.modify()
ren.AddActor(ia)

Jothy

On Mon, Feb 13, 2012 at 12:12 PM, Anders Wallin <anders.e.e.wallin at gmail.com
> wrote:

> I'm not sure exactly what modification you suggest.
> This slightly modified code shows exactly the same behavior as before:
> http://pastebin.com/8BVZViQ3
>
> Anders
>
> > Can you remove
> > ren.AddActor( self.ia )
> > from the class and add it after adding the renderer?
> > Jothy
> >
> >
> > On Sat, Feb 11, 2012 at 9:07 AM, Anders Wallin <
> anders.e.e.wallin at gmail.com>
> > wrote:
> >>
> >> 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?
> >> _______________________________________________
> >> Powered by www.kitware.com
> >>
> >> Visit other Kitware open-source projects at
> >> http://www.kitware.com/opensource/opensource.html
> >>
> >> Please keep messages on-topic and check the VTK FAQ at:
> >> http://www.vtk.org/Wiki/VTK_FAQ
> >>
> >> Follow this link to subscribe/unsubscribe:
> >> http://www.vtk.org/mailman/listinfo/vtkusers
> >
> >
> >
> >
> > --
> > Jothy
> >
>



-- 
Jothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120213/09ded714/attachment.htm>


More information about the vtkusers mailing list