[vtkusers] Re: get data values at line

Fabian Braennstroem f.braennstroem at gmx.de
Mon Oct 31 14:12:15 EST 2005


Hi,

I just found the solution. I needed a missing
'probe.update'.

* On 19 Oct 2005 * Fabian Braennstroem wrote:

> Hi,
> 
> * On 19 Oct 2005 * Fabian Braennstroem wrote:
> 
> > Hi,
> > 
> > I read my EnSight Case with the 'vtkGenericEnSightReader'
> > and I am able to find the max velocity with:
> > 
> >   maxVelocity=reader.GetOutput().GetPointData().GetVectors().GetMaxNorm();
> > 
> > Now, I would like to read the actual velocity at certain
> > points and/or lines and write them to an external file. Can
> > I do this using the probe filter or is there anything
> > similar to 'GetActualValue(x1,y1,z1,x2,y2,z2)', where I
> > define the point/line and get the values!? Afterwards I would
> > use a simple 'print' in Cxx/Python/Tcl.
> 
> I found something, which could work... I am actually trying
> to implement a probe filter into the python-officeTube
> example. I got the probe filter from the xyPlot.py example:
> 
> 
> 
> 
>    #!/usr/bin/env python
>    
>    # This example demonstrates the use of a single streamline and the
>    # tube filter to create a streamtube.
>    
>    import vtk
>    from vtk.util.misc import vtkGetDataRoot
>    from vtk.util.colors import *
>    VTK_DATA_ROOT = vtkGetDataRoot()
>    
>    # We read a data file the is a CFD analysis of airflow in an office
>    # (with ventilation and a burning cigarette). We force an update so
>    # that we can query the output for its length, i.e., the length of the
>    # diagonal of the bounding box. This is useful for normalizing the
>    # data.
>    reader = vtk.vtkStructuredGridReader()
>    reader.SetFileName(VTK_DATA_ROOT + "/Data/office.binary.vtk")
>    reader.Update()
>    
>    length = reader.GetOutput().GetLength()
>    
>    maxVelocity =reader.GetOutput().GetPointData().GetVectors().GetMaxNorm()
>    maxTime = 35.0*length/maxVelocity
>    
>    
>    # Create three the line source to use for the probe lines.
>    line = vtk.vtkLineSource()
>    line.SetResolution(1)
>    
>    # Move the line into place and create the probe filter.  For
>    # vtkProbeFilter, the probe line is the input, and the underlying data
>    # set is the source.
>    transL1 = vtk.vtkTransform()
>    transL1.Translate(0.0, 0.0, 0.37)
>    transL1.Scale(1, 1, 1)
>    #transL1.RotateY(90)
>    tf = vtk.vtkTransformPolyDataFilter()
>    tf.SetInput(line.GetOutput())
>    tf.SetTransform(transL1)
>    probe = vtk.vtkProbeFilter()
>    probe.SetInput(tf.GetOutput())
>    probe.SetSource(reader.GetOutput())


probe.Update()

>    
>    wertreader = reader.GetOutput().GetPointData().GetScalars().GetTuple1(1)
>    
>    print 'line', line
>    print 'transL1', transL1
>    print 'tf', tf
>    print 'probe', probe
> 
>    print 'wertreader', wertreader
> 
>    wert = probe.GetOutput().GetPointData().GetScalars().GetTuple1(1)
>    print 'wert', wert
> 
> 

Greetings!
Fabian



More information about the vtkusers mailing list