read file for geometry
reader = vtk.vtkXMLMultiBlockDataReader()
reader.SetFileName(geometry_file)
reader.Update()
data = reader.GetOutput()
data_iterator = data.NewIterator()
img_data = data_iterator.GetCurrentDataObject()
img_data.Update()
point_data = img_data.GetPointData()
array_data = point_data.GetArray(0)
np_array = vtk_to_numpy(array_data)
img_shape = img_data.GetWholeExtent()
np_shape = [img_shape[3] - img_shape[2] + 1, img_shape[1] - img_shape[0] + 1, 1]
geometry_array = np_array.reshape(np_shape)
if np.isnan(geometry_array).any():
continue
ERROR:‘vtkmodules.vtkCommonDataModel.vtkImageData’ object has no attribute ‘Update’
Can you please tell me how to modify it?