[vtkusers] updating vtkimagedata in animation.

David Gobbi david.gobbi at gmail.com
Fri Jan 18 17:48:05 EST 2019


Hi Shadab,

When you directly modify data in VTK, it is necessary to call Modified() on
the data container or else the pipeline will not update.

For vtkImageData, the voxel values are stored in an array that can be
retrieved as follows:

    data->GetPointData()->GetScalars()

So when you modify voxels, you should also do the following:

    data->GetPointData()->GetScalars()->Modified();
    data->Modified();

It's been a while since I've done anything similar myself, so there might
be other Modifed() calls that are necessary.

Cheers,
   David


On Fri, Jan 18, 2019 at 3:40 PM shadab anwar <sk.shadabanwar at gmail.com>
wrote:

> Hi everyone,
>
> I am working on creating an animation of a tool and a workpiece
> (vtkimagedata). Where the tool should move to a  location and turnoff the
> voxels (create a hole) at that location. I want to animate a dynamic scene.
>
> I am turning off voxels of workpiece (vtkimagedata) in " virtual void
> Execute () "  function of  " class vtkTimerCallback"   but I am not able
> to render the updated vtkimagedata.
>
> basically I am not able to see the hole at those positions.
>
> Any suggestions? directions? on how its done will be a great help.
>
> Thanks,
> Shadab
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20190118/327483dc/attachment-0001.html>


More information about the vtkusers mailing list