I want to be able to modify vtk arrays in python without the need to copy them, modify them and then add them back to vtk polydata. In C++, I assume that this is feasible using references. Is there a solution a similar solution in python?
A MWE is as follows
from os import read
import vtk as vtk
import numpy as np
from helpers.numpy_support import *
def main():
sphere = vtk.vtkPolyDataReader()
sphere.SetFileName('sphere.vtk')
sphere.Update()
polyData=sphere.GetOutput()
array = vtk_to_numpy(polyData.GetPointData().GetAbstractArray('Result'))
for a in array:
a*=5.0
writer = vtk.vtkPolyDataWriter()
writer.SetFileName('modifiedSphere.vtk')
writer.SetInputData(polyData)
writer.Write()
main()