If it helps, there is an example of how to write a python programmable filter that outputs image data here:<br><br><a href="http://www.paraview.org/Wiki/Here_are_some_more_examples_of_simple_ParaView_3_python_filters.#Producing_Image_Data_.28Source.29">http://www.paraview.org/Wiki/Here_are_some_more_examples_of_simple_ParaView_3_python_filters.#Producing_Image_Data_.28Source.29</a><br>
<br>You could modify this to be a filter that takes polydata from the PlotOverLine and outputs an image data.  The wiki example may be slightly complicated to read because it is written in a way that it works as a parallel filter.  You might be able to skip this part for your purposes.<br>
<br>Pat<br><br><div class="gmail_quote">On Wed, Nov 3, 2010 at 5:33 PM,  <span dir="ltr">&lt;<a href="mailto:m.c.wilkins@massey.ac.nz">m.c.wilkins@massey.ac.nz</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Hi,<br>
<br>
Thanks Jerome.  You are dead right!  The writer doesn&#39;t want<br>
vtkpolydata, rather vtkimagedata.  Grrrr, silly me.  I couldn&#39;t figure<br>
out how to convert vtkpolydata to vtkimagedata without actually<br>
rendering to the screen unfortunately.<br>
<br>
Actually I found a really old posting on this mailing list (damn, lost<br>
it now) that says that &quot;Offscreen screenshots&quot; aren&#39;t possible, unless<br>
you compile paraview with offscreen rendering.  Don&#39;t know if this is<br>
still true or not.  But, it appears I am after something too<br>
difficult.<br>
<br>
Anyway, I did figure out how to just extract the numbers of the<br>
vtkpolydata, using commands like this:<br>
<br>
pl.GetPoints().GetData().GetValue(0)<br>
and<br>
pl.GetPointData().GetArray(0).GetValue(0)<br>
<br>
etc<br>
<br>
so I can throw them into an array and use matplotlib.<br>
<br>
Thanks again<br>
<br>
Matt Wilkins<br>
<div><div></div><div class="h5"><br>
On Fri, Oct 29, 2010 at 09:27:45AM +0200, Jérôme wrote:<br>
&gt; Hi Matt,<br>
&gt;<br>
&gt; By quickly reading your code, I understand that you try to put<br>
&gt; the ouput of the PlotOverLine on the the input of an image writer.<br>
&gt; The mistake, IMHO, is that PlotOverLine outputs a vtkPolyData<br>
&gt; (Polygonal Mesh in ParaView), that&#39;s why the writer doesn&#39;t want it as<br>
&gt; input (it expects a vtkImageData instead).<br>
&gt;<br>
&gt; I think that what you want is a screenshot of the plot. You should look<br>
&gt; in that direction. Sort of &quot;Offscreen screenshot&quot; ?? Don&#39;t know...<br>
&gt;<br>
&gt; HTH<br>
&gt; Jerome<br>
&gt;<br>
&gt; 2010/10/29  &lt;<a href="mailto:m.c.wilkins@massey.ac.nz">m.c.wilkins@massey.ac.nz</a>&gt;:<br>
&gt; &gt;<br>
&gt; &gt; Hi,<br>
&gt; &gt;<br>
&gt; &gt; As promised, I have another question!<br>
&gt; &gt;<br>
&gt; &gt; The code below can render a picture to the screen fine.  But I would<br>
&gt; &gt; like to send the picture to a file, without rendering anything to the<br>
&gt; &gt; screen.  I know I can put<br>
&gt; &gt;   WriteImage(&#39;/tmp/foo.png&#39;)<br>
&gt; &gt; at the end to save the output, but that is after I&#39;ve popped up an<br>
&gt; &gt; image.<br>
&gt; &gt;<br>
&gt; &gt; I did find a powerpoint by David E DeMarle about paraview scripting<br>
&gt; &gt; with this in it:<br>
&gt; &gt;<br>
&gt; &gt; writer = servermanager.writers.PNGWriter()<br>
&gt; &gt; writer.FileName = &#39;/tmp/foo.png&#39;<br>
&gt; &gt; writer.Input = pl<br>
&gt; &gt; writer.UpdatePipeline()<br>
&gt; &gt;<br>
&gt; &gt; But when I try that I get:<br>
&gt; &gt; ERROR: In /scratch/pv/ParaView/VTK/IO/vtkPNGWriter.cxx, line 54<br>
&gt; &gt; vtkPNGWriter (0xb108028): Write:Please specify an input!<br>
&gt; &gt; which is odd since I thought I had set the input via writer.Input = pl<br>
&gt; &gt;<br>
&gt; &gt; My full code was<br>
&gt; &gt;<br>
&gt; &gt; from paraview.simple import *<br>
&gt; &gt; reader = servermanager.sources.XMLUnstructuredGridReader(FileName = &quot;/var/tmp/file.vtu&quot;)<br>
&gt; &gt; pl = PlotOverLine(Input = reader)<br>
&gt; &gt; pl.Source.Point1 = [-7000, -5000, 0]<br>
&gt; &gt; pl.Source.Point2 = [4300, 6300, 1111.75]<br>
&gt; &gt; writer = servermanager.writers.PNGWriter()<br>
&gt; &gt; writer.FileName = &#39;/tmp/foo.png&#39;<br>
&gt; &gt; writer.Input = pl<br>
&gt; &gt; c = CreateXYPlotView()<br>
&gt; &gt; d = Show()<br>
&gt; &gt; d.XArrayName = &#39;arc_length&#39;<br>
&gt; &gt; d.SeriesVisibility = [&#39;namecolours (0)&#39;, &#39;0&#39;, &#39;namecolours (1)&#39;, &#39;0&#39;,<br>
&gt; &gt; &#39;namecolours (2)&#39;, &#39;0&#39;, &#39;vtkValidPointMask&#39;, &#39;0&#39;, &#39;arc_length&#39;, &#39;0&#39;]<br>
&gt; &gt; d.UseIndexForXAxis = 0<br>
&gt; &gt; writer.UpdatePipeline()<br>
&gt; &gt;<br>
&gt; &gt; I feel pretty bad about always asking questions on this list, but I<br>
&gt; &gt; just can&#39;t seem to find documentation, or if I do, it is for a<br>
&gt; &gt; slightly different setup (as in David E DeMarle&#39;s powerpoint for<br>
&gt; &gt; instance).  So, if I am just missing some good doco source, please<br>
&gt; &gt; point me that way!<br>
&gt; &gt;<br>
&gt; &gt; Thanks for any help!<br>
&gt; &gt;<br>
&gt; &gt; Matt Wilkins<br>
&gt; &gt;<br>
&gt; &gt; On Fri, Oct 29, 2010 at 01:22:24PM +1300, <a href="mailto:m.c.wilkins@massey.ac.nz">m.c.wilkins@massey.ac.nz</a> wrote:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Hi Utkarsh,<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Thanks, I am using 3.9, but I wasn&#39;t using paraview.simple, just<br>
&gt; &gt;&gt; following the examples in the Python Scripting chapter in the ParaView<br>
&gt; &gt;&gt; Guide.  Using paraview.simple does make things simpler ;-)  and indeed<br>
&gt; &gt;&gt; I can get it to work.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; For the record this works fine for me:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; from paraview.simple import *<br>
&gt; &gt;&gt; reader = servermanager.sources.XMLUnstructuredGridReader(FileName = &quot;/var/tmp/file.vtu&quot;)<br>
&gt; &gt;&gt; pl = PlotOverLine(Input = reader)<br>
&gt; &gt;&gt; pl.Source.Point1 = [-7000, -5000, 0]<br>
&gt; &gt;&gt; pl.Source.Point2 = [4300, 6300, 1111.75]<br>
&gt; &gt;&gt; CreateXYPlotView()<br>
&gt; &gt;&gt; d = Show()<br>
&gt; &gt;&gt; d.XArrayName = &#39;arc_length&#39;<br>
&gt; &gt;&gt; d.SeriesVisibility = [&#39;namecolours (0)&#39;, &#39;0&#39;, &#39;namecolours (1)&#39;, &#39;0&#39;, &#39;namecolours (2)&#39;, &#39;0&#39;, &#39;vtkValidPointMask&#39;, &#39;0&#39;, &#39;arc_length&#39;, &#39;0&#39;]<br>

&gt; &gt;&gt; d.UseIndexForXAxis = 0<br>
&gt; &gt;&gt; Render()<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; OK, so got past this problem, more to come I expect!<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Thank you<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Matt Wilkins<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; On Thu, Oct 28, 2010 at 09:08:50AM -0600, Utkarsh Ayachit wrote:<br>
&gt; &gt;&gt; &gt; What version of ParaView are you using? Here&#39;s my script with 3.9<br>
&gt; &gt;&gt; &gt; (should work with 3.8 too).<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; Wavelet()<br>
&gt; &gt;&gt; &gt; pl = PlotOverLine()<br>
&gt; &gt;&gt; &gt; pl.Source.Point1 = [-10, -10, -10]<br>
&gt; &gt;&gt; &gt; pl.Source.Point2 = [10, 10, 10]<br>
&gt; &gt;&gt; &gt; CreateXYPlotView()<br>
&gt; &gt;&gt; &gt; Show()<br>
&gt; &gt;&gt; &gt; Render()<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; Utkarsh<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; On Wed, Oct 27, 2010 at 2:30 PM,  &lt;<a href="mailto:m.c.wilkins@massey.ac.nz">m.c.wilkins@massey.ac.nz</a>&gt; wrote:<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; Hi,<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; I am driving paraview via pvpython, and trying to do a probe over<br>
&gt; &gt;&gt; &gt; &gt; line.  I would think this is quite easy, but it is proving<br>
&gt; &gt;&gt; &gt; &gt; frustratingly difficult!  This is what I am typing<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; from paraview import servermanager<br>
&gt; &gt;&gt; &gt; &gt; c = servermanager.Connect()<br>
&gt; &gt;&gt; &gt; &gt; reader = servermanager.sources.XMLUnstructuredGridReader(FileName =<br>
&gt; &gt;&gt; &gt; &gt; &quot;/var/tmp/file.vtu&quot;)<br>
&gt; &gt;&gt; &gt; &gt; pl = servermanager.filters.ProbeLine(Input = reader)<br>
&gt; &gt;&gt; &gt; &gt; pl.Source.Point1 = [-7000, -5000, 0]<br>
&gt; &gt;&gt; &gt; &gt; pl.Source.Point2 = [4300, 6300, 1111.75]<br>
&gt; &gt;&gt; &gt; &gt; view = servermanager.CreateRenderView()<br>
&gt; &gt;&gt; &gt; &gt; rep = servermanager.CreateRepresentation(pl, view)<br>
&gt; &gt;&gt; &gt; &gt; pl.UpdatePipeline()<br>
&gt; &gt;&gt; &gt; &gt; view.ResetCamera()<br>
&gt; &gt;&gt; &gt; &gt; view.StillRender()<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; I get a nice picture of the x axis and a short y axis, but nothing<br>
&gt; &gt;&gt; &gt; &gt; plotted.  I try a probe over line in paraview with the same beginning<br>
&gt; &gt;&gt; &gt; &gt; and end points and I get data displayed.<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; I am not specifying what variables should be displayed for the probe<br>
&gt; &gt;&gt; &gt; &gt; over line, so perhaps nothing is getting displayed?  I cannot for the<br>
&gt; &gt;&gt; &gt; &gt; life of me find how I would specify what to display though.  If I do a<br>
&gt; &gt;&gt; &gt; &gt; probe over line in paraview with the Python Shell Trace running, I can<br>
&gt; &gt;&gt; &gt; &gt; see that the SeriesVisibility attribute in the<br>
&gt; &gt;&gt; &gt; &gt; paraview.servermanager.XYChartRepresentation object is being set.<br>
&gt; &gt;&gt; &gt; &gt; However I don&#39;t have that representation, I only have the &#39;rep&#39; above,<br>
&gt; &gt;&gt; &gt; &gt; and that doesn&#39;t have a SeriesVisibility attribute.<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; Thank you for any help, even if it is a pointer to where this is<br>
&gt; &gt;&gt; &gt; &gt; documented!<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; Matt<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; _______________________________________________<br>
&gt; &gt;&gt; &gt; &gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; Follow this link to subscribe/unsubscribe:<br>
&gt; &gt;&gt; &gt; &gt; <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; _______________________________________________<br>
&gt; &gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; &gt;&gt; <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt; &gt;<br>
&gt; &gt; Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt; &gt;<br>
&gt; &gt; Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
&gt; &gt;<br>
&gt; &gt; Follow this link to subscribe/unsubscribe:<br>
&gt; &gt; <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
&gt; &gt;<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" 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" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</div></div></blockquote></div><br>