<div dir="ltr">The data that I'm generating has a set of scalar values for every point in the 2D matrix, so a single data row looks like<br>xcoord, ycoord, zcord(probably superfluous), scalar1, scalar2,...scalarN<div>Since the data in your example is being rendered as an image directly I'm not sure how I could incorporate different scalar data which can be selected from the UI, as I can when running the table-to-points filter on a loaded CSV file.</div><div><br></div><div>Is there a way to have a python macro cause ParaView to request a file selection through the UI? Then I could have this single macro loaded and it could process any CSV file I select.</div><div><br></div><div>Thanks,</div><div>Wyatt</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 31, 2018 at 8:23 AM, Cory Quammen <span dir="ltr"><<a href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Wyatt,<br>
<br>
Here's a simple script that sets up a 200 x 200 image data object like<br>
you might use for displaying a heat map.<br>
<br>
#### import the simple module from the paraview<br>
from paraview.simple import *<br>
#### disable automatic camera reset on 'Show'<br>
paraview.simple._<wbr>DisableFirstRenderCameraReset(<wbr>)<br>
<br>
# Create a 2D image data object<br>
from paraview import vtk<br>
vtk_image = vtk.vtkImageData()<br>
vtk_image.SetDimensions(200, 200, 1) # Your size may vary<br>
<br>
# Wrap data in numpy interface<br>
from vtk.numpy_interface import dataset_adapter as dsa<br>
image = dsa.WrapDataObject(vtk_image)<br>
<br>
# Create numpy array. Set your data here<br>
import numpy as np<br>
arr = np.zeros(200*200)<br>
<br>
# Set the data in the image object<br>
image.PointData.append(arr, 'myarray')<br>
<br>
# Now set up a ParaView proxy for the image data<br>
tp = PVTrivialProducer()<br>
tp.GetClientSideObject().<wbr>SetOutput(vtk_image)<br>
Show(tp)<br>
<br>
<br>
# Set up filters, display options, etc. below<br>
<br>
<br>
You can modify it as needed to set up your data array as a numpy array.<br>
<br>
Hope that helps,<br>
Cory<br>
<div class="HOEnZb"><div class="h5"><br>
On Mon, Jan 29, 2018 at 3:27 PM, Wyatt Spear <<a href="mailto:wspear@cs.uoregon.edu">wspear@cs.uoregon.edu</a>> wrote:<br>
> I think the python scripting with embedded data is worth a try. I'm not<br>
> familiar with the built-in vs other server modes so I'm not sure what kind<br>
> of restrictions that entails. Probably my ultimate goal is to build a<br>
> reader plugin that will parse the data out of my application's native format<br>
> but generating a script seems like a decent interim solution.<br>
><br>
> Thanks,<br>
> Wyatt<br>
><br>
> On Mon, Jan 29, 2018 at 5:57 AM, Cory Quammen <<a href="mailto:cory.quammen@kitware.com">cory.quammen@kitware.com</a>><br>
> wrote:<br>
>><br>
>> Wyatt,<br>
>><br>
>> ParaView provides extensive Python scriptability. One solution is to<br>
>> write out a Python script from your program. Within the Pythons<br>
>> script, you set up the data, set up filters and modify visualization<br>
>> settings just as you wish. Once it is loaded, you can continue to<br>
>> explore your data by creating new filters, changing visualization<br>
>> parameters, and so on.<br>
>><br>
>> Creating example Python scripts is easy using the Trace functionality<br>
>> (Tools menu -> Start Trace) - you just interact with the UI and the<br>
>> equivalent Python operations will be written to the trace file. Use<br>
>> such a trace as a basis for what is written from your program.<br>
>><br>
>> To save the data to the Python script and then load it is a different<br>
>> use case from what we typical support, but I think it is doable. It<br>
>> would just look a little ugly (and it would only work in built-in<br>
>> server mode). Basically, you could write out your data in a NumPy<br>
>> array within the script, as if you were entering the array information<br>
>> by hand, then provide that data to what's called a TrivialProducer<br>
>> source. This source would stand in place of a reader. There is a<br>
>> little bit of code required to do that that isn't super obvious -<br>
>> before sketching it out, would this approach work for your needs?<br>
>><br>
>> Thanks,<br>
>> Cory<br>
>><br>
>><br>
>><br>
>> On Sun, Jan 28, 2018 at 10:10 PM, Wyatt Spear <<a href="mailto:wspear@cs.uoregon.edu">wspear@cs.uoregon.edu</a>><br>
>> wrote:<br>
>> > Thanks, I'll take a look at this. My use case is pretty severely<br>
>> > underutilizing ParaView's capabilities though. I'm rendering very large<br>
>> > multi-variable heat maps. So color mapped 2d points are all I need<br>
>> > rendered,<br>
>> > (until I can figure out how to map glyph height to another variable).<br>
>> ><br>
>> > =Wyatt<br>
>> ><br>
>> ><br>
>> > On Sat, Jan 27, 2018 at 8:52 AM Samuel Key <<a href="mailto:samuelkey@bresnan.net">samuelkey@bresnan.net</a>><br>
>> > wrote:<br>
>> >><br>
>> >> Wyatt--<br>
>> >><br>
>> >> While ParaView can read CSV files and subsequently generate images, the<br>
>> >> CSV format for simulation results limits the functionality available to<br>
>> >> you<br>
>> >> in ParaView. My suggestion is that you write your simulation results in<br>
>> >> a<br>
>> >> format that contains geometry information, as well as, Point and Cell<br>
>> >> centered values like displacement, velocity, acceleration, temperature,<br>
>> >> concentrations, volume fractions, et cetera.<br>
>> >><br>
>> >> The attached document is a good place to start. (This document is very<br>
>> >> concise and very complete, but the information is only written down<br>
>> >> once. As<br>
>> >> a result, the format information is sometimes not located where you<br>
>> >> need<br>
>> >> it.)<br>
>> >><br>
>> >> If your simulations are concerned with the deformation of 3-D solids<br>
>> >> and<br>
>> >> structures, I can provide you with FORTRAN95 routines that you can use<br>
>> >> to<br>
>> >> write VTK-formatted simulation results.<br>
>> >><br>
>> >> Once you can generate VTK-formatted datum sets, The File > Save State<br>
>> >> command will generate *.pvsm files that will let you "recreate" a<br>
>> >> previously<br>
>> >> constructed Browser Pipeline. (The PV *.pvsm reader gives you the<br>
>> >> opportunity to select a different datum set.)<br>
>> >><br>
>> >> There is a small two-cell mesh file attached that might be helpful to<br>
>> >> you<br>
>> >> when constructing a VTK-formatted file writer in your application.<br>
>> >><br>
>> >> --Sam<br>
>> >><br>
>> >><br>
>> >><br>
>> >><br>
>> >><br>
>> >> On 1/27/2018 8:46 AM, Wyatt Spear wrote:<br>
>> >><br>
>> >> Greetings,<br>
>> >><br>
>> >> Currently I am using my own application to generate a simple CSV file<br>
>> >> which can be loaded up in ParaView. I then create the visualization I<br>
>> >> want<br>
>> >> with a few manual filter operations.<br>
>> >><br>
>> >> What I would like is to generate a file, preferably still with a field<br>
>> >> for<br>
>> >> CSV-like raw data, that tells ParaView to load the data and then apply<br>
>> >> the<br>
>> >> filters I want, so the view I want is immediately available upon<br>
>> >> loading the<br>
>> >> file and the raw data is available if I want to try other filters.<br>
>> >><br>
>> >> I've taken a look at vpt and pvd files saved from my intended view but<br>
>> >> I'm<br>
>> >> not seeing much correspondence between the CSV data I generate, the<br>
>> >> filters<br>
>> >> I apply and the data fields in there. I'm also pondering the save-state<br>
>> >> and<br>
>> >> trace/macro features of ParaView but I suspect those won't quite square<br>
>> >> with<br>
>> >> my aim of generating a file in an external application which includes<br>
>> >> data.<br>
>> >><br>
>> >> Could someone point me toward a proper way to do this? If it comes down<br>
>> >> to<br>
>> >> plugin development I'm willing to take a look at that.<br>
>> >><br>
>> >> Thanks,<br>
>> >> Wyatt Spear<br>
>> >><br>
>> >><br>
>> >> ______________________________<wbr>_________________<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<br>
>> >> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
>> >><br>
>> >> Please keep messages on-topic and check the ParaView Wiki at:<br>
>> >> <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/<wbr>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=<wbr>ParaView</a><br>
>> >><br>
>> >> Follow this link to subscribe/unsubscribe:<br>
>> >> <a href="https://paraview.org/mailman/listinfo/paraview" rel="noreferrer" target="_blank">https://paraview.org/mailman/<wbr>listinfo/paraview</a><br>
>> >><br>
>> >><br>
>> >> ______________________________<wbr>_________________<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<br>
>> >> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
>> >><br>
>> >> Please keep messages on-topic and check the ParaView Wiki at:<br>
>> >> <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/<wbr>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=<wbr>ParaView</a><br>
>> >><br>
>> >> Follow this link to subscribe/unsubscribe:<br>
>> >> <a href="https://paraview.org/mailman/listinfo/paraview" rel="noreferrer" target="_blank">https://paraview.org/mailman/<wbr>listinfo/paraview</a><br>
>> ><br>
>> ><br>
>> > ______________________________<wbr>_________________<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<br>
>> > <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
>> ><br>
>> > Please keep messages on-topic and check the ParaView Wiki at:<br>
>> > <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/<wbr>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=<wbr>ParaView</a><br>
>> ><br>
>> > Follow this link to subscribe/unsubscribe:<br>
>> > <a href="https://paraview.org/mailman/listinfo/paraview" rel="noreferrer" target="_blank">https://paraview.org/mailman/<wbr>listinfo/paraview</a><br>
>> ><br>
>><br>
>><br>
>><br>
>> --<br>
>> Cory Quammen<br>
>> Staff R&D Engineer<br>
>> Kitware, Inc.<br>
>><br>
><br>
<br>
<br>
<br>
--<br>
Cory Quammen<br>
Staff R&D Engineer<br>
Kitware, Inc.<br>
<br>
</div></div></blockquote></div><br></div>