There are many reasons to maintain provenance information in image files containing scientific visualizations. A big reason is reproducibility, and reproducibility from a saved image just got a lot easier in ParaView.

The ParaView state file was introduced in 2005. A state file captures all of ParaView’s data sources, processing pipelines, and visualization parameters, into an XML representation of the state (extension .pvsm). Loading the state file brings ParaView back to the same state it was in when the file was saved. Doing this, you might find yourself with many state files with names that seemed clever at the time to help you remember which visualization would be created after loading that ParaView state. If you were more patient, you could independently save a screenshot and a state file and associate them somehow and use the screenshot to remember the visualization the ParaView state file will produce.

This situation improved dramatically with the Save State and Screenshot Plugin introduced in 2020. This plugin allows a user to simply click a ParaView GUI icon to save a screenshot and .pvsm state file, both with the same name but different extensions, in a preconfigured directory. This vastly improves the situation for those dealing with many ParaView-generated visualizations. One can use the OS-provided file browser to scan through the images they create. Right next to each one is a .pvsm file that can be used to get ParaView back into the state that created the screenshot. This plugin was created as part of an Office of Science BER project for the express purpose of creating a large number of disparate images that could be continuously refined after weekly meetings with a team of various domain experts. Issues in iteratively creating production visualizations were addressed e.g., maintaining camera angles, color maps, color legend properties, visibilities in complex pipelines, animations, and simply managing the ParaView state for a large number of individual visualization products. This is not perfect, however, and requires you to evaluate the filenames to make sure the right state file is loaded. 

In version 5.12, ParaView supports saving a single PNG file that contains both the screenshot image and the state information. ParaView supports the creation and use of this PNG. You can load this file into ParaView as image data or you can have ParaView load it as a state file to bring it back to the state that created the visualization. This is possible because PNG images can store metadata information, and we embed the ParaView state XML as metadata. Thanks to this new functionality, the iterative process of progressively improving a visualization is simplified.

To generate a PNG image that embeds the ParaView state, click FileSave Screenshot, type the output filename, and enable the Embed ParaView State option shown in Figure 1 (left). To load the ParaView state from a PNG image, you can either click File→Load State and select the PNG image with the embedded state file or drag and drop the PNG image into ParaView and click Yes in the pop-up dialog box (Figure 1: right) to load the PNG file as a ParaView state instead of an image.

Figure 1: (Left) Save Screenshot Options including Embed ParaView State. (Right) Dialog when dragging and dropping a PNG with an embedded state onto ParaView GUI.

This work was funded by the ASC program at the Los Alamos National Laboratory. LA-UR-23-21138

Leave a Reply