<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Kenichiro,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
It works!</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you so much! You saved my day!</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best regards,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Joey</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> kenichiro yoshimi <rccm.kyoshimi@gmail.com><br>
<b>Sent:</b> Saturday, November 3, 2018 0:19<br>
<b>To:</b> zhouyu@live.com<br>
<b>Cc:</b> vtkusers@public.kitware.com<br>
<b>Subject:</b> Re: [vtkusers] Question to use the vtkStreamTracer</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi,<br>
<br>
You need to call setActivectors on the point data:<br>
reader.GetOutput().GetPointData().SetActiveVectors('velocity')<br>
<br>
Regards<br>
2018年10月30日(火) 7:27 Yu Zhou <zhouyu@live.com>:<br>
><br>
> Hello,<br>
><br>
><br>
> I have a problem with vtkStreamTracer.<br>
><br>
> Here is the code:<br>
><br>
><br>
> ```<br>
><br>
> def generate_streamline(source_file, dest_file, axis, resolution=1):<br>
> reader = vtk.vtkXMLImageDataReader()<br>
> reader.SetFileName(source_file)<br>
> reader.GetPointDataArraySelection().DisableArray('density')<br>
> reader.Update()<br>
> extent = reader.GetOutput().GetExtent()<br>
> center = [np.mean(extent[0:2]), np.mean(extent[2:4]), np.mean(extent[4:6])]<br>
><br>
> seeds = vtk.vtkPointSource()<br>
> seeds.SetCenter(center)<br>
> seeds.SetRadius(10.5)<br>
> seeds.SetNumberOfPoints(100)<br>
> seeds.Update()<br>
><br>
> streamTracer = vtk.vtkStreamTracer()<br>
> streamTracer.SetInterpolatorTypeToDataSetPointLocator()<br>
> streamTracer.SetInputData(reader.GetOutputDataObject(0))<br>
> streamTracer.SetSourceData(seeds.GetOutputDataObject(0))<br>
> streamTracer.SetIntegratorTypeToRungeKutta45()<br>
> streamTracer.SetMaximumPropagation(104)<br>
> streamTracer.SetInitialIntegrationStep(0.2)<br>
> streamTracer.SetMaximumIntegrationStep(0.5)<br>
> streamTracer.SetIntegrationDirectionToBoth()<br>
> streamTracer.SetStartPosition(center)<br>
> streamTracer.SurfaceStreamlinesOn()<br>
> streamTracer.Update()<br>
><br>
> print(streamTracer.GetOutputDataObject(0))<br>
><br>
> ```<br>
><br>
> The output is:<br>
> ```<br>
><br>
> vtkPolyData (0x273ece0)<br>
> Debug: Off<br>
> Modified Time: 2638<br>
> Reference Count: 2<br>
> Registered Events: (none)<br>
> Information: 0x2ccb540<br>
> Data Released: False<br>
> Global Release Data: Off<br>
> UpdateTime: 2680<br>
> Field Data:<br>
> Debug: Off<br>
> Modified Time: 2628<br>
> Reference Count: 1<br>
> Registered Events: (none)<br>
> Number Of Arrays: 0<br>
> Number Of Components: 0<br>
> Number Of Tuples: 0<br>
> Number Of Points: 0<br>
> Number Of Cells: 0<br>
> Cell Data:<br>
> Debug: Off<br>
> Modified Time: 2636<br>
> Reference Count: 1<br>
> Registered Events:<br>
> Registered Observers:<br>
> vtkObserver (0x2ccc370)<br>
> Event: 33<br>
> EventName: ModifiedEvent<br>
> Command: 0x2ccb880<br>
> Priority: 0<br>
> Tag: 1<br>
> Number Of Arrays: 0<br>
> Number Of Components: 0<br>
> Number Of Tuples: 0<br>
> Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )<br>
> Interpolate Flags: ( 1 1 1 1 1 0 0 1 )<br>
> Pass Through Flags: ( 1 1 1 1 1 1 1 1 )<br>
> Scalars: (none)<br>
> Vectors: (none)<br>
> Normals: (none)<br>
> TCoords: (none)<br>
> Tensors: (none)<br>
> GlobalIds: (none)<br>
> PedigreeIds: (none)<br>
> EdgeFlag: (none)<br>
> Point Data:<br>
> Debug: Off<br>
> Modified Time: 2638<br>
> Reference Count: 1<br>
> Registered Events:<br>
> Registered Observers:<br>
> vtkObserver (0x2ccc210)<br>
> Event: 33<br>
> EventName: ModifiedEvent<br>
> Command: 0x2ccb880<br>
> Priority: 0<br>
> Tag: 1<br>
> Number Of Arrays: 0<br>
> Number Of Components: 0<br>
> Number Of Tuples: 0<br>
> Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )<br>
> Interpolate Flags: ( 1 1 1 1 1 0 0 1 )<br>
> Pass Through Flags: ( 1 1 1 1 1 1 1 1 )<br>
> Scalars: (none)<br>
> Vectors: (none)<br>
> Normals: (none)<br>
> TCoords: (none)<br>
> Tensors: (none)<br>
> GlobalIds: (none)<br>
> PedigreeIds: (none)<br>
> EdgeFlag: (none)<br>
> Bounds:<br>
> Xmin,Xmax: (1, -1)<br>
> Ymin,Ymax: (1, -1)<br>
> Zmin,Zmax: (1, -1)<br>
> Compute Time: 2692<br>
> Number Of Points: 0<br>
> Point Coordinates: 0<br>
> Locator: 0<br>
> Number Of Vertices: 0<br>
> Number Of Lines: 0<br>
> Number Of Polygons: 0<br>
> Number Of Triangle Strips: 0<br>
> Number Of Pieces: 1<br>
> Piece: 0<br>
> Ghost Level: 0<br>
> ```<br>
><br>
> And I get an empty vtkPolyData without any streamline in it.<br>
><br>
> Attached please find the testing dataset.<br>
><br>
><br>
> Please help me.<br>
><br>
><br>
> Thanks,<br>
><br>
><br>
> Joey<br>
><br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">
http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers">http://markmail.org/search/?q=vtkusers</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="https://public.kitware.com/mailman/listinfo/vtkusers">https://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</div>
</span></font></div>
</body>
</html>