mimre
mimre

Reputation: 92

ParaView programmable filter for contours

I'm trying to create a programmable filter to extract isosurfaces. I know that I can manually type in multiple Isosurfaces and get all of them extracted by a single filter. The problem with that is, that I have to manually type them in. In my use case, I have a bunch of isovalues that I want to use and thus it's kinda tedious to type them in manually.

I've tried using the programmable filter, but I'm kinda stuck on the data format I'm getting.

Here is what I've got so far:

pdi = self.GetPolyDataInput()
pdo =  self.GetPolyDataOutput() 
c = vtk.vtkContourFilter()
c.SetInputConnection(pdo)
c.SetValue(0, 0.01)
c.Update()
self.GetOutput().ShallowCopy(c.GetOutput())

The problem is, that pdo is "None", ie the I don't have PolyData. When I use pdo = self.GetOutput() then I get a vtkImageData object. Which does not work as InputConnection for the ContourFilter.

My ideal solution would be a snipped of code where I just have to copy in a list of values with the rendered isosurfaces for these values, preferable as different objects, so I can color them and add/remove them from the current RenderView.

I'm using raw data as input

Upvotes: 0

Views: 514

Answers (1)

Cory Quammen
Cory Quammen

Reputation: 1298

You can use the Python shell to do just this. Click on the Contour object in the Pipeline Browser. Then, open the Python shell (Tools -> Python Shell). Execute the following lines of Python code in the shell:

contour = GetActiveSource()
contour.Isosurfaces = [100.0, 200.0, 300.0]

Upvotes: 1

Related Questions