<div dir="ltr">ParaView's Python Programmable Filter and Python Programmable Source use VTK Python wrapping to do the work while making it available in Paraview. Check out <a href="http://www.paraview.org/Wiki/Python_Programmable_Filter">http://www.paraview.org/Wiki/Python_Programmable_Filter</a>.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 14, 2015 at 2:59 PM, Jeff Becker <span dir="ltr"><<a href="mailto:jeffrey.c.becker@nasa.gov" target="_blank">jeffrey.c.becker@nasa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi.<br>
<br>
As a proof of concept, I have a vtk script that reads some binary data, and produces a vti file. I then have a second script that I generated using ParaView's tracing facility while viewing the data. Now I'd like to combine them, so as to eliminate the intermediate file, i.e., go from binary data directly to rendering. To be specific, my vtk script ends like this:<br>
<br>
steinbmag = steinbmag.reshape(nx,ny,nz).T<br>
<br>
vtkImporter = vtk.vtkImageImport()<br>
vtkImporter.CopyImportVoidPointer(steinbmag, steinbmag.nbytes)<br>
<br>
vtkImporter.SetDataScalarTypeToFloat()<br>
vtkImporter.SetNumberOfScalarComponents(1)<br>
vtkImporter.SetDataExtent(0, nx-1, 0, ny-1, 0, nz-1)<br>
vtkImporter.SetWholeExtent(0, nx-1, 0, ny-1, 0, nz-1)<br>
vtkImporter.SetScalarArrayName('B field magnitude')<br>
<br>
writer=vtk.vtkXMLImageDataWriter()<br>
writer.SetFileName(out_fname)<br>
writer.SetInputConnection(vtkImporter.GetOutputPort())<br>
writer.Write()<br>
<br>
and the ParaView script starts like this:<br>
<br>
from paraview.simple import *<br>
<br>
paraview.simple._DisableFirstRenderCameraReset()<br>
<br>
filepfx = '/nobackup/jcbecker/steinBmag_0'<br>
infile = filepfx+'.vti'<br>
# create a new 'XML Image Data Reader'<br>
steinBmag_ = XMLImageDataReader(FileName=infile)<br>
steinBmag_.CellArrayStatus = []<br>
steinBmag_.PointArrayStatus = ['B field magnitude']<br>
<br>
# get animation scene<br>
animationScene1 = GetAnimationScene()<br>
<br>
# update animation scene based on data timesteps<br>
animationScene1.UpdateAnimationUsingDataTimeSteps()<br>
<br>
# get active view<br>
renderView1 = GetActiveViewOrCreate('RenderView')<br>
# uncomment following to set a specific view size<br>
renderView1.ViewSize = [1090, 761]<br>
<br>
I'm looking at the VTK examples and pvpython documentation, but any help is appreciated.<br>
<br>
Thanks.<br>
<br>
-jeff<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
</blockquote></div><br></div>