[vtkusers] Question to use the vtkStreamTracer
Yu Zhou
zhouyu at live.com
Mon Oct 29 18:27:30 EDT 2018
Hello,
I have a problem with vtkStreamTracer.
Here is the code:
```
def generate_streamline(source_file, dest_file, axis, resolution=1):
reader = vtk.vtkXMLImageDataReader()
reader.SetFileName(source_file)
reader.GetPointDataArraySelection().DisableArray('density')
reader.Update()
extent = reader.GetOutput().GetExtent()
center = [np.mean(extent[0:2]), np.mean(extent[2:4]), np.mean(extent[4:6])]
seeds = vtk.vtkPointSource()
seeds.SetCenter(center)
seeds.SetRadius(10.5)
seeds.SetNumberOfPoints(100)
seeds.Update()
streamTracer = vtk.vtkStreamTracer()
streamTracer.SetInterpolatorTypeToDataSetPointLocator()
streamTracer.SetInputData(reader.GetOutputDataObject(0))
streamTracer.SetSourceData(seeds.GetOutputDataObject(0))
streamTracer.SetIntegratorTypeToRungeKutta45()
streamTracer.SetMaximumPropagation(104)
streamTracer.SetInitialIntegrationStep(0.2)
streamTracer.SetMaximumIntegrationStep(0.5)
streamTracer.SetIntegrationDirectionToBoth()
streamTracer.SetStartPosition(center)
streamTracer.SurfaceStreamlinesOn()
streamTracer.Update()
print(streamTracer.GetOutputDataObject(0))
```
The output is:
```
vtkPolyData (0x273ece0)
Debug: Off
Modified Time: 2638
Reference Count: 2
Registered Events: (none)
Information: 0x2ccb540
Data Released: False
Global Release Data: Off
UpdateTime: 2680
Field Data:
Debug: Off
Modified Time: 2628
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Points: 0
Number Of Cells: 0
Cell Data:
Debug: Off
Modified Time: 2636
Reference Count: 1
Registered Events:
Registered Observers:
vtkObserver (0x2ccc370)
Event: 33
EventName: ModifiedEvent
Command: 0x2ccb880
Priority: 0
Tag: 1
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Point Data:
Debug: Off
Modified Time: 2638
Reference Count: 1
Registered Events:
Registered Observers:
vtkObserver (0x2ccc210)
Event: 33
EventName: ModifiedEvent
Command: 0x2ccb880
Priority: 0
Tag: 1
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Bounds:
Xmin,Xmax: (1, -1)
Ymin,Ymax: (1, -1)
Zmin,Zmax: (1, -1)
Compute Time: 2692
Number Of Points: 0
Point Coordinates: 0
Locator: 0
Number Of Vertices: 0
Number Of Lines: 0
Number Of Polygons: 0
Number Of Triangle Strips: 0
Number Of Pieces: 1
Piece: 0
Ghost Level: 0
```
And I get an empty vtkPolyData without any streamline in it.
Attached please find the testing dataset.
Please help me.
Thanks,
Joey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181029/03f13c19/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 45de41e7.0000000100.vti
Type: application/octet-stream
Size: 569329 bytes
Desc: 45de41e7.0000000100.vti
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181029/03f13c19/attachment-0001.obj>
More information about the vtkusers
mailing list