output.SetPoints(newPoints)

Hi.

For a past project, where I needed to visualize the complex space-time varying coordinate structure of my dataset, I had:

2,

  1. preprocessed the data, and added the coordinate (space-time varying) matrix
  2. created a programmable filter in PV to read, at each timestep, the coordinates contained in that matrix
  3. reassigning coordinates
  4. updating coordinates.

With the newer version of PV, the same code seems to have a problem with point 4 (all the rest is working, input data is the same: netcdf format, regular structured grid, [x, y, z, time]).

This is the line that used to work:
#impose new points (modified!)
output.SetPoints(newPoints)

but now I got following error:

Traceback (most recent call last):
  File "<string>", line 22, in <module>
  File "<string>", line 32, in RequestData
AttributeError: 'vtkmodules.vtkCommonDataModel.vtkImageData' object has no attribute 'SetPoints'

It is very frustrating. I know all the rest is working, I can just not inject the new, corrected data and visualize it. Anyone knows how to? Has the syntax changed?

Thanks bye

P.s.: filter attached:

input = self.GetInputDataObject(0, 0)
output = self.GetOutputDataObject(0)
	
output.ShallowCopy(input)
newPoints = vtk.vtkPoints()
numPoints = input.GetNumberOfPoints()
	
t =self.GetInputDataObject(0,0).GetInformation().Get(vtk.vtkDataObject.DATA_TIME_STEP())
print("time: ",t)


q = "zlev"
input0 = inputs[0]
zlev = input0.PointData[q]
print(zlev)



#foreach gridpoint in my domain:
for i in range(0, numPoints):
    #extract coordinates
    coord = input.GetPoint(i)
    x, y, z = coord[:3]
    z = zlev[i]
             
    #insert 
    newPoints.InsertPoint(i, x, y, z)


#impose new points (modified!)
output.SetPoints(newPoints) ----- this is the culprit

I find my own way out for this. Unlike the previous cases, for the original input dataset I had to set:

Output Type: Structured

The filter now know how to deal with it and the original data topology is preserved and rendered perfectly.

1 Like