Hello,
I have been looking around the forum in similar questions but I can not finish of getting it.
lets say I want to get all the data of a filter that is shown if I show it in a spreadsheet, as a list of arrays, inside my python script that I will then use in pvbatch so I completely automatize my workflow and at the same time I make it it a little bit more ‘inteligent’.
the behavior I am looking for would be the exactly result of doing something like:
then import the csv.
I have saw that in some post it was suggest Fetch() in others servermanager.Fetch(createdFilterObject) I also came across with ‘vtk_to_numpy’ and lastly use directly like createdFilterObject.PointData["Points"] but for some filters works, for other no.
how can I do this in a clean way?
like having as input any filter and as output what is shown in the spread sheet?
thanks in advance
Hello mathieu,
but from servermanager.fetch I get a vtk object that from this sometimes there are some properties sometimes not… for example here it is used this after the servermanager.fetch calc_vtk.GetPointData()link where calc_vtk is the result of servermanager.fetch(filter) but for example if I do the following I get an empty result:
import paraview.servermanager as sm
s=Sphere(Radius=10)
boundingRuler1 = BoundingRuler(registrationName='boundingRuler1', Input=s, Axis = 'X Axis')
ruler = sm.Fetch(boundingRuler1)
ruler.GetPointData().GetArray('Points')
what I am missing? the boundingRuler has point data and also has the array Points
yes, but how I get the entire array of it? that has [[x,y,z],[x0,y0,z0]]
I should treat each filter differently? If I want to transform the points in a slice. or another thing? that’s what I don’t understand, to completely transform a column to an array. as it was logic for me to this line: ruler.GetPointData().GetArray('Points')
but this would not be the general solution to each type? what I want to get is the data sets of whatever the filter is, get what spreadsheet of that filter shows me… in that case how should I do it?
what I want to get is the data sets of whatever the filter is,
servermanager.Fetch()
get what spreadsheet of that filter shows me
The spreadsheet is accumulating the data in different way depending on the datatype. Moreover, the spreadsheet can show pointdata or celldata.
Points and PointData arrays cannot be recovered the same way all the time. If you are working with the same kind of data, then you should be able to generalize.
Hello mathieu,
sorry to continue bothering you with this, but once we have the VTK object, how we wrap it the data set to make the numpy array?
thanks in advance,
this helped me a lot, and furthermore, the info you gave me threw a little bit of light to the subject. one last thing I bother you with, do you have by any means info about the types of data? because I find it as the last peace of the puzzle as for example when we look at point data we also see points inside of it (in speed sheet view) while in reality we access this data in separate places. what in part 2 is mentioned as:
It is possible to access PointData, CellData, FieldData, Points (subclasses of vtkPointSet only), Polygons (vtkPolyData only) this way.
what is in the info is in each data type? what are all the data types? is there any ‘list’ with this info? thanks in advance
what is in the info is in each data type?
Please clarify your question
I mean there is pointData, cellData, Points, and looks like at least FieldData and polygons, if there any other and to know what are in each of this types? as for example when we show the pointData of a filter we also see in the table the Points, that is what perturbates me. to know if I am looking for a field that I can see where to go to see if I can recover it…