When a ParaView state file is saved, it saves the absolute paths to the data files that ParaView has loaded. This has made sharing state files annoying since the person loading the state file has to tell ParaView where to look for each data file. Since sharing state files is something many people want to do, one of the most requested features for ParaView is to be able to load data from a path relative to the state file rather than an absolute path. We have added some new features to loading state files that will make sharing state files much easier.
When you load a state file, ParaView will now give broader options of where to look for the files as shown in this screenshot:
Use File Names From State just uses the file locations specified in the state file and errors if they are not found. This is useful if you are using a state file written out on the same computer.
Search files under specified directory looks for the data files in a specified directory. ParaView will parse out the filename of each file and look in the given directory to see if that filename exists. If the file exists it will be used, otherwise it will try the path in the state file. Since a common use case is sharing state files along with their data, the default directory used by this option is the location of the state file. Here is what the dialog looks like when using this option:
The Choose File Names option is the old default: manually specifying where each data file is located. This is still useful for running a pipeline on a different dataset than the one it was built with although we expect the other two to be more commonly used. This option has been improved with the ability to specify environment variables as a part of the filename as shown here:
Unlike the old load state file mechanism these options can also be specified from the Python API. Use the python trace to find the options needed for a given state file. Here is an example of loading state in a python script that loads a state and uses the Search files under specified directory option. This was created by using Python Trace while loading the state file used to create the above screenshots, so you can compare the options passed to LoadState to the options in the screenshots above.
# load state LoadState('/home/shawn/data/pvsm/exampleStateFile.pvsm', LoadStateDataFileOptions='Search files under specified directory', DataDirectory='/home/shawn/data/pvsm', SMALL_PtCu_NanoParticletifFileNames=['/home/shawn/data/tem/SMALL_PtCu_NanoParticle.tif'], ringeFileName=['/home/shawn/data/pvsm/ring.e'], sFilePattern='%s', ringeFilePrefix='/home/shawn/data/pvsm/ring.e', InvalidresultXMLFileName='Invalid result')
These changes are merged into ParaView master and are available in the ParaView 5.4-RC1 binaries which can be obtained here.