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