[Paraview] contour programmable filter

Guillaume robguillaume at free.fr
Wed Oct 6 14:49:30 EDT 2010


  Yes, I know, It's impossible to obtain an isosurface with the maximum 
value,
but I want just use it in order to compute a new value (max - 0.1 for 
example) and use this new value for threshold.

So my actual problem is how create the contour ?
I tried with :

cf = vtk.vtkContourGrid()
cf.SetInputConnection(pdo)
cf.SetValue(1,0.1)

I didn't obtained some images. Perhaps I need some lines code with 
self.GetPolyDataOutput() ?

Thank you.
PS: Sorry for the delay of the response, I was out of my office during 
the last weeks.

Guillaume


On 24/09/2010 23:28, Favre Jean wrote:
> Using the maximum value of any scalar field as the threshold for an isosurface will always give a null object. In fact, the smallest isosurface you could ever construct is a single triangle, intersecting 3 edges connecting one vertex greater than your threshold, and three other vertices below your threshold.
>
> this is the second case in this figure: http://en.wikipedia.org/wiki/File:MarchingCubes.svg
>
> you should rethink your strategy of using the maximum value as input threshold.
>
> That being said, there is a much faster way to get the range (the min and maximum) of a scalar field from within the Pogrammable Filter. Simply use GetRange()
>
> max = temperature.GetRange()[1]
>
> -----------------
> Jean M. Favre
> Swiss National Supercomputing Center
>

Hi everybody,

I begin with Paraview and I would like to have a variable input (like 
the maximum temperature at each time step) for the isosurface into the 
contour filter.
In this way, I created a programmable filter to get the maximum 
temperature :

pdi = self.GetPolyDataInput()
pdo =  self.GetPolyDataOutput()
numPoints = pdi.GetNumberOfPoints()
temperature = pdi.GetPointData().GetArray("temperature")

max=-1.0
for i in range(0, numPoints):
    if (max < temperature.GetValue(i)):
        max = temperature.GetValue(i)
print(max)

But, now my problem is how create the contour filter ?
I tried with :

cf = vtk.vtkContourGrid()
cf.SetInputConnection(pdo)
cf.SetValue(1,0.1)

but I didn't obtained some images. Perhaps I need some lines code with 
self.GetPolyDataOutput() ?

Thanks in advance,
Guillaume



More information about the ParaView mailing list